From 413ab9bc575068247a10862a6c6da1d060557da5 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 12 Oct 2020 11:59:04 +0100 Subject: [PATCH 001/160] MIB NR: pdcch_ConfigSIB1 selection and fill --- openair2/LAYER2/MAC/mac_vars.h | 15 +++ openair2/RRC/NR/L2_nr_interface.c | 208 +++++++++++++++++++++--------- 2 files changed, 164 insertions(+), 59 deletions(-) diff --git a/openair2/LAYER2/MAC/mac_vars.h b/openair2/LAYER2/MAC/mac_vars.h index bd25bd6047..bf735d3df6 100644 --- a/openair2/LAYER2/MAC/mac_vars.h +++ b/openair2/LAYER2/MAC/mac_vars.h @@ -35,6 +35,21 @@ #include "mac.h" #include "COMMON/mac_rrc_primitives.h" + +#define table_38213_13_1_num_indexes 15 +#define table_38213_13_2_num_indexes 14 +#define table_38213_13_3_num_indexes 9 +#define table_38213_13_4_num_indexes 16 +#define table_38213_13_5_num_indexes 9 +#define table_38213_13_6_num_indexes 10 +#define table_38213_13_7_num_indexes 12 +#define table_38213_13_8_num_indexes 8 +#define table_38213_13_9_num_indexes 4 +#define table_38213_13_10_num_indexes 8 +#define table_38213_13_11_num_indexes 16 +#define table_38213_13_12_num_indexes 14 + + const uint32_t BSR_TABLE[BSR_TABLE_SIZE] = { 0, 10, 12, 14, 17, 19, 22, 26, 31, 36, 42, 49, 57, 67, 78, 91, 105, 125, 146, 171, 200, 234, 274, 321, 376, 440, 515, 603, 706, 826, diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 0905f6d7de..326958c1af 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -30,11 +30,10 @@ #include "platform_types.h" #include "nr_rrc_defs.h" -#include "nr_rrc_extern.h" #include "common/utils/LOG/log.h" #include "pdcp.h" -#include "msc.h" #include "common/ran_context.h" +#include "openair2/LAYER2/MAC/mac_vars.h" #include "intertask_interface.h" @@ -44,74 +43,165 @@ 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 ){ + 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; + uint8_t Sdu_size = 0; + uint8_t sfn_msb = (uint8_t) ((frameP >> 4) & 0x3f); - asn_enc_rval_t enc_rval; - uint8_t Sdu_size = 0; - uint8_t sfn_msb = (uint8_t)((frameP>>4)&0x3f); - #ifdef DEBUG_RRC - LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id); + LOG_D(RRC, "[eNB %d] mac_rrc_data_req to SRB ID=%ld\n", Mod_idP, Srb_id); #endif - gNB_RRC_INST *rrc; - rrc_gNB_carrier_data_t *carrier; - NR_BCCH_BCH_Message_t *mib; - NR_SRB_INFO * srb_info; - char payload_size, *payload_pP; - - rrc = RC.nrrrc[Mod_idP]; - carrier = &rrc->carrier; - mib = &carrier->mib; - srb_info = &carrier->Srb0; + gNB_RRC_INST *rrc; + rrc_gNB_carrier_data_t *carrier; + NR_BCCH_BCH_Message_t *mib; + NR_SRB_INFO *srb_info; + char payload_size, *payload_pP; - /* MIBCH */ - if( (Srb_id & RAB_OFFSET ) == MIBCH) { - mib->message.choice.mib->systemFrameNumber.buf[0] = sfn_msb << 2; - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message, - NULL, - (void *)mib, - carrier->MIB, - 24); - LOG_D(NR_RRC,"Encoded MIB for frame %d sfn_msb %d (%p), bits %lu\n",frameP,sfn_msb,carrier->MIB,enc_rval.encoded); - buffer_pP[0]=carrier->MIB[0]; - buffer_pP[1]=carrier->MIB[1]; - buffer_pP[2]=carrier->MIB[2]; - LOG_D(NR_RRC,"MIB PDU buffer_pP[0]=%x , buffer_pP[1]=%x, buffer_pP[2]=%x\n",buffer_pP[0],buffer_pP[1],buffer_pP[2]); - AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return(3); - } + rrc = RC.nrrrc[Mod_idP]; + carrier = &rrc->carrier; + mib = &carrier->mib; + srb_info = &carrier->Srb0; - /* TODO BCCH SIB1 SIBs */ + /* MIBCH */ + if ((Srb_id & RAB_OFFSET) == MIBCH) { - /* CCCH */ - if( (Srb_id & RAB_OFFSET ) == CCCH) { - //struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti); - //if (ue_context_p == NULL) return(0); - //eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; - LOG_D(RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id); - // srb_info=&ue_p->Srb0; + /// controlResourceSetZero - payload_size = srb_info->Tx_buffer.payload_size; + switch (*carrier->servingcellconfigcommon->ssbSubcarrierSpacing) { - // check if data is there for MAC - if (payload_size > 0) { - payload_pP = srb_info->Tx_buffer.Payload; - LOG_D(RRC,"[gNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n", Mod_idP, srb_info, payload_size, buffer_pP, payload_pP); - // Fill buffer - memcpy((void *)buffer_pP, (void*)payload_pP, payload_size); - Sdu_size = payload_size; - srb_info->Tx_buffer.payload_size = 0; + case NR_SubcarrierSpacing_kHz15: + if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz15) { + mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_1_num_indexes; + } else if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz30) { + mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_2_num_indexes; + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + case NR_SubcarrierSpacing_kHz30: + if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz15) { + + // TODO get min_bw 38.101-1 table 5.3.5-1 + //if ( (min_bw == 5) || (min_bw == 10) { + mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_3_num_indexes; + //} else if (min_bw == 40) { + // mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_5_num_indexes; + //} + + } else if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz30) { + + // TODO get min_bw 38.101-1 table 5.3.5-1 + //if ( (min_bw == 5) || (min_bw == 10) { + mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_4_num_indexes; + //} else if (min_bw == 40) { + // mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_6_num_indexes; + //} + + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + case NR_SubcarrierSpacing_kHz120: + if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz60) { + mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_7_num_indexes; + } else if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz120) { + mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_8_num_indexes; + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + case NR_SubcarrierSpacing_kHz240: + if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz60) { + mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_9_num_indexes; + } else if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz120) { + mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_10_num_indexes; + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + default: + AssertFatal(true,"Invalid ssbSubcarrierSpacing\n"); + break; + } + + + /// TODO: searchSpaceZero + + //if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){ + mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rand() % table_38213_13_11_num_indexes; + /*} + if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR2){ + mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rand() % table_38213_13_12_num_indexes; + } + if(mac->type0_pdcch_ss_mux_pattern == 2) { + if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){ + mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rand() % table_38213_13_13_num_indexes; + } else if((scs_ssb == scs_240kHz) && (scs_pdcch == scs_120kHz)){ + mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rand() % table_38213_13_14_num_indexes; + } + }*/ + + + //NR_UE_MAC_INST_t *mac = get_mac_inst(Mod_idP); + //gNB_mac = RC.nrmac[0]; + //mac->type0_pdcch_ss_mux_pattern + + + mib->message.choice.mib->systemFrameNumber.buf[0] = sfn_msb << 2; + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message, + NULL, + (void *) mib, + carrier->MIB, + 24); + LOG_D(NR_RRC, "Encoded MIB for frame %d sfn_msb %d (%p), bits %lu\n", frameP, sfn_msb, carrier->MIB, + enc_rval.encoded); + buffer_pP[0] = carrier->MIB[0]; + buffer_pP[1] = carrier->MIB[1]; + buffer_pP[2] = carrier->MIB[2]; + LOG_D(NR_RRC, "MIB PDU buffer_pP[0]=%x , buffer_pP[1]=%x, buffer_pP[2]=%x\n", buffer_pP[0], buffer_pP[1], + buffer_pP[2]); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return (3); } - return Sdu_size; - } - return(0); + /* TODO BCCH SIB1 SIBs */ + + /* CCCH */ + if ((Srb_id & RAB_OFFSET) == CCCH) { + //struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti); + //if (ue_context_p == NULL) return(0); + //eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; + LOG_D(RRC, "[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id); + + // srb_info=&ue_p->Srb0; + + payload_size = srb_info->Tx_buffer.payload_size; + + // check if data is there for MAC + if (payload_size > 0) { + payload_pP = srb_info->Tx_buffer.Payload; + LOG_D(RRC, "[gNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n", Mod_idP, srb_info, payload_size, + buffer_pP, payload_pP); + // Fill buffer + memcpy((void *) buffer_pP, (void *) payload_pP, payload_size); + Sdu_size = payload_size; + srb_info->Tx_buffer.payload_size = 0; + } + return Sdu_size; + } + + return (0); } \ No newline at end of file From f2d5bce8038b3ae7cf0af00fc5891a4090991468 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 12 Oct 2020 12:11:19 +0100 Subject: [PATCH 002/160] MIB NR: pdcch_ConfigSIB1 selection and fill --- openair2/RRC/NR/L2_nr_interface.c | 77 +++++++++++++++---------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 326958c1af..babbd1f596 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -43,30 +43,30 @@ 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) { + 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; - uint8_t Sdu_size = 0; - uint8_t sfn_msb = (uint8_t) ((frameP >> 4) & 0x3f); + asn_enc_rval_t enc_rval; + uint8_t Sdu_size = 0; + uint8_t sfn_msb = (uint8_t)((frameP>>4)&0x3f); #ifdef DEBUG_RRC - LOG_D(RRC, "[eNB %d] mac_rrc_data_req to SRB ID=%ld\n", Mod_idP, Srb_id); + LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id); #endif - gNB_RRC_INST *rrc; - rrc_gNB_carrier_data_t *carrier; - NR_BCCH_BCH_Message_t *mib; - NR_SRB_INFO *srb_info; - char payload_size, *payload_pP; + gNB_RRC_INST *rrc; + rrc_gNB_carrier_data_t *carrier; + NR_BCCH_BCH_Message_t *mib; + NR_SRB_INFO * srb_info; + char payload_size, *payload_pP; - rrc = RC.nrrrc[Mod_idP]; - carrier = &rrc->carrier; - mib = &carrier->mib; - srb_info = &carrier->Srb0; + rrc = RC.nrrrc[Mod_idP]; + carrier = &rrc->carrier; + mib = &carrier->mib; + srb_info = &carrier->Srb0; /* MIBCH */ if ((Srb_id & RAB_OFFSET) == MIBCH) { @@ -176,32 +176,31 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, return (3); } - /* TODO BCCH SIB1 SIBs */ + /* TODO BCCH SIB1 SIBs */ - /* CCCH */ - if ((Srb_id & RAB_OFFSET) == CCCH) { - //struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti); - //if (ue_context_p == NULL) return(0); - //eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; - LOG_D(RRC, "[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id); + /* CCCH */ + if( (Srb_id & RAB_OFFSET ) == CCCH) { + //struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti); + //if (ue_context_p == NULL) return(0); + //eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; + LOG_D(RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id); - // srb_info=&ue_p->Srb0; + // srb_info=&ue_p->Srb0; - payload_size = srb_info->Tx_buffer.payload_size; + payload_size = srb_info->Tx_buffer.payload_size; - // check if data is there for MAC - if (payload_size > 0) { - payload_pP = srb_info->Tx_buffer.Payload; - LOG_D(RRC, "[gNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n", Mod_idP, srb_info, payload_size, - buffer_pP, payload_pP); - // Fill buffer - memcpy((void *) buffer_pP, (void *) payload_pP, payload_size); - Sdu_size = payload_size; - srb_info->Tx_buffer.payload_size = 0; - } - return Sdu_size; + // check if data is there for MAC + if (payload_size > 0) { + payload_pP = srb_info->Tx_buffer.Payload; + LOG_D(RRC,"[gNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n", Mod_idP, srb_info, payload_size, buffer_pP, payload_pP); + // Fill buffer + memcpy((void *)buffer_pP, (void*)payload_pP, payload_size); + Sdu_size = payload_size; + srb_info->Tx_buffer.payload_size = 0; } + return Sdu_size; + } - return (0); + return(0); } \ No newline at end of file From ddb538a30eae31d514afcf7de3495a963edea178 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 15 Oct 2020 11:55:28 +0100 Subject: [PATCH 003/160] MIB NR: pdcch_ConfigSIB1 selection and fill using the configuration file, and using a dynamic method. --- .../gnb.band78.tm1.106PRB.usrpn300.conf | 12 + openair2/GNB_APP/RRC_nr_paramsvalues.h | 16 ++ openair2/GNB_APP/gnb_config.c | 15 +- openair2/GNB_APP/gnb_paramdef.h | 1 - openair2/LAYER2/MAC/mac_vars.h | 15 -- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 70 ++++++ openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 34 +++ openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h | 61 +++++ openair2/LAYER2/NR_MAC_UE/mac_defs.h | 14 -- openair2/LAYER2/NR_MAC_UE/mac_extern.h | 52 ----- openair2/LAYER2/NR_MAC_UE/mac_vars.c | 58 ----- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 10 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 4 + openair2/RRC/NR/L2_nr_interface.c | 219 ++++++++++-------- openair2/RRC/NR/MESSAGES/asn1_msg.c | 6 +- openair2/RRC/NR/nr_rrc_defs.h | 1 + 16 files changed, 341 insertions(+), 247 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index aa03e91fd0..7ba3a438d8 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -2,6 +2,11 @@ Active_gNBs = ( "gNB-Eurecom-5GNRBox"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; +#pdcch-ConfigSIB1 +#controlResourceSetZero = 10; +#searchSpaceZero = 0; + + gNBs = ( { @@ -23,6 +28,13 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 10; + searchSpaceZero = 0; + } + ); servingCellConfigCommon = ( { diff --git a/openair2/GNB_APP/RRC_nr_paramsvalues.h b/openair2/GNB_APP/RRC_nr_paramsvalues.h index 231aeb34f4..1f1d076e9d 100644 --- a/openair2/GNB_APP/RRC_nr_paramsvalues.h +++ b/openair2/GNB_APP/RRC_nr_paramsvalues.h @@ -39,6 +39,7 @@ /* cell configuration section name */ #define GNB_CONFIG_STRING_GNB_LIST "gNBs" +#define GNB_CONFIG_STRING_PDCCH_CONFIGSIB1 "pdcch_ConfigSIB1" #define GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON "servingCellConfigCommon" #define GNB_CONFIG_STRING_PHYSCELLID "physCellId" #define GNB_CONFIG_STRING_NTIMINGADVANCEOFFSET "n_TimingAdvanceOffset" @@ -210,6 +211,21 @@ #define CARRIERBANDWIDTH_OKVALUES {11,18,24,25,31,32,38,51,52,65,66,78,79,93,106,107,121,132,133,135,160,162,189,216,217,245,264,270,273} +/*--------------------------------------------------------------------------------------------------------------------*/ +/* pdcch_ConfigSIB1 parameters */ +/*--------------------------------------------------------------------------------------------------------------------*/ +#define CONTROL_RESOURCE_SET_ZERO "controlResourceSetZero" +#define SEARCH_SPACE_ZERO "searchSpaceZero" + +#define PDCCH_CONFIGSIB1PARAMS_DESC(pdcch_ConfigSIB1) { \ +{CONTROL_RESOURCE_SET_ZERO, NULL, 0, i64ptr:&pdcch_ConfigSIB1->controlResourceSetZero, defintval:0, TYPE_INT64, 0}, \ +{SEARCH_SPACE_ZERO, NULL, 0, i64ptr:&pdcch_ConfigSIB1->searchSpaceZero, defintval:0, TYPE_INT64, 0} \ +} + +#define CONTROL_RESOURCE_SET_ZERO_IDX 0 +#define SEARCH_SPACE_ZERO_IDX 1 +/*--------------------------------------------------------------------------------------------------------------------*/ + /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* Serving Cell Config Common configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 8c8e78bbd0..962e3544e7 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -572,6 +572,17 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { gnb_id = *(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr); } + // pdcch_ConfigSIB1 + rrc->carrier.pdcch_ConfigSIB1 = calloc(1,sizeof(NR_PDCCH_ConfigSIB1_t)); + paramdef_t pdcch_ConfigSIB1[] = PDCCH_CONFIGSIB1PARAMS_DESC(rrc->carrier.pdcch_ConfigSIB1); + paramlist_def_t pdcch_ConfigSIB1ParamList = {GNB_CONFIG_STRING_PDCCH_CONFIGSIB1, NULL, 0}; + sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); + config_getlist(&pdcch_ConfigSIB1ParamList, NULL, 0, aprefix); + if (pdcch_ConfigSIB1ParamList.numelt > 0) { + sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_PDCCH_CONFIGSIB1, 0); + config_get(pdcch_ConfigSIB1,sizeof(pdcch_ConfigSIB1)/sizeof(paramdef_t),aprefix); + } + sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); config_getlist(&SCCsParamList, NULL, 0, aprefix); @@ -968,13 +979,9 @@ void NRRCConfig(void) { paramdef_t GNBSParams[] = GNBSPARAMS_DESC; /* get global parameters, defined outside any section in the config file */ - LOG_I(GNB_APP, "Getting GNBSParams\n"); - config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); RC.nb_nr_inst = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; - - // Get num MACRLC instances config_getlist( &MACRLCParamList,NULL,0, NULL); RC.nb_macrlc_inst = MACRLCParamList.numelt; diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 84da1de530..7bfd71c88f 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -78,7 +78,6 @@ typedef enum { #define GNB_CONFIG_STRING_ASN1_VERBOSITY_NONE "none" #define GNB_CONFIG_STRING_ASN1_VERBOSITY_ANNOYING "annoying" #define GNB_CONFIG_STRING_ASN1_VERBOSITY_INFO "info" - /* global parameters, not under a specific section */ #define GNB_CONFIG_STRING_ASN1_VERBOSITY "Asn1_verbosity" diff --git a/openair2/LAYER2/MAC/mac_vars.h b/openair2/LAYER2/MAC/mac_vars.h index bf735d3df6..bd25bd6047 100644 --- a/openair2/LAYER2/MAC/mac_vars.h +++ b/openair2/LAYER2/MAC/mac_vars.h @@ -35,21 +35,6 @@ #include "mac.h" #include "COMMON/mac_rrc_primitives.h" - -#define table_38213_13_1_num_indexes 15 -#define table_38213_13_2_num_indexes 14 -#define table_38213_13_3_num_indexes 9 -#define table_38213_13_4_num_indexes 16 -#define table_38213_13_5_num_indexes 9 -#define table_38213_13_6_num_indexes 10 -#define table_38213_13_7_num_indexes 12 -#define table_38213_13_8_num_indexes 8 -#define table_38213_13_9_num_indexes 4 -#define table_38213_13_10_num_indexes 8 -#define table_38213_13_11_num_indexes 16 -#define table_38213_13_12_num_indexes 14 - - const uint32_t BSR_TABLE[BSR_TABLE_SIZE] = { 0, 10, 12, 14, 17, 19, 22, 26, 31, 36, 42, 49, 57, 67, 78, 91, 105, 125, 146, 171, 200, 234, 274, 321, 376, 440, 515, 603, 706, 826, diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 8fe83dd40d..645f59ad91 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -33,6 +33,8 @@ #include "LAYER2/NR_MAC_gNB/mac_proto.h" #include +#define reserved 0xffff + const uint8_t nr_slots_per_frame[5] = {10, 20, 40, 80, 160}; // Table 6.3.3.1-5 (38.211) NCS for preamble formats with delta_f_RA = 1.25 KHz @@ -48,6 +50,73 @@ uint16_t NCS_restricted_TypeB_delta_f_RA_5[14] = {36,57,60,63,65,68,71,77,81,8 // Table 6.3.3.1-7 (38.211) NCS for preamble formats with delta_f_RA = 15 * 2mu KHz where mu = {0,1,2,3} uint16_t NCS_unrestricted_delta_f_RA_15[16] = {0,2,4,6,8,10,12,13,15,17,19,23,27,34,46,69}; + +// specification mapping talbe, table_38$x_$y_$z_c$a +// - $x: specification +// - $y: subclause-major +// - $z: subclause-minor +// - $a: ($a)th of column in table, start from zero +const int32_t table_38213_13_1_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, reserved}; // index 15 reserved +const int32_t table_38213_13_1_c2[16] = {24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, 96, 96, 96, reserved}; // index 15 reserved +const int32_t table_38213_13_1_c3[16] = { 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved}; // index 15 reserved +const int32_t table_38213_13_1_c4[16] = { 0, 2, 4, 0, 2, 4, 12, 16, 12, 16, 12, 16, 38, 38, 38, reserved}; // index 15 reserved + +const int32_t table_38213_13_2_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved}; // index 14-15 reserved +const int32_t table_38213_13_2_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved}; // index 14-15 reserved +const int32_t table_38213_13_2_c3[16] = { 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved}; // index 14-15 reserved +const int32_t table_38213_13_2_c4[16] = { 5, 6, 7, 8, 5, 6, 7, 8, 18, 20, 18, 20, 18, 20, reserved, reserved}; // index 14-15 reserved + +const int32_t table_38213_13_3_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_3_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_3_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_3_c4[16] = { 2, 6, 2, 6, 2, 6, 28, 28, 28, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved + +const int32_t table_38213_13_4_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; +const int32_t table_38213_13_4_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48}; +const int32_t table_38213_13_4_c3[16] = { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 1, 1, 1, 2, 2, 2}; +const int32_t table_38213_13_4_c4[16] = { 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 12, 14, 16, 12, 14, 16}; + +const int32_t table_38213_13_5_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_5_c2[16] = {48, 48, 48, 96, 96, 96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_5_c3[16] = { 1, 2, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_5_c4[16] = { 4, 4, 4, 0, 56, 0, 56, 0, 56, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved + +const int32_t table_38213_13_6_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved +const int32_t table_38213_13_6_c2[16] = {24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved +const int32_t table_38213_13_6_c3[16] = { 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved +const int32_t table_38213_13_6_c4[16] = { 0, 4, 0, 4, 0, 28, 0, 28, 0, 28, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved + +const int32_t table_38213_13_7_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, reserved, reserved, reserved, reserved}; // index 12-15 reserved +const int32_t table_38213_13_7_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 48, 48, 96, 96, reserved, reserved, reserved, reserved}; // index 12-15 reserved +const int32_t table_38213_13_7_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved}; // index 12-15 reserved +const int32_t table_38213_13_7_c4[16] = { 0, 8, 0, 8, 0, 8, 28, 28,-41, 49,-41, 97, reserved, reserved, reserved, reserved}; // index 12-15 reserved, condition A as default + +const int32_t table_38213_13_8_c1[16] = { 1, 1, 1, 1, 3, 3, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved +const int32_t table_38213_13_8_c2[16] = {24, 24, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved +const int32_t table_38213_13_8_c3[16] = { 2, 2, 1, 2, 2, 2, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved +const int32_t table_38213_13_8_c4[16] = { 0, 4, 14, 14,-20, 24,-20, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved, condition A as default + +const int32_t table_38213_13_9_c1[16] = {1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved +const int32_t table_38213_13_9_c2[16] = {96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved +const int32_t table_38213_13_9_c3[16] = { 1, 1, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved +const int32_t table_38213_13_9_c4[16] = { 0, 16, 0, 16, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved + +const int32_t table_38213_13_10_c1[16] = {1, 1, 1, 1, 2, 2, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved +const int32_t table_38213_13_10_c2[16] = {48, 48, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved +const int32_t table_38213_13_10_c3[16] = { 1, 1, 2, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved +const int32_t table_38213_13_10_c4[16] = { 0, 8, 0, 8,-41, 25,-41, 49, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved, condition A as default + +const float table_38213_13_11_c1[16] = { 0, 0, 2, 2, 5, 5, 7, 7, 0, 5, 0, 0, 2, 2, 5, 5}; // O +const int32_t table_38213_13_11_c2[16] = { 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1}; +const float table_38213_13_11_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 1, 1, 1, 1, 1, 1, 1}; // M +const int32_t table_38213_13_11_c4[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2}; // i is even as default + +const float table_38213_13_12_c1[16] = { 0, 0, 2.5f, 2.5f, 5, 5, 0, 2.5f, 5, 7.5f, 7.5f, 7.5f, 0, 5, reserved, reserved}; // O, index 14-15 reserved +const int32_t table_38213_13_12_c2[16] = { 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, reserved, reserved}; // index 14-15 reserved +const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f, 0.5f, 1, 0.5f, 0.5f, 1, 1, reserved, reserved}; // M, index 14-15 reserved + +const int32_t table_38213_10_1_1_c2[5] = { 0, 0, 4, 2, 1 }; + const char *prachfmt[]={"A1","A2","A3","B1","B2","B3","B4","C0","C2"}; const char *prachfmt03[]={"0","1","2","3"}; @@ -2519,3 +2588,4 @@ int binomial(int n, int k) { return c; } + diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index f19a46cb34..84457f077d 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -35,6 +35,20 @@ #include "NR_PDSCH-Config.h" #include "NR_CellGroupConfig.h" #include "nr_mac.h" +#include "openair1/PHY/impl_defs_nr.h" + +#define TABLE_38213_13_1_NUM_INDEXES 15 +#define TABLE_38213_13_2_NUM_INDEXES 14 +#define TABLE_38213_13_3_NUM_INDEXES 9 +#define TABLE_38213_13_4_NUM_INDEXES 16 +#define TABLE_38213_13_5_NUM_INDEXES 9 +#define TABLE_38213_13_6_NUM_INDEXES 10 +#define TABLE_38213_13_7_NUM_INDEXES 12 +#define TABLE_38213_13_8_NUM_INDEXES 8 +#define TABLE_38213_13_9_NUM_INDEXES 4 +#define TABLE_38213_13_10_NUM_INDEXES 8 +#define TABLE_38213_13_11_NUM_INDEXES 16 +#define TABLE_38213_13_12_NUM_INDEXES 14 typedef enum { NR_DL_DCI_FORMAT_1_0 = 0, @@ -64,6 +78,26 @@ typedef enum { NR_RNTI_MCS_C, } nr_rnti_type_t; +typedef enum channel_bandwidth_e { + bw_5MHz = 0x1, + bw_10MHz = 0x2, + bw_20MHz = 0x4, + bw_40MHz = 0x8, + bw_80MHz = 0x16, + bw_100MHz = 0x32 +} channel_bandwidth_t; + +typedef enum frequency_range_e { + FR1 = 0, + FR2 +} frequency_range_t; + +typedef enum nr_ssb_and_cset_mux_pattern_type_e { + NR_SSB_AND_CSET_MUX_PATTERN_TYPE1=1, + NR_SSB_AND_CSET_MUX_PATTERN_TYPE2, + NR_SSB_AND_CSET_MUX_PATTERN_TYPE3 +} nr_ssb_and_cset_mux_pattern_type_t; + uint16_t config_bandwidth(int mu, int nb_rb, int nr_band); void get_band(uint64_t downlink_frequency, uint16_t *current_band, int32_t *current_offset, lte_frame_type_t *current_type); diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h index 5c714e4a93..50918b2e76 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h @@ -75,5 +75,66 @@ extern boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX]; extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; #endif*/ +// Type0-PDCCH search space +extern const int32_t table_38213_13_1_c1[16]; +extern const int32_t table_38213_13_1_c2[16]; +extern const int32_t table_38213_13_1_c3[16]; +extern const int32_t table_38213_13_1_c4[16]; + +extern const int32_t table_38213_13_2_c1[16]; +extern const int32_t table_38213_13_2_c2[16]; +extern const int32_t table_38213_13_2_c3[16]; +extern const int32_t table_38213_13_2_c4[16]; + +extern const int32_t table_38213_13_3_c1[16]; +extern const int32_t table_38213_13_3_c2[16]; +extern const int32_t table_38213_13_3_c3[16]; +extern const int32_t table_38213_13_3_c4[16]; + +extern const int32_t table_38213_13_4_c1[16]; +extern const int32_t table_38213_13_4_c2[16]; +extern const int32_t table_38213_13_4_c3[16]; +extern const int32_t table_38213_13_4_c4[16]; + +extern const int32_t table_38213_13_5_c1[16]; +extern const int32_t table_38213_13_5_c2[16]; +extern const int32_t table_38213_13_5_c3[16]; +extern const int32_t table_38213_13_5_c4[16]; + +extern const int32_t table_38213_13_6_c1[16]; +extern const int32_t table_38213_13_6_c2[16]; +extern const int32_t table_38213_13_6_c3[16]; +extern const int32_t table_38213_13_6_c4[16]; + +extern const int32_t table_38213_13_7_c1[16]; +extern const int32_t table_38213_13_7_c2[16]; +extern const int32_t table_38213_13_7_c3[16]; +extern const int32_t table_38213_13_7_c4[16]; + +extern const int32_t table_38213_13_8_c1[16]; +extern const int32_t table_38213_13_8_c2[16]; +extern const int32_t table_38213_13_8_c3[16]; +extern const int32_t table_38213_13_8_c4[16]; + +extern const int32_t table_38213_13_9_c1[16]; +extern const int32_t table_38213_13_9_c2[16]; +extern const int32_t table_38213_13_9_c3[16]; +extern const int32_t table_38213_13_9_c4[16]; + +extern const int32_t table_38213_13_10_c1[16]; +extern const int32_t table_38213_13_10_c2[16]; +extern const int32_t table_38213_13_10_c3[16]; +extern const int32_t table_38213_13_10_c4[16]; + +extern const float table_38213_13_11_c1[16]; +extern const int32_t table_38213_13_11_c2[16]; +extern const float table_38213_13_11_c3[16]; +extern const int32_t table_38213_13_11_c4[16]; + +extern const float table_38213_13_12_c1[16]; +extern const int32_t table_38213_13_12_c2[16]; +extern const float table_38213_13_12_c3[16]; + +extern const int32_t table_38213_10_1_1_c2[5]; #endif //DEF_H diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 97c99b6050..2666354652 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -278,20 +278,6 @@ typedef enum subcarrier_spacing_e { scs_240kHz = 0x16 } subcarrier_spacing_t; -typedef enum channel_bandwidth_e { - bw_5MHz = 0x1, - bw_10MHz = 0x2, - bw_20MHz = 0x4, - bw_40MHz = 0x8, - bw_80MHz = 0x16, - bw_100MHz = 0x32 -} channel_bandwidth_t; - -typedef enum frequency_range_e { - FR1 = 0, - FR2 -} frequency_range_t; - typedef struct { uint8_t identifier_dci_formats ; // 0 IDENTIFIER_DCI_FORMATS: uint8_t carrier_ind ; // 1 CARRIER_IND: 0 or 3 bits, as defined in Subclause x.x of [5, TS38.213] diff --git a/openair2/LAYER2/NR_MAC_UE/mac_extern.h b/openair2/LAYER2/NR_MAC_UE/mac_extern.h index 54cdc4d149..79d671b8fb 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_extern.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_extern.h @@ -34,58 +34,6 @@ //extern NR_UE_MAC_INST_t *UE_mac_inst; -// Type0-PDCCH search space -extern const int32_t table_38213_13_1_c2[16]; -extern const int32_t table_38213_13_1_c3[16]; -extern const int32_t table_38213_13_1_c4[16]; - -extern const int32_t table_38213_13_2_c2[16]; -extern const int32_t table_38213_13_2_c3[16]; -extern const int32_t table_38213_13_2_c4[16]; - -extern const int32_t table_38213_13_3_c2[16]; -extern const int32_t table_38213_13_3_c3[16]; -extern const int32_t table_38213_13_3_c4[16]; - -extern const int32_t table_38213_13_4_c2[16]; -extern const int32_t table_38213_13_4_c3[16]; -extern const int32_t table_38213_13_4_c4[16]; - -extern const int32_t table_38213_13_5_c2[16]; -extern const int32_t table_38213_13_5_c3[16]; -extern const int32_t table_38213_13_5_c4[16]; - -extern const int32_t table_38213_13_6_c2[16]; -extern const int32_t table_38213_13_6_c3[16]; -extern const int32_t table_38213_13_6_c4[16]; - -extern const int32_t table_38213_13_7_c2[16]; -extern const int32_t table_38213_13_7_c3[16]; -extern const int32_t table_38213_13_7_c4[16]; - -extern const int32_t table_38213_13_8_c2[16]; -extern const int32_t table_38213_13_8_c3[16]; -extern const int32_t table_38213_13_8_c4[16]; - -extern const int32_t table_38213_13_9_c2[16]; -extern const int32_t table_38213_13_9_c3[16]; -extern const int32_t table_38213_13_9_c4[16]; - -extern const int32_t table_38213_13_10_c2[16]; -extern const int32_t table_38213_13_10_c3[16]; -extern const int32_t table_38213_13_10_c4[16]; - -extern const float table_38213_13_11_c1[16]; -extern const int32_t table_38213_13_11_c2[16]; -extern const float table_38213_13_11_c3[16]; -extern const int32_t table_38213_13_11_c4[16]; - -extern const float table_38213_13_12_c1[16]; -extern const int32_t table_38213_13_12_c2[16]; -extern const float table_38213_13_12_c3[16]; - -extern const int32_t table_38213_10_1_1_c2[5]; - // DCI extraction // for PUSCH from TS 38.214 subclause 6.1.2.1.1 extern uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3]; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_vars.c b/openair2/LAYER2/NR_MAC_UE/mac_vars.c index 95dea61a45..4986ab5883 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_vars.c +++ b/openair2/LAYER2/NR_MAC_UE/mac_vars.c @@ -32,64 +32,6 @@ #include "mac_defs.h" -#define reserved 0xffff - -// specification mapping talbe, table_38$x_$y_$z_c$a -// - $x: specification -// - $y: subclause-major -// - $z: subclause-minor -// - $a: ($a)th of column in table, start from zero -const int32_t table_38213_13_1_c2[16] = {24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, 96, 96, 96, reserved}; // index 15 reserved -const int32_t table_38213_13_1_c3[16] = { 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved}; // index 15 reserved -const int32_t table_38213_13_1_c4[16] = { 0, 2, 4, 0, 2, 4, 12, 16, 12, 16, 12, 16, 38, 38, 38, reserved}; // index 15 reserved - -const int32_t table_38213_13_2_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved}; // index 14-15 reserved -const int32_t table_38213_13_2_c3[16] = { 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved}; // index 14-15 reserved -const int32_t table_38213_13_2_c4[16] = { 5, 6, 7, 8, 5, 6, 7, 8, 18, 20, 18, 20, 18, 20, reserved, reserved}; // index 14-15 reserved - -const int32_t table_38213_13_3_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved -const int32_t table_38213_13_3_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved -const int32_t table_38213_13_3_c4[16] = { 2, 6, 2, 6, 2, 6, 28, 28, 28, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved - -const int32_t table_38213_13_4_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48}; -const int32_t table_38213_13_4_c3[16] = { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 1, 1, 1, 2, 2, 2}; -const int32_t table_38213_13_4_c4[16] = { 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 12, 14, 16, 12, 14, 16}; - -const int32_t table_38213_13_5_c2[16] = {48, 48, 48, 96, 96, 96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved -const int32_t table_38213_13_5_c3[16] = { 1, 2, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved -const int32_t table_38213_13_5_c4[16] = { 4, 4, 4, 0, 56, 0, 56, 0, 56, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved - -const int32_t table_38213_13_6_c2[16] = {24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved -const int32_t table_38213_13_6_c3[16] = { 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved -const int32_t table_38213_13_6_c4[16] = { 0, 4, 0, 4, 0, 28, 0, 28, 0, 28, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved - -const int32_t table_38213_13_7_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 48, 48, 96, 96, reserved, reserved, reserved, reserved}; // index 12-15 reserved -const int32_t table_38213_13_7_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved}; // index 12-15 reserved -const int32_t table_38213_13_7_c4[16] = { 0, 8, 0, 8, 0, 8, 28, 28,-41, 49,-41, 97, reserved, reserved, reserved, reserved}; // index 12-15 reserved, condition A as default - -const int32_t table_38213_13_8_c2[16] = { 1, 1, 1, 1, 3, 3, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved -const int32_t table_38213_13_8_c3[16] = {24, 24, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved -const int32_t table_38213_13_8_c4[16] = { 0, 4, 14, 14,-20, 24,-20, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved, condition A as default - -const int32_t table_38213_13_9_c2[16] = {96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved -const int32_t table_38213_13_9_c3[16] = { 1, 1, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved -const int32_t table_38213_13_9_c4[16] = { 0, 16, 0, 16, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved - -const int32_t table_38213_13_10_c2[16] = {48, 48, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved -const int32_t table_38213_13_10_c3[16] = { 1, 1, 2, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved -const int32_t table_38213_13_10_c4[16] = { 0, 8, 0, 8,-41, 25,-41, 49, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved, condition A as default - -const float table_38213_13_11_c1[16] = { 0, 0, 2, 2, 5, 5, 7, 7, 0, 5, 0, 0, 2, 2, 5, 5}; // O -const int32_t table_38213_13_11_c2[16] = { 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1}; -const float table_38213_13_11_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 1, 1, 1, 1, 1, 1, 1}; // M -const int32_t table_38213_13_11_c4[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2}; // i is even as default - -const float table_38213_13_12_c1[16] = { 0, 0, 2.5f, 2.5f, 5, 5, 0, 2.5f, 5, 7.5f, 7.5f, 7.5f, 0, 5, reserved, reserved}; // O, index 14-15 reserved -const int32_t table_38213_13_12_c2[16] = { 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, reserved, reserved}; // index 14-15 reserved -const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f, 0.5f, 1, 0.5f, 0.5f, 1, 1, reserved, reserved}; // M, index 14-15 reserved - -const int32_t table_38213_10_1_1_c2[5] = { 0, 0, 4, 2, 1 }; - /* #define mu_pusch 1 // definition table j Table 6.1.2.1.1-4 diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index e237a910c6..85f3ebe137 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -49,6 +49,7 @@ #include "NR_MAC_COMMON/nr_mac.h" #include "NR_MAC_UE/mac_proto.h" #include "NR_MAC_UE/mac_extern.h" +#include "NR_MAC_COMMON/nr_mac_extern.h" #include "common/utils/nr/nr_common.h" /* PHY */ @@ -311,18 +312,19 @@ int8_t nr_ue_decode_mib(module_id_t module_id, } } -#ifdef DEBUG_MIB +//#ifdef DEBUG_MIB LOG_I(MAC,"system frame number(6 MSB bits): %d\n", mac->mib->systemFrameNumber.buf[0]); LOG_I(MAC,"system frame number(with LSB): %d\n", (int)frame); LOG_I(MAC,"subcarrier spacing (0=15or60, 1=30or120): %d\n", (int)mac->mib->subCarrierSpacingCommon); LOG_I(MAC,"ssb carrier offset(with MSB): %d\n", (int)ssb_subcarrier_offset); LOG_I(MAC,"dmrs type A position (0=pos2,1=pos3): %d\n", (int)mac->mib->dmrs_TypeA_Position); - LOG_I(MAC,"pdcch config sib1: %d\n", (int)mac->mib->pdcch_ConfigSIB1); + LOG_I(MAC,"pdcch config sib1.controlResourceSetZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.controlResourceSetZero); + LOG_I(MAC,"pdcch config sib1.searchSpaceZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.searchSpaceZero); LOG_I(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred); LOG_I(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection); - LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit); + //LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit); LOG_I(MAC,"ssb index(extra bits): %d\n", (int)ssb_index); -#endif +//#endif subcarrier_spacing_t scs_ssb = scs_30kHz; // default for //const uint32_t scs_index = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 989d6fb952..e5734fb66f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -146,4 +146,8 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ } } +void schedule_nr_sib1(){ + +} + diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index babbd1f596..21709471f5 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -28,12 +28,14 @@ * \email: raymond.knopp@eurecom.fr, kroempa@gmail.com */ + #include "platform_types.h" #include "nr_rrc_defs.h" #include "common/utils/LOG/log.h" #include "pdcp.h" #include "common/ran_context.h" -#include "openair2/LAYER2/MAC/mac_vars.h" +#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" +#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" #include "intertask_interface.h" @@ -42,6 +44,104 @@ extern RAN_CONTEXT_t RC; + +int generate_pdcch_ConfigSIB1(NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1, + long ssbSubcarrierSpacing, + long subCarrierSpacingCommon, + channel_bandwidth_t min_channel_bw) { + + nr_ssb_and_cset_mux_pattern_type_t mux_pattern; + + switch (ssbSubcarrierSpacing) { + + case NR_SubcarrierSpacing_kHz15: + if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz15) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_1_NUM_INDEXES; + mux_pattern = table_38213_13_1_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz30) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_2_NUM_INDEXES; + mux_pattern = table_38213_13_2_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + case NR_SubcarrierSpacing_kHz30: + if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz15) { + + if ( (min_channel_bw == bw_5MHz) || (min_channel_bw == bw_10MHz) ) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_3_NUM_INDEXES; + mux_pattern = table_38213_13_3_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else if (min_channel_bw == bw_40MHz) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_5_NUM_INDEXES; + mux_pattern = table_38213_13_5_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else { + AssertFatal(true,"Invalid min_bandwidth\n"); + } + + } else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz30) { + + if ( (min_channel_bw == bw_5MHz) || (min_channel_bw == bw_10MHz) ) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_4_NUM_INDEXES; + mux_pattern = table_38213_13_4_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else if (min_channel_bw == bw_40MHz) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_6_NUM_INDEXES; + mux_pattern = table_38213_13_6_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else { + AssertFatal(true,"Invalid min_bandwidth\n"); + } + + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + case NR_SubcarrierSpacing_kHz120: + if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz60) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_7_NUM_INDEXES; + mux_pattern = table_38213_13_7_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz120) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_8_NUM_INDEXES; + mux_pattern = table_38213_13_8_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + case NR_SubcarrierSpacing_kHz240: + if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz60) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_9_NUM_INDEXES; + mux_pattern = table_38213_13_9_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz120) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_10_NUM_INDEXES; + mux_pattern = table_38213_13_10_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + default: + AssertFatal(true,"Invalid ssbSubcarrierSpacing\n"); + break; + } + + + frequency_range_t frequency_range = FR1; + if(ssbSubcarrierSpacing>=60) { + frequency_range = FR2; + } + + pdcch_ConfigSIB1->searchSpaceZero = 0; + if(mux_pattern == NR_SSB_AND_CSET_MUX_PATTERN_TYPE1 && frequency_range == FR1){ + pdcch_ConfigSIB1->searchSpaceZero = rand() % TABLE_38213_13_11_NUM_INDEXES; + } + if(mux_pattern == NR_SSB_AND_CSET_MUX_PATTERN_TYPE1 && frequency_range == FR2){ + pdcch_ConfigSIB1->searchSpaceZero = rand() % TABLE_38213_13_12_NUM_INDEXES; + } + + return 0; +} + int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, const int CC_id, const frame_t frameP, @@ -53,110 +153,35 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, uint8_t Sdu_size = 0; uint8_t sfn_msb = (uint8_t)((frameP>>4)&0x3f); + #ifdef DEBUG_RRC - LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id); + LOG_D(RRC, "[eNB %d] mac_rrc_data_req to SRB ID=%ld\n", Mod_idP, Srb_id); #endif - gNB_RRC_INST *rrc; - rrc_gNB_carrier_data_t *carrier; - NR_BCCH_BCH_Message_t *mib; - NR_SRB_INFO * srb_info; - char payload_size, *payload_pP; + gNB_RRC_INST *rrc; + rrc_gNB_carrier_data_t *carrier; + NR_BCCH_BCH_Message_t *mib; + NR_SRB_INFO *srb_info; + char payload_size, *payload_pP; - rrc = RC.nrrrc[Mod_idP]; - carrier = &rrc->carrier; - mib = &carrier->mib; - srb_info = &carrier->Srb0; + rrc = RC.nrrrc[Mod_idP]; + carrier = &rrc->carrier; + mib = &carrier->mib; + srb_info = &carrier->Srb0; /* MIBCH */ if ((Srb_id & RAB_OFFSET) == MIBCH) { - - /// controlResourceSetZero - - switch (*carrier->servingcellconfigcommon->ssbSubcarrierSpacing) { - - case NR_SubcarrierSpacing_kHz15: - if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz15) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_1_num_indexes; - } else if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz30) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_2_num_indexes; - } else { - AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); - } - break; - - case NR_SubcarrierSpacing_kHz30: - if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz15) { - - // TODO get min_bw 38.101-1 table 5.3.5-1 - //if ( (min_bw == 5) || (min_bw == 10) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_3_num_indexes; - //} else if (min_bw == 40) { - // mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_5_num_indexes; - //} - - } else if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz30) { - - // TODO get min_bw 38.101-1 table 5.3.5-1 - //if ( (min_bw == 5) || (min_bw == 10) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_4_num_indexes; - //} else if (min_bw == 40) { - // mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_6_num_indexes; - //} - - } else { - AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); - } - break; - - case NR_SubcarrierSpacing_kHz120: - if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz60) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_7_num_indexes; - } else if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz120) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_8_num_indexes; - } else { - AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); - } - break; - - case NR_SubcarrierSpacing_kHz240: - if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz60) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_9_num_indexes; - } else if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz120) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_10_num_indexes; - } else { - AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); - } - break; - - default: - AssertFatal(true,"Invalid ssbSubcarrierSpacing\n"); - break; - } - - - /// TODO: searchSpaceZero - - //if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){ - mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rand() % table_38213_13_11_num_indexes; - /*} - if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR2){ - mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rand() % table_38213_13_12_num_indexes; - } - if(mac->type0_pdcch_ss_mux_pattern == 2) { - if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){ - mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rand() % table_38213_13_13_num_indexes; - } else if((scs_ssb == scs_240kHz) && (scs_pdcch == scs_120kHz)){ - mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rand() % table_38213_13_14_num_indexes; - } - }*/ - - - //NR_UE_MAC_INST_t *mac = get_mac_inst(Mod_idP); - //gNB_mac = RC.nrmac[0]; - //mac->type0_pdcch_ss_mux_pattern - + // Currently we are getting the pdcch_ConfigSIB1 from the configuration file. + // 3GPP is not clear about the static/semi-static/dynamic behaviour of the pdcch_ConfigSIB1 value + // on the gNB side. + // Uncomment this function for a dynamic pdcch_ConfigSIB1. + // TODO: Update this static value + //channel_bandwidth_t min_channel_bw = bw_10MHz; // Must be obtained based on TS 38.101-1 Table 5.3.5-1 + //generate_pdcch_ConfigSIB1( &mib->message.choice.mib->pdcch_ConfigSIB1, + // *carrier->servingcellconfigcommon->ssbSubcarrierSpacing, + // mib->message.choice.mib->subCarrierSpacingCommon, + // min_channel_bw); mib->message.choice.mib->systemFrameNumber.buf[0] = sfn_msb << 2; enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message, diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index c00b57d7aa..f746be6cfe 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -200,8 +200,10 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) { mib->message.choice.mib->spare.bits_unused = 7; // This makes a spare of 1 bits mib->message.choice.mib->ssb_SubcarrierOffset = (carrier->ssb_SubcarrierOffset)&15; - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero; - mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero; + mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero; + mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rrc->carrier.pdcch_ConfigSIB1->searchSpaceZero; + + AssertFatal(scc->ssbSubcarrierSpacing != NULL, "scc->ssbSubcarrierSpacing is null\n"); switch (*scc->ssbSubcarrierSpacing) { case NR_SubcarrierSpacing_kHz15: diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 9a53a5bbe0..ec608f1a29 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -383,6 +383,7 @@ typedef struct { int pucch_TargetSNRx10; NR_BCCH_DL_SCH_Message_t *siblock1; NR_ServingCellConfigCommon_t *servingcellconfigcommon; + NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1; NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS]; NR_SRB_INFO SI; NR_SRB_INFO Srb0; From 9100b28b476cc951d4e5777a6984c6703fed7348 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Sun, 18 Oct 2020 00:25:31 +0100 Subject: [PATCH 004/160] Get type0_PDCCH_CSS_config parameters at the gNB. SIB1 initialization has been added at SI initialization. SIB1 was transmitted with static parameters. --- .../gnb.band78.tm1.106PRB.usrpn300.conf | 5 - openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 366 ++++++++++++++++++ openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 36 ++ openair2/LAYER2/NR_MAC_UE/mac_defs.h | 18 +- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 2 - openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 121 +++--- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 6 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 195 +++++++++- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 1 + openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 3 + openair2/RRC/NR/L2_nr_interface.c | 24 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 3 + openair2/RRC/NR/rrc_gNB.c | 38 ++ 13 files changed, 744 insertions(+), 74 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index 7ba3a438d8..92de04e283 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -2,11 +2,6 @@ Active_gNBs = ( "gNB-Eurecom-5GNRBox"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -#pdcch-ConfigSIB1 -#controlResourceSetZero = 10; -#searchSpaceZero = 0; - - gNBs = ( { diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 645f59ad91..90cfe42e07 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2588,4 +2588,370 @@ int binomial(int n, int k) { return c; } +uint32_t get_ssb_slot(uint32_t ssb_index){ + // this function now only support f <= 3GHz + return ssb_index & 0x3 ; + // return first_symbol(case, freq, ssb_index) / 14 +} + +int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, + NR_MIB_t *mib, + uint8_t extra_bits, + uint32_t ssb_length, + uint32_t ssb_index) { + + // deafult for testing + subcarrier_spacing_t scs_ssb = scs_30kHz; + channel_bandwidth_t min_channel_bw = bw_10MHz; + frequency_range_t frequency_range = FR1; + const uint32_t num_slot_per_frame = 20; + + type0_PDCCH_CSS_config->ssb_length = ssb_length; + type0_PDCCH_CSS_config->ssb_index = ssb_index; + type0_PDCCH_CSS_config->frame = (mib->systemFrameNumber.buf[0] >> mib->systemFrameNumber.bits_unused); + + uint16_t frame_number_4lsb = 0; + for (int i=0; i<4; i++) { + frame_number_4lsb |= ((extra_bits>>i)&1)<<(3-i); + } + + uint8_t ssb_subcarrier_offset_msb = ( extra_bits >> 5 ) & 0x1; // extra bits[5] + uint8_t ssb_subcarrier_offset = (uint8_t)mib->ssb_SubcarrierOffset; + + type0_PDCCH_CSS_config->frame = type0_PDCCH_CSS_config->frame << 4; + type0_PDCCH_CSS_config->frame = type0_PDCCH_CSS_config->frame | frame_number_4lsb; + + if(type0_PDCCH_CSS_config->ssb_length == 64){ + type0_PDCCH_CSS_config->ssb_index = type0_PDCCH_CSS_config->ssb_index & (( extra_bits >> 2 ) & 0x1C ); // { extra_bits[5:7], ssb_index[2:0] } + }else{ + if(ssb_subcarrier_offset_msb){ + ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10; + } + } + + // assume carrier frequency < 6GHz + subcarrier_spacing_t scs_pdcch; + if(mib->subCarrierSpacingCommon == NR_MIB__subCarrierSpacingCommon_scs15or60){ + scs_pdcch = scs_15kHz; + }else{ //NR_MIB__subCarrierSpacingCommon_scs30or120 + scs_pdcch = scs_30kHz; + } + + uint32_t is_condition_A = (ssb_subcarrier_offset == 0); // 38.213 ch.13 + uint32_t index_4msb = (mib->pdcch_ConfigSIB1.controlResourceSetZero); + uint32_t index_4lsb = (mib->pdcch_ConfigSIB1.searchSpaceZero); + + type0_PDCCH_CSS_config->num_rbs = -1; + type0_PDCCH_CSS_config->num_symbols = -1; + type0_PDCCH_CSS_config->rb_offset = -1; + + // type0-pdcch coreset + switch( (scs_ssb << 5) | scs_pdcch ){ + case (scs_15kHz << 5) | scs_15kHz : + AssertFatal(index_4msb < 15, "38.213 Table 13-1 4 MSB out of range\n"); + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + type0_PDCCH_CSS_config->num_rbs = table_38213_13_1_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_1_c3[index_4msb]; + type0_PDCCH_CSS_config->rb_offset = table_38213_13_1_c4[index_4msb]; + break; + + case (scs_15kHz << 5) | scs_30kHz: + AssertFatal(index_4msb < 14, "38.213 Table 13-2 4 MSB out of range\n"); + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + type0_PDCCH_CSS_config->num_rbs = table_38213_13_2_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_2_c3[index_4msb]; + type0_PDCCH_CSS_config->rb_offset = table_38213_13_2_c4[index_4msb]; + break; + + case (scs_30kHz << 5) | scs_15kHz: + if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){ + AssertFatal(index_4msb < 9, "38.213 Table 13-3 4 MSB out of range\n"); + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + type0_PDCCH_CSS_config->num_rbs = table_38213_13_3_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_3_c3[index_4msb]; + type0_PDCCH_CSS_config->rb_offset = table_38213_13_3_c4[index_4msb]; + }else if(min_channel_bw & bw_40MHz){ + AssertFatal(index_4msb < 9, "38.213 Table 13-5 4 MSB out of range\n"); + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + type0_PDCCH_CSS_config->num_rbs = table_38213_13_5_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_5_c3[index_4msb]; + type0_PDCCH_CSS_config->rb_offset = table_38213_13_5_c4[index_4msb]; + }else{ ; } + + break; + + case (scs_30kHz << 5) | scs_30kHz: + if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){ + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + type0_PDCCH_CSS_config->num_rbs = table_38213_13_4_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_4_c3[index_4msb]; + type0_PDCCH_CSS_config->rb_offset = table_38213_13_4_c4[index_4msb]; + + LOG_I(MAC,"<<<<<<<<num_rbs,type0_PDCCH_CSS_config->num_symbols,type0_PDCCH_CSS_config->rb_offset ); + + }else if(min_channel_bw & bw_40MHz){ + AssertFatal(index_4msb < 10, "38.213 Table 13-6 4 MSB out of range\n"); + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + type0_PDCCH_CSS_config->num_rbs = table_38213_13_6_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_6_c3[index_4msb]; + type0_PDCCH_CSS_config->rb_offset = table_38213_13_6_c4[index_4msb]; + }else{ ; } + break; + + case (scs_120kHz << 5) | scs_60kHz: + AssertFatal(index_4msb < 12, "38.213 Table 13-7 4 MSB out of range\n"); + if(index_4msb & 0x7){ + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + }else if(index_4msb & 0x18){ + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 2; + }else{ ; } + + type0_PDCCH_CSS_config->num_rbs = table_38213_13_7_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_7_c3[index_4msb]; + if(!is_condition_A && (index_4msb == 8 || index_4msb == 10)){ + type0_PDCCH_CSS_config->rb_offset = table_38213_13_7_c4[index_4msb] - 1; + }else{ + type0_PDCCH_CSS_config->rb_offset = table_38213_13_7_c4[index_4msb]; + } + break; + + case (scs_120kHz << 5) | scs_120kHz: + AssertFatal(index_4msb < 8, "38.213 Table 13-8 4 MSB out of range\n"); + if(index_4msb & 0x3){ + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + }else if(index_4msb & 0x0c){ + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 3; + } + + type0_PDCCH_CSS_config->num_rbs = table_38213_13_8_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_8_c3[index_4msb]; + if(!is_condition_A && (index_4msb == 4 || index_4msb == 6)){ + type0_PDCCH_CSS_config->rb_offset = table_38213_13_8_c4[index_4msb] - 1; + }else{ + type0_PDCCH_CSS_config->rb_offset = table_38213_13_8_c4[index_4msb]; + } + break; + + case (scs_240kHz << 5) | scs_60kHz: + AssertFatal(index_4msb < 4, "38.213 Table 13-9 4 MSB out of range\n"); + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + type0_PDCCH_CSS_config->num_rbs = table_38213_13_9_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_9_c3[index_4msb]; + type0_PDCCH_CSS_config->rb_offset = table_38213_13_9_c4[index_4msb]; + break; + + case (scs_240kHz << 5) | scs_120kHz: + AssertFatal(index_4msb < 8, "38.213 Table 13-10 4 MSB out of range\n"); + if(index_4msb & 0x3){ + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + }else if(index_4msb & 0x0c){ + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 2; + } + type0_PDCCH_CSS_config->num_rbs = table_38213_13_10_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_10_c3[index_4msb]; + if(!is_condition_A && (index_4msb == 4 || index_4msb == 6)){ + type0_PDCCH_CSS_config->rb_offset = table_38213_13_10_c4[index_4msb]-1; + }else{ + type0_PDCCH_CSS_config->rb_offset = table_38213_13_10_c4[index_4msb]; + } + + break; + + default: + break; + } + + AssertFatal(type0_PDCCH_CSS_config->num_rbs != -1, "Type0 PDCCH coreset num_rbs undefined"); + AssertFatal(type0_PDCCH_CSS_config->num_symbols != -1, "Type0 PDCCH coreset num_symbols undefined"); + AssertFatal(type0_PDCCH_CSS_config->rb_offset != -1, "Type0 PDCCH coreset rb_offset undefined"); + + + //uint32_t cell_id = 0; // obtain from L1 later + + //mac->type0_pdcch_dci_config.coreset.rb_start = rb_offset; + //mac->type0_pdcch_dci_config.coreset.rb_end = rb_offset + num_rbs - 1; + +// uint64_t mask = 0x0; +// uint8_t i; +// for(i=0; i<(type0_PDCCH_CSS_config->num_rbs/6); ++i){ // 38.331 Each bit corresponds a group of 6 RBs +// mask = mask >> 1; +// mask = mask | 0x100000000000; +// } + + //LOG_I(MAC,">>>>>>>>mask %x num_rbs %d rb_offset %d\n", mask, num_rbs, rb_offset); + +// mac->type0_pdcch_dci_config.coreset.frequency_domain_resource = mask; +// mac->type0_pdcch_dci_config.coreset.rb_offset = rb_offset; // additional parameter other than coreset +// +// //mac->type0_pdcch_dci_config.type0_pdcch_coreset.duration = num_symbols; +// mac->type0_pdcch_dci_config.coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED; +// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_reg_bundle_size = 6; // L 38.211 7.3.2.2 +// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_interleaver_size = 2; // R 38.211 7.3.2.2 +// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_shift_index = cell_id; +// mac->type0_pdcch_dci_config.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE; +// mac->type0_pdcch_dci_config.coreset.pdcch_dmrs_scrambling_id = cell_id; + + + // type0-pdcch search space + float big_o; + float big_m; + uint32_t temp; + type0_PDCCH_CSS_config->sfn_c=SFN_C_IMPOSSIBLE; // only valid for mux=1 + type0_PDCCH_CSS_config->n_c=UINT_MAX; + type0_PDCCH_CSS_config->number_of_search_space_per_slot=UINT_MAX; + type0_PDCCH_CSS_config->first_symbol_index=UINT_MAX; + type0_PDCCH_CSS_config->search_space_duration; // element of search space + // 38.213 table 10.1-1 + + /// MUX PATTERN 1 + if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){ + big_o = table_38213_13_11_c1[index_4lsb]; + type0_PDCCH_CSS_config->number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; + big_m = table_38213_13_11_c3[index_4lsb]; + + temp = (uint32_t)(big_o*pow(2, scs_pdcch)) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m); + type0_PDCCH_CSS_config->n_c = temp / num_slot_per_frame; + if((temp/num_slot_per_frame) & 0x1){ + type0_PDCCH_CSS_config->sfn_c = SFN_C_MOD_2_EQ_1; + }else{ + type0_PDCCH_CSS_config->sfn_c = SFN_C_MOD_2_EQ_0; + } + + if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 7) && (type0_PDCCH_CSS_config->ssb_index&1)){ + type0_PDCCH_CSS_config->first_symbol_index = type0_PDCCH_CSS_config->num_symbols; + }else{ + type0_PDCCH_CSS_config->first_symbol_index = table_38213_13_11_c4[index_4lsb]; + } + // 38.213 chapter 13: over two consecutive slots + type0_PDCCH_CSS_config->search_space_duration = 2; + } + + if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR2){ + big_o = table_38213_13_12_c1[index_4lsb]; + type0_PDCCH_CSS_config->number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; + big_m = table_38213_13_12_c3[index_4lsb]; + + if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 10) && (type0_PDCCH_CSS_config->ssb_index&1)){ + type0_PDCCH_CSS_config->first_symbol_index = 7; + }else if((index_4lsb == 6 || index_4lsb == 7 || index_4lsb == 8 || index_4lsb == 11) && (type0_PDCCH_CSS_config->ssb_index&1)){ + type0_PDCCH_CSS_config->first_symbol_index = type0_PDCCH_CSS_config->num_symbols; + }else{ + type0_PDCCH_CSS_config->first_symbol_index = 0; + } + // 38.213 chapter 13: over two consecutive slots + type0_PDCCH_CSS_config->search_space_duration = 2; + } + + /// MUX PATTERN 2 + if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 2){ + + if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){ + // 38.213 Table 13-13 + AssertFatal(index_4lsb == 0, "38.213 Table 13-13 4 LSB out of range\n"); + // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot + // sfn_c = SFN_C_EQ_SFN_SSB; + type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index); + switch(type0_PDCCH_CSS_config->ssb_index & 0x3){ // ssb_index(i) mod 4 + case 0: + type0_PDCCH_CSS_config->first_symbol_index = 0; + break; + case 1: + type0_PDCCH_CSS_config->first_symbol_index = 1; + break; + case 2: + type0_PDCCH_CSS_config->first_symbol_index = 6; + break; + case 3: + type0_PDCCH_CSS_config->first_symbol_index = 7; + break; + default: break; + } + + }else if((scs_ssb == scs_240kHz) && (scs_pdcch == scs_120kHz)){ + // 38.213 Table 13-14 + AssertFatal(index_4lsb == 0, "38.213 Table 13-14 4 LSB out of range\n"); + // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot + // sfn_c = SFN_C_EQ_SFN_SSB; + type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index); + switch(type0_PDCCH_CSS_config->ssb_index & 0x7){ // ssb_index(i) mod 8 + case 0: + type0_PDCCH_CSS_config->first_symbol_index = 0; + break; + case 1: + type0_PDCCH_CSS_config->first_symbol_index = 1; + break; + case 2: + type0_PDCCH_CSS_config->first_symbol_index = 2; + break; + case 3: + type0_PDCCH_CSS_config->first_symbol_index = 3; + break; + case 4: + type0_PDCCH_CSS_config->first_symbol_index = 12; + type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index) - 1; + break; + case 5: + type0_PDCCH_CSS_config->first_symbol_index = 13; + type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index) - 1; + break; + case 6: + type0_PDCCH_CSS_config->first_symbol_index = 0; + break; + case 7: + type0_PDCCH_CSS_config->first_symbol_index = 1; + break; + default: break; + } + }else{ ; } + // 38.213 chapter 13: over one slot + type0_PDCCH_CSS_config->search_space_duration = 1; + } + + /// MUX PATTERN 3 + if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 3){ + if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_120kHz)){ + // 38.213 Table 13-15 + AssertFatal(index_4lsb == 0, "38.213 Table 13-15 4 LSB out of range\n"); + // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot + // sfn_c = SFN_C_EQ_SFN_SSB; + type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index); + switch(type0_PDCCH_CSS_config->ssb_index & 0x3){ // ssb_index(i) mod 4 + case 0: + type0_PDCCH_CSS_config->first_symbol_index = 4; + break; + case 1: + type0_PDCCH_CSS_config->first_symbol_index = 8; + break; + case 2: + type0_PDCCH_CSS_config->first_symbol_index = 2; + break; + case 3: + type0_PDCCH_CSS_config->first_symbol_index = 6; + break; + default: break; + } + }else{ ; } + // 38.213 chapter 13: over one slot + type0_PDCCH_CSS_config->search_space_duration = 1; + } + + AssertFatal(type0_PDCCH_CSS_config->number_of_search_space_per_slot!=UINT_MAX,""); + +// uint32_t coreset_duration = num_symbols * number_of_search_space_per_slot; +// mac->type0_pdcch_dci_config.number_of_candidates[0] = table_38213_10_1_1_c2[0]; +// mac->type0_pdcch_dci_config.number_of_candidates[1] = table_38213_10_1_1_c2[1]; +// mac->type0_pdcch_dci_config.number_of_candidates[2] = table_38213_10_1_1_c2[2]; // CCE aggregation level = 4 +// mac->type0_pdcch_dci_config.number_of_candidates[3] = table_38213_10_1_1_c2[3]; // CCE aggregation level = 8 +// mac->type0_pdcch_dci_config.number_of_candidates[4] = table_38213_10_1_1_c2[4]; // CCE aggregation level = 16 +// mac->type0_pdcch_dci_config.duration = search_space_duration; +// mac->type0_pdcch_dci_config.coreset.duration = coreset_duration; // coreset +// AssertFatal(first_symbol_index!=UINT_MAX,""); +// mac->type0_pdcch_dci_config.monitoring_symbols_within_slot = (0x3fff << first_symbol_index) & (0x3fff >> (14-coreset_duration-first_symbol_index)) & 0x3fff; + + AssertFatal(type0_PDCCH_CSS_config->sfn_c!=SFN_C_IMPOSSIBLE,""); + AssertFatal(type0_PDCCH_CSS_config->n_c!=UINT_MAX,""); + + return 0; +} diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 84457f077d..9d6ee62072 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -32,6 +32,7 @@ #ifndef __LAYER2_NR_MAC_COMMON_H__ #define __LAYER2_NR_MAC_COMMON_H__ +#include #include "NR_PDSCH-Config.h" #include "NR_CellGroupConfig.h" #include "nr_mac.h" @@ -78,6 +79,14 @@ typedef enum { NR_RNTI_MCS_C, } nr_rnti_type_t; +typedef enum subcarrier_spacing_e { + scs_15kHz = 0x1, + scs_30kHz = 0x2, + scs_60kHz = 0x4, + scs_120kHz = 0x8, + scs_240kHz = 0x16 +} subcarrier_spacing_t; + typedef enum channel_bandwidth_e { bw_5MHz = 0x1, bw_10MHz = 0x2, @@ -98,6 +107,27 @@ typedef enum nr_ssb_and_cset_mux_pattern_type_e { NR_SSB_AND_CSET_MUX_PATTERN_TYPE3 } nr_ssb_and_cset_mux_pattern_type_t; +typedef enum { + SFN_C_MOD_2_EQ_0, + SFN_C_MOD_2_EQ_1, + SFN_C_IMPOSSIBLE +} SFN_C_TYPE; + +typedef struct Type0_PDCCH_CSS_config_s { + int32_t num_rbs; + int32_t num_symbols; + int32_t rb_offset; + uint32_t type0_pdcch_ss_mux_pattern; + uint16_t frame; + SFN_C_TYPE sfn_c; + uint32_t n_c; + uint32_t number_of_search_space_per_slot; + uint32_t first_symbol_index; + uint32_t search_space_duration; + uint32_t ssb_length; + uint32_t ssb_index; +} NR_Type0_PDCCH_CSS_config_t; + uint16_t config_bandwidth(int mu, int nb_rb, int nr_band); void get_band(uint64_t downlink_frequency, uint16_t *current_band, int32_t *current_offset, lte_frame_type_t *current_type); @@ -159,4 +189,10 @@ int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmr uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint8_t mcs_table); uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB); +int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, + NR_MIB_t *mib, + uint8_t extra_bits, + uint32_t ssb_length, + uint32_t ssb_index); + #endif diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 2666354652..f94500f8e2 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -72,13 +72,6 @@ /*!\brief value for indicating BSR Timer is not running */ #define NR_MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF) - -typedef enum { - SFN_C_MOD_2_EQ_0, - SFN_C_MOD_2_EQ_1, - SFN_C_IMPOSSIBLE -} SFN_C_TYPE; - // LTE structure, might need to be adapted for NR typedef struct { /// buffer status for each lcgid @@ -260,6 +253,9 @@ typedef struct { /// PHR uint8_t PHR_reporting_active; + + NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config; + } NR_UE_MAC_INST_t; typedef enum seach_space_mask_e { @@ -270,14 +266,6 @@ typedef enum seach_space_mask_e { type3_pdcch = 0x10 } search_space_mask_t; -typedef enum subcarrier_spacing_e { - scs_15kHz = 0x1, - scs_30kHz = 0x2, - scs_60kHz = 0x4, - scs_120kHz = 0x8, - scs_240kHz = 0x16 -} subcarrier_spacing_t; - typedef struct { uint8_t identifier_dci_formats ; // 0 IDENTIFIER_DCI_FORMATS: uint8_t carrier_ind ; // 1 CARRIER_IND: 0 or 3 bits, as defined in Subclause x.x of [5, TS38.213] diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 4126b19b0b..03e72f17a6 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -123,8 +123,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_index,fapi_nr_dci_indication_pdu_t *dci); uint32_t get_ssb_frame(uint32_t test); -uint32_t get_ssb_slot(uint32_t ssb_index); - uint32_t mr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 85f3ebe137..cd2189cfe3 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -112,12 +112,6 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, } -uint32_t get_ssb_slot(uint32_t ssb_index){ - // this function now only support f <= 3GHz - return ssb_index & 0x3 ; - - // return first_symbol(case, freq, ssb_index) / 14 -} uint8_t table_9_2_2_1[16][8]={ {0,12,2, 0, 0,3,0,0}, @@ -287,10 +281,59 @@ int8_t nr_ue_decode_mib(module_id_t module_id, NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); + // fill in the elements in config request inside P5 message + mac->phy_config.Mod_id = module_id; + mac->phy_config.CC_id = cc_id; + nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU AssertFatal(mac->mib != NULL, "nr_ue_decode_mib() mac->mib == NULL\n"); - //if(mac->mib != NULL){ + +//#ifdef DEBUG_MIB + LOG_I(MAC,"system frame number(6 MSB bits): %d\n", mac->mib->systemFrameNumber.buf[0]); + //LOG_I(MAC,"system frame number(with LSB): %d\n", (int)frame); + LOG_I(MAC,"subcarrier spacing (0=15or60, 1=30or120): %d\n", (int)mac->mib->subCarrierSpacingCommon); + //LOG_I(MAC,"ssb carrier offset(with MSB): %d\n", (int)ssb_subcarrier_offset); + LOG_I(MAC,"dmrs type A position (0=pos2,1=pos3): %d\n", (int)mac->mib->dmrs_TypeA_Position); + LOG_I(MAC,"pdcch config sib1.controlResourceSetZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.controlResourceSetZero); + LOG_I(MAC,"pdcch config sib1.searchSpaceZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.searchSpaceZero); + LOG_I(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred); + LOG_I(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection); + //LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit); + //LOG_I(MAC,"ssb index(extra bits): %d\n", (int)ssb_index); +//#endif + + get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config, mac->mib, extra_bits, ssb_length, ssb_index); + + ssb_index = mac->type0_PDCCH_CSS_config.ssb_index; // TODO: ssb_index should obtain from L1 in case Lssb != 64 + mac->type0_pdcch_ss_mux_pattern = mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern; + mac->type0_pdcch_ss_sfn_c = mac->type0_PDCCH_CSS_config.sfn_c; + mac->type0_pdcch_ss_n_c = mac->type0_PDCCH_CSS_config.n_c; + mac->dl_config_request.sfn = mac->type0_PDCCH_CSS_config.frame; + mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS + + + printf("extra_bits = %i\n", extra_bits); + + printf("mac->type0_PDCCH_CSS_config.num_rbs = %i\n", mac->type0_PDCCH_CSS_config.num_rbs); + printf("mac->type0_PDCCH_CSS_config.num_symbols = %i\n", mac->type0_PDCCH_CSS_config.num_symbols); + printf("mac->type0_PDCCH_CSS_config.rb_offset = %i\n", mac->type0_PDCCH_CSS_config.rb_offset); + printf("mac->type0_pdcch_ss_mux_pattern = %i\n", mac->type0_pdcch_ss_mux_pattern); + printf("mac->type0_PDCCH_CSS_config.frame = %i\n", mac->type0_PDCCH_CSS_config.frame); + printf("mac->type0_pdcch_ss_sfn_c = %i\n", mac->type0_pdcch_ss_sfn_c); + printf("mac->type0_pdcch_ss_n_c = %i\n", mac->type0_pdcch_ss_n_c); + printf("mac->type0_PDCCH_CSS_config.number_of_search_space_per_slot = %i\n", mac->type0_PDCCH_CSS_config.number_of_search_space_per_slot); + printf("mac->type0_PDCCH_CSS_config.first_symbol_index = %i\n", mac->type0_PDCCH_CSS_config.first_symbol_index); + printf("mac->type0_PDCCH_CSS_config.search_space_duration = %i\n", mac->type0_PDCCH_CSS_config.search_space_duration); + printf("mac->type0_PDCCH_CSS_config.ssb_length = %i\n", mac->type0_PDCCH_CSS_config.ssb_length); + printf("ssb_index = %i\n", ssb_index); + + printf("mac->dl_config_request.sfn = %i\n", mac->dl_config_request.sfn); + printf("mac->dl_config_request.slot = %i\n", mac->dl_config_request.slot); + + printf("\n\n\n"); + + /*//if(mac->mib != NULL){ uint16_t frame = (mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused); uint16_t frame_number_4lsb = 0; for (int i=0; i<4; i++) @@ -312,19 +355,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, } } -//#ifdef DEBUG_MIB - LOG_I(MAC,"system frame number(6 MSB bits): %d\n", mac->mib->systemFrameNumber.buf[0]); - LOG_I(MAC,"system frame number(with LSB): %d\n", (int)frame); - LOG_I(MAC,"subcarrier spacing (0=15or60, 1=30or120): %d\n", (int)mac->mib->subCarrierSpacingCommon); - LOG_I(MAC,"ssb carrier offset(with MSB): %d\n", (int)ssb_subcarrier_offset); - LOG_I(MAC,"dmrs type A position (0=pos2,1=pos3): %d\n", (int)mac->mib->dmrs_TypeA_Position); - LOG_I(MAC,"pdcch config sib1.controlResourceSetZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.controlResourceSetZero); - LOG_I(MAC,"pdcch config sib1.searchSpaceZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.searchSpaceZero); - LOG_I(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred); - LOG_I(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection); - //LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit); - LOG_I(MAC,"ssb index(extra bits): %d\n", (int)ssb_index); -//#endif + subcarrier_spacing_t scs_ssb = scs_30kHz; // default for //const uint32_t scs_index = 0; @@ -479,18 +510,18 @@ int8_t nr_ue_decode_mib(module_id_t module_id, mask = mask | 0x100000000000; } //LOG_I(MAC,">>>>>>>>mask %x num_rbs %d rb_offset %d\n", mask, num_rbs, rb_offset); - /* - mac->type0_pdcch_dci_config.coreset.frequency_domain_resource = mask; - mac->type0_pdcch_dci_config.coreset.rb_offset = rb_offset; // additional parameter other than coreset - //mac->type0_pdcch_dci_config.type0_pdcch_coreset.duration = num_symbols; - mac->type0_pdcch_dci_config.coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED; - mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_reg_bundle_size = 6; // L 38.211 7.3.2.2 - mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_interleaver_size = 2; // R 38.211 7.3.2.2 - mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_shift_index = cell_id; - mac->type0_pdcch_dci_config.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE; - mac->type0_pdcch_dci_config.coreset.pdcch_dmrs_scrambling_id = cell_id; - */ +// mac->type0_pdcch_dci_config.coreset.frequency_domain_resource = mask; +// mac->type0_pdcch_dci_config.coreset.rb_offset = rb_offset; // additional parameter other than coreset +// +// //mac->type0_pdcch_dci_config.type0_pdcch_coreset.duration = num_symbols; +// mac->type0_pdcch_dci_config.coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED; +// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_reg_bundle_size = 6; // L 38.211 7.3.2.2 +// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_interleaver_size = 2; // R 38.211 7.3.2.2 +// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_shift_index = cell_id; +// mac->type0_pdcch_dci_config.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE; +// mac->type0_pdcch_dci_config.coreset.pdcch_dmrs_scrambling_id = cell_id; + // type0-pdcch search space @@ -637,18 +668,18 @@ int8_t nr_ue_decode_mib(module_id_t module_id, } AssertFatal(number_of_search_space_per_slot!=UINT_MAX,""); - /* - uint32_t coreset_duration = num_symbols * number_of_search_space_per_slot; - mac->type0_pdcch_dci_config.number_of_candidates[0] = table_38213_10_1_1_c2[0]; - mac->type0_pdcch_dci_config.number_of_candidates[1] = table_38213_10_1_1_c2[1]; - mac->type0_pdcch_dci_config.number_of_candidates[2] = table_38213_10_1_1_c2[2]; // CCE aggregation level = 4 - mac->type0_pdcch_dci_config.number_of_candidates[3] = table_38213_10_1_1_c2[3]; // CCE aggregation level = 8 - mac->type0_pdcch_dci_config.number_of_candidates[4] = table_38213_10_1_1_c2[4]; // CCE aggregation level = 16 - mac->type0_pdcch_dci_config.duration = search_space_duration; - mac->type0_pdcch_dci_config.coreset.duration = coreset_duration; // coreset - AssertFatal(first_symbol_index!=UINT_MAX,""); - mac->type0_pdcch_dci_config.monitoring_symbols_within_slot = (0x3fff << first_symbol_index) & (0x3fff >> (14-coreset_duration-first_symbol_index)) & 0x3fff; - */ + +// uint32_t coreset_duration = num_symbols * number_of_search_space_per_slot; +// mac->type0_pdcch_dci_config.number_of_candidates[0] = table_38213_10_1_1_c2[0]; +// mac->type0_pdcch_dci_config.number_of_candidates[1] = table_38213_10_1_1_c2[1]; +// mac->type0_pdcch_dci_config.number_of_candidates[2] = table_38213_10_1_1_c2[2]; // CCE aggregation level = 4 +// mac->type0_pdcch_dci_config.number_of_candidates[3] = table_38213_10_1_1_c2[3]; // CCE aggregation level = 8 +// mac->type0_pdcch_dci_config.number_of_candidates[4] = table_38213_10_1_1_c2[4]; // CCE aggregation level = 16 +// mac->type0_pdcch_dci_config.duration = search_space_duration; +// mac->type0_pdcch_dci_config.coreset.duration = coreset_duration; // coreset +// AssertFatal(first_symbol_index!=UINT_MAX,""); +// mac->type0_pdcch_dci_config.monitoring_symbols_within_slot = (0x3fff << first_symbol_index) & (0x3fff >> (14-coreset_duration-first_symbol_index)) & 0x3fff; + AssertFatal(sfn_c!=SFN_C_IMPOSSIBLE,""); AssertFatal(n_c!=UINT_MAX,""); mac->type0_pdcch_ss_sfn_c = sfn_c; @@ -659,8 +690,8 @@ int8_t nr_ue_decode_mib(module_id_t module_id, mac->phy_config.CC_id = cc_id; mac->dl_config_request.sfn = frame; - mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS - + mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS +*/ //} return 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 58de000ac5..856d1937b1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -457,6 +457,12 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, schedule_nr_mib(module_idP, frame, slot); } + // This schedules SIB1 + if(slot == 15){ + schedule_nr_sib1(module_idP, frame, slot); + } + + // This schedule PRACH if we are not in phy_test mode if (get_softmodem_params()->phy_test == 0) schedule_nr_prach(module_idP, frame, slot); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index e5734fb66f..f64a3ba981 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -39,8 +39,8 @@ #include "UTIL/OPT/opt.h" #include "OCG.h" #include "OCG_extern.h" - #include "RRC/NR/nr_rrc_extern.h" +#include "common/utils/nr/nr_common.h" //#include "LAYER2/MAC/pre_processor.c" @@ -146,8 +146,199 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ } } -void schedule_nr_sib1(){ +void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { + printf("\n\n--- Schedule_nr_sib1: Start\n"); + + // Get type0_PDCCH_CSS_config parameters + PHY_VARS_gNB *gNB = RC.gNB[module_idP]; + gNB_MAC_INST *mac = RC.nrmac[module_idP]; + NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; + NR_MIB_t *mib = RC.nrrrc[module_idP]->carrier.mib.message.choice.mib; + uint8_t gNB_xtra_byte = 0; + for (int i = 0; i < 8; i++) { + gNB_xtra_byte |= ((gNB->pbch.pbch_a >> (31 - i)) & 1) << (7 - i); + } + get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config, mib, gNB_xtra_byte, frame_parms->Lmax, + frame_parms->ssb_index); + + + // Get SIB1 + int CC_id = 0; + uint8_t sib1_payload[100]; + uint8_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, 1, sib1_payload); + printf("sib1_sdu_length = %i\n", sib1_sdu_length); + for(int i = 0; icommon_channels[CC_id]; + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + + NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info; + NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id]; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + long bwp_Id = sched_ctrl->active_bwp->bwp_Id; + + nfapi_nr_dl_tti_request_body_t *dl_req = &mac->DL_req[CC_id].dl_tti_request_body; + nfapi_nr_pdu_t *tx_req = &mac->TX_req[CC_id].pdu_list[mac->TX_req[CC_id].Number_of_PDUs]; + + NR_SearchSpace_t *ss; + + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; + memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE; + dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); + + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs+1]; + memset((void *)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; + dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu)); + + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; + nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; + + NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_Id - 1]; + NR_BWP_Uplink_t *ubwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_Id-1]; + + pdsch_pdu_rel15->pduBitmap = 0; + pdsch_pdu_rel15->rnti = 0; //UE_info->rnti[UE_id]; + pdsch_pdu_rel15->pduIndex = 0; //mac->pdu_index[0]++; + + pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); + pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); + pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; + pdsch_pdu_rel15->CyclicPrefix = 0; + pdsch_pdu_rel15->NrOfCodewords = 1; + pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(mcsIndex,0); + pdsch_pdu_rel15->qamModOrder[0] = 2; + pdsch_pdu_rel15->mcsIndex[0] = mcsIndex; + if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == NULL) + pdsch_pdu_rel15->mcsTable[0] = 0; + else{ + if (*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == 0) + pdsch_pdu_rel15->mcsTable[0] = 1; + else + pdsch_pdu_rel15->mcsTable[0] = 2; + } + pdsch_pdu_rel15->rvIndex[0] = 0; + pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; + pdsch_pdu_rel15->nrOfLayers = 1; + pdsch_pdu_rel15->transmissionScheme = 0; + pdsch_pdu_rel15->refPoint = 0; + pdsch_pdu_rel15->dmrsConfigType = 0; + pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; + pdsch_pdu_rel15->SCID = 0; + pdsch_pdu_rel15->numDmrsCdmGrpsNoData = 2; + pdsch_pdu_rel15->dmrsPorts = 1; + pdsch_pdu_rel15->resourceAlloc = 1; + pdsch_pdu_rel15->rbStart = 0; + pdsch_pdu_rel15->rbSize = 6; + pdsch_pdu_rel15->VRBtoPRBMapping = 0; // non interleaved + + + for (int i=0; ibwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count; i++) { + startSymbolAndLength = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &StartSymbolIndex_tmp, &NrOfSymbols_tmp); + if (NrOfSymbols_tmp < NrOfSymbols) { + NrOfSymbols = NrOfSymbols_tmp; + StartSymbolIndex = StartSymbolIndex_tmp; + time_domain_assignment = i; // this is short PDSCH added to the config to fit mixed slot + } + } + + pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; + pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; + pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL, scc->dmrs_TypeA_Position, NrOfSymbols); + + locationAndBandwidth = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth; + dci10_bw = NRRIV2BW(locationAndBandwidth,275); + + dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET]; + dci_pdu_rel15[0].frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize, + pdsch_pdu_rel15->rbStart,dci10_bw); + dci_pdu_rel15[0].time_domain_assignment.val = time_domain_assignment; + dci_pdu_rel15[0].vrb_to_prb_mapping.val = 0; + dci_pdu_rel15[0].mcs = pdsch_pdu_rel15->mcsIndex[0]; + dci_pdu_rel15[0].tb_scaling = 0; + + int found = 0; + for ( int i=0; ibwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count; i++) { + ss=bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.array[i]; + if (ss->searchSpaceType->present == target_ss) { + found=1; + break; + } + } + + uint8_t nr_of_candidates, aggregation_level; + find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss); + NR_ControlResourceSet_t *coreset = get_coreset(bwp, ss, 0); + int CCEIndex = allocate_nr_CCEs(mac,bwp,coreset,aggregation_level,0,0); + + if (CCEIndex < 0) { + LOG_E(MAC, "%s(): cannot find free CCE for RNTI %04x!\n", __func__, pdsch_pdu_rel15->rnti); + return; + } + + nr_configure_pdcch(mac, + pdcch_pdu_rel15, + pdsch_pdu_rel15->rnti, + ss, + coreset, + scc, + bwp, + aggregation_level, + CCEIndex); + + LOG_I(MAC, "Frame %d: Subframe %d : Adding common DL DCI for RNTI %x\n", frameP, slotP, pdsch_pdu_rel15->rnti); + + int dci_formats[2], rnti_types[2]; + dci_formats[0] = NR_DL_DCI_FORMAT_1_0; + rnti_types[0] = NR_RNTI_SI; + fill_dci_pdu_rel15(scc,secondaryCellGroup,pdcch_pdu_rel15, &dci_pdu_rel15[0], dci_formats, rnti_types,dci10_bw,bwp_Id); + + dl_req->nPDUs+=2; + + int x_Overhead = 0; + nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, dci_pdu_rel15[0].tb_scaling); + + // DL TX request + tx_req->PDU_length = pdsch_pdu_rel15->TBSize[0]; + tx_req->PDU_index = mac->pdu_index[CC_id]++; + tx_req->num_TLV = 1; + tx_req->TLVs[0].length = sib1_sdu_length; + mac->TX_req[CC_id].SFN = frameP; + mac->TX_req[CC_id].Number_of_PDUs++; + mac->TX_req[CC_id].Slot = slotP; + memcpy((void*)&tx_req->TLVs[0].value.direct[0], (void*)sib1_payload, sib1_sdu_length); + + // Mark the corresponding RBs as used + uint8_t *vrb_map = cc[CC_id].vrb_map; + for (int rb = 0; rb < pdsch_pdu_rel15->rbSize; rb++) { + vrb_map[rb + pdsch_pdu_rel15->rbStart] = 1; + } + + + printf("--- Schedule_nr_sib1: End\n\n\n"); } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 726615b6e3..852f988594 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -83,6 +83,7 @@ void nr_schedule_ue_spec(module_id_t module_id, int num_slots_per_tdd); void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP); +void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP); /////// Random Access MAC-PHY interface functions and primitives /////// diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 0ed64a9621..d33ad37be7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -442,6 +442,9 @@ typedef struct gNB_MAC_INST_s { time_stats_t schedule_pch; /// CCE lists int cce_list[MAX_NUM_BWP][MAX_NUM_CORESET][MAX_NUM_CCE]; + + NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config; + } gNB_MAC_INST; #endif /*__LAYER2_NR_MAC_GNB_H__ */ diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 21709471f5..17e018d1ec 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -158,14 +158,12 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, LOG_D(RRC, "[eNB %d] mac_rrc_data_req to SRB ID=%ld\n", Mod_idP, Srb_id); #endif - gNB_RRC_INST *rrc; rrc_gNB_carrier_data_t *carrier; NR_BCCH_BCH_Message_t *mib; NR_SRB_INFO *srb_info; char payload_size, *payload_pP; - rrc = RC.nrrrc[Mod_idP]; - carrier = &rrc->carrier; + carrier = &RC.nrrrc[Mod_idP]->carrier; mib = &carrier->mib; srb_info = &carrier->Srb0; @@ -178,11 +176,14 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, // Uncomment this function for a dynamic pdcch_ConfigSIB1. // TODO: Update this static value //channel_bandwidth_t min_channel_bw = bw_10MHz; // Must be obtained based on TS 38.101-1 Table 5.3.5-1 - //generate_pdcch_ConfigSIB1( &mib->message.choice.mib->pdcch_ConfigSIB1, + //generate_pdcch_ConfigSIB1(carrier->pdcch_ConfigSIB1, // *carrier->servingcellconfigcommon->ssbSubcarrierSpacing, - // mib->message.choice.mib->subCarrierSpacingCommon, + // carrier->mib.message.choice.mib->subCarrierSpacingCommon, // min_channel_bw); + mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = carrier->pdcch_ConfigSIB1->controlResourceSetZero; + mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = carrier->pdcch_ConfigSIB1->searchSpaceZero; + mib->message.choice.mib->systemFrameNumber.buf[0] = sfn_msb << 2; enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message, NULL, @@ -202,6 +203,19 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, } /* TODO BCCH SIB1 SIBs */ + if ((Srb_id & RAB_OFFSET ) == BCCH) { +// memcpy(&buffer_pP[0], +// RC.rrc[Mod_idP]->carrier[CC_id].SIB1_MBMS, +// RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_MBMS); +// +// return RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_MBMS; + + memcpy(&buffer_pP[0], + RC.nrrrc[Mod_idP]->carrier.SIB1, + RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1); + + return RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1; + } /* CCCH */ if( (Srb_id & RAB_OFFSET ) == CCCH) { diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index f746be6cfe..b9f08af7aa 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -341,6 +341,9 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, nr_uac_BarringInfoSet.uac_BarringForAccessIdentity.bits_unused = 1; ASN_SEQUENCE_ADD(&sib1->uac_BarringInfo->uac_BarringInfoSetList, &nr_uac_BarringInfoSet); #endif + + xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)sib1_message->message.choice.c1->choice.systemInformationBlockType1); + //encode SIB1 to data enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_DL_SCH_Message, NULL, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 757724765e..6f5a5907bc 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -179,9 +179,47 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge( ///---------------------------------------------------------------------------------------------------------------/// static void init_NR_SI(gNB_RRC_INST *rrc) { + LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); + rrc->carrier.MIB = (uint8_t *) malloc16(4); rrc->carrier.sizeof_MIB = do_MIB_NR(rrc,0); + printf("rrc->carrier.sizeof_MIB = %i\n", rrc->carrier.sizeof_MIB); + + + + + + gNB_RrcConfigurationReq *configuration; + configuration = CALLOC(1,sizeof(gNB_RrcConfigurationReq)); + + configuration->cell_identity = 3; + + configuration->ssb_SubcarrierOffset = rrc->carrier.ssb_SubcarrierOffset; + configuration->pdsch_AntennaPorts = rrc->carrier.pdsch_AntennaPorts; + configuration->pusch_TargetSNRx10 = rrc->carrier.pusch_TargetSNRx10; + configuration->pucch_TargetSNRx10 = rrc->carrier.pucch_TargetSNRx10; + configuration->scc = rrc->carrier.servingcellconfigcommon; + + rrc->carrier.SIB1 = (uint8_t *) malloc16(100); + rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier, configuration); + + + printf("\n"); + printf("rrc->carrier.sizeof_SIB1 = %i\n", rrc->carrier.sizeof_SIB1); + for(int i = 0; i<20; i++) { + printf("%i ", rrc->carrier.SIB1[i]); + } + printf("\n\n"); + + + + + + + + + LOG_I(NR_RRC,"Done init_NR_SI\n"); rrc_mac_config_req_gNB(rrc->module_id, rrc->carrier.ssb_SubcarrierOffset, From cdf72e6d3e558291fc53271ecb137f15b21bf933 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Sat, 24 Oct 2020 22:45:19 +0100 Subject: [PATCH 005/160] Creation of fill_default_coresetZero() and fill_default_searchSpaceZero(). Resource allocation and transmission of the DCI of SIB1. Partial implementation of the reception of the DCI of SIB1. --- openair1/PHY/NR_TRANSPORT/nr_dci.c | 7 + openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 16 +- openair2/LAYER2/NR_MAC_UE/config_ue.c | 2 +- .../NR_MAC_UE/nr_ue_dci_configuration.c | 36 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 366 +---------------- openair2/LAYER2/NR_MAC_gNB/config.c | 2 + openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 10 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 375 +++++++++--------- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 1 + openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 + openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 1 + openair2/RRC/NR/nr_rrc_proto.h | 4 + openair2/RRC/NR/rrc_gNB_reconfig.c | 122 ++++-- 13 files changed, 364 insertions(+), 580 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 2d79aa8fbd..0687acd1b4 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -168,6 +168,13 @@ uint8_t nr_generate_dci_top(PHY_VARS_gNB *gNB, /// Scrambling uint32_t scrambled_output[NR_MAX_DCI_SIZE_DWORD]= {0}; nr_pdcch_scrambling(encoder_output, encoded_length, Nid, scrambling_RNTI, scrambled_output); + + printf("polar_encoder_fast: pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d] = %i, pdcch_pdu_rel15->dci_pdu.AggregationLevel[d] = %i, n_RNTI = %i\n", + pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d], pdcch_pdu_rel15->dci_pdu.AggregationLevel[d], n_RNTI); + + printf("nr_pdcch_scrambling: encoded_length = %i, Nid = %i, scrambling_RNTI = %i\n\n",encoded_length, Nid, scrambling_RNTI); + + #ifdef DEBUG_CHANNEL_CODING printf("scrambled output: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\t [4]->0x%08x\t [5]->0x%08x\t \ [6]->0x%08x \t [7]->0x%08x \t [8]->0x%08x \t [9]->0x%08x\t [10]->0x%08x\t [11]->0x%08x\n", diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 53456bb691..8fb663f294 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -873,12 +873,18 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, #endif uint16_t crc = polar_decoder_int16(tmp_e, - dci_estimation, + dci_estimation, 1, currentPtrDCI); n_rnti = rel15->rnti; + printf("nr_pdcch_unscrambling: encoded_length = %i, Nid = %i, scrambling_RNTI = %i\n", + L*108, rel15->coreset.pdcch_dmrs_scrambling_id, rel15->coreset.scrambling_rnti); + + printf("polar_decoder_int16: pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d] = %i, pdcch_pdu_rel15->dci_pdu.AggregationLevel[d] = %i, n_RNTI = %i\n", + dci_length, L, rel15->rnti); + if (crc == n_rnti) { LOG_D(PHY,"Decoded crc %x matches rnti %x for DCI format %d\n", crc, n_rnti, rel15->dci_format_options[k]); dci_ind->SFN = frame; @@ -889,6 +895,10 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, dci_ind->dci_list[dci_ind->number_of_dcis].payloadSize = dci_length; memcpy((void*)dci_ind->dci_list[dci_ind->number_of_dcis].payloadBits,(void*)dci_estimation,8); dci_ind->number_of_dcis++; + + printf("\n>> Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n\n", + n_rnti,rel15->dci_format_options[k],CCEind,dci_length,*(unsigned long long*)dci_estimation); + break; // If DCI is found, no need to check for remaining DCI lengths } else { LOG_D(PHY,"Decoded crc %x does not match rnti %x for DCI format %d\n", crc, n_rnti, rel15->dci_format_options[k]); @@ -896,6 +906,10 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, } } } + + printf("nr_dci_decoding_procedure: frame = %i, slot = %i\n", frame, slot); + getchar(); + return(dci_ind->number_of_dcis); } diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index bc98e16d39..800214e715 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -394,7 +394,7 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ NR_SearchSpace_t *css = commonSearchSpaceList->list.array[css_id]; AssertFatal(css->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n"); AssertFatal(*css->controlResourceSetId == mac->coreset[bwp_id - 1][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n"); - AssertFatal(css->searchSpaceId != 0, "css->searchSpaceId is 0\n"); + AssertFatal(&css->searchSpaceId != NULL, "css->searchSpaceId is null\n"); AssertFatal(css->searchSpaceType != NULL, "css->searchSpaceType is null\n"); AssertFatal(css->monitoringSymbolsWithinSlot != NULL, "css->monitoringSymbolsWithinSlot is null\n"); AssertFatal(css->monitoringSymbolsWithinSlot->buf != NULL, "css->monitoringSymbolsWithinSlot->buf is null\n"); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 33aed06aec..27680893f0 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -143,6 +143,23 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t case NR_RNTI_SP_CSI: break; case NR_RNTI_SI: + + // we use DL BWP dedicated + sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12; + // for SPS=14 8 MSBs in positions 13 down to 6 + monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); + rel15->rnti = mac->crnti; // FIXME: Must be 0xFFFF + rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, 275); + rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275); + rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing; + + for (int i = 0; i < rel15->num_dci_options; i++) { + rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, bwp_id); + } + + printf("bwp_Common->genericParameters.locationAndBandwidth = %li\n", bwp_Common->genericParameters.locationAndBandwidth); + printf("rel15->BWPSize = %i\n", rel15->BWPSize); + break; case NR_RNTI_SFI: break; @@ -203,6 +220,14 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl // Fetch configuration for searchSpaceZero // note: The search space with the SearchSpaceId = 0 identifies the search space configured via PBCH (MIB) and in ServingCellConfigCommon (searchSpaceZero). if (pdcch_ConfigCommon->choice.setup->searchSpaceZero){ + + printf("pdcch_ConfigCommon->choice.setup->searchSpaceZero = %li\n", *pdcch_ConfigCommon->choice.setup->searchSpaceZero); + + if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 == NULL){ + pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1)); + } + *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = 0; + LOG_D(MAC, "[DCI_CONFIG] Configure SearchSpace#0 of the initial BWP\n"); LOG_W(MAC, "[DCI_CONFIG] This should not be available yet..."); } @@ -227,7 +252,16 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl } } if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ - if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ + //if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ + + if(slot == 10){ + rel15->num_dci_options = 1; + rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; + config_dci_pdu(mac, rel15, dl_config, NR_RNTI_SI, ss_id); + fill_dci_search_candidates(ss, rel15); + //} + + // Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet..."); } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index cd2189cfe3..7f93bdc262 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -313,7 +313,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS - printf("extra_bits = %i\n", extra_bits); + printf("\nextra_bits = %i\n", extra_bits); printf("mac->type0_PDCCH_CSS_config.num_rbs = %i\n", mac->type0_PDCCH_CSS_config.num_rbs); printf("mac->type0_PDCCH_CSS_config.num_symbols = %i\n", mac->type0_PDCCH_CSS_config.num_symbols); @@ -333,366 +333,6 @@ int8_t nr_ue_decode_mib(module_id_t module_id, printf("\n\n\n"); - /*//if(mac->mib != NULL){ - uint16_t frame = (mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused); - uint16_t frame_number_4lsb = 0; - for (int i=0; i<4; i++) - frame_number_4lsb |= ((extra_bits>>i)&1)<<(3-i); - //uint8_t half_frame_bit = ( extra_bits >> 4 ) & 0x1; // extra bits[4] - uint8_t ssb_subcarrier_offset_msb = ( extra_bits >> 5 ) & 0x1; // extra bits[5] - uint8_t ssb_subcarrier_offset = (uint8_t)mac->mib->ssb_SubcarrierOffset; - - //uint32_t ssb_index = 0; // TODO: ssb_index should obtain from L1 in case Lssb != 64 - - frame = frame << 4; - frame = frame | frame_number_4lsb; - - if(ssb_length == 64){ - ssb_index = ssb_index & (( extra_bits >> 2 ) & 0x1C ); // { extra_bits[5:7], ssb_index[2:0] } - }else{ - if(ssb_subcarrier_offset_msb){ - ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10; - } - } - - - - subcarrier_spacing_t scs_ssb = scs_30kHz; // default for - //const uint32_t scs_index = 0; - const uint32_t num_slot_per_frame = 20; - subcarrier_spacing_t scs_pdcch; - - // assume carrier frequency < 6GHz - if(mac->mib->subCarrierSpacingCommon == NR_MIB__subCarrierSpacingCommon_scs15or60){ - scs_pdcch = scs_15kHz; - }else{ //NR_MIB__subCarrierSpacingCommon_scs30or120 - scs_pdcch = scs_30kHz; - } - - channel_bandwidth_t min_channel_bw = bw_10MHz; // deafult for testing - - uint32_t is_condition_A = (ssb_subcarrier_offset == 0); // 38.213 ch.13 - frequency_range_t frequency_range = FR1; - uint32_t index_4msb = (mac->mib->pdcch_ConfigSIB1.controlResourceSetZero); - uint32_t index_4lsb = (mac->mib->pdcch_ConfigSIB1.searchSpaceZero); - int32_t num_rbs = -1; - int32_t num_symbols = -1; - int32_t rb_offset = -1; - //LOG_I(MAC,"<<<<<<<<mib->pdcch_ConfigSIB1,index_4msb,index_4lsb,scs_ssb,scs_pdcch, (scs_ssb << 5)|scs_pdcch); - - // type0-pdcch coreset - switch( (scs_ssb << 5)|scs_pdcch ){ - case (scs_15kHz << 5) | scs_15kHz : - AssertFatal(index_4msb < 15, "38.213 Table 13-1 4 MSB out of range\n"); - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_1_c2[index_4msb]; - num_symbols = table_38213_13_1_c3[index_4msb]; - rb_offset = table_38213_13_1_c4[index_4msb]; - break; - - case (scs_15kHz << 5) | scs_30kHz: - AssertFatal(index_4msb < 14, "38.213 Table 13-2 4 MSB out of range\n"); - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_2_c2[index_4msb]; - num_symbols = table_38213_13_2_c3[index_4msb]; - rb_offset = table_38213_13_2_c4[index_4msb]; - break; - - case (scs_30kHz << 5) | scs_15kHz: - if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){ - AssertFatal(index_4msb < 9, "38.213 Table 13-3 4 MSB out of range\n"); - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_3_c2[index_4msb]; - num_symbols = table_38213_13_3_c3[index_4msb]; - rb_offset = table_38213_13_3_c4[index_4msb]; - }else if(min_channel_bw & bw_40MHz){ - AssertFatal(index_4msb < 9, "38.213 Table 13-5 4 MSB out of range\n"); - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_5_c2[index_4msb]; - num_symbols = table_38213_13_5_c3[index_4msb]; - rb_offset = table_38213_13_5_c4[index_4msb]; - }else{ ; } - - break; - - case (scs_30kHz << 5) | scs_30kHz: - if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){ - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_4_c2[index_4msb]; - num_symbols = table_38213_13_4_c3[index_4msb]; - rb_offset = table_38213_13_4_c4[index_4msb]; - LOG_I(MAC,"<<<<<<<<type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_6_c2[index_4msb]; - num_symbols = table_38213_13_6_c3[index_4msb]; - rb_offset = table_38213_13_6_c4[index_4msb]; - }else{ ; } - break; - - case (scs_120kHz << 5) | scs_60kHz: - AssertFatal(index_4msb < 12, "38.213 Table 13-7 4 MSB out of range\n"); - if(index_4msb & 0x7){ - mac->type0_pdcch_ss_mux_pattern = 1; - }else if(index_4msb & 0x18){ - mac->type0_pdcch_ss_mux_pattern = 2; - }else{ ; } - - num_rbs = table_38213_13_7_c2[index_4msb]; - num_symbols = table_38213_13_7_c3[index_4msb]; - if(!is_condition_A && (index_4msb == 8 || index_4msb == 10)){ - rb_offset = table_38213_13_7_c4[index_4msb] - 1; - }else{ - rb_offset = table_38213_13_7_c4[index_4msb]; - } - break; - - case (scs_120kHz << 5) | scs_120kHz: - AssertFatal(index_4msb < 8, "38.213 Table 13-8 4 MSB out of range\n"); - if(index_4msb & 0x3){ - mac->type0_pdcch_ss_mux_pattern = 1; - }else if(index_4msb & 0x0c){ - mac->type0_pdcch_ss_mux_pattern = 3; - } - - num_rbs = table_38213_13_8_c2[index_4msb]; - num_symbols = table_38213_13_8_c3[index_4msb]; - if(!is_condition_A && (index_4msb == 4 || index_4msb == 6)){ - rb_offset = table_38213_13_8_c4[index_4msb] - 1; - }else{ - rb_offset = table_38213_13_8_c4[index_4msb]; - } - break; - - case (scs_240kHz << 5) | scs_60kHz: - AssertFatal(index_4msb < 4, "38.213 Table 13-9 4 MSB out of range\n"); - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_9_c2[index_4msb]; - num_symbols = table_38213_13_9_c3[index_4msb]; - rb_offset = table_38213_13_9_c4[index_4msb]; - break; - - case (scs_240kHz << 5) | scs_120kHz: - AssertFatal(index_4msb < 8, "38.213 Table 13-10 4 MSB out of range\n"); - if(index_4msb & 0x3){ - mac->type0_pdcch_ss_mux_pattern = 1; - }else if(index_4msb & 0x0c){ - mac->type0_pdcch_ss_mux_pattern = 2; - } - num_rbs = table_38213_13_10_c2[index_4msb]; - num_symbols = table_38213_13_10_c3[index_4msb]; - if(!is_condition_A && (index_4msb == 4 || index_4msb == 6)){ - rb_offset = table_38213_13_10_c4[index_4msb]-1; - }else{ - rb_offset = table_38213_13_10_c4[index_4msb]; - } - - break; - - default: - break; - } - - AssertFatal(num_rbs != -1, "Type0 PDCCH coreset num_rbs undefined"); - AssertFatal(num_symbols != -1, "Type0 PDCCH coreset num_symbols undefined"); - AssertFatal(rb_offset != -1, "Type0 PDCCH coreset rb_offset undefined"); - - //uint32_t cell_id = 0; // obtain from L1 later - - //mac->type0_pdcch_dci_config.coreset.rb_start = rb_offset; - //mac->type0_pdcch_dci_config.coreset.rb_end = rb_offset + num_rbs - 1; - uint64_t mask = 0x0; - uint8_t i; - for(i=0; i<(num_rbs/6); ++i){ // 38.331 Each bit corresponds a group of 6 RBs - mask = mask >> 1; - mask = mask | 0x100000000000; - } - //LOG_I(MAC,">>>>>>>>mask %x num_rbs %d rb_offset %d\n", mask, num_rbs, rb_offset); - -// mac->type0_pdcch_dci_config.coreset.frequency_domain_resource = mask; -// mac->type0_pdcch_dci_config.coreset.rb_offset = rb_offset; // additional parameter other than coreset -// -// //mac->type0_pdcch_dci_config.type0_pdcch_coreset.duration = num_symbols; -// mac->type0_pdcch_dci_config.coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED; -// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_reg_bundle_size = 6; // L 38.211 7.3.2.2 -// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_interleaver_size = 2; // R 38.211 7.3.2.2 -// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_shift_index = cell_id; -// mac->type0_pdcch_dci_config.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE; -// mac->type0_pdcch_dci_config.coreset.pdcch_dmrs_scrambling_id = cell_id; - - - - // type0-pdcch search space - float big_o; - float big_m; - uint32_t temp; - SFN_C_TYPE sfn_c=SFN_C_IMPOSSIBLE; // only valid for mux=1 - uint32_t n_c=UINT_MAX; - uint32_t number_of_search_space_per_slot=UINT_MAX; - uint32_t first_symbol_index=UINT_MAX; - uint32_t search_space_duration; // element of search space - // 38.213 table 10.1-1 - - /// MUX PATTERN 1 - if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){ - big_o = table_38213_13_11_c1[index_4lsb]; - number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; - big_m = table_38213_13_11_c3[index_4lsb]; - - temp = (uint32_t)(big_o*pow(2, scs_pdcch)) + (uint32_t)(ssb_index*big_m); - n_c = temp / num_slot_per_frame; - if((temp/num_slot_per_frame) & 0x1){ - sfn_c = SFN_C_MOD_2_EQ_1; - }else{ - sfn_c = SFN_C_MOD_2_EQ_0; - } - - if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 7) && (ssb_index&1)){ - first_symbol_index = num_symbols; - }else{ - first_symbol_index = table_38213_13_11_c4[index_4lsb]; - } - // 38.213 chapter 13: over two consecutive slots - search_space_duration = 2; - } - - if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR2){ - big_o = table_38213_13_12_c1[index_4lsb]; - number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; - big_m = table_38213_13_12_c3[index_4lsb]; - - if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 10) && (ssb_index&1)){ - first_symbol_index = 7; - }else if((index_4lsb == 6 || index_4lsb == 7 || index_4lsb == 8 || index_4lsb == 11) && (ssb_index&1)){ - first_symbol_index = num_symbols; - }else{ - first_symbol_index = 0; - } - // 38.213 chapter 13: over two consecutive slots - search_space_duration = 2; - } - - /// MUX PATTERN 2 - if(mac->type0_pdcch_ss_mux_pattern == 2){ - - if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){ - // 38.213 Table 13-13 - AssertFatal(index_4lsb == 0, "38.213 Table 13-13 4 LSB out of range\n"); - // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot - // sfn_c = SFN_C_EQ_SFN_SSB; - n_c = get_ssb_slot(ssb_index); - switch(ssb_index & 0x3){ // ssb_index(i) mod 4 - case 0: - first_symbol_index = 0; - break; - case 1: - first_symbol_index = 1; - break; - case 2: - first_symbol_index = 6; - break; - case 3: - first_symbol_index = 7; - break; - default: break; - } - - }else if((scs_ssb == scs_240kHz) && (scs_pdcch == scs_120kHz)){ - // 38.213 Table 13-14 - AssertFatal(index_4lsb == 0, "38.213 Table 13-14 4 LSB out of range\n"); - // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot - // sfn_c = SFN_C_EQ_SFN_SSB; - n_c = get_ssb_slot(ssb_index); - switch(ssb_index & 0x7){ // ssb_index(i) mod 8 - case 0: - first_symbol_index = 0; - break; - case 1: - first_symbol_index = 1; - break; - case 2: - first_symbol_index = 2; - break; - case 3: - first_symbol_index = 3; - break; - case 4: - first_symbol_index = 12; - n_c = get_ssb_slot(ssb_index) - 1; - break; - case 5: - first_symbol_index = 13; - n_c = get_ssb_slot(ssb_index) - 1; - break; - case 6: - first_symbol_index = 0; - break; - case 7: - first_symbol_index = 1; - break; - default: break; - } - }else{ ; } - // 38.213 chapter 13: over one slot - search_space_duration = 1; - } - - /// MUX PATTERN 3 - if(mac->type0_pdcch_ss_mux_pattern == 3){ - if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_120kHz)){ - // 38.213 Table 13-15 - AssertFatal(index_4lsb == 0, "38.213 Table 13-15 4 LSB out of range\n"); - // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot - // sfn_c = SFN_C_EQ_SFN_SSB; - n_c = get_ssb_slot(ssb_index); - switch(ssb_index & 0x3){ // ssb_index(i) mod 4 - case 0: - first_symbol_index = 4; - break; - case 1: - first_symbol_index = 8; - break; - case 2: - first_symbol_index = 2; - break; - case 3: - first_symbol_index = 6; - break; - default: break; - } - }else{ ; } - // 38.213 chapter 13: over one slot - search_space_duration = 1; - } - - AssertFatal(number_of_search_space_per_slot!=UINT_MAX,""); - -// uint32_t coreset_duration = num_symbols * number_of_search_space_per_slot; -// mac->type0_pdcch_dci_config.number_of_candidates[0] = table_38213_10_1_1_c2[0]; -// mac->type0_pdcch_dci_config.number_of_candidates[1] = table_38213_10_1_1_c2[1]; -// mac->type0_pdcch_dci_config.number_of_candidates[2] = table_38213_10_1_1_c2[2]; // CCE aggregation level = 4 -// mac->type0_pdcch_dci_config.number_of_candidates[3] = table_38213_10_1_1_c2[3]; // CCE aggregation level = 8 -// mac->type0_pdcch_dci_config.number_of_candidates[4] = table_38213_10_1_1_c2[4]; // CCE aggregation level = 16 -// mac->type0_pdcch_dci_config.duration = search_space_duration; -// mac->type0_pdcch_dci_config.coreset.duration = coreset_duration; // coreset -// AssertFatal(first_symbol_index!=UINT_MAX,""); -// mac->type0_pdcch_dci_config.monitoring_symbols_within_slot = (0x3fff << first_symbol_index) & (0x3fff >> (14-coreset_duration-first_symbol_index)) & 0x3fff; - - AssertFatal(sfn_c!=SFN_C_IMPOSSIBLE,""); - AssertFatal(n_c!=UINT_MAX,""); - mac->type0_pdcch_ss_sfn_c = sfn_c; - mac->type0_pdcch_ss_n_c = n_c; - - // fill in the elements in config request inside P5 message - mac->phy_config.Mod_id = module_id; - mac->phy_config.CC_id = cc_id; - - mac->dl_config_request.sfn = frame; - mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS -*/ - //} return 0; } @@ -3880,8 +3520,8 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac, break; } break; - } - + } + return dci_format; } diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index ad8409de69..2974f28a4e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -349,6 +349,8 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, if (secondaryCellGroup) { + RC.nrmac[Mod_idP]->secondaryCellGroupCommon = secondaryCellGroup; + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; if (add_ue == 1 && get_softmodem_params()->phy_test) { const int UE_id = add_new_nr_ue(Mod_idP,rnti); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 856d1937b1..db7493b4fe 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -458,14 +458,13 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, } // This schedules SIB1 - if(slot == 15){ - schedule_nr_sib1(module_idP, frame, slot); - } + schedule_nr_sib1(module_idP, frame, slot); // This schedule PRACH if we are not in phy_test mode - if (get_softmodem_params()->phy_test == 0) + if (get_softmodem_params()->phy_test == 0) { schedule_nr_prach(module_idP, frame, slot); + } // This schedule SR // TODO @@ -513,8 +512,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ue_sched_ctl->ta_apply = false; } - if (UE_info->active[UE_id]) + if (UE_info->active[UE_id]) { nr_schedule_pucch(module_idP, UE_id, nr_ulmix_slots, frame, slot); + } stop_meas(&RC.nrmac[module_idP]->eNB_scheduler); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index f64a3ba981..a4e36f0c3c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -30,6 +30,7 @@ */ +#include #include "assertions.h" #include "NR_MAC_gNB/nr_mac_gNB.h" #include "NR_MAC_gNB/mac_proto.h" @@ -38,28 +39,26 @@ #include "common/utils/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 "common/utils/nr/nr_common.h" -//#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" -#include "intertask_interface.h" - #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 #include "common/ran_context.h" +#include "executables/softmodem-common.h" + extern RAN_CONTEXT_t RC; void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ - gNB_MAC_INST *gNB = RC.nrmac[module_idP]; + gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; NR_COMMON_channels_t *cc; - + nfapi_nr_dl_tti_request_t *dl_tti_request; nfapi_nr_dl_tti_request_body_t *dl_req; nfapi_nr_dl_tti_request_pdu_t *dl_config_pdu; @@ -72,9 +71,9 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - dl_tti_request = &gNB->DL_req[CC_id]; + dl_tti_request = &gNB_mac->DL_req[CC_id]; dl_req = &dl_tti_request->dl_tti_request_body; - cc = &gNB->common_channels[CC_id]; + cc = &gNB_mac->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 @@ -107,30 +106,30 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ uint32_t ssb_offset0 = *cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; int ratio; switch (*cc->ServingCellConfigCommon->ssbSubcarrierSpacing) { - case NR_SubcarrierSpacing_kHz15: - AssertFatal(band <= 79, "Band %ld is not possible for SSB with 15 kHz SCS\n",band); - if (band<77) // below 3GHz - ratio=3; // NRARFCN step is 5 kHz - else - ratio=1; // NRARFCN step is 15 kHz - break; - case NR_SubcarrierSpacing_kHz30: - AssertFatal(band <= 79, "Band %ld is not possible for SSB with 15 kHz SCS\n",band); - if (band<77) // below 3GHz - ratio=6; // NRARFCN step is 5 kHz - else - ratio=2; // NRARFCN step is 15 kHz - break; - case NR_SubcarrierSpacing_kHz120: - AssertFatal(band >= 257, "Band %ld is not possible for SSB with 120 kHz SCS\n",band); - ratio=2; // NRARFCN step is 15 kHz - break; - case NR_SubcarrierSpacing_kHz240: - AssertFatal(band >= 257, "Band %ld is not possible for SSB with 240 kHz SCS\n",band); - ratio=4; // NRARFCN step is 15 kHz - break; - default: - AssertFatal(1==0,"SCS %ld not allowed for SSB \n", *cc->ServingCellConfigCommon->ssbSubcarrierSpacing); + case NR_SubcarrierSpacing_kHz15: + AssertFatal(band <= 79, "Band %ld is not possible for SSB with 15 kHz SCS\n",band); + if (band<77) // below 3GHz + ratio=3; // NRARFCN step is 5 kHz + else + ratio=1; // NRARFCN step is 15 kHz + break; + case NR_SubcarrierSpacing_kHz30: + AssertFatal(band <= 79, "Band %ld is not possible for SSB with 15 kHz SCS\n",band); + if (band<77) // below 3GHz + ratio=6; // NRARFCN step is 5 kHz + else + ratio=2; // NRARFCN step is 15 kHz + break; + case NR_SubcarrierSpacing_kHz120: + AssertFatal(band >= 257, "Band %ld is not possible for SSB with 120 kHz SCS\n",band); + ratio=2; // NRARFCN step is 15 kHz + break; + case NR_SubcarrierSpacing_kHz240: + AssertFatal(band >= 257, "Band %ld is not possible for SSB with 240 kHz SCS\n",band); + ratio=4; // NRARFCN step is 15 kHz + break; + default: + AssertFatal(1==0,"SCS %ld not allowed for SSB \n", *cc->ServingCellConfigCommon->ssbSubcarrierSpacing); } dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset = 0; //kSSB dl_config_pdu->ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA = ssb_offset0/(ratio*12) - 10; // absoluteFrequencySSB is the center of SSB @@ -144,201 +143,213 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ vrb_map[rbStart + rb] = 1; } } -} - -void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { - - printf("\n\n--- Schedule_nr_sib1: Start\n"); // Get type0_PDCCH_CSS_config parameters PHY_VARS_gNB *gNB = RC.gNB[module_idP]; - gNB_MAC_INST *mac = RC.nrmac[module_idP]; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_MIB_t *mib = RC.nrrrc[module_idP]->carrier.mib.message.choice.mib; uint8_t gNB_xtra_byte = 0; for (int i = 0; i < 8; i++) { gNB_xtra_byte |= ((gNB->pbch.pbch_a >> (31 - i)) & 1) << (7 - i); } - get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config, mib, gNB_xtra_byte, frame_parms->Lmax, + get_type0_PDCCH_CSS_config_parameters(&gNB_mac->type0_PDCCH_CSS_config, mib, gNB_xtra_byte, frame_parms->Lmax, frame_parms->ssb_index); +} +void schedule_control_sib1(module_id_t module_id, + int CC_id, + int bwp_id, + int time_domain_allocation, + uint8_t mcsTableIdx, + uint8_t mcs, + uint8_t numDmrsCdmGrpsNoData) { - // Get SIB1 - int CC_id = 0; - uint8_t sib1_payload[100]; - uint8_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, 1, sib1_payload); - printf("sib1_sdu_length = %i\n", sib1_sdu_length); - for(int i = 0; isecondaryCellGroupCommon->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + if (gNB_mac->sched_ctrlCommon == NULL){ + gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon)); + gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space)); + gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp)); + gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset)); + fill_default_searchSpaceZero(gNB_mac->sched_ctrlCommon->search_space); + fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset); } - printf("\n"); + gNB_mac->sched_ctrlCommon->active_bwp = bwp; + gNB_mac->sched_ctrlCommon->rbSize = 0; + gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation; + gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx; + gNB_mac->sched_ctrlCommon->mcs = mcs; + gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = numDmrsCdmGrpsNoData; + uint8_t nr_of_candidates; + find_aggregation_candidates(&gNB_mac->sched_ctrlCommon->aggregation_level, &nr_of_candidates,gNB_mac->sched_ctrlCommon->search_space); - // Schedule SIB1 + gNB_mac->sched_ctrlCommon->cce_index = allocate_nr_CCEs(RC.nrmac[module_id], + gNB_mac->sched_ctrlCommon->active_bwp, + gNB_mac->sched_ctrlCommon->coreset, + gNB_mac->sched_ctrlCommon->aggregation_level, + 0, + 0); - int UE_id = 0; - int mcsIndex = 0; - int startSymbolAndLength = 0; - int NrOfSymbols = 14; - int StartSymbolIndex_tmp; - int NrOfSymbols_tmp; - int StartSymbolIndex = -1; - int time_domain_assignment = 0; - int dci10_bw; - long locationAndBandwidth; - int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; + // Frequency-domain allocation + const uint16_t bwpSize = NRRIV2BW(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); + int rbStart = NRRIV2PRBOFFSET(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); + uint8_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; + while (rbStart < bwpSize && vrb_map[rbStart]) { + rbStart++; + } - NR_COMMON_channels_t *cc = &mac->common_channels[CC_id]; - NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + // Calculate number of PRB_DMRS + uint8_t N_PRB_DMRS; + if(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NFAPI_NR_DMRS_TYPE1) { + N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; + } else { + N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 4; + } - NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info; - NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id]; - NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - long bwp_Id = sched_ctrl->active_bwp->bwp_Id; + // Calculate number of symbols + struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; + int startSymbolIndex, nrOfSymbols; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); - nfapi_nr_dl_tti_request_body_t *dl_req = &mac->DL_req[CC_id].dl_tti_request_body; - nfapi_nr_pdu_t *tx_req = &mac->TX_req[CC_id].pdu_list[mac->TX_req[CC_id].Number_of_PDUs]; + // Calculate rbStart and rbSize + int rbSize = 0; + uint32_t TBS = 0; + do { + rbSize++; + TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + rbSize, nrOfSymbols, N_PRB_DMRS,0,0,1) >> 3; + } while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < 0); + gNB_mac->sched_ctrlCommon->rbSize = rbSize; + gNB_mac->sched_ctrlCommon->rbStart = rbStart; - NR_SearchSpace_t *ss; + // Mark the corresponding RBs as used + for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) { + vrb_map[rb + gNB_mac->sched_ctrlCommon->rbStart] = 1; + } - nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; + printf("searchSpaceId = %li\n", gNB_mac->sched_ctrlCommon->search_space->searchSpaceId); + printf("locationAndBandwidth = %li\n", gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth); + printf("cce_index = %i\n", gNB_mac->sched_ctrlCommon->cce_index); + printf("aggregation_level = %i\n", gNB_mac->sched_ctrlCommon->aggregation_level); + printf("nr_of_candidates = %i\n", nr_of_candidates); + printf("startSymbolIndex = %i\n", startSymbolIndex); + printf("nrOfSymbols = %i\n", nrOfSymbols); + printf("rbSize = %i\n", rbSize); + printf("rbStart = %i\n", rbStart); + printf("TBS = %i\n", TBS); + printf("N_PRB_DMRS = %i\n", N_PRB_DMRS); +} + +void nr_fill_nfapi_dci_sib1_pdu(int Mod_idP, rnti_t rnti, nfapi_nr_dl_tti_request_body_t *dl_req) { + + gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; + NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels->ServingCellConfigCommon; + NR_BWP_Downlink_t *bwp = gNB_mac->sched_ctrlCommon->active_bwp; + + long locationAndBandwidth = bwp->bwp_Common->genericParameters.locationAndBandwidth; + int dci10_bw = NRRIV2BW(locationAndBandwidth,275); + + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE; dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); - nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs+1]; - memset((void *)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); - dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; - dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu)); - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; - nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; - - NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_Id - 1]; - NR_BWP_Uplink_t *ubwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_Id-1]; - - pdsch_pdu_rel15->pduBitmap = 0; - pdsch_pdu_rel15->rnti = 0; //UE_info->rnti[UE_id]; - pdsch_pdu_rel15->pduIndex = 0; //mac->pdu_index[0]++; - - pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); - pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); - pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; - pdsch_pdu_rel15->CyclicPrefix = 0; - pdsch_pdu_rel15->NrOfCodewords = 1; - pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(mcsIndex,0); - pdsch_pdu_rel15->qamModOrder[0] = 2; - pdsch_pdu_rel15->mcsIndex[0] = mcsIndex; - if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == NULL) - pdsch_pdu_rel15->mcsTable[0] = 0; - else{ - if (*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == 0) - pdsch_pdu_rel15->mcsTable[0] = 1; - else - pdsch_pdu_rel15->mcsTable[0] = 2; - } - pdsch_pdu_rel15->rvIndex[0] = 0; - pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; - pdsch_pdu_rel15->nrOfLayers = 1; - pdsch_pdu_rel15->transmissionScheme = 0; - pdsch_pdu_rel15->refPoint = 0; - pdsch_pdu_rel15->dmrsConfigType = 0; - pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; - pdsch_pdu_rel15->SCID = 0; - pdsch_pdu_rel15->numDmrsCdmGrpsNoData = 2; - pdsch_pdu_rel15->dmrsPorts = 1; - pdsch_pdu_rel15->resourceAlloc = 1; - pdsch_pdu_rel15->rbStart = 0; - pdsch_pdu_rel15->rbSize = 6; - pdsch_pdu_rel15->VRBtoPRBMapping = 0; // non interleaved - - - for (int i=0; ibwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count; i++) { - startSymbolAndLength = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength; - SLIV2SL(startSymbolAndLength, &StartSymbolIndex_tmp, &NrOfSymbols_tmp); - if (NrOfSymbols_tmp < NrOfSymbols) { - NrOfSymbols = NrOfSymbols_tmp; - StartSymbolIndex = StartSymbolIndex_tmp; - time_domain_assignment = i; // this is short PDSCH added to the config to fit mixed slot - } - } - - pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; - pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; - pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL, scc->dmrs_TypeA_Position, NrOfSymbols); - - locationAndBandwidth = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth; - dci10_bw = NRRIV2BW(locationAndBandwidth,275); dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET]; - dci_pdu_rel15[0].frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize, - pdsch_pdu_rel15->rbStart,dci10_bw); - dci_pdu_rel15[0].time_domain_assignment.val = time_domain_assignment; - dci_pdu_rel15[0].vrb_to_prb_mapping.val = 0; - dci_pdu_rel15[0].mcs = pdsch_pdu_rel15->mcsIndex[0]; - dci_pdu_rel15[0].tb_scaling = 0; + memset(dci_pdu_rel15, 0, sizeof(dci_pdu_rel15_t) * MAX_DCI_CORESET); - int found = 0; - for ( int i=0; ibwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count; i++) { - ss=bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.array[i]; - if (ss->searchSpaceType->present == target_ss) { - found=1; - break; - } - } + dci_pdu_rel15[0].bwp_indicator.val = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id - 1; + dci_pdu_rel15[0].frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(gNB_mac->sched_ctrlCommon->rbSize, + gNB_mac->sched_ctrlCommon->rbStart, + dci10_bw); - uint8_t nr_of_candidates, aggregation_level; - find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss); - NR_ControlResourceSet_t *coreset = get_coreset(bwp, ss, 0); - int CCEIndex = allocate_nr_CCEs(mac,bwp,coreset,aggregation_level,0,0); + dci_pdu_rel15[0].time_domain_assignment.val = gNB_mac->sched_ctrlCommon->time_domain_allocation; + dci_pdu_rel15[0].mcs = gNB_mac->sched_ctrlCommon->mcs; + dci_pdu_rel15[0].rv = 0; + dci_pdu_rel15[0].harq_pid = 0; + dci_pdu_rel15[0].ndi = 0; + dci_pdu_rel15[0].dai[0].val = 0; + dci_pdu_rel15[0].tpc = 0; + dci_pdu_rel15[0].pucch_resource_indicator = 0; + dci_pdu_rel15[0].pdsch_to_harq_feedback_timing_indicator.val = 0; + dci_pdu_rel15[0].antenna_ports.val = 0; + dci_pdu_rel15[0].dmrs_sequence_initialization.val = 0; - if (CCEIndex < 0) { - LOG_E(MAC, "%s(): cannot find free CCE for RNTI %04x!\n", __func__, pdsch_pdu_rel15->rnti); - return; - } - - nr_configure_pdcch(mac, + nr_configure_pdcch(gNB_mac, pdcch_pdu_rel15, - pdsch_pdu_rel15->rnti, - ss, - coreset, + rnti, + gNB_mac->sched_ctrlCommon->search_space, + gNB_mac->sched_ctrlCommon->coreset, scc, bwp, - aggregation_level, - CCEIndex); + gNB_mac->sched_ctrlCommon->aggregation_level, + gNB_mac->sched_ctrlCommon->cce_index); - LOG_I(MAC, "Frame %d: Subframe %d : Adding common DL DCI for RNTI %x\n", frameP, slotP, pdsch_pdu_rel15->rnti); + int dci_formats[2]; + int rnti_types[2]; + dci_formats[0] = NR_DL_DCI_FORMAT_1_0; + rnti_types[0] = NR_RNTI_SI; - int dci_formats[2], rnti_types[2]; - dci_formats[0] = NR_DL_DCI_FORMAT_1_0; - rnti_types[0] = NR_RNTI_SI; - fill_dci_pdu_rel15(scc,secondaryCellGroup,pdcch_pdu_rel15, &dci_pdu_rel15[0], dci_formats, rnti_types,dci10_bw,bwp_Id); + fill_dci_pdu_rel15(scc,gNB_mac->secondaryCellGroupCommon,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types, dci10_bw,bwp->bwp_Id); - dl_req->nPDUs+=2; + dl_req->nPDUs += 1; - int x_Overhead = 0; - nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, dci_pdu_rel15[0].tb_scaling); + printf("locationAndBandwidth = %li\n", locationAndBandwidth); + printf("dci10_bw = %i\n", dci10_bw); +} - // DL TX request - tx_req->PDU_length = pdsch_pdu_rel15->TBSize[0]; - tx_req->PDU_index = mac->pdu_index[CC_id]++; - tx_req->num_TLV = 1; - tx_req->TLVs[0].length = sib1_sdu_length; - mac->TX_req[CC_id].SFN = frameP; - mac->TX_req[CC_id].Number_of_PDUs++; - mac->TX_req[CC_id].Slot = slotP; - memcpy((void*)&tx_req->TLVs[0].value.direct[0], (void*)sib1_payload, sib1_sdu_length); +void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { + + printf("\n\n--- Schedule_nr_sib1: Start\n"); + printf("frameP = %i, slotP = %i\n", frameP, slotP); + + int CC_id = 0; + rnti_t rnti = 0x1234; + int bwp_id = 1; + int time_domain_allocation = 2; + uint8_t mcsTableIdx = 0; + uint8_t mcs = 9; + uint8_t numDmrsCdmGrpsNoData = 1; + + gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; + + // TODO: Check at gNB_mac->type0_PDCCH_CSS_config if it is to transmit (structure arrives here updated) + bool is_to_transmit_sib1 = false; + is_to_transmit_sib1 = slotP == 10; + + if(is_to_transmit_sib1) { + + printf("SIB1 will be transmitted here\n"); + + // Computation of the sched_ctrlCommon: bwp, coreset0, rbStart, rbSize, etc. + schedule_control_sib1(module_idP, CC_id, bwp_id, time_domain_allocation, mcsTableIdx, mcs, numDmrsCdmGrpsNoData); + + // Schedule broadcast DCI for the SIB1 + nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; + nr_fill_nfapi_dci_sib1_pdu(module_idP, rnti, dl_req); + + // Get SIB1 + uint8_t sib1_payload[100]; + uint8_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, 1, sib1_payload); + printf("sib1_sdu_length = %i\n", sib1_sdu_length); + for(int i = 0; irbSize; rb++) { - vrb_map[rb + pdsch_pdu_rel15->rbStart] = 1; } + printf("--- Schedule_nr_sib1: End\n\n\n"); - printf("--- Schedule_nr_sib1: End\n\n\n"); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index a686215fd5..968c280f2e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -63,6 +63,7 @@ #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_gNB_SCHEDULER 1 + #include "common/ran_context.h" extern RAN_CONTEXT_t RC; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index d33ad37be7..e8f26a06a1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -443,6 +443,8 @@ typedef struct gNB_MAC_INST_s { /// CCE lists int cce_list[MAX_NUM_BWP][MAX_NUM_CORESET][MAX_NUM_CCE]; + NR_UE_sched_ctrl_t *sched_ctrlCommon; + NR_CellGroupConfig_t *secondaryCellGroupCommon; NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config; } gNB_MAC_INST; diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 5d620181d1..ec393e7eda 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -190,6 +190,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ (dl_info->rx_ind->rx_indication_body+i)->sib_pdu.pdu, (dl_info->rx_ind->rx_indication_body+i)->sib_pdu.pdu_length)) << FAPI_NR_RX_PDU_TYPE_SIB; + LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], SIB case Number of PDUs: %d \n", dl_info->rx_ind->number_pdus); break; case FAPI_NR_RX_PDU_TYPE_DLSCH: diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 3a6bbfd5a3..26eab29fd7 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -71,6 +71,10 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti); +void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0); + +void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0); + void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CellGroupConfig_t *secondaryCellGroup, int scg_id, diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index b8962051d8..777baae549 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -47,6 +47,71 @@ #define false 0 #define true 1 +void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0) { + + coreset0->controlResourceSetId = 0; + + // frequencyDomainResources '11111111 11111111 00000000 00000000 00000000 00000'B, + if(coreset0->frequencyDomainResources.buf == NULL) coreset0->frequencyDomainResources.buf = calloc(1,6); + coreset0->frequencyDomainResources.buf[0] = 0xff; + coreset0->frequencyDomainResources.buf[1] = 0xff; + coreset0->frequencyDomainResources.buf[2] = 0; + coreset0->frequencyDomainResources.buf[3] = 0; + coreset0->frequencyDomainResources.buf[4] = 0; + coreset0->frequencyDomainResources.buf[5] = 0; + coreset0->frequencyDomainResources.size = 6; + coreset0->frequencyDomainResources.bits_unused = 3; + coreset0->duration = 1; + coreset0->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved; // FIXME: Interleaved + //coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset->cce_REG_MappingType.choice.interleaved)); + //coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; + //coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = scc->physCellId; + coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; + + if(coreset0->tci_StatesPDCCH_ToAddList == NULL) coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*coreset0->tci_StatesPDCCH_ToAddList)); + + NR_TCI_StateId_t *tci[8]; + for (int i=0;i<8;i++) { + tci[i]=calloc(1,sizeof(*tci[i])); + *tci[i] = i; + ASN_SEQUENCE_ADD(&coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]); + } + coreset0->tci_StatesPDCCH_ToReleaseList = NULL; + coreset0->tci_PresentInDCI = NULL; + coreset0->pdcch_DMRS_ScramblingID = NULL; + +} + +void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0) { + + if(ss0->controlResourceSetId == NULL) ss0->controlResourceSetId=calloc(1,sizeof(*ss0->controlResourceSetId)); + if(ss0->monitoringSymbolsWithinSlot == NULL) ss0->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss0->monitoringSymbolsWithinSlot)); + if(ss0->monitoringSymbolsWithinSlot->buf == NULL) ss0->monitoringSymbolsWithinSlot->buf = calloc(1,2); + if(ss0->nrofCandidates == NULL) ss0->nrofCandidates = calloc(1,sizeof(*ss0->nrofCandidates)); + if(ss0->searchSpaceType == NULL) ss0->searchSpaceType = calloc(1,sizeof(*ss0->searchSpaceType)); + if(ss0->searchSpaceType->choice.common == NULL) ss0->searchSpaceType->choice.common=calloc(1,sizeof(*ss0->searchSpaceType->choice.common)); + if(ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 == NULL) ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); + + ss0->searchSpaceId = 0; + *ss0->controlResourceSetId = 0; + ss0->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*ss0->monitoringSlotPeriodicityAndOffset)); + ss0->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; + ss0->duration=NULL; + + // should be '1100 0000 0000 00'B (LSB first!), first two symols in slot, adjust if needed + ss0->monitoringSymbolsWithinSlot->buf[1] = 0; + ss0->monitoringSymbolsWithinSlot->buf[0] = (1<<7) | (1<<6); + ss0->monitoringSymbolsWithinSlot->size = 2; + ss0->monitoringSymbolsWithinSlot->bits_unused = 2; + + ss0->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; + ss0->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; + ss0->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; + ss0->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; + ss0->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; + + ss0->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; +} void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CellGroupConfig_t *secondaryCellGroup, @@ -468,35 +533,38 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList=NULL; bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList)); - NR_SearchSpace_t *ss=calloc(1,sizeof(*ss)); - ss->searchSpaceId = 1; - ss->controlResourceSetId=calloc(1,sizeof(*ss->controlResourceSetId)); - *ss->controlResourceSetId=1; - ss->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*ss->monitoringSlotPeriodicityAndOffset)); - ss->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; - ss->duration=NULL; - ss->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss->monitoringSymbolsWithinSlot)); - ss->monitoringSymbolsWithinSlot->buf = calloc(1,2); - // should be '1100 0000 0000 00'B (LSB first!), first two symols in slot, adjust if needed - ss->monitoringSymbolsWithinSlot->buf[1] = 0; - ss->monitoringSymbolsWithinSlot->buf[0] = (1<<7) | (1<<6); - ss->monitoringSymbolsWithinSlot->size = 2; - ss->monitoringSymbolsWithinSlot->bits_unused = 2; - ss->nrofCandidates = calloc(1,sizeof(*ss->nrofCandidates)); - ss->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; - ss->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; - ss->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; - ss->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; - ss->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; - ss->searchSpaceType = calloc(1,sizeof(*ss->searchSpaceType)); - ss->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; - ss->searchSpaceType->choice.common=calloc(1,sizeof(*ss->searchSpaceType->choice.common)); - ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); - ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss); - - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=NULL; + NR_SearchSpace_t *ss=calloc(1,sizeof(*ss)); + ss->searchSpaceId = 1; + ss->controlResourceSetId=calloc(1,sizeof(*ss->controlResourceSetId)); + *ss->controlResourceSetId=1; + ss->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*ss->monitoringSlotPeriodicityAndOffset)); + ss->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; + ss->duration=NULL; + ss->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss->monitoringSymbolsWithinSlot)); + ss->monitoringSymbolsWithinSlot->buf = calloc(1,2); + // should be '1100 0000 0000 00'B (LSB first!), first two symols in slot, adjust if needed + ss->monitoringSymbolsWithinSlot->buf[1] = 0; + ss->monitoringSymbolsWithinSlot->buf[0] = (1<<7) | (1<<6); + ss->monitoringSymbolsWithinSlot->size = 2; + ss->monitoringSymbolsWithinSlot->bits_unused = 2; + ss->nrofCandidates = calloc(1,sizeof(*ss->nrofCandidates)); + ss->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; + ss->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; + ss->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; + ss->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; + ss->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; + ss->searchSpaceType = calloc(1,sizeof(*ss->searchSpaceType)); + ss->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; + ss->searchSpaceType->choice.common=calloc(1,sizeof(*ss->searchSpaceType->choice.common)); + ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); + + ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss); + + + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1)); + *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=0; bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation=NULL; bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->pagingSearchSpace=NULL; bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace)); From 807b3e90b8069259d988c8e033cf7d7205560c88 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Tue, 27 Oct 2020 00:30:03 +0000 Subject: [PATCH 006/160] RNTI_SI: update to 0xFFFF --- openair1/PHY/NR_TRANSPORT/nr_dci.c | 18 +++--- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 9 +++ openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 1 + .../NR_MAC_UE/nr_ue_dci_configuration.c | 16 ++--- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 63 ++++++++++--------- 5 files changed, 61 insertions(+), 46 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 0687acd1b4..4414bb9b83 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -168,13 +168,6 @@ uint8_t nr_generate_dci_top(PHY_VARS_gNB *gNB, /// Scrambling uint32_t scrambled_output[NR_MAX_DCI_SIZE_DWORD]= {0}; nr_pdcch_scrambling(encoder_output, encoded_length, Nid, scrambling_RNTI, scrambled_output); - - printf("polar_encoder_fast: pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d] = %i, pdcch_pdu_rel15->dci_pdu.AggregationLevel[d] = %i, n_RNTI = %i\n", - pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d], pdcch_pdu_rel15->dci_pdu.AggregationLevel[d], n_RNTI); - - printf("nr_pdcch_scrambling: encoded_length = %i, Nid = %i, scrambling_RNTI = %i\n\n",encoded_length, Nid, scrambling_RNTI); - - #ifdef DEBUG_CHANNEL_CODING printf("scrambled output: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\t [4]->0x%08x\t [5]->0x%08x\t \ [6]->0x%08x \t [7]->0x%08x \t [8]->0x%08x \t [9]->0x%08x\t [10]->0x%08x\t [11]->0x%08x\n", @@ -246,7 +239,16 @@ uint8_t nr_generate_dci_top(PHY_VARS_gNB *gNB, k -= frame_parms.ofdm_symbol_size; } // m } // reg_idx - + + + printf("polar_encoder_fast: pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d] = %i, pdcch_pdu_rel15->dci_pdu.AggregationLevel[d] = %i, n_RNTI = %i\n", + pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d], pdcch_pdu_rel15->dci_pdu.AggregationLevel[d], n_RNTI); + + printf("nr_pdcch_scrambling: encoded_length = %i, Nid = %i, scrambling_RNTI = %i\n\n",encoded_length, Nid, scrambling_RNTI); + + printf("\n>> DCI: payloadSize = %d | payload = %llx\n\n", + *pdcch_pdu_rel15->dci_pdu.PayloadSizeBits,*(unsigned long long*)pdcch_pdu_rel15->dci_pdu.Payload); + } // for (int d=0;dnumDlDci;d++) return 0; } diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 90cfe42e07..216879f2a1 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2953,5 +2953,14 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC AssertFatal(type0_PDCCH_CSS_config->sfn_c!=SFN_C_IMPOSSIBLE,""); AssertFatal(type0_PDCCH_CSS_config->n_c!=UINT_MAX,""); + type0_PDCCH_CSS_config->n_0 = ((uint32_t)(big_o*pow(2, scs_pdcch)) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m))%num_slot_per_frame; + + /*printf("\nbig_o = %f\n", big_o); + printf("scs_pdcch = %u\n", scs_pdcch); + printf("ssb_index = %u\n", type0_PDCCH_CSS_config->ssb_index); + printf("big_m = %f\n", big_m); + printf("num_slot_per_frame = %u\n", num_slot_per_frame);*/ + + return 0; } diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 9d6ee62072..a6c1bea4eb 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -121,6 +121,7 @@ typedef struct Type0_PDCCH_CSS_config_s { uint16_t frame; SFN_C_TYPE sfn_c; uint32_t n_c; + uint32_t n_0; uint32_t number_of_search_space_per_slot; uint32_t first_symbol_index; uint32_t search_space_duration; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 27680893f0..56f52c0bbf 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -148,7 +148,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12; // for SPS=14 8 MSBs in positions 13 down to 6 monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); - rel15->rnti = mac->crnti; // FIXME: Must be 0xFFFF + rel15->rnti = 0xFFFF; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, 275); rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275); rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing; @@ -252,19 +252,21 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl } } if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ + + printf("*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = %li\n", *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1); + printf("ss->searchSpaceId = %li\n", ss->searchSpaceId); + + // FIXME: //if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ - if(slot == 10){ + if( (frame%2 == mac->type0_PDCCH_CSS_config.sfn_c) && (slot == mac->type0_PDCCH_CSS_config.n_0) ){ rel15->num_dci_options = 1; rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; config_dci_pdu(mac, rel15, dl_config, NR_RNTI_SI, ss_id); fill_dci_search_candidates(ss, rel15); - //} + } - - // Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG - LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet..."); - } + //} } if (pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){ if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){ diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index a4e36f0c3c..27d349c080 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -165,7 +165,6 @@ void schedule_control_sib1(module_id_t module_id, uint8_t numDmrsCdmGrpsNoData) { gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; - NR_BWP_Downlink_t *bwp = gNB_mac->secondaryCellGroupCommon->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; if (gNB_mac->sched_ctrlCommon == NULL){ gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon)); @@ -176,7 +175,7 @@ void schedule_control_sib1(module_id_t module_id, fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset); } - gNB_mac->sched_ctrlCommon->active_bwp = bwp; + gNB_mac->sched_ctrlCommon->active_bwp = gNB_mac->secondaryCellGroupCommon->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; gNB_mac->sched_ctrlCommon->rbSize = 0; gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation; gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx; @@ -193,14 +192,6 @@ void schedule_control_sib1(module_id_t module_id, 0, 0); - // Frequency-domain allocation - const uint16_t bwpSize = NRRIV2BW(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); - int rbStart = NRRIV2PRBOFFSET(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); - uint8_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; - while (rbStart < bwpSize && vrb_map[rbStart]) { - rbStart++; - } - // Calculate number of PRB_DMRS uint8_t N_PRB_DMRS; if(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NFAPI_NR_DMRS_TYPE1) { @@ -216,18 +207,14 @@ void schedule_control_sib1(module_id_t module_id, SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); // Calculate rbStart and rbSize - int rbSize = 0; - uint32_t TBS = 0; - do { - rbSize++; - TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + gNB_mac->sched_ctrlCommon->rbStart = NRRIV2PRBOFFSET(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); + gNB_mac->sched_ctrlCommon->rbSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs; + uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - rbSize, nrOfSymbols, N_PRB_DMRS,0,0,1) >> 3; - } while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < 0); - gNB_mac->sched_ctrlCommon->rbSize = rbSize; - gNB_mac->sched_ctrlCommon->rbStart = rbStart; + gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS,0,0,1) >> 3; // Mark the corresponding RBs as used + uint8_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) { vrb_map[rb + gNB_mac->sched_ctrlCommon->rbStart] = 1; } @@ -239,13 +226,13 @@ void schedule_control_sib1(module_id_t module_id, printf("nr_of_candidates = %i\n", nr_of_candidates); printf("startSymbolIndex = %i\n", startSymbolIndex); printf("nrOfSymbols = %i\n", nrOfSymbols); - printf("rbSize = %i\n", rbSize); - printf("rbStart = %i\n", rbStart); + printf("rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); + printf("rbStart = %i\n", gNB_mac->sched_ctrlCommon->rbStart); printf("TBS = %i\n", TBS); printf("N_PRB_DMRS = %i\n", N_PRB_DMRS); } -void nr_fill_nfapi_dci_sib1_pdu(int Mod_idP, rnti_t rnti, nfapi_nr_dl_tti_request_body_t *dl_req) { +void nr_fill_nfapi_dci_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_request_body_t *dl_req) { gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels->ServingCellConfigCommon; @@ -283,7 +270,7 @@ void nr_fill_nfapi_dci_sib1_pdu(int Mod_idP, rnti_t rnti, nfapi_nr_dl_tti_reques nr_configure_pdcch(gNB_mac, pdcch_pdu_rel15, - rnti, + 0xFFFF, // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values gNB_mac->sched_ctrlCommon->search_space, gNB_mac->sched_ctrlCommon->coreset, scc, @@ -310,29 +297,43 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) printf("frameP = %i, slotP = %i\n", frameP, slotP); int CC_id = 0; - rnti_t rnti = 0x1234; int bwp_id = 1; - int time_domain_allocation = 2; + int time_domain_allocation = 0; uint8_t mcsTableIdx = 0; uint8_t mcs = 9; uint8_t numDmrsCdmGrpsNoData = 1; gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; - // TODO: Check at gNB_mac->type0_PDCCH_CSS_config if it is to transmit (structure arrives here updated) - bool is_to_transmit_sib1 = false; - is_to_transmit_sib1 = slotP == 10; + if(gNB_mac->type0_PDCCH_CSS_config.num_rbs<=0) { + return; + } - if(is_to_transmit_sib1) { + printf("search_space_duration = %i\n", gNB_mac->type0_PDCCH_CSS_config.search_space_duration); + printf("number_of_search_space_per_slot = %i\n", gNB_mac->type0_PDCCH_CSS_config.number_of_search_space_per_slot); + printf("type0_pdcch_ss_mux_pattern = %i\n", gNB_mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern); + printf("ssb_index = %i\n", gNB_mac->type0_PDCCH_CSS_config.ssb_index); + printf("first_symbol_index = %i\n", gNB_mac->type0_PDCCH_CSS_config.first_symbol_index); + printf("num_symbols = %i\n", gNB_mac->type0_PDCCH_CSS_config.num_symbols); + printf("ssb_length = %i\n", gNB_mac->type0_PDCCH_CSS_config.ssb_length); + printf("frame = %i\n", gNB_mac->type0_PDCCH_CSS_config.frame); + printf("n_c = %i\n", gNB_mac->type0_PDCCH_CSS_config.n_c); + printf("num_rbs = %i\n", gNB_mac->type0_PDCCH_CSS_config.num_rbs); + printf("rb_offset = %i\n", gNB_mac->type0_PDCCH_CSS_config.rb_offset); + printf("sfn_c = %i\n", gNB_mac->type0_PDCCH_CSS_config.sfn_c); + printf("n_0 = %i\n", gNB_mac->type0_PDCCH_CSS_config.n_0); - printf("SIB1 will be transmitted here\n"); + + if( (frameP%2 == gNB_mac->type0_PDCCH_CSS_config.sfn_c) && (slotP == gNB_mac->type0_PDCCH_CSS_config.n_0) ) { + + printf("\nSIB1 will be transmitted here\n"); // Computation of the sched_ctrlCommon: bwp, coreset0, rbStart, rbSize, etc. schedule_control_sib1(module_idP, CC_id, bwp_id, time_domain_allocation, mcsTableIdx, mcs, numDmrsCdmGrpsNoData); // Schedule broadcast DCI for the SIB1 nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; - nr_fill_nfapi_dci_sib1_pdu(module_idP, rnti, dl_req); + nr_fill_nfapi_dci_sib1_pdu(module_idP, dl_req); // Get SIB1 uint8_t sib1_payload[100]; From 4f525854d0add13ba01cfb6b2380ab7b11592256 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 28 Oct 2020 16:39:09 +0000 Subject: [PATCH 007/160] Update nr_extract_dci_info() for the NR_RNTI_SI case. --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 31 +++ openair2/LAYER2/NR_MAC_UE/mac_defs.h | 1 + .../NR_MAC_UE/nr_ue_dci_configuration.c | 43 +++- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 67 ++++-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 1 - .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 218 +++++++++++++++--- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 62 +++-- 7 files changed, 351 insertions(+), 72 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 800214e715..248f71763e 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -401,6 +401,37 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ mac->SSpace[0][0][ss_id] = css; ss_id++; } + + // TODO: Merge this code in a single function as fill_default_searchSpaceZero() in rrc_gNB_reconfig.c + // Search space zero + if(mac->search_space_zero == NULL) mac->search_space_zero=calloc(1,sizeof(*mac->search_space_zero)); + if(mac->search_space_zero->controlResourceSetId == NULL) mac->search_space_zero->controlResourceSetId=calloc(1,sizeof(*mac->search_space_zero->controlResourceSetId)); + if(mac->search_space_zero->monitoringSymbolsWithinSlot == NULL) mac->search_space_zero->monitoringSymbolsWithinSlot = calloc(1,sizeof(*mac->search_space_zero->monitoringSymbolsWithinSlot)); + if(mac->search_space_zero->monitoringSymbolsWithinSlot->buf == NULL) mac->search_space_zero->monitoringSymbolsWithinSlot->buf = calloc(1,2); + if(mac->search_space_zero->nrofCandidates == NULL) mac->search_space_zero->nrofCandidates = calloc(1,sizeof(*mac->search_space_zero->nrofCandidates)); + if(mac->search_space_zero->searchSpaceType == NULL) mac->search_space_zero->searchSpaceType = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType)); + if(mac->search_space_zero->searchSpaceType->choice.common == NULL) mac->search_space_zero->searchSpaceType->choice.common=calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common)); + if(mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 == NULL) mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); + + mac->search_space_zero->searchSpaceId = 0; + *mac->search_space_zero->controlResourceSetId = 0; + mac->search_space_zero->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*mac->search_space_zero->monitoringSlotPeriodicityAndOffset)); + mac->search_space_zero->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; + mac->search_space_zero->duration=NULL; + + // should be '1100 0000 0000 00'B (LSB first!), first two symols in slot, adjust if needed + mac->search_space_zero->monitoringSymbolsWithinSlot->buf[1] = 0; + mac->search_space_zero->monitoringSymbolsWithinSlot->buf[0] = (1<<7) | (1<<6); + mac->search_space_zero->monitoringSymbolsWithinSlot->size = 2; + mac->search_space_zero->monitoringSymbolsWithinSlot->bits_unused = 2; + + mac->search_space_zero->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; + mac->search_space_zero->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; + mac->search_space_zero->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; + mac->search_space_zero->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; + mac->search_space_zero->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; + + mac->search_space_zero->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; } int nr_rrc_mac_config_req_ue( diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index f94500f8e2..24c7949106 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -255,6 +255,7 @@ typedef struct { uint8_t PHR_reporting_active; NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config; + NR_SearchSpace_t *search_space_zero; } NR_UE_MAC_INST_t; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 56f52c0bbf..0f1eac8e89 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -74,7 +74,13 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t NR_ServingCellConfigCommon_t *scc = mac->scc; NR_BWP_DownlinkCommon_t *bwp_Common = mac->DLbwp[bwp_id - 1]->bwp_Common; NR_BWP_DownlinkCommon_t *initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP; - NR_SearchSpace_t *ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id]; + + NR_SearchSpace_t *ss; + if(ss_id>=0) { + ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id]; + } else { + ss = mac->search_space_zero; + } // CORESET configuration NR_ControlResourceSet_t *coreset = mac->coreset[bwp_id - 1][coreset_id - 1]; @@ -154,7 +160,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing; for (int i = 0; i < rel15->num_dci_options; i++) { - rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, bwp_id); + rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, bwp_id); } printf("bwp_Common->genericParameters.locationAndBandwidth = %li\n", bwp_Common->genericParameters.locationAndBandwidth); @@ -220,14 +226,10 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl // Fetch configuration for searchSpaceZero // note: The search space with the SearchSpaceId = 0 identifies the search space configured via PBCH (MIB) and in ServingCellConfigCommon (searchSpaceZero). if (pdcch_ConfigCommon->choice.setup->searchSpaceZero){ - - printf("pdcch_ConfigCommon->choice.setup->searchSpaceZero = %li\n", *pdcch_ConfigCommon->choice.setup->searchSpaceZero); - if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 == NULL){ pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1)); } *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = 0; - LOG_D(MAC, "[DCI_CONFIG] Configure SearchSpace#0 of the initial BWP\n"); LOG_W(MAC, "[DCI_CONFIG] This should not be available yet..."); } @@ -251,14 +253,14 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl } } } - if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ + /*if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ printf("*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = %li\n", *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1); printf("ss->searchSpaceId = %li\n", ss->searchSpaceId); // FIXME: //if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ - + if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ if( (frame%2 == mac->type0_PDCCH_CSS_config.sfn_c) && (slot == mac->type0_PDCCH_CSS_config.n_0) ){ rel15->num_dci_options = 1; rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; @@ -266,8 +268,8 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl fill_dci_search_candidates(ss, rel15); } - //} - } + } + }*/ if (pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){ if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){ // Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG @@ -360,4 +362,25 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl break; } } + + // Search space 0, CORESET ID 0 + + NR_BWP_DownlinkCommon_t *bwp_Common = bwp->bwp_Common; + NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon; + + if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ + + NR_SearchSpace_t *ss0 = mac->search_space_zero; + fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; + + if (ss0->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ + if( (frame%2 == mac->type0_PDCCH_CSS_config.sfn_c) && (slot == mac->type0_PDCCH_CSS_config.n_0) ){ + rel15->num_dci_options = 1; + rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; + config_dci_pdu(mac, rel15, dl_config, NR_RNTI_SI, -1); + fill_dci_search_candidates(ss0, rel15); + } + } + } + } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 7f93bdc262..e5bd129928 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2943,7 +2943,7 @@ int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){ case NR_RNTI_RA: case NR_RNTI_TC: case NR_RNTI_P: - case NR_RNTI_SI: + //case NR_RNTI_SI: if (mac->DLbwp[0]->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero) { uint8_t bwp_id = 1; uint8_t coreset_id = 0; // assuming controlResourceSetId is 0 for controlResourceSetZero @@ -2953,8 +2953,9 @@ int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){ N_RB = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); } break; + case NR_RNTI_SI: case NR_RNTI_C: - N_RB = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, 275); + N_RB = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, 275); break; } return N_RB; @@ -3192,23 +3193,51 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac, break; case NR_RNTI_SI: - /* - // Freq domain assignment 0-16 bit - fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); - for (int i=0; ifrequency_domain_assignment>>(fsize-i-1))&1)<<(dci_size-pos++); - // Time domain assignment 4 bit - for (int i=0; i<4; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment>>(3-i))&1)<<(dci_size-pos++); - // VRB to PRB mapping 1 bit - *dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val&1)<<(dci_size-pos++); - // MCS 5bit //bit over 32, so dci_pdu ++ - for (int i=0; i<5; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs>>(4-i))&1)<<(dci_size-pos++); - // Redundancy version 2bit - for (int i=0; i<2; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->rv>>(1-i))&1)<<(dci_size-pos++); - */ + + printf("\nnr_extract_dci_info\n\n"); + + // Freq domain assignment 0-16 bit + fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); + pos+=fsize; + dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<time_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&0xf; + + // VRB to PRB mapping 1 bit + pos++; + dci_pdu_rel15->vrb_to_prb_mapping.val = (*dci_pdu>>(dci_size-pos))&0x1; + + // MCS 5bit //bit over 32, so dci_pdu ++ + pos+=5; + dci_pdu_rel15->mcs = (*dci_pdu>>(dci_size-pos))&0x1f; + + // Redundancy version 2 bit + pos+=2; + dci_pdu_rel15->rv = (*dci_pdu>>(dci_size-pos))&3; + + // System information indicator 1 bit + pos++; + dci_pdu_rel15->system_info_indicator = (*dci_pdu>>(dci_size-pos))&0x1; + + printf("\n\n"); + + for(int i = 64-dci_size; i<64; i++) { + printf("%i ", (*dci_pdu >> 63-i)&(uint64_t)0x01); + } + + printf("\nN_RB = %i\n", N_RB); + printf("\ndci_size = %i\n", dci_size); + printf("fsize = %i\n", fsize); + printf("dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val); + printf("dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val); + printf("dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val); + printf("dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs); + printf("dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); + printf("dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator); + printf("\n"); + break; case NR_RNTI_TC: diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index db7493b4fe..ba05b15e57 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -460,7 +460,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, // This schedules SIB1 schedule_nr_sib1(module_idP, frame, slot); - // This schedule PRACH if we are not in phy_test mode if (get_softmodem_params()->phy_test == 0) { schedule_nr_prach(module_idP, frame, slot); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 27d349c080..d4f37acdf9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -175,7 +175,19 @@ void schedule_control_sib1(module_id_t module_id, fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset); } + + gNB_mac->sched_ctrlCommon->active_bwp = gNB_mac->secondaryCellGroupCommon->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + + + + + + + //NR_COMMON_channels_t *cc = &gNB_mac->common_channels[0]; + //NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + //scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth; + gNB_mac->sched_ctrlCommon->rbSize = 0; gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation; gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx; @@ -192,26 +204,9 @@ void schedule_control_sib1(module_id_t module_id, 0, 0); - // Calculate number of PRB_DMRS - uint8_t N_PRB_DMRS; - if(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NFAPI_NR_DMRS_TYPE1) { - N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; - } else { - N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 4; - } - - // Calculate number of symbols - struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; - int startSymbolIndex, nrOfSymbols; - SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); - // Calculate rbStart and rbSize gNB_mac->sched_ctrlCommon->rbStart = NRRIV2PRBOFFSET(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); - gNB_mac->sched_ctrlCommon->rbSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs; - uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS,0,0,1) >> 3; + gNB_mac->sched_ctrlCommon->rbSize = 4; //24; //gNB_mac->type0_PDCCH_CSS_config.num_rbs; // Mark the corresponding RBs as used uint8_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; @@ -224,12 +219,8 @@ void schedule_control_sib1(module_id_t module_id, printf("cce_index = %i\n", gNB_mac->sched_ctrlCommon->cce_index); printf("aggregation_level = %i\n", gNB_mac->sched_ctrlCommon->aggregation_level); printf("nr_of_candidates = %i\n", nr_of_candidates); - printf("startSymbolIndex = %i\n", startSymbolIndex); - printf("nrOfSymbols = %i\n", nrOfSymbols); printf("rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); printf("rbStart = %i\n", gNB_mac->sched_ctrlCommon->rbStart); - printf("TBS = %i\n", TBS); - printf("N_PRB_DMRS = %i\n", N_PRB_DMRS); } void nr_fill_nfapi_dci_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_request_body_t *dl_req) { @@ -239,6 +230,9 @@ void nr_fill_nfapi_dci_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_request_body_t *dl_ NR_BWP_Downlink_t *bwp = gNB_mac->sched_ctrlCommon->active_bwp; long locationAndBandwidth = bwp->bwp_Common->genericParameters.locationAndBandwidth; + + //long locationAndBandwidth = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth; + int dci10_bw = NRRIV2BW(locationAndBandwidth,275); nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; @@ -267,6 +261,7 @@ void nr_fill_nfapi_dci_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_request_body_t *dl_ dci_pdu_rel15[0].pdsch_to_harq_feedback_timing_indicator.val = 0; dci_pdu_rel15[0].antenna_ports.val = 0; dci_pdu_rel15[0].dmrs_sequence_initialization.val = 0; + dci_pdu_rel15[0].system_info_indicator = 0; nr_configure_pdcch(gNB_mac, pdcch_pdu_rel15, @@ -284,13 +279,90 @@ void nr_fill_nfapi_dci_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_request_body_t *dl_ rnti_types[0] = NR_RNTI_SI; fill_dci_pdu_rel15(scc,gNB_mac->secondaryCellGroupCommon,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types, dci10_bw,bwp->bwp_Id); + //fill_dci_pdu_rel15(scc,gNB_mac->secondaryCellGroupCommon,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types, 50,bwp->bwp_Id); - dl_req->nPDUs += 1; + //dl_req->nPDUs += 1; // ----------------------------- printf("locationAndBandwidth = %li\n", locationAndBandwidth); printf("dci10_bw = %i\n", dci10_bw); } +void nr_fill_nfapi_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_request_body_t *dl_req) { + + gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; + NR_BWP_Downlink_t *bwp = gNB_mac->sched_ctrlCommon->active_bwp; + + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs+1]; + memset((void*)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; + dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu)); + + nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; + + // Calculate number of symbols + struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; + int startSymbolIndex, nrOfSymbols; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + + // Calculate number of PRB_DMRS + uint8_t N_PRB_DMRS; + if(bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NFAPI_NR_DMRS_TYPE1) { + N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; + } else { + N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 4; + } + + pdsch_pdu_rel15->pduBitmap = 0; + pdsch_pdu_rel15->rnti = 0xFFFF; + pdsch_pdu_rel15->pduIndex = gNB_mac->pdu_index[0]++; + + pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); + pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); + pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; + + if (bwp->bwp_Common->genericParameters.cyclicPrefix) { + pdsch_pdu_rel15->CyclicPrefix = *bwp->bwp_Common->genericParameters.cyclicPrefix; + } + else { + pdsch_pdu_rel15->CyclicPrefix = 0; + } + + pdsch_pdu_rel15->NrOfCodewords = 1; + pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs,0); + pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx); + pdsch_pdu_rel15->mcsIndex[0] = gNB_mac->sched_ctrlCommon->mcs; + pdsch_pdu_rel15->mcsTable[0] = 0; + pdsch_pdu_rel15->rvIndex[0] = 0; + pdsch_pdu_rel15->dataScramblingId = *gNB_mac->common_channels->ServingCellConfigCommon->physCellId; + pdsch_pdu_rel15->nrOfLayers = 1; + pdsch_pdu_rel15->transmissionScheme = 0; + pdsch_pdu_rel15->refPoint = 0; // Point A + pdsch_pdu_rel15->dmrsConfigType = 0; + pdsch_pdu_rel15->dlDmrsScramblingId = *gNB_mac->common_channels->ServingCellConfigCommon->physCellId; + pdsch_pdu_rel15->SCID = 0; + pdsch_pdu_rel15->numDmrsCdmGrpsNoData = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData; + pdsch_pdu_rel15->dmrsPorts = 1; + pdsch_pdu_rel15->resourceAlloc = 1; + pdsch_pdu_rel15->rbStart = gNB_mac->sched_ctrlCommon->rbStart; + pdsch_pdu_rel15->rbSize = gNB_mac->sched_ctrlCommon->rbSize; + pdsch_pdu_rel15->VRBtoPRBMapping = 1; // non-interleaved, check if this is ok for initialBWP + pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx); + pdsch_pdu_rel15->mcsTable[0] = gNB_mac->sched_ctrlCommon->mcsTableIdx; + pdsch_pdu_rel15->StartSymbolIndex = startSymbolIndex; + pdsch_pdu_rel15->NrOfSymbols = nrOfSymbols; + + pdsch_pdu_rel15->TBSize[0] = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS,0,0,1) >> 3; + + pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, + gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, + pdsch_pdu_rel15->NrOfSymbols); + + dl_req->nPDUs += 2; // ---------------------------- +} + void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { printf("\n\n--- Schedule_nr_sib1: Start\n"); @@ -300,7 +372,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) int bwp_id = 1; int time_domain_allocation = 0; uint8_t mcsTableIdx = 0; - uint8_t mcs = 9; + uint8_t mcs = 3; // 9 uint8_t numDmrsCdmGrpsNoData = 1; gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; @@ -323,7 +395,6 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) printf("sfn_c = %i\n", gNB_mac->type0_PDCCH_CSS_config.sfn_c); printf("n_0 = %i\n", gNB_mac->type0_PDCCH_CSS_config.n_0); - if( (frameP%2 == gNB_mac->type0_PDCCH_CSS_config.sfn_c) && (slotP == gNB_mac->type0_PDCCH_CSS_config.n_0) ) { printf("\nSIB1 will be transmitted here\n"); @@ -345,8 +416,103 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) } printf("\n"); - // TODO: Schedule broadcast the SIB1 + // Schedule broadcast the SIB1 + nr_fill_nfapi_sib1_pdu(module_idP, dl_req); + + + + + + + const int ta_len = 2; // 0 or 2 + + // Get RLC data TODO: remove random data retrieval + int header_length_total = 0; + int header_length_last = 0; + int sdu_length_total = 0; + int num_sdus = 0; + uint16_t sdu_lengths[NB_RB_MAX] = {0}; + uint8_t mac_sdus[MAX_NR_DLSCH_PAYLOAD_BYTES]; + unsigned char sdu_lcids[NB_RB_MAX] = {0}; + const int lcid = DL_SCH_LCID_DTCH; + + + + // Calculate number of PRB_DMRS + uint8_t N_PRB_DMRS; + if(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NFAPI_NR_DMRS_TYPE1) { + N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; + } else { + N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 4; + } + + + + // Calculate number of symbols + struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; + int startSymbolIndex, nrOfSymbols; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + + + + uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS,0,0,1) >> 3; + + + + printf("TBS = %i\n", TBS); + + + LOG_D(MAC, "Configuring DL_TX in %d.%d: random data\n", frameP, slotP); + // fill dlsch_buffer with random data + for (int i = 0; i < TBS; i++) + mac_sdus[i] = (unsigned char) (lrand48()&0xff); + + sdu_lcids[0] = 0x3f; // DRB + sdu_lengths[0] = TBS - ta_len - 3; + header_length_total += 2 + (sdu_lengths[0] >= 128); + sdu_length_total += sdu_lengths[0]; + num_sdus +=1; + + // Check if there is data from RLC or CE + const int post_padding = TBS >= 2 + header_length_total + sdu_length_total + ta_len; + // padding param currently not in use + //padding = TBS - header_length_total - sdu_length_total - ta_len - 1; + + const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs; + nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req]; + // pointer to directly generate the PDU into the nFAPI structure + uint32_t *buf = tx_req->TLVs[0].value.direct; + + const int offset = nr_generate_dlsch_pdu( + module_idP, + gNB_mac->sched_ctrlCommon, + (unsigned char *)mac_sdus, + (unsigned char *)buf, + num_sdus, // num_sdus + sdu_lengths, + sdu_lcids, + 255, // no drx + NULL, // contention res id + post_padding); + + // Padding: fill remainder of DLSCH with 0 + if (post_padding > 0) { + for (int j = 0; j < TBS - offset; j++) + buf[offset + j] = 0; + } + + + tx_req->PDU_length = TBS; + tx_req->PDU_index = gNB_mac->pdu_index[0]++; + tx_req->num_TLV = 1; + tx_req->TLVs[0].length = TBS + 2; + gNB_mac->TX_req[CC_id].Number_of_PDUs++; + gNB_mac->TX_req[CC_id].SFN = frameP; + gNB_mac->TX_req[CC_id].Slot = slotP; } printf("--- Schedule_nr_sib1: End\n\n\n"); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 968c280f2e..7809cb7744 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1167,22 +1167,52 @@ void fill_dci_pdu_rel15(NR_ServingCellConfigCommon_t *scc, break; case NR_RNTI_SI: - // Freq domain assignment 0-16 bit - fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); - for (int i=0; ifrequency_domain_assignment.val>>(fsize-i-1))&1)<<(dci_size-pos++); - // Time domain assignment 4 bit - for (int i=0; i<4; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val>>(3-i))&1)<<(dci_size-pos++); - // VRB to PRB mapping 1 bit - *dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val&1)<<(dci_size-pos++); - // MCS 5bit //bit over 32, so dci_pdu ++ - for (int i=0; i<5; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs>>(4-i))&1)<<(dci_size-pos++); - // Redundancy version 2bit - for (int i=0; i<2; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->rv>>(1-i))&1)<<(dci_size-pos++); - + + pos=1; + + // Freq domain assignment 0-16 bit + fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); + for (int i=0; ifrequency_domain_assignment.val>>(fsize-1-i))&1)<<(dci_size-pos++); + + // Time domain assignment 4 bit + for (int i=0; i<4; i++) + *dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val>>(3-i))&1)<<(dci_size-pos++); + + // VRB to PRB mapping 1 bit + *dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val&1)<<(dci_size-pos++); + + // MCS 5bit //bit over 32, so dci_pdu ++ + for (int i=0; i<5; i++) + *dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs>>(4-i))&1)<<(dci_size-pos++); + + // Redundancy version 2 bit + for (int i=0; i<2; i++) + *dci_pdu |= (((uint64_t)dci_pdu_rel15->rv>>(1-i))&1)<<(dci_size-pos++); + + // System information indicator 1bit + *dci_pdu |= ((uint64_t)dci_pdu_rel15->system_info_indicator&1)<<(dci_size-pos++); + + // reserved 15 bits + + + printf("\n\n"); + + for(int i = 64-dci_size; i<64; i++) { + printf("%i ", (*dci_pdu >> 63-i)&(uint64_t)0x01); + } + + printf("\ndci_size = %i\n", dci_size); + printf("fsize = %i\n", fsize); + printf("dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val); + printf("dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val); + printf("dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val); + printf("dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs); + printf("dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); + printf("dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator); + printf("\n"); + + break; case NR_RNTI_TC: From ac0dc9d3aa3252c66958ad5f7e65d62483b0cdfa Mon Sep 17 00:00:00 2001 From: rmagueta Date: Fri, 30 Oct 2020 17:01:51 +0000 Subject: [PATCH 008/160] Transmission of SIB1 --- openair1/PHY/NR_TRANSPORT/nr_dci.c | 8 +- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 20 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 7 +- .../NR_MAC_UE/nr_ue_dci_configuration.c | 23 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 445 ++++++++---------- openair2/RRC/NR/L2_nr_interface.c | 6 - openair2/RRC/NR/rrc_gNB.c | 30 +- 7 files changed, 235 insertions(+), 304 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 4414bb9b83..4066494bdb 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -240,13 +240,7 @@ uint8_t nr_generate_dci_top(PHY_VARS_gNB *gNB, } // m } // reg_idx - - printf("polar_encoder_fast: pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d] = %i, pdcch_pdu_rel15->dci_pdu.AggregationLevel[d] = %i, n_RNTI = %i\n", - pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d], pdcch_pdu_rel15->dci_pdu.AggregationLevel[d], n_RNTI); - - printf("nr_pdcch_scrambling: encoded_length = %i, Nid = %i, scrambling_RNTI = %i\n\n",encoded_length, Nid, scrambling_RNTI); - - printf("\n>> DCI: payloadSize = %d | payload = %llx\n\n", + printf(">> DCI: payloadSize = %d | payload = %llx\n\n", *pdcch_pdu_rel15->dci_pdu.PayloadSizeBits,*(unsigned long long*)pdcch_pdu_rel15->dci_pdu.Payload); } // for (int d=0;dnumDlDci;d++) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 7378f69c27..03c9b4008e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -590,8 +590,17 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, // Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) { LOG_D(PHY,"Segment %u CRC OK\n\033[0m",r); - if (r==0) - for (int i=0;i<10;i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]); + + if (r==0) { + for (int i=0;i<10;i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]); + + printf("\n"); + printf("==== CRC OK ====\n"); + for (int i=0;i<10;i++) printf("byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]); + printf("\n"); + + getchar(); + } //Temporary hack no_iteration_ldpc = dlsch->max_ldpc_iterations; @@ -600,6 +609,13 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, else { LOG_D(PHY,"CRC NOK\n\033[0m"); ret = 1 + dlsch->max_ldpc_iterations; + + printf("\n"); + printf("==== CRC NOT OK ====\n"); + for (int i=0;i<10;i++) printf("byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]); + printf("\n"); + + getchar(); } diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 216879f2a1..2a7392a63d 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2234,8 +2234,13 @@ uint16_t nr_dci_size(NR_ServingCellConfigCommon_t *scc, case NR_DL_DCI_FORMAT_1_0: /// fixed: Format identifier 1, VRB2PRB 1, MCS 5, NDI 1, RV 2, HARQ PID 4, DAI 2, PUCCH TPC 2, PUCCH RInd 3, PDSCH to HARQ TInd 3 Time Domain assgnmt 4 -- 28 - size += 28; + size = 28; size += (uint8_t)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); // Freq domain assignment + + dci_pdu->frequency_domain_assignment.nbits = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); + dci_pdu->time_domain_assignment.nbits = 4; + dci_pdu->vrb_to_prb_mapping.nbits = 1; + break; case NR_DL_DCI_FORMAT_1_1: diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 0f1eac8e89..982a5ceabe 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -163,10 +163,8 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, bwp_id); } - printf("bwp_Common->genericParameters.locationAndBandwidth = %li\n", bwp_Common->genericParameters.locationAndBandwidth); - printf("rel15->BWPSize = %i\n", rel15->BWPSize); - break; + case NR_RNTI_SFI: break; case NR_RNTI_INT: @@ -253,23 +251,12 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl } } } - /*if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ - - printf("*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = %li\n", *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1); - printf("ss->searchSpaceId = %li\n", ss->searchSpaceId); - - // FIXME: - //if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ + if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ - if( (frame%2 == mac->type0_PDCCH_CSS_config.sfn_c) && (slot == mac->type0_PDCCH_CSS_config.n_0) ){ - rel15->num_dci_options = 1; - rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; - config_dci_pdu(mac, rel15, dl_config, NR_RNTI_SI, ss_id); - fill_dci_search_candidates(ss, rel15); - } - + // Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG + LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet..."); } - }*/ + } if (pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){ if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){ // Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index d4f37acdf9..3971503bd2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -162,9 +162,11 @@ void schedule_control_sib1(module_id_t module_id, int time_domain_allocation, uint8_t mcsTableIdx, uint8_t mcs, - uint8_t numDmrsCdmGrpsNoData) { + uint8_t numDmrsCdmGrpsNoData, + int num_total_bytes) { gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; + uint8_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; if (gNB_mac->sched_ctrlCommon == NULL){ gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon)); @@ -175,97 +177,172 @@ void schedule_control_sib1(module_id_t module_id, fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset); } - - gNB_mac->sched_ctrlCommon->active_bwp = gNB_mac->secondaryCellGroupCommon->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; - - - - - - //NR_COMMON_channels_t *cc = &gNB_mac->common_channels[0]; - //NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - //scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth; - - gNB_mac->sched_ctrlCommon->rbSize = 0; gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation; gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx; gNB_mac->sched_ctrlCommon->mcs = mcs; gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = numDmrsCdmGrpsNoData; + gNB_mac->sched_ctrlCommon->num_total_bytes = num_total_bytes; uint8_t nr_of_candidates; - find_aggregation_candidates(&gNB_mac->sched_ctrlCommon->aggregation_level, &nr_of_candidates,gNB_mac->sched_ctrlCommon->search_space); + find_aggregation_candidates(&gNB_mac->sched_ctrlCommon->aggregation_level, &nr_of_candidates, gNB_mac->sched_ctrlCommon->search_space); gNB_mac->sched_ctrlCommon->cce_index = allocate_nr_CCEs(RC.nrmac[module_id], gNB_mac->sched_ctrlCommon->active_bwp, gNB_mac->sched_ctrlCommon->coreset, gNB_mac->sched_ctrlCommon->aggregation_level, 0, - 0); + 0); - // Calculate rbStart and rbSize - gNB_mac->sched_ctrlCommon->rbStart = NRRIV2PRBOFFSET(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); - gNB_mac->sched_ctrlCommon->rbSize = 4; //24; //gNB_mac->type0_PDCCH_CSS_config.num_rbs; + const uint16_t bwpSize = NRRIV2BW(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); + int rbStart = NRRIV2PRBOFFSET(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); + + // Freq-domain allocation + while (rbStart < bwpSize && vrb_map[rbStart]) rbStart++; + + // Calculate number of PRB_DMRS + uint8_t N_PRB_DMRS; + if(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NFAPI_NR_DMRS_TYPE1) { + N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; + } else { + N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 4; + } + + // Calculate number of symbols + struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; + int startSymbolIndex, nrOfSymbols; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + + int rbSize = 0; + uint32_t TBS = 0; + do { + rbSize++; + TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + rbSize, nrOfSymbols, N_PRB_DMRS,0, 0,1) >> 3; + } while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes); + gNB_mac->sched_ctrlCommon->rbSize = rbSize; + gNB_mac->sched_ctrlCommon->rbStart = rbStart; // Mark the corresponding RBs as used - uint8_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) { vrb_map[rb + gNB_mac->sched_ctrlCommon->rbStart] = 1; } - printf("searchSpaceId = %li\n", gNB_mac->sched_ctrlCommon->search_space->searchSpaceId); - printf("locationAndBandwidth = %li\n", gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth); - printf("cce_index = %i\n", gNB_mac->sched_ctrlCommon->cce_index); - printf("aggregation_level = %i\n", gNB_mac->sched_ctrlCommon->aggregation_level); - printf("nr_of_candidates = %i\n", nr_of_candidates); - printf("rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); - printf("rbStart = %i\n", gNB_mac->sched_ctrlCommon->rbStart); } -void nr_fill_nfapi_dci_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_request_body_t *dl_req) { +void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, + nfapi_nr_dl_tti_request_body_t *dl_req, + uint32_t TBS, + int StartSymbolIndex, + int NrOfSymbols) { + + // static values + int rnti = 0xFFFF; + int dci_format = NR_DL_DCI_FORMAT_1_0; + int rnti_type = NR_RNTI_SI; gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; - NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels->ServingCellConfigCommon; + NR_COMMON_channels_t *cc = gNB_mac->common_channels; + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + NR_CellGroupConfig_t *secondaryCellGroup = gNB_mac->secondaryCellGroupCommon; NR_BWP_Downlink_t *bwp = gNB_mac->sched_ctrlCommon->active_bwp; - long locationAndBandwidth = bwp->bwp_Common->genericParameters.locationAndBandwidth; - - //long locationAndBandwidth = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth; - - int dci10_bw = NRRIV2BW(locationAndBandwidth,275); + // Uncommenting these lines, the DLSCH is decoded in the UE: + // + //rnti = 0x1234; + //dci_format = NR_DL_DCI_FORMAT_1_1; + //rnti_type = NR_RNTI_C; + //gNB_mac->type0_PDCCH_CSS_config.n_0 = 6; + // nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE; dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs+1]; + memset((void*)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; + dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu)); + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; + nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; + + pdsch_pdu_rel15->pduBitmap = 0; + pdsch_pdu_rel15->rnti = rnti; + pdsch_pdu_rel15->pduIndex = gNB_mac->pdu_index[0]++; + + pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); + pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); + pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; + if (bwp->bwp_Common->genericParameters.cyclicPrefix) { + pdsch_pdu_rel15->CyclicPrefix = *bwp->bwp_Common->genericParameters.cyclicPrefix; + } else { + pdsch_pdu_rel15->CyclicPrefix = 0; + } + + pdsch_pdu_rel15->NrOfCodewords = 1; + pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs,0); + pdsch_pdu_rel15->qamModOrder[0] = 2; + pdsch_pdu_rel15->mcsIndex[0] = gNB_mac->sched_ctrlCommon->mcs; + pdsch_pdu_rel15->mcsTable[0] = 0; + pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[0]; + pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; + pdsch_pdu_rel15->nrOfLayers = 1; + pdsch_pdu_rel15->transmissionScheme = 0; + pdsch_pdu_rel15->refPoint = 0; // Point A + pdsch_pdu_rel15->dmrsConfigType = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; + pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; + pdsch_pdu_rel15->SCID = 0; + pdsch_pdu_rel15->numDmrsCdmGrpsNoData = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData; + pdsch_pdu_rel15->dmrsPorts = 1; + pdsch_pdu_rel15->resourceAlloc = 1; + pdsch_pdu_rel15->rbStart = gNB_mac->sched_ctrlCommon->rbStart; + pdsch_pdu_rel15->rbSize = gNB_mac->sched_ctrlCommon->rbSize; + pdsch_pdu_rel15->VRBtoPRBMapping = 1; + pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx); + pdsch_pdu_rel15->TBSize[0] = TBS; + pdsch_pdu_rel15->mcsTable[0] = gNB_mac->sched_ctrlCommon->mcsTableIdx; + pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; + pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; + + pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, pdsch_pdu_rel15->NrOfSymbols); dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET]; memset(dci_pdu_rel15, 0, sizeof(dci_pdu_rel15_t) * MAX_DCI_CORESET); - dci_pdu_rel15[0].bwp_indicator.val = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id - 1; - dci_pdu_rel15[0].frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(gNB_mac->sched_ctrlCommon->rbSize, - gNB_mac->sched_ctrlCommon->rbStart, - dci10_bw); + int n_dl_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; + + if (n_dl_bwp < 4) { + dci_pdu_rel15[0].bwp_indicator.val = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id; + } else { + dci_pdu_rel15[0].bwp_indicator.val = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id - 1; // as per table 7.3.1.1.2-1 in 38.212 + } + + // frequency domain assignment + dci_pdu_rel15[0].frequency_domain_assignment.val = + PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize, + pdsch_pdu_rel15->rbStart, + NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275)); dci_pdu_rel15[0].time_domain_assignment.val = gNB_mac->sched_ctrlCommon->time_domain_allocation; dci_pdu_rel15[0].mcs = gNB_mac->sched_ctrlCommon->mcs; - dci_pdu_rel15[0].rv = 0; + dci_pdu_rel15[0].rv = pdsch_pdu_rel15->rvIndex[0]; dci_pdu_rel15[0].harq_pid = 0; dci_pdu_rel15[0].ndi = 0; dci_pdu_rel15[0].dai[0].val = 0; - dci_pdu_rel15[0].tpc = 0; + dci_pdu_rel15[0].tpc = 0; // table 7.2.1-1 in 38.213 dci_pdu_rel15[0].pucch_resource_indicator = 0; dci_pdu_rel15[0].pdsch_to_harq_feedback_timing_indicator.val = 0; dci_pdu_rel15[0].antenna_ports.val = 0; - dci_pdu_rel15[0].dmrs_sequence_initialization.val = 0; - dci_pdu_rel15[0].system_info_indicator = 0; + dci_pdu_rel15[0].dmrs_sequence_initialization.val = pdsch_pdu_rel15->SCID; nr_configure_pdcch(gNB_mac, pdcch_pdu_rel15, - 0xFFFF, // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values + rnti, gNB_mac->sched_ctrlCommon->search_space, gNB_mac->sched_ctrlCommon->coreset, scc, @@ -275,248 +352,128 @@ void nr_fill_nfapi_dci_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_request_body_t *dl_ int dci_formats[2]; int rnti_types[2]; - dci_formats[0] = NR_DL_DCI_FORMAT_1_0; - rnti_types[0] = NR_RNTI_SI; - fill_dci_pdu_rel15(scc,gNB_mac->secondaryCellGroupCommon,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types, dci10_bw,bwp->bwp_Id); - //fill_dci_pdu_rel15(scc,gNB_mac->secondaryCellGroupCommon,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types, 50,bwp->bwp_Id); + dci_formats[0] = dci_format; + rnti_types[0] = rnti_type; - //dl_req->nPDUs += 1; // ----------------------------- + fill_dci_pdu_rel15(scc,secondaryCellGroup,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types,pdsch_pdu_rel15->BWPSize,gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id); - printf("locationAndBandwidth = %li\n", locationAndBandwidth); - printf("dci10_bw = %i\n", dci10_bw); -} - -void nr_fill_nfapi_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_request_body_t *dl_req) { - - gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; - NR_BWP_Downlink_t *bwp = gNB_mac->sched_ctrlCommon->active_bwp; - - nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs+1]; - memset((void*)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); - dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; - dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu)); - - nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; - - // Calculate number of symbols - struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; - int startSymbolIndex, nrOfSymbols; - SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); - - // Calculate number of PRB_DMRS - uint8_t N_PRB_DMRS; - if(bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NFAPI_NR_DMRS_TYPE1) { - N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; - } else { - N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 4; - } - - pdsch_pdu_rel15->pduBitmap = 0; - pdsch_pdu_rel15->rnti = 0xFFFF; - pdsch_pdu_rel15->pduIndex = gNB_mac->pdu_index[0]++; - - pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); - pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); - pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; - - if (bwp->bwp_Common->genericParameters.cyclicPrefix) { - pdsch_pdu_rel15->CyclicPrefix = *bwp->bwp_Common->genericParameters.cyclicPrefix; - } - else { - pdsch_pdu_rel15->CyclicPrefix = 0; - } - - pdsch_pdu_rel15->NrOfCodewords = 1; - pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs,0); - pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx); - pdsch_pdu_rel15->mcsIndex[0] = gNB_mac->sched_ctrlCommon->mcs; - pdsch_pdu_rel15->mcsTable[0] = 0; - pdsch_pdu_rel15->rvIndex[0] = 0; - pdsch_pdu_rel15->dataScramblingId = *gNB_mac->common_channels->ServingCellConfigCommon->physCellId; - pdsch_pdu_rel15->nrOfLayers = 1; - pdsch_pdu_rel15->transmissionScheme = 0; - pdsch_pdu_rel15->refPoint = 0; // Point A - pdsch_pdu_rel15->dmrsConfigType = 0; - pdsch_pdu_rel15->dlDmrsScramblingId = *gNB_mac->common_channels->ServingCellConfigCommon->physCellId; - pdsch_pdu_rel15->SCID = 0; - pdsch_pdu_rel15->numDmrsCdmGrpsNoData = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData; - pdsch_pdu_rel15->dmrsPorts = 1; - pdsch_pdu_rel15->resourceAlloc = 1; - pdsch_pdu_rel15->rbStart = gNB_mac->sched_ctrlCommon->rbStart; - pdsch_pdu_rel15->rbSize = gNB_mac->sched_ctrlCommon->rbSize; - pdsch_pdu_rel15->VRBtoPRBMapping = 1; // non-interleaved, check if this is ok for initialBWP - pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx); - pdsch_pdu_rel15->mcsTable[0] = gNB_mac->sched_ctrlCommon->mcsTableIdx; - pdsch_pdu_rel15->StartSymbolIndex = startSymbolIndex; - pdsch_pdu_rel15->NrOfSymbols = nrOfSymbols; - - pdsch_pdu_rel15->TBSize[0] = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS,0,0,1) >> 3; - - pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, - gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, - pdsch_pdu_rel15->NrOfSymbols); - - dl_req->nPDUs += 2; // ---------------------------- + dl_req->nPDUs += 2; } void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { - printf("\n\n--- Schedule_nr_sib1: Start\n"); - printf("frameP = %i, slotP = %i\n", frameP, slotP); + printf("\n\nSchedule_nr_sib1: frameP = %i, slotP = %i\n", frameP, slotP); - int CC_id = 0; - int bwp_id = 1; - int time_domain_allocation = 0; + // static values + const int CC_id = 0; + int time_domain_allocation = 2; uint8_t mcsTableIdx = 0; - uint8_t mcs = 3; // 9 + uint8_t mcs = 9; uint8_t numDmrsCdmGrpsNoData = 1; + int bwp_id = 1; gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; - if(gNB_mac->type0_PDCCH_CSS_config.num_rbs<=0) { - return; - } + if( (frameP%2 == gNB_mac->type0_PDCCH_CSS_config.sfn_c) && (slotP == gNB_mac->type0_PDCCH_CSS_config.n_0 ) ) { - printf("search_space_duration = %i\n", gNB_mac->type0_PDCCH_CSS_config.search_space_duration); - printf("number_of_search_space_per_slot = %i\n", gNB_mac->type0_PDCCH_CSS_config.number_of_search_space_per_slot); - printf("type0_pdcch_ss_mux_pattern = %i\n", gNB_mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern); - printf("ssb_index = %i\n", gNB_mac->type0_PDCCH_CSS_config.ssb_index); - printf("first_symbol_index = %i\n", gNB_mac->type0_PDCCH_CSS_config.first_symbol_index); - printf("num_symbols = %i\n", gNB_mac->type0_PDCCH_CSS_config.num_symbols); - printf("ssb_length = %i\n", gNB_mac->type0_PDCCH_CSS_config.ssb_length); - printf("frame = %i\n", gNB_mac->type0_PDCCH_CSS_config.frame); - printf("n_c = %i\n", gNB_mac->type0_PDCCH_CSS_config.n_c); - printf("num_rbs = %i\n", gNB_mac->type0_PDCCH_CSS_config.num_rbs); - printf("rb_offset = %i\n", gNB_mac->type0_PDCCH_CSS_config.rb_offset); - printf("sfn_c = %i\n", gNB_mac->type0_PDCCH_CSS_config.sfn_c); - printf("n_0 = %i\n", gNB_mac->type0_PDCCH_CSS_config.n_0); - - if( (frameP%2 == gNB_mac->type0_PDCCH_CSS_config.sfn_c) && (slotP == gNB_mac->type0_PDCCH_CSS_config.n_0) ) { - - printf("\nSIB1 will be transmitted here\n"); - - // Computation of the sched_ctrlCommon: bwp, coreset0, rbStart, rbSize, etc. - schedule_control_sib1(module_idP, CC_id, bwp_id, time_domain_allocation, mcsTableIdx, mcs, numDmrsCdmGrpsNoData); - - // Schedule broadcast DCI for the SIB1 - nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; - nr_fill_nfapi_dci_sib1_pdu(module_idP, dl_req); + printf("> SIB1 will be transmitted here\n"); // Get SIB1 uint8_t sib1_payload[100]; uint8_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, 1, sib1_payload); printf("sib1_sdu_length = %i\n", sib1_sdu_length); + printf("SIB1: "); for(int i = 0; isched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + // Calculate number of PRB_DMRS + uint8_t N_PRB_DMRS; + if(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NFAPI_NR_DMRS_TYPE1) { + N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; + } else { + N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 4; + } + const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS,0 ,0 ,1 ) >> 3; + nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; + nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, TBS, startSymbolIndex, nrOfSymbols); + // reserve space for timing advance of UE if necessary, + const int ta_len = (gNB_mac->sched_ctrlCommon->ta_apply) ? 2 : 0; + int header_length_total = 0; + int sdu_length_total = 0; + int num_sdus = 0; + uint16_t sdu_lengths[NB_RB_MAX] = {0}; + uint8_t mac_sdus[MAX_NR_DLSCH_PAYLOAD_BYTES]; + unsigned char sdu_lcids[NB_RB_MAX] = {0}; - const int ta_len = 2; // 0 or 2 + // Data to be transmitted + bzero(mac_sdus,MAX_NR_DLSCH_PAYLOAD_BYTES); + //mac_sdus[2] = 0xFF; + //mac_sdus[5] = 0xFF; + memcpy(mac_sdus, sib1_payload, sib1_sdu_length); - // Get RLC data TODO: remove random data retrieval - int header_length_total = 0; - int header_length_last = 0; - int sdu_length_total = 0; - int num_sdus = 0; - uint16_t sdu_lengths[NB_RB_MAX] = {0}; - uint8_t mac_sdus[MAX_NR_DLSCH_PAYLOAD_BYTES]; - unsigned char sdu_lcids[NB_RB_MAX] = {0}; - const int lcid = DL_SCH_LCID_DTCH; + sdu_lcids[0] = 0x3f; // DRB + sdu_lengths[0] = TBS - ta_len - 3; + header_length_total += 2 + (sdu_lengths[0] >= 128); + sdu_length_total += sdu_lengths[0]; + num_sdus +=1; + // Check if there is data from RLC or CE + const int post_padding = TBS >= 2 + header_length_total + sdu_length_total + ta_len; + const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs; + nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req]; - // Calculate number of PRB_DMRS - uint8_t N_PRB_DMRS; - if(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NFAPI_NR_DMRS_TYPE1) { - N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; - } else { - N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 4; - } + // pointer to directly generate the PDU into the nFAPI structure + uint32_t *buf = tx_req->TLVs[0].value.direct; + const int offset = nr_generate_dlsch_pdu( + module_idP, + gNB_mac->sched_ctrlCommon, + (unsigned char *)mac_sdus, + (unsigned char *)buf, + num_sdus, + sdu_lengths, + sdu_lcids, + 255, + NULL, + post_padding); + // Padding: fill remainder of DLSCH with 0 + if (post_padding > 0) { + for (int j = 0; j < TBS - offset; j++) { + buf[offset + j] = 0; + } + } - // Calculate number of symbols - struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; - int startSymbolIndex, nrOfSymbols; - SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + tx_req->PDU_length = TBS; + tx_req->PDU_index = gNB_mac->pdu_index[0]++; + tx_req->num_TLV = 1; + tx_req->TLVs[0].length = TBS + 2; + gNB_mac->TX_req[CC_id].Number_of_PDUs++; + gNB_mac->TX_req[CC_id].SFN = frameP; + gNB_mac->TX_req[CC_id].Slot = slotP; - - - uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS,0,0,1) >> 3; - - - - printf("TBS = %i\n", TBS); - - - LOG_D(MAC, "Configuring DL_TX in %d.%d: random data\n", frameP, slotP); - // fill dlsch_buffer with random data - for (int i = 0; i < TBS; i++) - mac_sdus[i] = (unsigned char) (lrand48()&0xff); - - sdu_lcids[0] = 0x3f; // DRB - sdu_lengths[0] = TBS - ta_len - 3; - header_length_total += 2 + (sdu_lengths[0] >= 128); - sdu_length_total += sdu_lengths[0]; - num_sdus +=1; - - // Check if there is data from RLC or CE - const int post_padding = TBS >= 2 + header_length_total + sdu_length_total + ta_len; - // padding param currently not in use - //padding = TBS - header_length_total - sdu_length_total - ta_len - 1; - - const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs; - nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req]; - // pointer to directly generate the PDU into the nFAPI structure - uint32_t *buf = tx_req->TLVs[0].value.direct; - - const int offset = nr_generate_dlsch_pdu( - module_idP, - gNB_mac->sched_ctrlCommon, - (unsigned char *)mac_sdus, - (unsigned char *)buf, - num_sdus, // num_sdus - sdu_lengths, - sdu_lcids, - 255, // no drx - NULL, // contention res id - post_padding); - - // Padding: fill remainder of DLSCH with 0 - if (post_padding > 0) { - for (int j = 0; j < TBS - offset; j++) - buf[offset + j] = 0; - } - - - tx_req->PDU_length = TBS; - tx_req->PDU_index = gNB_mac->pdu_index[0]++; - tx_req->num_TLV = 1; - tx_req->TLVs[0].length = TBS + 2; - gNB_mac->TX_req[CC_id].Number_of_PDUs++; - gNB_mac->TX_req[CC_id].SFN = frameP; - gNB_mac->TX_req[CC_id].Slot = slotP; } - printf("--- Schedule_nr_sib1: End\n\n\n"); - } diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 17e018d1ec..423886f19d 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -204,12 +204,6 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, /* TODO BCCH SIB1 SIBs */ if ((Srb_id & RAB_OFFSET ) == BCCH) { -// memcpy(&buffer_pP[0], -// RC.rrc[Mod_idP]->carrier[CC_id].SIB1_MBMS, -// RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_MBMS); -// -// return RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_MBMS; - memcpy(&buffer_pP[0], RC.nrrrc[Mod_idP]->carrier.SIB1, RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 6f5a5907bc..aa66ae0c27 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -182,43 +182,21 @@ static void init_NR_SI(gNB_RRC_INST *rrc) { LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); + // MIB rrc->carrier.MIB = (uint8_t *) malloc16(4); rrc->carrier.sizeof_MIB = do_MIB_NR(rrc,0); - printf("rrc->carrier.sizeof_MIB = %i\n", rrc->carrier.sizeof_MIB); - - - - + // SIB 1 gNB_RrcConfigurationReq *configuration; configuration = CALLOC(1,sizeof(gNB_RrcConfigurationReq)); - configuration->cell_identity = 3; - configuration->ssb_SubcarrierOffset = rrc->carrier.ssb_SubcarrierOffset; configuration->pdsch_AntennaPorts = rrc->carrier.pdsch_AntennaPorts; configuration->pusch_TargetSNRx10 = rrc->carrier.pusch_TargetSNRx10; configuration->pucch_TargetSNRx10 = rrc->carrier.pucch_TargetSNRx10; configuration->scc = rrc->carrier.servingcellconfigcommon; - - rrc->carrier.SIB1 = (uint8_t *) malloc16(100); - rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier, configuration); - - - printf("\n"); - printf("rrc->carrier.sizeof_SIB1 = %i\n", rrc->carrier.sizeof_SIB1); - for(int i = 0; i<20; i++) { - printf("%i ", rrc->carrier.SIB1[i]); - } - printf("\n\n"); - - - - - - - - + if(rrc->carrier.SIB1 == NULL) rrc->carrier.SIB1 = (uint8_t *) malloc16(100); + rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier, configuration); LOG_I(NR_RRC,"Done init_NR_SI\n"); rrc_mac_config_req_gNB(rrc->module_id, From 290d9691f73aa9ee86d62888f3bb23bba12d1808 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Sat, 31 Oct 2020 19:56:04 +0000 Subject: [PATCH 009/160] SIB1 PDSCH implementation --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index e5bd129928..c45f9cdfb0 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2586,11 +2586,17 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc mac->scc->dmrs_TypeA_Position, dlsch_config_pdu_1_0->number_symbols); dlsch_config_pdu_1_0->dmrsConfigType = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; + /* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */ - if (dlsch_config_pdu_1_0->number_symbols == 2) - dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1; - else - dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 2; + //if (dlsch_config_pdu_1_0->number_symbols == 2) + // dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1; + //else + // dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 2; + + /* TODO: fix number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214, + using tables 7.3.1.2.2-1, 7.3.1.2.2-2, 7.3.1.2.2-3, 7.3.1.2.2-4 of 3GPP TS 38.212 */ + dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1; + /* VRB_TO_PRB_MAPPING */ dlsch_config_pdu_1_0->vrb_to_prb_mapping = (dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved:vrb_to_prb_mapping_interleaved; /* MCS */ From d07e2ecc3be6d76d9f4366add864922ad9450cb4 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 2 Nov 2020 12:44:00 +0000 Subject: [PATCH 010/160] Minor correction: removing mac header --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 51 ++----------------- 1 file changed, 5 insertions(+), 46 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 3971503bd2..d536f3dee3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -414,55 +414,14 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, TBS, startSymbolIndex, nrOfSymbols); - // reserve space for timing advance of UE if necessary, - const int ta_len = (gNB_mac->sched_ctrlCommon->ta_apply) ? 2 : 0; - - int header_length_total = 0; - int sdu_length_total = 0; - int num_sdus = 0; - uint16_t sdu_lengths[NB_RB_MAX] = {0}; - uint8_t mac_sdus[MAX_NR_DLSCH_PAYLOAD_BYTES]; - unsigned char sdu_lcids[NB_RB_MAX] = {0}; - - // Data to be transmitted - bzero(mac_sdus,MAX_NR_DLSCH_PAYLOAD_BYTES); - //mac_sdus[2] = 0xFF; - //mac_sdus[5] = 0xFF; - memcpy(mac_sdus, sib1_payload, sib1_sdu_length); - - sdu_lcids[0] = 0x3f; // DRB - sdu_lengths[0] = TBS - ta_len - 3; - header_length_total += 2 + (sdu_lengths[0] >= 128); - sdu_length_total += sdu_lengths[0]; - num_sdus +=1; - - // Check if there is data from RLC or CE - const int post_padding = TBS >= 2 + header_length_total + sdu_length_total + ta_len; - const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs; nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req]; - // pointer to directly generate the PDU into the nFAPI structure - uint32_t *buf = tx_req->TLVs[0].value.direct; - - const int offset = nr_generate_dlsch_pdu( - module_idP, - gNB_mac->sched_ctrlCommon, - (unsigned char *)mac_sdus, - (unsigned char *)buf, - num_sdus, - sdu_lengths, - sdu_lcids, - 255, - NULL, - post_padding); - - // Padding: fill remainder of DLSCH with 0 - if (post_padding > 0) { - for (int j = 0; j < TBS - offset; j++) { - buf[offset + j] = 0; - } - } + // Data to be transmitted + bzero(tx_req->TLVs[0].value.direct,MAX_NR_DLSCH_PAYLOAD_BYTES); + //mac_sdus[2] = 0xFF; + //mac_sdus[5] = 0xFF; + memcpy(tx_req->TLVs[0].value.direct, sib1_payload, sib1_sdu_length); tx_req->PDU_length = TBS; tx_req->PDU_index = gNB_mac->pdu_index[0]++; From 23f5277d299ce1e1de85ec999cd5584985f28364 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Tue, 3 Nov 2020 02:31:46 +0000 Subject: [PATCH 011/160] Decoding and xer_fprint of SIB1 at UE --- .../nfapi/public_inc/fapi_nr_ue_constants.h | 2 +- openair1/PHY/defs_nr_common.h | 2 + openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 3 ++ openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 46 +++++++++++-------- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 6 ++- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 21 ++------- openair2/RRC/NR/rrc_gNB.c | 4 +- openair2/RRC/NR_UE/rrc_UE.c | 35 ++++++++++++++ openair2/RRC/NR_UE/rrc_defs.h | 2 + openair2/RRC/NR_UE/rrc_proto.h | 5 ++ 10 files changed, 85 insertions(+), 41 deletions(-) diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h index e1d06335f5..0a83c1a27f 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h @@ -44,7 +44,7 @@ #define FAPI_NR_DL_CONFIG_TYPE_DCI 0x01 #define FAPI_NR_DL_CONFIG_TYPE_DLSCH 0x02 #define FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH 0x03 - +#define FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH 0x04 #define FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED 0x01 #define FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED 0x02 diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index a21af3fa03..4b5d86aed2 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -105,6 +105,8 @@ #define MAX_NUM_NR_DLSCH_SEGMENTS 34 #define MAX_NR_DLSCH_PAYLOAD_BYTES (MAX_NUM_NR_DLSCH_SEGMENTS*1056) +#define MAX_NR_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1 - The physical layer imposes a limit to the maximum size a SIB can take. The maximum SIB1 or SI message size is 2976 bits. + #define MAX_NUM_NR_ULSCH_SEGMENTS MAX_NUM_NR_DLSCH_SEGMENTS #define MAX_NR_ULSCH_PAYLOAD_BYTES (MAX_NUM_NR_ULSCH_SEGMENTS*1056) diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 2df917d676..5bc5231f8c 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -81,6 +81,9 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH){ dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_ra[0]; } + else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH){ + dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_SI[0]; + } fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15; uint8_t current_harq_pid = dlsch_config_pdu->harq_process_nbr; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index d24c88fd1f..80f8324b1b 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -770,8 +770,8 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ return -1; } else { // This is to adjust the llr offset in the case of skipping over a dmrs symbol (i.e. in case of no PDSCH REs in DMRS) - if (pdsch == RA_PDSCH) ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m]=ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m-1]; - else if (pdsch == PDSCH) { + if (pdsch == RA_PDSCH) ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m]=ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m-1]; + else if (pdsch == PDSCH || pdsch == SI_PDSCH) { if (nr_rx_pdsch(ue, pdsch, eNB_id, @@ -785,7 +785,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ dlsch0->current_harq_pid) < 0) return -1; } - else AssertFatal(1==0,"not RA_PDSCH or PDSCH\n"); + else AssertFatal(1==0,"not RA_PDSCH, SI_PDSCH or PDSCH\n"); } if (pdsch == PDSCH) LOG_D(PHY,"Done processing symbol %d : llr_offset %d\n",m,ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m]); #if UE_TIMING_TRACE @@ -1178,6 +1178,9 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, case PDSCH: rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH; break; + case SI_PDSCH: + rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_SIB; + break; default: break; } @@ -1747,6 +1750,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, NR_UE_DLSCH_t *dlsch = NULL; if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->active == 1){ dlsch = ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]; + } else if (ue->dlsch_SI[0]->active == 1){ + dlsch = ue->dlsch_SI[0]; } else if (ue->dlsch_ra[0]->active == 1){ dlsch = ue->dlsch_ra[0]; } @@ -1822,7 +1827,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_OUT); } - // do procedures for SI-RNTI + // do procedures for P-RNTI if ((ue->dlsch_p[gNB_id]) && (ue->dlsch_p[gNB_id]->active == 1)) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_IN); nr_ue_pdsch_procedures(ue, @@ -1938,23 +1943,24 @@ start_meas(&ue->generic_stat); // do procedures for SI-RNTI if ((ue->dlsch_SI[gNB_id]) && (ue->dlsch_SI[gNB_id]->active == 1)) { - nr_ue_pdsch_procedures(ue, - proc, - gNB_id, - SI_PDSCH, - ue->dlsch_SI[gNB_id], - NULL); - /*ue_dlsch_procedures(ue, - proc, - gNB_id, - SI_PDSCH, - ue->dlsch_SI[gNB_id], - NULL, - &ue->dlsch_SI_errors[gNB_id], - mode, - abstraction_flag); - ue->dlsch_SI[gNB_id]->active = 0;*/ + nr_ue_dlsch_procedures(ue, + proc, + gNB_id, + SI_PDSCH, + ue->dlsch_SI[gNB_id], + NULL, + &ue->dlsch_SI_errors[gNB_id], + mode); + + ue->dlsch_SI[gNB_id]->active = 0; + + // FIXME: It was assumed that SIB1 has only one segment + int harq_pid = PHY_vars_UE_g[0][0]->dlsch_SI[0]->current_harq_pid; + nr_rrc_ue_decode_NR_SIB1_Message(&ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->c[0][0], + ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->TBS); + + getchar(); } // do procedures for P-RNTI diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index c45f9cdfb0..dc546896d2 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2659,7 +2659,11 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc if (mac->RA_window_cnt >= 0 && rnti == mac->ra_rnti){ dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH; - } else { + } + else if(rnti == SI_RNTI) { + dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH; + } + else { dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index d536f3dee3..226b6e7954 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -239,25 +239,12 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, int StartSymbolIndex, int NrOfSymbols) { - // static values - int rnti = 0xFFFF; - int dci_format = NR_DL_DCI_FORMAT_1_0; - int rnti_type = NR_RNTI_SI; - gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; NR_COMMON_channels_t *cc = gNB_mac->common_channels; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; NR_CellGroupConfig_t *secondaryCellGroup = gNB_mac->secondaryCellGroupCommon; NR_BWP_Downlink_t *bwp = gNB_mac->sched_ctrlCommon->active_bwp; - // Uncommenting these lines, the DLSCH is decoded in the UE: - // - //rnti = 0x1234; - //dci_format = NR_DL_DCI_FORMAT_1_1; - //rnti_type = NR_RNTI_C; - //gNB_mac->type0_PDCCH_CSS_config.n_0 = 6; - // - nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE; @@ -272,7 +259,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; pdsch_pdu_rel15->pduBitmap = 0; - pdsch_pdu_rel15->rnti = rnti; + pdsch_pdu_rel15->rnti = SI_RNTI; pdsch_pdu_rel15->pduIndex = gNB_mac->pdu_index[0]++; pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); @@ -342,7 +329,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, nr_configure_pdcch(gNB_mac, pdcch_pdu_rel15, - rnti, + SI_RNTI, gNB_mac->sched_ctrlCommon->search_space, gNB_mac->sched_ctrlCommon->coreset, scc, @@ -353,8 +340,8 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, int dci_formats[2]; int rnti_types[2]; - dci_formats[0] = dci_format; - rnti_types[0] = rnti_type; + dci_formats[0] = NR_DL_DCI_FORMAT_1_0; + rnti_types[0] = NR_RNTI_SI; fill_dci_pdu_rel15(scc,secondaryCellGroup,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types,pdsch_pdu_rel15->BWPSize,gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index aa66ae0c27..c6e7b414fa 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -189,13 +189,13 @@ static void init_NR_SI(gNB_RRC_INST *rrc) { // SIB 1 gNB_RrcConfigurationReq *configuration; configuration = CALLOC(1,sizeof(gNB_RrcConfigurationReq)); - configuration->cell_identity = 3; + configuration->cell_identity = 0x0E00; // TODO: Get value from config file configuration->ssb_SubcarrierOffset = rrc->carrier.ssb_SubcarrierOffset; configuration->pdsch_AntennaPorts = rrc->carrier.pdsch_AntennaPorts; configuration->pusch_TargetSNRx10 = rrc->carrier.pusch_TargetSNRx10; configuration->pucch_TargetSNRx10 = rrc->carrier.pucch_TargetSNRx10; configuration->scc = rrc->carrier.servingcellconfigcommon; - if(rrc->carrier.SIB1 == NULL) rrc->carrier.SIB1 = (uint8_t *) malloc16(100); + if(rrc->carrier.SIB1 == NULL) rrc->carrier.SIB1 = (uint8_t *) malloc16(MAX_NR_SIB_LENGTH/8); rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier, configuration); LOG_I(NR_RRC,"Done init_NR_SI\n"); diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 1e182eff8b..8afc3165ef 100755 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -432,6 +432,41 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message( return 0; } +/*brief decode SIB1 message*/ +int8_t nr_rrc_ue_decode_NR_SIB1_Message(uint8_t *const bufferP, const uint8_t buffer_len){ + + NR_BCCH_DL_SCH_Message_t *bcch_message = NULL; + + asn_dec_rval_t dec_rval = uper_decode_complete(NULL, + &asn_DEF_NR_BCCH_DL_SCH_Message, + (void **)&bcch_message, + (const void *)bufferP, + buffer_len); + + if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) { + + printf("NR_BCCH_DL_SCH decode error\n"); + for (int i=0; isib1 != NULL){ + SEQUENCE_free(&asn_DEF_NR_BCCH_BCH_Message, (void *)NR_UE_rrc_inst->sib1, 1 ); + } + NR_UE_rrc_inst->sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; + xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)NR_UE_rrc_inst->sib1); + + } + + return 0; +} + // from NR SRB3 int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message( diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index 6481fb0cea..03511eff7c 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -51,6 +51,7 @@ #include "NR_asn_constant.h" #include "NR_SchedulingRequestToAddMod.h" #include "NR_MIB.h" +#include "NR_SIB1.h" #include "NR_BCCH-BCH-Message.h" #include "NR_DL-DCCH-Message.h" @@ -70,6 +71,7 @@ typedef struct NR_UE_RRC_INST_s { NR_RadioBearerConfig_t *radio_bearer_config; NR_MIB_t *mib; + NR_SIB1_t *sib1; // lists // CellGroupConfig.rlc-BearerToAddModList diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 7bc7e4b90c..292eae10d4 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -86,6 +86,11 @@ int8_t nr_rrc_ue_process_radio_bearer_config(NR_RadioBearerConfig_t *radio_beare \param sdu_len length of buffer*/ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len); +/**\brief decode NR SIB1 message + \param sduP pointer to buffer of ASN message + \param sdu_len length of buffer*/ +int8_t nr_rrc_ue_decode_NR_SIB1_Message(uint8_t *const bufferP, const uint8_t buffer_len); + /**\brief Decode NR DCCH from gNB, sent from lower layer through SRB3 \param module_id module id \param gNB_index gNB index From 6e0b0049ea0be0015fc41a8046b29f930fa4229b Mon Sep 17 00:00:00 2001 From: rmagueta Date: Tue, 3 Nov 2020 18:58:56 +0000 Subject: [PATCH 012/160] Coreset0 frequency allocation update --- openair1/PHY/NR_TRANSPORT/nr_dci.c | 2 +- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 13 +--- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 22 ++----- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 11 +++- openair2/GNB_APP/gnb_config.c | 5 ++ openair2/LAYER2/NR_MAC_UE/config_ue.c | 37 +++++++++-- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 1 + .../NR_MAC_UE/nr_ue_dci_configuration.c | 6 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 61 ++++--------------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 18 ++---- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 25 +++----- openair2/RRC/NR/rrc_gNB_reconfig.c | 4 +- 12 files changed, 87 insertions(+), 118 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 4066494bdb..a06a040a83 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -240,7 +240,7 @@ uint8_t nr_generate_dci_top(PHY_VARS_gNB *gNB, } // m } // reg_idx - printf(">> DCI: payloadSize = %d | payload = %llx\n\n", + LOG_I(PHY, ">> DCI: payloadSize = %d | payload = %llx\n", *pdcch_pdu_rel15->dci_pdu.PayloadSizeBits,*(unsigned long long*)pdcch_pdu_rel15->dci_pdu.Payload); } // for (int d=0;dnumDlDci;d++) diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 8fb663f294..cce06d3a28 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -879,12 +879,6 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, n_rnti = rel15->rnti; - printf("nr_pdcch_unscrambling: encoded_length = %i, Nid = %i, scrambling_RNTI = %i\n", - L*108, rel15->coreset.pdcch_dmrs_scrambling_id, rel15->coreset.scrambling_rnti); - - printf("polar_decoder_int16: pdcch_pdu_rel15->dci_pdu.PayloadSizeBits[d] = %i, pdcch_pdu_rel15->dci_pdu.AggregationLevel[d] = %i, n_RNTI = %i\n", - dci_length, L, rel15->rnti); - if (crc == n_rnti) { LOG_D(PHY,"Decoded crc %x matches rnti %x for DCI format %d\n", crc, n_rnti, rel15->dci_format_options[k]); dci_ind->SFN = frame; @@ -896,19 +890,18 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, memcpy((void*)dci_ind->dci_list[dci_ind->number_of_dcis].payloadBits,(void*)dci_estimation,8); dci_ind->number_of_dcis++; - printf("\n>> Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n\n", + LOG_I(PHY, "\n>> Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n\n", n_rnti,rel15->dci_format_options[k],CCEind,dci_length,*(unsigned long long*)dci_estimation); break; // If DCI is found, no need to check for remaining DCI lengths } else { - LOG_D(PHY,"Decoded crc %x does not match rnti %x for DCI format %d\n", crc, n_rnti, rel15->dci_format_options[k]); + LOG_I(PHY,"Decoded crc %x does not match rnti %x for DCI format %d\n", crc, n_rnti, rel15->dci_format_options[k]); } } } } - printf("nr_dci_decoding_procedure: frame = %i, slot = %i\n", frame, slot); - getchar(); + LOG_I(PHY,"nr_dci_decoding_procedure: frame = %i, slot = %i\n", frame, slot); return(dci_ind->number_of_dcis); } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 03c9b4008e..f3485b0885 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -589,17 +589,11 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, // Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) { - LOG_D(PHY,"Segment %u CRC OK\n\033[0m",r); + + LOG_I(PHY,"Segment %u CRC OK\n\033[0m",r); if (r==0) { - for (int i=0;i<10;i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]); - - printf("\n"); - printf("==== CRC OK ====\n"); - for (int i=0;i<10;i++) printf("byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]); - printf("\n"); - - getchar(); + for (int i=0;i<10;i++) LOG_I(PHY,"byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]); } //Temporary hack @@ -607,18 +601,10 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ret = no_iteration_ldpc; } else { - LOG_D(PHY,"CRC NOK\n\033[0m"); + LOG_I(PHY,"CRC NOT OK\n\033[0m"); ret = 1 + dlsch->max_ldpc_iterations; - - printf("\n"); - printf("==== CRC NOT OK ====\n"); - for (int i=0;i<10;i++) printf("byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]); - printf("\n"); - - getchar(); } - nb_total_decod++; if (no_iteration_ldpc > dlsch->max_ldpc_iterations){ nb_error_decod++; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 80f8324b1b..fac78dadae 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1957,10 +1957,15 @@ start_meas(&ue->generic_stat); // FIXME: It was assumed that SIB1 has only one segment int harq_pid = PHY_vars_UE_g[0][0]->dlsch_SI[0]->current_harq_pid; - nr_rrc_ue_decode_NR_SIB1_Message(&ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->c[0][0], - ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->TBS); - getchar(); + if(ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->harq_ack.ack == 1) { + nr_rrc_ue_decode_NR_SIB1_Message(&ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->c[0][0], + ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->TBS); + } else { + LOG_D(PHY,"SIB1 CRC NOT OK"); + } + + } // do procedures for P-RNTI diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 962e3544e7..31510d50c7 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -583,6 +583,11 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { config_get(pdcch_ConfigSIB1,sizeof(pdcch_ConfigSIB1)/sizeof(paramdef_t),aprefix); } + AssertFatal(rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero == 10 + || rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero == 11 + || rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero == 12, + "controlResourceSetZero %li not suported yet\n", rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero); + sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); config_getlist(&SCCsParamList, NULL, 0, aprefix); diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 248f71763e..06dbb10d39 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -412,26 +412,53 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ if(mac->search_space_zero->searchSpaceType == NULL) mac->search_space_zero->searchSpaceType = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType)); if(mac->search_space_zero->searchSpaceType->choice.common == NULL) mac->search_space_zero->searchSpaceType->choice.common=calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common)); if(mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 == NULL) mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); - mac->search_space_zero->searchSpaceId = 0; *mac->search_space_zero->controlResourceSetId = 0; mac->search_space_zero->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*mac->search_space_zero->monitoringSlotPeriodicityAndOffset)); mac->search_space_zero->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; mac->search_space_zero->duration=NULL; - - // should be '1100 0000 0000 00'B (LSB first!), first two symols in slot, adjust if needed + // should be '1100 0000 0000 00'B (LSB first!), first two symbols in slot, adjust if needed mac->search_space_zero->monitoringSymbolsWithinSlot->buf[1] = 0; mac->search_space_zero->monitoringSymbolsWithinSlot->buf[0] = (1<<7) | (1<<6); mac->search_space_zero->monitoringSymbolsWithinSlot->size = 2; mac->search_space_zero->monitoringSymbolsWithinSlot->bits_unused = 2; - mac->search_space_zero->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; mac->search_space_zero->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; mac->search_space_zero->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; mac->search_space_zero->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; mac->search_space_zero->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; - mac->search_space_zero->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; + + // Coreset0 + if(mac->coreset0 == NULL) mac->coreset0 = calloc(1,sizeof(*mac->coreset0)); + mac->coreset0->controlResourceSetId = 0; + // frequencyDomainResources '11111111 00000000 00000000 00000000 00000000 00000'B, + if(mac->coreset0->frequencyDomainResources.buf == NULL) mac->coreset0->frequencyDomainResources.buf = calloc(1,6); + mac->coreset0->frequencyDomainResources.buf[0] = 0xff; + mac->coreset0->frequencyDomainResources.buf[1] = 0; + mac->coreset0->frequencyDomainResources.buf[2] = 0; + mac->coreset0->frequencyDomainResources.buf[3] = 0; + mac->coreset0->frequencyDomainResources.buf[4] = 0; + mac->coreset0->frequencyDomainResources.buf[5] = 0; + mac->coreset0->frequencyDomainResources.size = 6; + mac->coreset0->frequencyDomainResources.bits_unused = 3; + mac->coreset0->duration = 1; + mac->coreset0->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved; // FIXME: Interleaved + //coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset->cce_REG_MappingType.choice.interleaved)); + //coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; + //coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = scc->physCellId; + mac->coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; + if(mac->coreset0->tci_StatesPDCCH_ToAddList == NULL) mac->coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*mac->coreset0->tci_StatesPDCCH_ToAddList)); + NR_TCI_StateId_t *tci[8]; + for (int i=0;i<8;i++) { + tci[i]=calloc(1,sizeof(*tci[i])); + *tci[i] = i; + ASN_SEQUENCE_ADD(&mac->coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]); + } + mac->coreset0->tci_StatesPDCCH_ToReleaseList = NULL; + mac->coreset0->tci_PresentInDCI = NULL; + mac->coreset0->pdcch_DMRS_ScramblingID = NULL; + } int nr_rrc_mac_config_req_ue( diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 24c7949106..b71a774839 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -256,6 +256,7 @@ typedef struct { NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config; NR_SearchSpace_t *search_space_zero; + NR_ControlResourceSet_t *coreset0; } NR_UE_MAC_INST_t; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 982a5ceabe..775b5c7ea2 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -76,15 +76,17 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t NR_BWP_DownlinkCommon_t *initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP; NR_SearchSpace_t *ss; + NR_ControlResourceSet_t *coreset; if(ss_id>=0) { ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id]; + coreset = mac->coreset[bwp_id - 1][coreset_id - 1]; } else { ss = mac->search_space_zero; + coreset = mac->coreset0; } - // CORESET configuration - NR_ControlResourceSet_t *coreset = mac->coreset[bwp_id - 1][coreset_id - 1]; rel15->coreset.duration = coreset->duration; + for (int i = 0; i < 6; i++) rel15->coreset.frequency_domain_resource[i] = coreset->frequencyDomainResources.buf[i]; rel15->coreset.CceRegMappingType = coreset->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved ? FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED : FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index dc546896d2..99af70c07b 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -289,19 +289,15 @@ int8_t nr_ue_decode_mib(module_id_t module_id, AssertFatal(mac->mib != NULL, "nr_ue_decode_mib() mac->mib == NULL\n"); -//#ifdef DEBUG_MIB +#ifdef DEBUG_MIB LOG_I(MAC,"system frame number(6 MSB bits): %d\n", mac->mib->systemFrameNumber.buf[0]); - //LOG_I(MAC,"system frame number(with LSB): %d\n", (int)frame); LOG_I(MAC,"subcarrier spacing (0=15or60, 1=30or120): %d\n", (int)mac->mib->subCarrierSpacingCommon); - //LOG_I(MAC,"ssb carrier offset(with MSB): %d\n", (int)ssb_subcarrier_offset); LOG_I(MAC,"dmrs type A position (0=pos2,1=pos3): %d\n", (int)mac->mib->dmrs_TypeA_Position); - LOG_I(MAC,"pdcch config sib1.controlResourceSetZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.controlResourceSetZero); - LOG_I(MAC,"pdcch config sib1.searchSpaceZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.searchSpaceZero); + LOG_I(MAC,"pdcch config sib1.controlResourceSetZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.controlResourceSetZero); + LOG_I(MAC,"pdcch config sib1.searchSpaceZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.searchSpaceZero); LOG_I(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred); LOG_I(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection); - //LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit); - //LOG_I(MAC,"ssb index(extra bits): %d\n", (int)ssb_index); -//#endif +#endif get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config, mac->mib, extra_bits, ssb_length, ssb_index); @@ -312,29 +308,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, mac->dl_config_request.sfn = mac->type0_PDCCH_CSS_config.frame; mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS - - printf("\nextra_bits = %i\n", extra_bits); - - printf("mac->type0_PDCCH_CSS_config.num_rbs = %i\n", mac->type0_PDCCH_CSS_config.num_rbs); - printf("mac->type0_PDCCH_CSS_config.num_symbols = %i\n", mac->type0_PDCCH_CSS_config.num_symbols); - printf("mac->type0_PDCCH_CSS_config.rb_offset = %i\n", mac->type0_PDCCH_CSS_config.rb_offset); - printf("mac->type0_pdcch_ss_mux_pattern = %i\n", mac->type0_pdcch_ss_mux_pattern); - printf("mac->type0_PDCCH_CSS_config.frame = %i\n", mac->type0_PDCCH_CSS_config.frame); - printf("mac->type0_pdcch_ss_sfn_c = %i\n", mac->type0_pdcch_ss_sfn_c); - printf("mac->type0_pdcch_ss_n_c = %i\n", mac->type0_pdcch_ss_n_c); - printf("mac->type0_PDCCH_CSS_config.number_of_search_space_per_slot = %i\n", mac->type0_PDCCH_CSS_config.number_of_search_space_per_slot); - printf("mac->type0_PDCCH_CSS_config.first_symbol_index = %i\n", mac->type0_PDCCH_CSS_config.first_symbol_index); - printf("mac->type0_PDCCH_CSS_config.search_space_duration = %i\n", mac->type0_PDCCH_CSS_config.search_space_duration); - printf("mac->type0_PDCCH_CSS_config.ssb_length = %i\n", mac->type0_PDCCH_CSS_config.ssb_length); - printf("ssb_index = %i\n", ssb_index); - - printf("mac->dl_config_request.sfn = %i\n", mac->dl_config_request.sfn); - printf("mac->dl_config_request.slot = %i\n", mac->dl_config_request.slot); - - printf("\n\n\n"); - return 0; - } @@ -3204,8 +3178,6 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac, case NR_RNTI_SI: - printf("\nnr_extract_dci_info\n\n"); - // Freq domain assignment 0-16 bit fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); pos+=fsize; @@ -3231,22 +3203,15 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac, pos++; dci_pdu_rel15->system_info_indicator = (*dci_pdu>>(dci_size-pos))&0x1; - printf("\n\n"); - - for(int i = 64-dci_size; i<64; i++) { - printf("%i ", (*dci_pdu >> 63-i)&(uint64_t)0x01); - } - - printf("\nN_RB = %i\n", N_RB); - printf("\ndci_size = %i\n", dci_size); - printf("fsize = %i\n", fsize); - printf("dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val); - printf("dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val); - printf("dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val); - printf("dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs); - printf("dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); - printf("dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator); - printf("\n"); + LOG_D(MAC,"N_RB = %i\n", N_RB); + LOG_D(MAC,"dci_size = %i\n", dci_size); + LOG_D(MAC,"fsize = %i\n", fsize); + LOG_D(MAC,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val); + LOG_D(MAC,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val); + LOG_D(MAC,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val); + LOG_D(MAC,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs); + LOG_D(MAC,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); + LOG_D(MAC,"dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator); break; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 226b6e7954..87d7384be4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -350,13 +350,13 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { - printf("\n\nSchedule_nr_sib1: frameP = %i, slotP = %i\n", frameP, slotP); + LOG_D(MAC,"Schedule_nr_sib1: frameP = %i, slotP = %i\n", frameP, slotP); // static values const int CC_id = 0; int time_domain_allocation = 2; uint8_t mcsTableIdx = 0; - uint8_t mcs = 9; + uint8_t mcs = 0; uint8_t numDmrsCdmGrpsNoData = 1; int bwp_id = 1; @@ -364,18 +364,14 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) if( (frameP%2 == gNB_mac->type0_PDCCH_CSS_config.sfn_c) && (slotP == gNB_mac->type0_PDCCH_CSS_config.n_0 ) ) { - printf("> SIB1 will be transmitted here\n"); + LOG_D(MAC,"> SIB1 transmission\n"); // Get SIB1 uint8_t sib1_payload[100]; uint8_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, 1, sib1_payload); - printf("sib1_sdu_length = %i\n", sib1_sdu_length); - printf("SIB1: "); - for(int i = 0; iTLVs[0].value.direct,MAX_NR_DLSCH_PAYLOAD_BYTES); - //mac_sdus[2] = 0xFF; - //mac_sdus[5] = 0xFF; memcpy(tx_req->TLVs[0].value.direct, sib1_payload, sib1_sdu_length); tx_req->PDU_length = TBS; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 7809cb7744..24df85e3d5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1195,23 +1195,14 @@ void fill_dci_pdu_rel15(NR_ServingCellConfigCommon_t *scc, // reserved 15 bits - - printf("\n\n"); - - for(int i = 64-dci_size; i<64; i++) { - printf("%i ", (*dci_pdu >> 63-i)&(uint64_t)0x01); - } - - printf("\ndci_size = %i\n", dci_size); - printf("fsize = %i\n", fsize); - printf("dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val); - printf("dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val); - printf("dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val); - printf("dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs); - printf("dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); - printf("dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator); - printf("\n"); - + LOG_D(PHY,"dci_size = %i\n", dci_size); + LOG_D(PHY,"fsize = %i\n", fsize); + LOG_D(PHY,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val); + LOG_D(PHY,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val); + LOG_D(PHY,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val); + LOG_D(PHY,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs); + LOG_D(PHY,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); + LOG_D(PHY,"dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator); break; diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 777baae549..d47d623859 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -51,10 +51,10 @@ void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0) { coreset0->controlResourceSetId = 0; - // frequencyDomainResources '11111111 11111111 00000000 00000000 00000000 00000'B, + // frequencyDomainResources '11111111 00000000 00000000 00000000 00000000 00000'B, if(coreset0->frequencyDomainResources.buf == NULL) coreset0->frequencyDomainResources.buf = calloc(1,6); coreset0->frequencyDomainResources.buf[0] = 0xff; - coreset0->frequencyDomainResources.buf[1] = 0xff; + coreset0->frequencyDomainResources.buf[1] = 0; coreset0->frequencyDomainResources.buf[2] = 0; coreset0->frequencyDomainResources.buf[3] = 0; coreset0->frequencyDomainResources.buf[4] = 0; From 578b17dec65040fdd99be8f7ce84c7385e4e37e3 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 4 Nov 2020 00:00:24 +0000 Subject: [PATCH 013/160] First baseline implementation of SIB1 --- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 48 +-- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 1 - openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 351 ++---------------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 3 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 57 ++- 5 files changed, 64 insertions(+), 396 deletions(-) diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 7b41c57f2e..af7fd96a1e 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1357,9 +1357,9 @@ void *UE_thread_slot1_dl_processing(void *arg) { CPU_ZERO(&cpuset); if ( (proc->sub_frame_start+1)%RX_NB_TH == 0 && threads.slot1_proc_one != -1 ) CPU_SET(threads.slot1_proc_one, &cpuset); - if ( RX_NB_TH > 1 && (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.slot1_proc_two != -1 ) + if ( (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.slot1_proc_two != -1 ) CPU_SET(threads.slot1_proc_two, &cpuset); - if ( RX_NB_TH > 2 && (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.slot1_proc_three != -1 ) + if ( (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.slot1_proc_three != -1 ) CPU_SET(threads.slot1_proc_three, &cpuset); init_thread(900000,1000000 , FIFO_PRIORITY-1, &cpuset, @@ -1654,8 +1654,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, uint8_t dci_cnt = 0; NR_DL_FRAME_PARMS *fp = &ue->frame_parms; - //NR_UE_MAC_INST_t *mac = get_mac_inst(0); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN); LOG_D(PHY," ****** start RX-Chain for Frame.Slot %d.%d ****** \n", frame_rx%1024, nr_tti_rx); @@ -1694,12 +1692,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, #endif } - - //if (mac->csirc->reportQuantity.choice.ssb_Index_RSRP){ - nr_ue_rsrp_measurements(ue,nr_tti_rx,0); - //} - - nr_ue_pbch_procedures(gNB_id, ue, proc, 0); if (ue->no_timing_correction==0) { @@ -1846,6 +1838,15 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // deactivate dlsch once dlsch proc is done ue->dlsch_SI[gNB_id]->active = 0; + // FIXME: It was assumed that SIB1 has only one segment + int harq_pid = PHY_vars_UE_g[0][0]->dlsch_SI[0]->current_harq_pid; + if(ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->harq_ack.ack == 1) { + nr_rrc_ue_decode_NR_SIB1_Message(&ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->c[0][0], + ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->TBS); + } else { + LOG_D(PHY,"SIB1 CRC NOT OK"); + } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_OUT); } @@ -1963,33 +1964,6 @@ start_meas(&ue->generic_stat); } #endif - // do procedures for SI-RNTI - if ((ue->dlsch_SI[gNB_id]) && (ue->dlsch_SI[gNB_id]->active == 1)) { - - nr_ue_dlsch_procedures(ue, - proc, - gNB_id, - SI_PDSCH, - ue->dlsch_SI[gNB_id], - NULL, - &ue->dlsch_SI_errors[gNB_id], - mode); - - ue->dlsch_SI[gNB_id]->active = 0; - - // FIXME: It was assumed that SIB1 has only one segment - int harq_pid = PHY_vars_UE_g[0][0]->dlsch_SI[0]->current_harq_pid; - - if(ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->harq_ack.ack == 1) { - nr_rrc_ue_decode_NR_SIB1_Message(&ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->c[0][0], - ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->TBS); - } else { - LOG_D(PHY,"SIB1 CRC NOT OK"); - } - - - } - // do procedures for P-RNTI if ((ue->dlsch_p[gNB_id]) && (ue->dlsch_p[gNB_id]->active == 1)) { nr_ue_pdsch_procedures(ue, diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 3528094065..18256d9fed 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -117,7 +117,6 @@ const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f const int32_t table_38213_10_1_1_c2[5] = { 0, 0, 4, 2, 1 }; -const char *prachfmt[]={"A1","A2","A3","B1","B2","B3","B4","C0","C2"}; const char *prachfmt03[]={"0","1","2","3"}; const char *prachfmt[]={"0","1","2","3", "A1","A2","A3","B1","B4","C0","C2","A1/B1","A2/B2","A3/B3"}; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index df3a61f888..da02079f7e 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -964,15 +964,40 @@ int8_t nr_ue_decode_mib(module_id_t module_id, nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU AssertFatal(mac->mib != NULL, "nr_ue_decode_mib() mac->mib == NULL\n"); + //if(mac->mib != NULL){ + uint16_t frame = (mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused); + uint16_t frame_number_4lsb = 0; + for (int i=0; i<4; i++) + frame_number_4lsb |= ((extra_bits>>i)&1)<<(3-i); + //uint8_t half_frame_bit = ( extra_bits >> 4 ) & 0x1; // extra bits[4] + uint8_t ssb_subcarrier_offset_msb = ( extra_bits >> 5 ) & 0x1; // extra bits[5] + uint8_t ssb_subcarrier_offset = (uint8_t)mac->mib->ssb_SubcarrierOffset; + + //uint32_t ssb_index = 0; // TODO: ssb_index should obtain from L1 in case Lssb != 64 + + frame = frame << 4; + frame = frame | frame_number_4lsb; + + if(ssb_length == 64){ + ssb_index = ssb_index & (( extra_bits >> 2 ) & 0x1C ); // { extra_bits[5:7], ssb_index[2:0] } + }else{ + if(ssb_subcarrier_offset_msb){ + ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10; + } + } #ifdef DEBUG_MIB LOG_I(MAC,"system frame number(6 MSB bits): %d\n", mac->mib->systemFrameNumber.buf[0]); + LOG_I(MAC,"system frame number(with LSB): %d\n", (int)frame); LOG_I(MAC,"subcarrier spacing (0=15or60, 1=30or120): %d\n", (int)mac->mib->subCarrierSpacingCommon); + LOG_I(MAC,"ssb carrier offset(with MSB): %d\n", (int)ssb_subcarrier_offset); LOG_I(MAC,"dmrs type A position (0=pos2,1=pos3): %d\n", (int)mac->mib->dmrs_TypeA_Position); LOG_I(MAC,"pdcch config sib1.controlResourceSetZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.controlResourceSetZero); LOG_I(MAC,"pdcch config sib1.searchSpaceZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.searchSpaceZero); LOG_I(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred); LOG_I(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection); + LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit); + LOG_I(MAC,"ssb index(extra bits): %d\n", (int)ssb_index); #endif get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config, mac->mib, extra_bits, ssb_length, ssb_index); @@ -983,331 +1008,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, mac->type0_pdcch_ss_n_c = mac->type0_PDCCH_CSS_config.n_c; mac->dl_config_request.sfn = mac->type0_PDCCH_CSS_config.frame; mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS - channel_bandwidth_t min_channel_bw = bw_10MHz; // deafult for testing - - - //TODO: Check this - - uint32_t is_condition_A = (ssb_subcarrier_offset == 0); // 38.213 ch.13 - frequency_range_t frequency_range = FR1; - uint32_t index_4msb = (mac->mib->pdcch_ConfigSIB1.controlResourceSetZero); - uint32_t index_4lsb = (mac->mib->pdcch_ConfigSIB1.searchSpaceZero); - int32_t num_rbs = -1; - int32_t num_symbols = -1; - int32_t rb_offset = -1; - //LOG_I(MAC,"<<<<<<<<mib->pdcch_ConfigSIB1,index_4msb,index_4lsb,scs_ssb,scs_pdcch, (scs_ssb << 5)|scs_pdcch); - - // type0-pdcch coreset - switch( (scs_ssb << 5)|scs_pdcch ){ - case (scs_15kHz << 5) | scs_15kHz : - AssertFatal(index_4msb < 15, "38.213 Table 13-1 4 MSB out of range\n"); - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_1_c2[index_4msb]; - num_symbols = table_38213_13_1_c3[index_4msb]; - rb_offset = table_38213_13_1_c4[index_4msb]; - break; - - case (scs_15kHz << 5) | scs_30kHz: - AssertFatal(index_4msb < 14, "38.213 Table 13-2 4 MSB out of range\n"); - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_2_c2[index_4msb]; - num_symbols = table_38213_13_2_c3[index_4msb]; - rb_offset = table_38213_13_2_c4[index_4msb]; - break; - - case (scs_30kHz << 5) | scs_15kHz: - if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){ - AssertFatal(index_4msb < 9, "38.213 Table 13-3 4 MSB out of range\n"); - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_3_c2[index_4msb]; - num_symbols = table_38213_13_3_c3[index_4msb]; - rb_offset = table_38213_13_3_c4[index_4msb]; - }else if(min_channel_bw & bw_40MHz){ - AssertFatal(index_4msb < 9, "38.213 Table 13-5 4 MSB out of range\n"); - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_5_c2[index_4msb]; - num_symbols = table_38213_13_5_c3[index_4msb]; - rb_offset = table_38213_13_5_c4[index_4msb]; - }else{ ; } - - break; - - case (scs_30kHz << 5) | scs_30kHz: - if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){ - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_4_c2[index_4msb]; - num_symbols = table_38213_13_4_c3[index_4msb]; - rb_offset = table_38213_13_4_c4[index_4msb]; - LOG_I(MAC,"<<<<<<<<type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_6_c2[index_4msb]; - num_symbols = table_38213_13_6_c3[index_4msb]; - rb_offset = table_38213_13_6_c4[index_4msb]; - }else{ ; } - break; - - case (scs_120kHz << 5) | scs_60kHz: - AssertFatal(index_4msb < 12, "38.213 Table 13-7 4 MSB out of range\n"); - if(index_4msb & 0x7){ - mac->type0_pdcch_ss_mux_pattern = 1; - }else if(index_4msb & 0x18){ - mac->type0_pdcch_ss_mux_pattern = 2; - }else{ ; } - - num_rbs = table_38213_13_7_c2[index_4msb]; - num_symbols = table_38213_13_7_c3[index_4msb]; - if(!is_condition_A && (index_4msb == 8 || index_4msb == 10)){ - rb_offset = table_38213_13_7_c4[index_4msb] - 1; - }else{ - rb_offset = table_38213_13_7_c4[index_4msb]; - } - break; - - case (scs_120kHz << 5) | scs_120kHz: - AssertFatal(index_4msb < 8, "38.213 Table 13-8 4 MSB out of range\n"); - if(index_4msb & 0x3){ - mac->type0_pdcch_ss_mux_pattern = 1; - }else if(index_4msb & 0x0c){ - mac->type0_pdcch_ss_mux_pattern = 3; - } - - num_rbs = table_38213_13_8_c2[index_4msb]; - num_symbols = table_38213_13_8_c3[index_4msb]; - if(!is_condition_A && (index_4msb == 4 || index_4msb == 6)){ - rb_offset = table_38213_13_8_c4[index_4msb] - 1; - }else{ - rb_offset = table_38213_13_8_c4[index_4msb]; - } - break; - - case (scs_240kHz << 5) | scs_60kHz: - AssertFatal(index_4msb < 4, "38.213 Table 13-9 4 MSB out of range\n"); - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_9_c2[index_4msb]; - num_symbols = table_38213_13_9_c3[index_4msb]; - rb_offset = table_38213_13_9_c4[index_4msb]; - break; - - case (scs_240kHz << 5) | scs_120kHz: - AssertFatal(index_4msb < 8, "38.213 Table 13-10 4 MSB out of range\n"); - if(index_4msb & 0x3){ - mac->type0_pdcch_ss_mux_pattern = 1; - }else if(index_4msb & 0x0c){ - mac->type0_pdcch_ss_mux_pattern = 2; - } - num_rbs = table_38213_13_10_c2[index_4msb]; - num_symbols = table_38213_13_10_c3[index_4msb]; - if(!is_condition_A && (index_4msb == 4 || index_4msb == 6)){ - rb_offset = table_38213_13_10_c4[index_4msb]-1; - }else{ - rb_offset = table_38213_13_10_c4[index_4msb]; - } - - break; - - default: - break; - } - - AssertFatal(num_rbs != -1, "Type0 PDCCH coreset num_rbs undefined"); - AssertFatal(num_symbols != -1, "Type0 PDCCH coreset num_symbols undefined"); - AssertFatal(rb_offset != -1, "Type0 PDCCH coreset rb_offset undefined"); - - //uint32_t cell_id = 0; // obtain from L1 later - - //mac->type0_pdcch_dci_config.coreset.rb_start = rb_offset; - //mac->type0_pdcch_dci_config.coreset.rb_end = rb_offset + num_rbs - 1; - uint64_t mask = 0x0; - uint8_t i; - for(i=0; i<(num_rbs/6); ++i){ // 38.331 Each bit corresponds a group of 6 RBs - mask = mask >> 1; - mask = mask | 0x100000000000; - } - //LOG_I(MAC,">>>>>>>>mask %x num_rbs %d rb_offset %d\n", mask, num_rbs, rb_offset); - /* - mac->type0_pdcch_dci_config.coreset.frequency_domain_resource = mask; - mac->type0_pdcch_dci_config.coreset.rb_offset = rb_offset; // additional parameter other than coreset - - //mac->type0_pdcch_dci_config.type0_pdcch_coreset.duration = num_symbols; - mac->type0_pdcch_dci_config.coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED; - mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_reg_bundle_size = 6; // L 38.211 7.3.2.2 - mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_interleaver_size = 2; // R 38.211 7.3.2.2 - mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_shift_index = cell_id; - mac->type0_pdcch_dci_config.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE; - mac->type0_pdcch_dci_config.coreset.pdcch_dmrs_scrambling_id = cell_id; - */ - - - // type0-pdcch search space - float big_o; - float big_m; - uint32_t temp; - SFN_C_TYPE sfn_c=SFN_C_IMPOSSIBLE; // only valid for mux=1 - uint32_t n_c=UINT_MAX; - uint32_t number_of_search_space_per_slot=UINT_MAX; -// uint32_t first_symbol_index=UINT_MAX; -// uint32_t search_space_duration; // element of search space - // 38.213 table 10.1-1 - - /// MUX PATTERN 1 - if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){ - big_o = table_38213_13_11_c1[index_4lsb]; - number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; - big_m = table_38213_13_11_c3[index_4lsb]; - - temp = (uint32_t)(big_o*pow(2, scs_pdcch)) + (uint32_t)(ssb_index*big_m); - n_c = temp / num_slot_per_frame; - if((temp/num_slot_per_frame) & 0x1){ - sfn_c = SFN_C_MOD_2_EQ_1; - }else{ - sfn_c = SFN_C_MOD_2_EQ_0; - } - -// if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 7) && (ssb_index&1)){ -// first_symbol_index = num_symbols; -// }else{ -// first_symbol_index = table_38213_13_11_c4[index_4lsb]; -// } - // 38.213 chapter 13: over two consecutive slots -// search_space_duration = 2; - } - - if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR2){ - big_o = table_38213_13_12_c1[index_4lsb]; - number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; - big_m = table_38213_13_12_c3[index_4lsb]; - -// if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 10) && (ssb_index&1)){ -// first_symbol_index = 7; -// }else if((index_4lsb == 6 || index_4lsb == 7 || index_4lsb == 8 || index_4lsb == 11) && (ssb_index&1)){ -// first_symbol_index = num_symbols; -// }else{ -// first_symbol_index = 0; -// } - // 38.213 chapter 13: over two consecutive slots - //search_space_duration = 2; - } - - /// MUX PATTERN 2 - if(mac->type0_pdcch_ss_mux_pattern == 2){ - - if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){ - // 38.213 Table 13-13 - AssertFatal(index_4lsb == 0, "38.213 Table 13-13 4 LSB out of range\n"); - // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot - // sfn_c = SFN_C_EQ_SFN_SSB; - n_c = get_ssb_slot(ssb_index); -// switch(ssb_index & 0x3){ // ssb_index(i) mod 4 -// case 0: -// first_symbol_index = 0; -// break; -// case 1: -// first_symbol_index = 1; -// break; -// case 2: -// first_symbol_index = 6; -// break; -// case 3: -// first_symbol_index = 7; -// break; -// default: break; -// } - - }else if((scs_ssb == scs_240kHz) && (scs_pdcch == scs_120kHz)){ - // 38.213 Table 13-14 - AssertFatal(index_4lsb == 0, "38.213 Table 13-14 4 LSB out of range\n"); - // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot - // sfn_c = SFN_C_EQ_SFN_SSB; - n_c = get_ssb_slot(ssb_index); - switch(ssb_index & 0x7){ // ssb_index(i) mod 8 - case 0: -// first_symbol_index = 0; - break; - case 1: -// first_symbol_index = 1; - break; - case 2: -// first_symbol_index = 2; - break; - case 3: -// first_symbol_index = 3; - break; - case 4: -// first_symbol_index = 12; - n_c = get_ssb_slot(ssb_index) - 1; - break; - case 5: -// first_symbol_index = 13; - n_c = get_ssb_slot(ssb_index) - 1; - break; - case 6: -// first_symbol_index = 0; - break; - case 7: -// first_symbol_index = 1; - break; - default: break; - } - }else{ ; } - // 38.213 chapter 13: over one slot -// search_space_duration = 1; - } - - /// MUX PATTERN 3 - if(mac->type0_pdcch_ss_mux_pattern == 3){ - if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_120kHz)){ - // 38.213 Table 13-15 - AssertFatal(index_4lsb == 0, "38.213 Table 13-15 4 LSB out of range\n"); - // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot - // sfn_c = SFN_C_EQ_SFN_SSB; - n_c = get_ssb_slot(ssb_index); -// switch(ssb_index & 0x3){ // ssb_index(i) mod 4 -// case 0: -// first_symbol_index = 4; -// break; -// case 1: -// first_symbol_index = 8; -// break; -// case 2: -// first_symbol_index = 2; -// break; -// case 3: -// first_symbol_index = 6; -// break; -// default: break; -// } - }else{ ; } - // 38.213 chapter 13: over one slot -// search_space_duration = 1; - } - - AssertFatal(number_of_search_space_per_slot!=UINT_MAX,""); - /* - uint32_t coreset_duration = num_symbols * number_of_search_space_per_slot; - mac->type0_pdcch_dci_config.number_of_candidates[0] = table_38213_10_1_1_c2[0]; - mac->type0_pdcch_dci_config.number_of_candidates[1] = table_38213_10_1_1_c2[1]; - mac->type0_pdcch_dci_config.number_of_candidates[2] = table_38213_10_1_1_c2[2]; // CCE aggregation level = 4 - mac->type0_pdcch_dci_config.number_of_candidates[3] = table_38213_10_1_1_c2[3]; // CCE aggregation level = 8 - mac->type0_pdcch_dci_config.number_of_candidates[4] = table_38213_10_1_1_c2[4]; // CCE aggregation level = 16 - mac->type0_pdcch_dci_config.duration = search_space_duration; - mac->type0_pdcch_dci_config.coreset.duration = coreset_duration; // coreset - AssertFatal(first_symbol_index!=UINT_MAX,""); - mac->type0_pdcch_dci_config.monitoring_symbols_within_slot = (0x3fff << first_symbol_index) & (0x3fff >> (14-coreset_duration-first_symbol_index)) & 0x3fff; - */ - AssertFatal(sfn_c!=SFN_C_IMPOSSIBLE,""); - AssertFatal(n_c!=UINT_MAX,""); - mac->type0_pdcch_ss_sfn_c = sfn_c; - mac->type0_pdcch_ss_n_c = n_c; - - // fill in the elements in config request inside P5 message - mac->phy_config.Mod_id = module_id; - mac->phy_config.CC_id = cc_id; - - mac->dl_config_request.sfn = frame; - mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS + channel_bandwidth_t min_channel_bw = bw_10MHz; // default for testing return 0; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 26d9619ce6..f8e031256c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -205,7 +205,8 @@ void schedule_control_sib1(module_id_t module_id, gNB_mac->sched_ctrlCommon->coreset, gNB_mac->sched_ctrlCommon->aggregation_level, 0, - 0); + 0, + nr_of_candidates); const uint16_t bwpSize = NRRIV2BW(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); int rbStart = NRRIV2PRBOFFSET(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index b9f08af7aa..c307630591 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -39,6 +39,7 @@ #include #include /* for _ASN_DEFAULT_STACK_MAX */ #include +#include #include "asn1_msg.h" #include "RRC/NR/nr_rrc_extern.h" @@ -267,10 +268,6 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, gNB_RrcConfigurationReq *configuration ) { asn_enc_rval_t enc_rval; - NR_BCCH_DL_SCH_Message_t *sib1_message ; - struct NR_SIB1 *sib1 ; - int i; - struct NR_PLMN_IdentityInfo nr_plmn_info; // TODO : Add support for more than one PLMN //int num_plmn = configuration->num_plmn; @@ -278,31 +275,29 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, struct NR_PLMN_Identity nr_plmn[num_plmn]; NR_MCC_MNC_Digit_t nr_mcc_digit[num_plmn][3]; NR_MCC_MNC_Digit_t nr_mnc_digit[num_plmn][3]; + memset(nr_plmn,0,sizeof(nr_plmn)); + memset(nr_mcc_digit,0,sizeof(nr_mcc_digit)); + memset(nr_mnc_digit,0,sizeof(nr_mnc_digit)); + // struct NR_UAC_BarringInfoSet nr_uac_BarringInfoSet; - sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t)); - memset(sib1_message,0,sizeof(NR_BCCH_DL_SCH_Message_t)); + NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t)); carrier->siblock1 = sib1_message; sib1_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1; sib1_message->message.choice.c1 = CALLOC(1,sizeof(struct NR_BCCH_DL_SCH_MessageType__c1)); - memset(sib1_message->message.choice.c1,0,sizeof(struct NR_BCCH_DL_SCH_MessageType__c1)); sib1_message->message.choice.c1->present = NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1; sib1_message->message.choice.c1->choice.systemInformationBlockType1 = CALLOC(1,sizeof(struct NR_SIB1)); - sib1 = sib1_message->message.choice.c1->choice.systemInformationBlockType1; - memset(sib1,0,sizeof(struct NR_SIB1)); - sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo)); - memset(sib1->cellSelectionInfo,0,sizeof(struct NR_SIB1__cellSelectionInfo)); - sib1->cellSelectionInfo->q_RxLevMin = -50; - memset(&nr_plmn_info.plmn_IdentityList,0,sizeof(struct NR_PLMN_IdentityInfo__plmn_IdentityList)); - asn_set_empty(&nr_plmn_info.plmn_IdentityList.list); - memset(&nr_plmn_info,0,sizeof(struct NR_PLMN_IdentityInfo)); - memset(nr_plmn,0,num_plmn*sizeof(struct NR_PLMN_Identity)); - for (i = 0; i < num_plmn; ++i) { + struct NR_SIB1 *sib1 = sib1_message->message.choice.c1->choice.systemInformationBlockType1; + sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo)); + sib1->cellSelectionInfo->q_RxLevMin = -50; + + struct NR_PLMN_IdentityInfo *nr_plmn_info=CALLOC(1,sizeof(struct NR_PLMN_IdentityInfo)); + asn_set_empty(&nr_plmn_info->plmn_IdentityList.list); + for (int i = 0; i < num_plmn; ++i) { nr_mcc_digit[i][0] = (configuration->mcc[i]/100)%10; nr_mcc_digit[i][1] = (configuration->mcc[i]/10)%10; nr_mcc_digit[i][2] = (configuration->mcc[i])%10; nr_plmn[i].mcc = CALLOC(1,sizeof(struct NR_MCC)); - memset(nr_plmn[i].mcc,0,sizeof(struct NR_MCC)); asn_set_empty(&nr_plmn[i].mcc->list); ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][0]); ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][1]); @@ -310,26 +305,23 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, nr_mnc_digit[i][0] = (configuration->mnc[i]/100)%10; nr_mnc_digit[i][1] = (configuration->mnc[i]/10)%10; nr_mnc_digit[i][2] = (configuration->mnc[i])%10; - memset(&nr_plmn[i].mnc,0,sizeof(NR_MNC_t)); nr_plmn[i].mnc.list.size=0; nr_plmn[i].mnc.list.count=0; ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][0]); ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][1]); ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][2]); - ASN_SEQUENCE_ADD(&nr_plmn_info.plmn_IdentityList.list, &nr_plmn[i]); + ASN_SEQUENCE_ADD(&nr_plmn_info->plmn_IdentityList.list, &nr_plmn[i]); }//end plmn loop - nr_plmn_info.cellIdentity.buf = MALLOC(8); - memset(nr_plmn_info.cellIdentity.buf,0,8); - nr_plmn_info.cellIdentity.buf[0]= (configuration->cell_identity >> 20) & 0xff; - nr_plmn_info.cellIdentity.buf[1]= (configuration->cell_identity >> 12) & 0xff; - nr_plmn_info.cellIdentity.buf[2]= (configuration->cell_identity >> 4) & 0xff; - nr_plmn_info.cellIdentity.buf[3]= (configuration->cell_identity << 4) & 0xff; - nr_plmn_info.cellIdentity.size= 4; - nr_plmn_info.cellIdentity.bits_unused= 4; - nr_plmn_info.cellReservedForOperatorUse = 0; - memset(&sib1->cellAccessRelatedInfo,0,sizeof(NR_CellAccessRelatedInfo_t)); - ASN_SEQUENCE_ADD(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list, &nr_plmn_info); + nr_plmn_info->cellIdentity.buf = CALLOC(1,8); + nr_plmn_info->cellIdentity.buf[0]= (configuration->cell_identity >> 20) & 0xff; + nr_plmn_info->cellIdentity.buf[1]= (configuration->cell_identity >> 12) & 0xff; + nr_plmn_info->cellIdentity.buf[2]= (configuration->cell_identity >> 4) & 0xff; + nr_plmn_info->cellIdentity.buf[3]= (configuration->cell_identity << 4) & 0xff; + nr_plmn_info->cellIdentity.size= 4; + nr_plmn_info->cellIdentity.bits_unused= 4; + nr_plmn_info->cellReservedForOperatorUse = 0; + ASN_SEQUENCE_ADD(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list, nr_plmn_info); #if 0 sib1->uac_BarringInfo = CALLOC(1, sizeof(struct NR_SIB1__uac_BarringInfo)); memset(sib1->uac_BarringInfo, 0, sizeof(struct NR_SIB1__uac_BarringInfo)); @@ -345,11 +337,12 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)sib1_message->message.choice.c1->choice.systemInformationBlockType1); //encode SIB1 to data + if(carrier->SIB1 == NULL) carrier->SIB1=(uint8_t *) malloc16(MAX_NR_SIB_LENGTH/8); enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_DL_SCH_Message, NULL, (void *)sib1_message, carrier->SIB1, - 100); + MAX_NR_SIB_LENGTH/8); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); From 976c2b2e8447886c16001e90256817c7b6314cad Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 4 Nov 2020 11:52:55 +0000 Subject: [PATCH 014/160] Fill SIB1 with configuration values --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 4 ++++ openair2/RRC/NR/rrc_gNB.c | 23 ++++------------------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index c307630591..c705f8663c 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -201,6 +201,10 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) { mib->message.choice.mib->spare.bits_unused = 7; // This makes a spare of 1 bits mib->message.choice.mib->ssb_SubcarrierOffset = (carrier->ssb_SubcarrierOffset)&15; + /* + * The SIB1 will be sent in this allocation (Type0-PDCCH) : 38.213, 13-4 Table and 38.213 13-11 to 13-14 tables + * the reverse allocation is in nr_ue_decode_mib() + */ mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero; mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rrc->carrier.pdcch_ConfigSIB1->searchSpaceZero; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index f1b83ea353..c94eb61225 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -82,7 +82,7 @@ #include "executables/softmodem-common.h" #include -#include "x2ap_eNB.h" +#include //#define XER_PRINT @@ -179,26 +179,11 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge( ///---------------------------------------------------------------------------------------------------------------/// ///---------------------------------------------------------------------------------------------------------------/// -static void init_NR_SI(gNB_RRC_INST *rrc) { - +static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration) { LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); - - // MIB rrc->carrier.MIB = (uint8_t *) malloc16(4); rrc->carrier.sizeof_MIB = do_MIB_NR(rrc,0); - - // SIB 1 - gNB_RrcConfigurationReq *configuration; - configuration = CALLOC(1,sizeof(gNB_RrcConfigurationReq)); - configuration->cell_identity = 0x0E00; // TODO: Get value from config file - configuration->ssb_SubcarrierOffset = rrc->carrier.ssb_SubcarrierOffset; - configuration->pdsch_AntennaPorts = rrc->carrier.pdsch_AntennaPorts; - configuration->pusch_TargetSNRx10 = rrc->carrier.pusch_TargetSNRx10; - configuration->pucch_TargetSNRx10 = rrc->carrier.pucch_TargetSNRx10; - configuration->scc = rrc->carrier.servingcellconfigcommon; - if(rrc->carrier.SIB1 == NULL) rrc->carrier.SIB1 = (uint8_t *) malloc16(MAX_NR_SIB_LENGTH/8); - rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier, configuration); - + rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier,configuration); LOG_I(NR_RRC,"Done init_NR_SI\n"); rrc_mac_config_req_gNB(rrc->module_id, rrc->carrier.ssb_SubcarrierOffset, @@ -288,7 +273,7 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu rrc->carrier.pucch_TargetSNRx10 = configuration->pucch_TargetSNRx10; /// System Information INIT LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" Checking release \n",PROTOCOL_NR_RRC_CTXT_ARGS(&ctxt)); - init_NR_SI(rrc); + init_NR_SI(rrc, configuration); rrc_init_nr_global_param(); openair_nr_rrc_on(&ctxt); return 0; From 11cb336dcc35c0547d184f5fc364debde960a7b6 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 11 Nov 2020 04:49:19 +0000 Subject: [PATCH 015/160] Correction of the offset and number of RBs of coreset0. Using the interleaver. --- .../gnb.band78.tm1.106PRB.usrpn300.conf | 2 +- openair1/PHY/NR_TRANSPORT/nr_dci.c | 23 ++++----- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 23 +++++++-- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 +- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 49 ++++++++++++------- openair2/LAYER2/NR_MAC_UE/config_ue.c | 12 ++--- .../NR_MAC_UE/nr_ue_dci_configuration.c | 31 +++++++----- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 3 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 6 ++- openair2/RRC/NR/rrc_gNB_reconfig.c | 12 ++--- 11 files changed, 102 insertions(+), 63 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index cb5b8fd7fb..3a92eeb8b4 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -40,7 +40,7 @@ gNBs = # downlinkConfigCommon #frequencyInfoDL # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) - absoluteFrequencySSB = 641032; + absoluteFrequencySSB = 641272; dl_frequencyBand = 78; # this is 3600 MHz dl_absoluteFrequencyPointA = 640000; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index ad81e36610..830a1e066b 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -30,6 +30,7 @@ * \warning */ +#include #include "nr_dci.h" #include "nr_dlsch.h" #include "nr_sch_dmrs.h" @@ -81,17 +82,15 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, int rb_offset; int n_rb; - nr_fill_cce_list(gNB,0,pdcch_pdu_rel15); - - get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset); - // compute rb_offset and n_prb based on frequency allocation - + nr_fill_cce_list(gNB,0,pdcch_pdu_rel15); + get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset); + cset_start_sc = frame_parms.first_carrier_offset + rb_offset*NR_NB_SC_PER_RB; if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1) { - cset_start_sc = frame_parms.first_carrier_offset + - (frame_parms.ssb_start_subcarrier/NR_NB_SC_PER_RB + rb_offset)*NR_NB_SC_PER_RB; - } else - cset_start_sc = frame_parms.first_carrier_offset + rb_offset*NR_NB_SC_PER_RB; + int cset_offset_sc = (frame_parms.ssb_start_subcarrier/NR_NB_SC_PER_RB - RC.nrmac[gNB->Mod_id]->type0_PDCCH_CSS_config.rb_offset)*NR_NB_SC_PER_RB; + cset_start_sc = cset_start_sc + cset_offset_sc; + } + for (int d=0;dnumDlDci;d++) { /*The coreset is initialised @@ -105,8 +104,10 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, LOG_D(PHY, "Coreset rb_offset %d, nb_rb %d\n",rb_offset,n_rb); LOG_D(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb); // DMRS length is per OFDM symbol - AssertFatal(pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED, - "Interleaved CCE REG MAPPING not supported\n"); + + //AssertFatal(pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED, + //"Interleaved CCE REG MAPPING not supported\n"); + uint32_t dmrs_length = (pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED)? (n_rb*6) : (pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]*36/cset_nsymb); //2(QPSK)*3(per RB)*6(REG per CCE) uint32_t encoded_length = pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]*108; //2(QPSK)*9(per RB)*6(REG per CCE) diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index cce06d3a28..d1ec670a84 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -36,6 +36,8 @@ #include #endif +#include +#include #include "executables/softmodem-common.h" #include "nr_transport_proto_ue.h" @@ -310,6 +312,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, NR_DL_FRAME_PARMS *frame_parms, uint8_t *coreset_freq_dom, uint32_t coreset_nbr_rb, + int cset_offset_sc, uint32_t n_BWP_start) { /* * This function is demapping DM-RS PDCCH RE @@ -381,7 +384,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, // first we set initial conditions for pointer to rxdataF depending on the situation of the first RB within the CORESET (c_rb = n_BWP_start) if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) { //if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): even case - rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))]; + rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+cset_offset_sc]; LOG_DDD("in even case c_rb (%d) is lower than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))); } @@ -389,7 +392,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, if ((c_rb >= (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) { // number of RBs is even and c_rb is higher than half system bandwidth (we don't skip DC) // if these conditions are true the pointer has to be situated at the 1st part of the rxdataF - rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol + rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))+cset_offset_sc]; // we point at the 1st part of the rxdataF in symbol LOG_DDD("in even case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))); //rxF = &rxdataF[aarx][(1 + 12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol @@ -401,7 +404,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { //if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): odd case - rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))]; + rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+cset_offset_sc]; #ifdef NR_PDCCH_DCI_DEBUG LOG_D(PHY,"in odd case c_rb (%d) is lower or equal than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))); @@ -411,7 +414,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, if ((c_rb > (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { // number of RBs is odd and c_rb is higher than half system bandwidth + 1 // if these conditions are true the pointer has to be situated at the 1st part of the rxdataF just after the first IQ symbols of the RB containing DC - rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol + rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))+cset_offset_sc]; // we point at the 1st part of the rxdataF in symbol #ifdef NR_PDCCH_DCI_DEBUG LOG_D(PHY,"in odd case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - frame_parms->N_RB_DL) - 5 + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))); @@ -421,7 +424,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, if ((c_rb == (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { // treatment of RB containing the DC // if odd number RBs in system bandwidth and first RB to be treated is higher than middle system bandwidth (around DC) // we have to treat the RB in two parts: first part from i=0 to 5, the data is at the end of rxdataF (pointing at the end of the table) - rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))]; + rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+cset_offset_sc]; #ifdef NR_PDCCH_DCI_DEBUG LOG_D(PHY,"in odd case c_rb (%d) is half N_RB_DL + 1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))); @@ -676,11 +679,20 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, uint8_t log2_maxh, aarx; int32_t avgs; int32_t avgP[4]; + for (int i=0;inb_search_space;i++) { rel15 = &pdcch_vars->pdcch_config[i]; int n_rb,rb_offset; + int cset_offset_sc = 0; + get_coreset_rballoc(rel15->coreset.frequency_domain_resource,&n_rb,&rb_offset); + + if(rel15->coreset.CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1) { + NR_UE_MAC_INST_t *mac = get_mac_inst(ue->Mod_id); + cset_offset_sc = (frame_parms->ssb_start_subcarrier / NR_NB_SC_PER_RB - mac->type0_PDCCH_CSS_config.rb_offset) * NR_NB_SC_PER_RB;; + } + for (int s=rel15->coreset.StartSymbolIndex; s<(rel15->coreset.StartSymbolIndex+rel15->coreset.duration); s++) { LOG_D(PHY,"in nr_pdcch_extract_rbs_single(rxdataF -> rxdataF_ext || dl_ch_estimates -> dl_ch_estimates_ext)\n"); @@ -692,6 +704,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, frame_parms, rel15->coreset.frequency_domain_resource, n_rb, + cset_offset_sc, rel15->BWPStart); LOG_D(PHY,"we enter nr_pdcch_channel_level(avgP=%d) => compute channel level based on ofdm symbol 0, pdcch_vars[eNB_id]->dl_ch_estimates_ext\n",*avgP); diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index f63af082db..0109735e39 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -108,7 +108,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol); nr_generate_pss(gNB->d_pss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); nr_generate_sss(gNB->d_sss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); - + if (cfg->carrier_config.num_tx_ant.value <= 4) nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); else diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index af7fd96a1e..e66e60fd5c 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1668,7 +1668,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, if (pdcch_vars->nb_search_space > 0) get_coreset_rballoc(pdcch_vars->pdcch_config[0].coreset.frequency_domain_resource,&coreset_nb_rb,&coreset_start_rb); - + slot_pbch = is_pbch_in_slot(cfg, frame_rx, nr_tti_rx, fp); // looking for pbch only in slot where it is supposed to be @@ -1725,25 +1725,36 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // note: this only works if RBs for PDCCH are contigous! LOG_D(PHY,"pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d\n", fp->first_carrier_offset,pdcch_vars->pdcch_config[0].BWPStart,coreset_start_rb); - if (coreset_nb_rb > 0) - nr_pdcch_channel_estimation(ue, - 0, - nr_tti_rx, - l, - fp->first_carrier_offset+(pdcch_vars->pdcch_config[0].BWPStart + coreset_start_rb)*12, - coreset_nb_rb); - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); -#if UE_TIMING_TRACE - stop_meas(&ue->ofdm_demod_stats); -#endif - - //printf("phy procedure pdcch start measurement l =%d\n",l); - //nr_ue_measurement_procedures(l,ue,proc,gNB_id,(nr_tti_rx),mode); - - } - dci_cnt = nr_ue_pdcch_procedures(gNB_id, ue, proc); + int cset_offset_sc; + fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15; + + for(int n_ss = 0; n_ssnb_search_space; n_ss++) { + + cset_offset_sc = 0; + rel15 = &pdcch_vars->pdcch_config[n_ss]; + if(rel15->coreset.CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1) { + NR_UE_MAC_INST_t *mac = get_mac_inst(ue->Mod_id); + cset_offset_sc = (ue->frame_parms.ssb_start_subcarrier/NR_NB_SC_PER_RB - mac->type0_PDCCH_CSS_config.rb_offset)*NR_NB_SC_PER_RB; + } + + if (coreset_nb_rb > 0) + nr_pdcch_channel_estimation(ue, + 0, + nr_tti_rx, + l, + fp->first_carrier_offset+(pdcch_vars->pdcch_config[0].BWPStart + coreset_start_rb)*12 + cset_offset_sc, + coreset_nb_rb); + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); + #if UE_TIMING_TRACE + stop_meas(&ue->ofdm_demod_stats); + #endif + + dci_cnt = dci_cnt + nr_ue_pdcch_procedures(gNB_id, ue, proc); + + } + } if (dci_cnt > 0) { diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 984ab61a59..84a04fb615 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -424,8 +424,8 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ mac->search_space_zero->monitoringSymbolsWithinSlot->bits_unused = 2; mac->search_space_zero->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; mac->search_space_zero->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; - mac->search_space_zero->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; - mac->search_space_zero->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; + mac->search_space_zero->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n0; + mac->search_space_zero->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n1; mac->search_space_zero->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; mac->search_space_zero->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; @@ -443,10 +443,10 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ mac->coreset0->frequencyDomainResources.size = 6; mac->coreset0->frequencyDomainResources.bits_unused = 3; mac->coreset0->duration = 1; - mac->coreset0->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved; // FIXME: Interleaved - //coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset->cce_REG_MappingType.choice.interleaved)); - //coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; - //coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = scc->physCellId; + //mac->coreset0->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved; // FIXME: Interleaved + mac->coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*mac->coreset0->cce_REG_MappingType.choice.interleaved)); + mac->coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; + mac->coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = 0; //scc->physCellId; mac->coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; if(mac->coreset0->tci_StatesPDCCH_ToAddList == NULL) mac->coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*mac->coreset0->tci_StatesPDCCH_ToAddList)); NR_TCI_StateId_t *tci[8]; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 36a93d6de9..8648affdf9 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -38,6 +38,7 @@ #include "common/utils/nr/nr_common.h" #include "executables/softmodem-common.h" #include +#include "nfapi_nr_interface.h" #ifdef NR_PDCCH_DCI_TOOLS_DEBUG #define LOG_DCI_D(a...) printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) ->" a) @@ -53,16 +54,22 @@ dci_pdu_rel15_t *def_dci_pdu_rel15; void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) { LOG_D(MAC,"Filling search candidates for DCI\n"); - - rel15->number_of_candidates=4; - rel15->CCE[0]=0; - rel15->L[0]=4; - rel15->CCE[1]=4; - rel15->L[1]=4; - rel15->CCE[2]=8; - rel15->L[2]=4; - rel15->CCE[3]=12; - rel15->L[3]=4; + + if(ss->searchSpaceId == 0) { + rel15->number_of_candidates=1; + rel15->CCE[0]=0; + rel15->L[0]=6; + } else { + rel15->number_of_candidates=4; + rel15->CCE[0]=0; + rel15->L[0]=4; + rel15->CCE[1]=4; + rel15->L[1]=4; + rel15->CCE[2]=8; + rel15->L[2]=4; + rel15->CCE[3]=12; + rel15->L[3]=4; + } } @@ -82,9 +89,11 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t if(ss_id>=0) { ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id]; coreset = mac->coreset[bwp_id - 1][coreset_id - 1]; + rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; } else { ss = mac->search_space_zero; coreset = mac->coreset0; + rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; } rel15->coreset.duration = coreset->duration; @@ -103,7 +112,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t rel15->coreset.InterleaverSize = 0; rel15->coreset.ShiftIndex = 0; } - rel15->coreset.CoreSetType = 1; + rel15->coreset.precoder_granularity = coreset->precoderGranularity; // Scrambling RNTI diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index da02079f7e..59d0a7d395 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -969,7 +969,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, uint16_t frame_number_4lsb = 0; for (int i=0; i<4; i++) frame_number_4lsb |= ((extra_bits>>i)&1)<<(3-i); - //uint8_t half_frame_bit = ( extra_bits >> 4 ) & 0x1; // extra bits[4] + uint8_t half_frame_bit = ( extra_bits >> 4 ) & 0x1; // extra bits[4] uint8_t ssb_subcarrier_offset_msb = ( extra_bits >> 5 ) & 0x1; // extra bits[5] uint8_t ssb_subcarrier_offset = (uint8_t)mac->mib->ssb_SubcarrierOffset; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index f8e031256c..b81c3a5166 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -76,7 +76,6 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ dl_tti_request = &gNB_mac->DL_req[CC_id]; dl_req = &dl_tti_request->dl_tti_request_body; cc = &gNB_mac->common_channels[CC_id]; - cc = &gNB_mac->common_channels[CC_id]; #if 0 //SSB is transmitted based on SSB periodicity if((frameP % cfg->ssb_table.ssb_period.value) == 0) { @@ -271,6 +270,8 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; + pdcch_pdu_rel15->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; + pdsch_pdu_rel15->pduBitmap = 0; pdsch_pdu_rel15->rnti = SI_RNTI; pdsch_pdu_rel15->pduIndex = gNB_mac->pdu_index[0]++; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 2716736d76..80305b7225 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -700,7 +700,11 @@ void nr_configure_pdcch(gNB_MAC_INST *nr_mac, pdcch_pdu->ShiftIndex = 0; } - pdcch_pdu->CoreSetType = 1; + if(coreset->controlResourceSetId == 0) { + pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; + } else{ + pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; + } //precoderGranularity pdcch_pdu->precoderGranularity = coreset->precoderGranularity; diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index c6abce9b61..ea2f450bb6 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -62,10 +62,10 @@ void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0) { coreset0->frequencyDomainResources.size = 6; coreset0->frequencyDomainResources.bits_unused = 3; coreset0->duration = 1; - coreset0->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved; // FIXME: Interleaved - //coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset->cce_REG_MappingType.choice.interleaved)); - //coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; - //coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = scc->physCellId; + //coreset0->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved; // FIXME: Interleaved + coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset0->cce_REG_MappingType.choice.interleaved)); + coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; + coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = 0; //scc->physCellId; coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; if(coreset0->tci_StatesPDCCH_ToAddList == NULL) coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*coreset0->tci_StatesPDCCH_ToAddList)); @@ -106,8 +106,8 @@ void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0) { ss0->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; ss0->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; - ss0->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1; - ss0->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0; + ss0->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n0; + ss0->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n1; ss0->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; ss0->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; From 1daaa7c6a30649c7a879b6d6a86725075a1a3fe3 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 12 Nov 2020 09:59:37 +0000 Subject: [PATCH 016/160] BWP fixes --- .../gnb.band78.tm1.106PRB.usrpn300.conf | 2 +- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 20 ++----- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 12 +++- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 24 ++++---- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 18 ++++-- .../NR_MAC_UE/nr_ue_dci_configuration.c | 11 ++-- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 18 +++++- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 58 +++++++++++-------- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 9 ++- openair2/RRC/NR/nr_rrc_proto.h | 2 + openair2/RRC/NR/rrc_gNB_reconfig.c | 26 +++++++++ 11 files changed, 135 insertions(+), 65 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index 3a92eeb8b4..f02c76385f 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -53,7 +53,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; + initialDLBWPlocationAndBandwidth = 12956; #12925; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index d1ec670a84..84ce8f3228 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -312,7 +312,6 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, NR_DL_FRAME_PARMS *frame_parms, uint8_t *coreset_freq_dom, uint32_t coreset_nbr_rb, - int cset_offset_sc, uint32_t n_BWP_start) { /* * This function is demapping DM-RS PDCCH RE @@ -372,7 +371,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, LOG_DDD("n_BWP_start=%d, coreset_nbr_rb=%d\n",n_BWP_start,coreset_nbr_rb); int c_rb_by6; - c_rb = n_BWP_start; + c_rb = 0; for (int rb=0;rbN_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) { //if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): even case - rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+cset_offset_sc]; + rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; LOG_DDD("in even case c_rb (%d) is lower than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))); } @@ -392,7 +391,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, if ((c_rb >= (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) { // number of RBs is even and c_rb is higher than half system bandwidth (we don't skip DC) // if these conditions are true the pointer has to be situated at the 1st part of the rxdataF - rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))+cset_offset_sc]; // we point at the 1st part of the rxdataF in symbol + rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; // we point at the 1st part of the rxdataF in symbol LOG_DDD("in even case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))); //rxF = &rxdataF[aarx][(1 + 12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol @@ -404,7 +403,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { //if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): odd case - rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+cset_offset_sc]; + rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; #ifdef NR_PDCCH_DCI_DEBUG LOG_D(PHY,"in odd case c_rb (%d) is lower or equal than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))); @@ -414,7 +413,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, if ((c_rb > (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { // number of RBs is odd and c_rb is higher than half system bandwidth + 1 // if these conditions are true the pointer has to be situated at the 1st part of the rxdataF just after the first IQ symbols of the RB containing DC - rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))+cset_offset_sc]; // we point at the 1st part of the rxdataF in symbol + rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; // we point at the 1st part of the rxdataF in symbol #ifdef NR_PDCCH_DCI_DEBUG LOG_D(PHY,"in odd case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - frame_parms->N_RB_DL) - 5 + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))); @@ -424,7 +423,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, if ((c_rb == (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { // treatment of RB containing the DC // if odd number RBs in system bandwidth and first RB to be treated is higher than middle system bandwidth (around DC) // we have to treat the RB in two parts: first part from i=0 to 5, the data is at the end of rxdataF (pointing at the end of the table) - rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+cset_offset_sc]; + rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; #ifdef NR_PDCCH_DCI_DEBUG LOG_D(PHY,"in odd case c_rb (%d) is half N_RB_DL + 1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))); @@ -684,15 +683,9 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, rel15 = &pdcch_vars->pdcch_config[i]; int n_rb,rb_offset; - int cset_offset_sc = 0; get_coreset_rballoc(rel15->coreset.frequency_domain_resource,&n_rb,&rb_offset); - if(rel15->coreset.CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1) { - NR_UE_MAC_INST_t *mac = get_mac_inst(ue->Mod_id); - cset_offset_sc = (frame_parms->ssb_start_subcarrier / NR_NB_SC_PER_RB - mac->type0_PDCCH_CSS_config.rb_offset) * NR_NB_SC_PER_RB;; - } - for (int s=rel15->coreset.StartSymbolIndex; s<(rel15->coreset.StartSymbolIndex+rel15->coreset.duration); s++) { LOG_D(PHY,"in nr_pdcch_extract_rbs_single(rxdataF -> rxdataF_ext || dl_ch_estimates -> dl_ch_estimates_ext)\n"); @@ -704,7 +697,6 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, frame_parms, rel15->coreset.frequency_domain_resource, n_rb, - cset_offset_sc, rel15->BWPStart); LOG_D(PHY,"we enter nr_pdcch_channel_level(avgP=%d) => compute channel level based on ofdm symbol 0, pdcch_vars[eNB_id]->dl_ch_estimates_ext\n",*avgP); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index e8204ad0b5..6772cbae1e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -303,6 +303,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, pilots = ((1<dlDmrsSymbPos)>0 ? 1 : 0; if (frame_parms->nb_antenna_ports_gNB>1 && beamforming_mode==0) { + + printf("=== 1\n"); + #ifdef DEBUG_DLSCH_MOD LOG_I(PHY,"dlsch: using pmi %x (%p)\n",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),dlsch[0]); #endif @@ -332,6 +335,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #endif if (rx_type >= rx_IC_single_stream) { + + printf("=== 2\n"); + if (eNB_id_in_connected_eNB) // we are in TM5 nb_rb = nr_dlsch_extract_rbs_dual(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[nr_tti_rx]].rxdataF, pdsch_vars[eNB_id]->dl_ch_estimates, @@ -378,6 +384,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, nr_tti_rx, ue->high_speed_flag, frame_parms); + + printf("QQQQQQQQQQQQQQ\n"); } /*else if(beamforming_mode>7) { LOG_W(PHY,"dlsch_demodulation: beamforming mode not supported yet.\n"); @@ -2382,12 +2390,12 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*(nb_rb_pdsch*12)]; rxF_ext = &rxdataF_ext[aarx][symbol*(nb_rb_pdsch*12)]; - rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))]; + rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size))) +31*12]; for (rb = 0; rb < nb_rb_pdsch; rb++) { if (k>frame_parms->ofdm_symbol_size) { k = k-frame_parms->ofdm_symbol_size; - rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))]; + rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size))) +31*12]; } if (pilots==0) { memcpy((void*)rxF_ext,(void*)rxF,12*sizeof(*rxF_ext)); diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index e66e60fd5c..191b167279 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -735,6 +735,14 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ m, ue->frame_parms.first_carrier_offset+(BWPStart + pdsch_start_rb)*12, pdsch_nb_rb); + + + printf("===== BWPStart = %i\n", BWPStart); + printf("===== pdsch_start_rb = %i\n", pdsch_start_rb); + + //getchar(); + + LOG_D(PHY,"Channel Estimation in symbol %d\n",m); break; } @@ -1722,28 +1730,22 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, 0, 0); - // note: this only works if RBs for PDCCH are contigous! - LOG_D(PHY,"pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d\n", - fp->first_carrier_offset,pdcch_vars->pdcch_config[0].BWPStart,coreset_start_rb); - - int cset_offset_sc; fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15; for(int n_ss = 0; n_ssnb_search_space; n_ss++) { - cset_offset_sc = 0; + // note: this only works if RBs for PDCCH are contigous! + LOG_D(PHY,"pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d\n", + fp->first_carrier_offset,pdcch_vars->pdcch_config[n_ss].BWPStart,coreset_start_rb); + rel15 = &pdcch_vars->pdcch_config[n_ss]; - if(rel15->coreset.CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1) { - NR_UE_MAC_INST_t *mac = get_mac_inst(ue->Mod_id); - cset_offset_sc = (ue->frame_parms.ssb_start_subcarrier/NR_NB_SC_PER_RB - mac->type0_PDCCH_CSS_config.rb_offset)*NR_NB_SC_PER_RB; - } if (coreset_nb_rb > 0) nr_pdcch_channel_estimation(ue, 0, nr_tti_rx, l, - fp->first_carrier_offset+(pdcch_vars->pdcch_config[0].BWPStart + coreset_start_rb)*12 + cset_offset_sc, + fp->first_carrier_offset+(pdcch_vars->pdcch_config[n_ss].BWPStart + coreset_start_rb)*12, coreset_nb_rb); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 18256d9fed..2a7c75923f 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2292,11 +2292,19 @@ uint16_t nr_dci_size(NR_ServingCellConfigCommon_t *scc, long rbg_size_config; int num_entries = 0; int pusch_antenna_ports = 1; // TODO hardcoded number of antenna ports for pusch - NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; - NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]; - NR_PDSCH_Config_t *pdsch_config = bwp->bwp_Dedicated->pdsch_Config->choice.setup; - NR_PUSCH_Config_t *pusch_Config = ubwp->bwp_Dedicated->pusch_Config->choice.setup; - NR_SRS_Config_t *srs_config = ubwp->bwp_Dedicated->srs_Config->choice.setup; + + NR_BWP_Downlink_t *bwp = NULL; + NR_BWP_Uplink_t *ubwp = NULL; + NR_PDSCH_Config_t *pdsch_config = NULL; + NR_PUSCH_Config_t *pusch_Config = NULL; + NR_SRS_Config_t *srs_config = NULL; + if(bwp_id > 0) { + bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]; + pdsch_config = bwp->bwp_Dedicated->pdsch_Config->choice.setup; + pusch_Config = ubwp->bwp_Dedicated->pusch_Config->choice.setup; + srs_config = ubwp->bwp_Dedicated->srs_Config->choice.setup; + } switch(format) { /*Only sizes for 0_0 and 1_0 are correct at the moment*/ diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 8648affdf9..987b9881b6 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -165,15 +165,18 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t // we use DL BWP dedicated sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12; + // for SPS=14 8 MSBs in positions 13 down to 6 monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); + rel15->rnti = 0xFFFF; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values - rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, 275); - rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275); - rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing; + + rel15->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; + rel15->BWPStart = mac->phy_config.config_req.ssb_table.ssb_offset_point_a - mac->type0_PDCCH_CSS_config.rb_offset; + rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; for (int i = 0; i < rel15->num_dci_options; i++) { - rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, bwp_id); + rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0); } break; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 59d0a7d395..94e8048bf6 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3229,12 +3229,22 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti; //fapi_nr_dl_config_dlsch_pdu_rel15_t dlsch_config_pdu_1_0 = dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; - dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); + + /*dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); - dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; + dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing;*/ + + dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; + dlsch_config_pdu_1_0->BWPStart = mac->phy_config.config_req.ssb_table.ssb_offset_point_a - mac->type0_PDCCH_CSS_config.rb_offset; + dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + /* IDENTIFIER_DCI_FORMATS */ /* FREQ_DOM_RESOURCE_ASSIGNMENT_DL */ nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_0,0,n_RB_DLBWP,dci->frequency_domain_assignment.val); + + printf("==== dlsch_config_pdu_1_0,dci->time_domain_assignment.val = %i\n", dci->time_domain_assignment.val); + + /* TIME_DOM_RESOURCE_ASSIGNMENT */ if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val) < 0) return -1; @@ -3620,7 +3630,9 @@ int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){ N_RB = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); } break; - case NR_RNTI_SI: // FIXME + case NR_RNTI_SI: + N_RB = mac->type0_PDCCH_CSS_config.num_rbs; + break; case NR_RNTI_C: N_RB = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, 275); break; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index b81c3a5166..15ba0c8a8d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -169,7 +169,6 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ void schedule_control_sib1(module_id_t module_id, int CC_id, - int bwp_id, int time_domain_allocation, uint8_t mcsTableIdx, uint8_t mcs, @@ -177,6 +176,7 @@ void schedule_control_sib1(module_id_t module_id, int num_total_bytes) { gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; + NR_ServingCellConfigCommon_t *servingcellconfigcommon = gNB_mac->common_channels[CC_id].ServingCellConfigCommon; uint8_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; if (gNB_mac->sched_ctrlCommon == NULL){ @@ -184,11 +184,14 @@ void schedule_control_sib1(module_id_t module_id, gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space)); gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp)); gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset)); + gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp)); fill_default_searchSpaceZero(gNB_mac->sched_ctrlCommon->search_space); fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset); + fill_default_initialDownlinkBWP(gNB_mac->sched_ctrlCommon->active_bwp,servingcellconfigcommon); } - gNB_mac->sched_ctrlCommon->active_bwp = gNB_mac->secondaryCellGroupCommon->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + //gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth = + // gNB_mac->secondaryCellGroupCommon->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.locationAndBandwidth; gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation; gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx; @@ -207,19 +210,22 @@ void schedule_control_sib1(module_id_t module_id, 0, nr_of_candidates); + if (gNB_mac->sched_ctrlCommon->cce_index < 0) { + LOG_E(MAC, "%s(): could not find CCE for coreset0\n", __func__); + return; + } + const uint16_t bwpSize = NRRIV2BW(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); int rbStart = NRRIV2PRBOFFSET(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); + printf("====== rel15->BWPSize = %i\n", bwpSize); + printf("====== rel15->BWPStart = %i\n", rbStart); + // Freq-domain allocation while (rbStart < bwpSize && vrb_map[rbStart]) rbStart++; // Calculate number of PRB_DMRS - uint8_t N_PRB_DMRS; - if(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NFAPI_NR_DMRS_TYPE1) { - N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; - } else { - N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 4; - } + uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; // Calculate number of symbols struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; @@ -227,6 +233,9 @@ void schedule_control_sib1(module_id_t module_id, int startSymbolIndex, nrOfSymbols; SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + //startSymbolIndex = 3; + //nrOfSymbols = 12; + int rbSize = 0; uint32_t TBS = 0; do { @@ -303,7 +312,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->resourceAlloc = 1; pdsch_pdu_rel15->rbStart = gNB_mac->sched_ctrlCommon->rbStart; pdsch_pdu_rel15->rbSize = gNB_mac->sched_ctrlCommon->rbSize; - pdsch_pdu_rel15->VRBtoPRBMapping = 1; + pdsch_pdu_rel15->VRBtoPRBMapping = 0; pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx); pdsch_pdu_rel15->TBSize[0] = TBS; pdsch_pdu_rel15->mcsTable[0] = gNB_mac->sched_ctrlCommon->mcsTableIdx; @@ -315,13 +324,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET]; memset(dci_pdu_rel15, 0, sizeof(dci_pdu_rel15_t) * MAX_DCI_CORESET); - int n_dl_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count; - - if (n_dl_bwp < 4) { - dci_pdu_rel15[0].bwp_indicator.val = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id; - } else { - dci_pdu_rel15[0].bwp_indicator.val = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id - 1; // as per table 7.3.1.1.2-1 in 38.212 - } + dci_pdu_rel15[0].bwp_indicator.val = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id; // frequency domain assignment dci_pdu_rel15[0].frequency_domain_assignment.val = @@ -329,6 +332,12 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->rbStart, NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275)); + printf("==== pdsch_pdu_rel15->rbSize = %i\n", pdsch_pdu_rel15->rbSize); + printf("==== pdsch_pdu_rel15->rbStart = %i\n", pdsch_pdu_rel15->rbStart); + printf("==== BW = %i\n", NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275)); + + + dci_pdu_rel15[0].time_domain_assignment.val = gNB_mac->sched_ctrlCommon->time_domain_allocation; dci_pdu_rel15[0].mcs = gNB_mac->sched_ctrlCommon->mcs; dci_pdu_rel15[0].rv = pdsch_pdu_rel15->rvIndex[0]; @@ -372,7 +381,6 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) uint8_t mcsTableIdx = 0; uint8_t mcs = 0; uint8_t numDmrsCdmGrpsNoData = 1; - int bwp_id = 1; gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; @@ -388,7 +396,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) for (int i=0;ilist.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + //startSymbolIndex = 3; + //nrOfSymbols = 12; + // Calculate number of PRB_DMRS - uint8_t N_PRB_DMRS; - if(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NFAPI_NR_DMRS_TYPE1) { - N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; - } else { - N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 4; - } + uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS,0 ,0 ,1 ) >> 3; + + printf("TBS = %i\n", TBS); + printf("gNB_mac->sched_ctrlCommon->rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); + nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, TBS, startSymbolIndex, nrOfSymbols); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 80305b7225..dfac2447e0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -181,7 +181,14 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, // NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; int coreset_id = coreset->controlResourceSetId; - int *cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id]; + + int *cce_list; + if(bwp->bwp_Id == 0) { + cce_list = nr_mac->cce_list[1][0]; + } else { + cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id]; + } + int n_rb=0; for (int i=0;i<6;i++) diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 26eab29fd7..e24293f8e1 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -71,6 +71,8 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti); +void fill_default_initialDownlinkBWP(NR_BWP_Downlink_t *bwp, NR_ServingCellConfigCommon_t *servingcellconfigcommon); + void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0); void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index ea2f450bb6..cc292ab2ea 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -47,6 +47,32 @@ #define false 0 #define true 1 +void fill_default_initialDownlinkBWP(NR_BWP_Downlink_t *bwp, NR_ServingCellConfigCommon_t *servingcellconfigcommon) { + + bwp->bwp_Id = 0; + + bwp->bwp_Common=calloc(1,sizeof(*bwp->bwp_Common)); + memcpy((void*)&bwp->bwp_Common, + &servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP, + sizeof(bwp->bwp_Common)); + + bwp->bwp_Dedicated=calloc(1,sizeof(*bwp->bwp_Dedicated)); + bwp->bwp_Dedicated->pdsch_Config = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config)); + bwp->bwp_Dedicated->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; + bwp->bwp_Dedicated->pdsch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); + *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; +} + void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0) { coreset0->controlResourceSetId = 0; From 17312d685f505d9e3faba1917fb1e4d32ec09137 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Fri, 13 Nov 2020 12:07:53 +0000 Subject: [PATCH 017/160] Minor fixes on used BWP. --- .../gnb.band78.tm1.106PRB.usrpn300.conf | 2 +- openair1/PHY/NR_TRANSPORT/nr_dci.c | 7 ++- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 7 ++- .../nr_dl_channel_estimation.c | 2 +- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 11 +++-- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 4 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 11 ++--- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 6 ++- .../NR_MAC_UE/nr_ue_dci_configuration.c | 6 ++- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 49 ++++++++++++++----- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 44 ++++++++++++++--- 11 files changed, 109 insertions(+), 40 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index f02c76385f..35e2a093ee 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -53,7 +53,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 12956; #12925; + initialDLBWPlocationAndBandwidth = 12956; #12925; 12956 28875 # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 830a1e066b..f358b6994c 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -87,10 +87,13 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset); cset_start_sc = frame_parms.first_carrier_offset + rb_offset*NR_NB_SC_PER_RB; if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1) { - int cset_offset_sc = (frame_parms.ssb_start_subcarrier/NR_NB_SC_PER_RB - RC.nrmac[gNB->Mod_id]->type0_PDCCH_CSS_config.rb_offset)*NR_NB_SC_PER_RB; - cset_start_sc = cset_start_sc + cset_offset_sc; + cset_start_sc = cset_start_sc + RC.nrmac[gNB->Mod_id]->type0_PDCCH_CSS_config.cset_start_rb*NR_NB_SC_PER_RB; } + printf("==== cset_start_sc = %i\n", cset_start_sc); + printf("==== frame_parms.first_carrier_offset = %i\n", frame_parms.first_carrier_offset); + printf("==== rb_offset = %i\n", rb_offset); + printf("==== RC.nrmac[gNB->Mod_id]->type0_PDCCH_CSS_config.cset_start_rb = %i\n", RC.nrmac[gNB->Mod_id]->type0_PDCCH_CSS_config.cset_start_rb); for (int d=0;dnumDlDci;d++) { /*The coreset is initialised diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 4461edb33b..2e6ed40a9d 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -269,7 +269,12 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, /// Resource mapping // Non interleaved VRB to PRB mapping - uint16_t start_sc = frame_parms->first_carrier_offset + rel15->rbStart*NR_NB_SC_PER_RB; + uint16_t start_sc = frame_parms->first_carrier_offset + (rel15->rbStart+rel15->BWPStart)*NR_NB_SC_PER_RB; + + + printf(">>>> start_sc = %i\n", start_sc); + + if (start_sc >= frame_parms->ofdm_symbol_size) start_sc -= frame_parms->ofdm_symbol_size; diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index 71a5771f5b..40730b9664 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -883,7 +883,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+nushift+re_offset)]; ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); - + // for proper allignment of SIMD vectors if((ue->frame_parms.N_RB_DL&1)==0) { diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 6772cbae1e..e45f64b174 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -384,8 +384,6 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, nr_tti_rx, ue->high_speed_flag, frame_parms); - - printf("QQQQQQQQQQQQQQ\n"); } /*else if(beamforming_mode>7) { LOG_W(PHY,"dlsch_demodulation: beamforming mode not supported yet.\n"); @@ -2382,6 +2380,11 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, k = frame_parms->first_carrier_offset + NR_NB_SC_PER_RB*start_rb; + printf("k = %i\n", k); + printf("frame_parms->first_carrier_offset = %i\n", frame_parms->first_carrier_offset); + printf("nr_dlsch_extract_rbs_single: start_rb = %i\n", start_rb); + //getchar(); + if (high_speed_flag == 1) dl_ch0 = &dl_ch_estimates[aarx][(2*(frame_parms->ofdm_symbol_size))]; else @@ -2390,12 +2393,12 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*(nb_rb_pdsch*12)]; rxF_ext = &rxdataF_ext[aarx][symbol*(nb_rb_pdsch*12)]; - rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size))) +31*12]; + rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))]; for (rb = 0; rb < nb_rb_pdsch; rb++) { if (k>frame_parms->ofdm_symbol_size) { k = k-frame_parms->ofdm_symbol_size; - rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size))) +31*12]; + rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))]; } if (pilots==0) { memcpy((void*)rxF_ext,(void*)rxF,12*sizeof(*rxF_ext)); diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 191b167279..4f6009a30e 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -737,9 +737,11 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ pdsch_nb_rb); + printf("===== Total = %i\n", ue->frame_parms.first_carrier_offset+(BWPStart + pdsch_start_rb)*12); + printf("===== ue->frame_parms.first_carrier_offset = %i\n", ue->frame_parms.first_carrier_offset); printf("===== BWPStart = %i\n", BWPStart); printf("===== pdsch_start_rb = %i\n", pdsch_start_rb); - + printf("===== pdsch_nb_rb = %i\n", pdsch_nb_rb); //getchar(); diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 2a7c75923f..f22734462e 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2879,7 +2879,8 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC NR_MIB_t *mib, uint8_t extra_bits, uint32_t ssb_length, - uint32_t ssb_index) { + uint32_t ssb_index, + uint32_t ssb_offset_point_a) { // deafult for testing subcarrier_spacing_t scs_ssb = scs_30kHz; @@ -3234,13 +3235,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC AssertFatal(type0_PDCCH_CSS_config->n_c!=UINT_MAX,""); type0_PDCCH_CSS_config->n_0 = ((uint32_t)(big_o*pow(2, scs_pdcch)) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m))%num_slot_per_frame; - - /*printf("\nbig_o = %f\n", big_o); - printf("scs_pdcch = %u\n", scs_pdcch); - printf("ssb_index = %u\n", type0_PDCCH_CSS_config->ssb_index); - printf("big_m = %f\n", big_m); - printf("num_slot_per_frame = %u\n", num_slot_per_frame);*/ - + type0_PDCCH_CSS_config->cset_start_rb = ssb_offset_point_a - type0_PDCCH_CSS_config->rb_offset; return 0; } diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 221bf2baca..fdf559e4ba 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -146,7 +146,7 @@ typedef enum { typedef struct Type0_PDCCH_CSS_config_s { int32_t num_rbs; int32_t num_symbols; - int32_t rb_offset; + int32_t rb_offset; // Offset from SSB RB0 uint32_t type0_pdcch_ss_mux_pattern; uint16_t frame; SFN_C_TYPE sfn_c; @@ -157,6 +157,7 @@ typedef struct Type0_PDCCH_CSS_config_s { uint32_t search_space_duration; uint32_t ssb_length; uint32_t ssb_index; + uint32_t cset_start_rb; } NR_Type0_PDCCH_CSS_config_t; uint16_t config_bandwidth(int mu, int nb_rb, int nr_band); @@ -245,7 +246,8 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC NR_MIB_t *mib, uint8_t extra_bits, uint32_t ssb_length, - uint32_t ssb_index); + uint32_t ssb_index, + uint32_t ssb_offset_point_a); int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH); #endif diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 987b9881b6..aa42c471ce 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -171,8 +171,12 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t rel15->rnti = 0xFFFF; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values + //rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + //rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + + rel15->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; - rel15->BWPStart = mac->phy_config.config_req.ssb_table.ssb_offset_point_a - mac->type0_PDCCH_CSS_config.rb_offset; + rel15->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; for (int i = 0; i < rel15->num_dci_options; i++) { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 94e8048bf6..6c224064a1 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -1000,7 +1000,8 @@ int8_t nr_ue_decode_mib(module_id_t module_id, LOG_I(MAC,"ssb index(extra bits): %d\n", (int)ssb_index); #endif - get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config, mac->mib, extra_bits, ssb_length, ssb_index); + get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config, mac->mib, extra_bits, ssb_length, ssb_index, + mac->phy_config.config_req.ssb_table.ssb_offset_point_a); ssb_index = mac->type0_PDCCH_CSS_config.ssb_index; // TODO: ssb_index should obtain from L1 in case Lssb != 64 mac->type0_pdcch_ss_mux_pattern = mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern; @@ -1122,6 +1123,27 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in } */ } + + fapi_nr_dl_config_dci_dl_pdu_rel15_t dci_config_rel15 = dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; + + printf("\n===================================================\n"); + LOG_I(MAC,"rnti: %i\n", dci_config_rel15.rnti); + LOG_I(MAC,"pdcch_pdu_rel15->BWPSize: %i\n", dci_config_rel15.BWPSize); + LOG_I(MAC,"pdcch_pdu_rel15->BWPStart: %i\n", dci_config_rel15.BWPStart); + LOG_I(MAC,"pdcch_pdu_rel15->SubcarrierSpacing: %i\n", dci_config_rel15.SubcarrierSpacing); + //LOG_I(MAC,"pdcch_pdu_rel15->CyclicPrefix: %i\n", dci_config_rel15.coreset.CyclicPrefix); + LOG_I(MAC,"pdcch_pdu_rel15->StartSymbolIndex: %i\n", dci_config_rel15.coreset.StartSymbolIndex); + LOG_I(MAC,"pdcch_pdu_rel15->DurationSymbols: %i\n", dci_config_rel15.coreset.duration); + for(int n=0;n<6;n++) LOG_I(MAC,"pdcch_pdu_rel15->FreqDomainResource[%i]: %x\n",n, dci_config_rel15.coreset.frequency_domain_resource[n]); + LOG_I(MAC,"pdcch_pdu_rel15->CceRegMappingType: %i\n", dci_config_rel15.coreset.CceRegMappingType); + LOG_I(MAC,"pdcch_pdu_rel15->RegBundleSize: %i\n", dci_config_rel15.coreset.RegBundleSize); + LOG_I(MAC,"pdcch_pdu_rel15->InterleaverSize: %i\n", dci_config_rel15.coreset.InterleaverSize); + LOG_I(MAC,"pdcch_pdu_rel15->CoreSetType: %i\n", dci_config_rel15.coreset.CoreSetType); + LOG_I(MAC,"pdcch_pdu_rel15->ShiftIndex: %i\n", dci_config_rel15.coreset.ShiftIndex); + LOG_I(MAC,"pdcch_pdu_rel15->precoderGranularity: %i\n", dci_config_rel15.coreset.precoder_granularity); + LOG_I(MAC,"pdcch_pdu_rel15->numDlDci: %i\n", dl_config->number_pdus); + printf("\n===================================================\n"); + } else if (ul_info) { if (get_softmodem_params()->phy_test && ul_info->slot_tx == 8) { // ULSCH is handled only in phy-test mode (consistently with OAI gNB) @@ -2702,6 +2724,13 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, SLIV2SL(startSymbolAndLength,&S,&L); dlsch_config_pdu->start_symbol=S; dlsch_config_pdu->number_symbols=L; + + + printf("SLIV = %i\n", startSymbolAndLength); + printf("dlsch_config_pdu->start_symbol = %i\n", dlsch_config_pdu->start_symbol); + printf("dlsch_config_pdu->number_symbols = %i\n", dlsch_config_pdu->number_symbols); + + } else {// Default configuration from tables // k_offset = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0]; @@ -3227,23 +3256,17 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc */ dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti; - //fapi_nr_dl_config_dlsch_pdu_rel15_t dlsch_config_pdu_1_0 = dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; + fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; - /*dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); - dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); - dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing;*/ - - dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; - dlsch_config_pdu_1_0->BWPStart = mac->phy_config.config_req.ssb_table.ssb_offset_point_a - mac->type0_PDCCH_CSS_config.rb_offset; - dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; + dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; + dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; /* IDENTIFIER_DCI_FORMATS */ /* FREQ_DOM_RESOURCE_ASSIGNMENT_DL */ - nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_0,0,n_RB_DLBWP,dci->frequency_domain_assignment.val); - - printf("==== dlsch_config_pdu_1_0,dci->time_domain_assignment.val = %i\n", dci->time_domain_assignment.val); - + // TODO: Check if dlsch_config_pdu_1_0->BWPSize is correct + nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_0,0,dlsch_config_pdu_1_0->BWPSize,dci->frequency_domain_assignment.val); /* TIME_DOM_RESOURCE_ASSIGNMENT */ if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val) < 0) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 15ba0c8a8d..c3cf4915a1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -164,7 +164,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ gNB_xtra_byte |= ((gNB->pbch.pbch_a >> (31 - i)) & 1) << (7 - i); } get_type0_PDCCH_CSS_config_parameters(&gNB_mac->type0_PDCCH_CSS_config, mib, gNB_xtra_byte, frame_parms->Lmax, - frame_parms->ssb_index); + frame_parms->ssb_index, frame_parms->ssb_start_subcarrier/NR_NB_SC_PER_RB); } void schedule_control_sib1(module_id_t module_id, @@ -229,6 +229,7 @@ void schedule_control_sib1(module_id_t module_id, // Calculate number of symbols struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + //tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength = 53; const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; int startSymbolIndex, nrOfSymbols; SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); @@ -245,11 +246,14 @@ void schedule_control_sib1(module_id_t module_id, rbSize, nrOfSymbols, N_PRB_DMRS,0, 0,1) >> 3; } while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes); gNB_mac->sched_ctrlCommon->rbSize = rbSize; - gNB_mac->sched_ctrlCommon->rbStart = rbStart; + + if(rbStart >= gNB_mac->type0_PDCCH_CSS_config.cset_start_rb) { + gNB_mac->sched_ctrlCommon->rbStart = rbStart - gNB_mac->type0_PDCCH_CSS_config.cset_start_rb; + } // Mark the corresponding RBs as used for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) { - vrb_map[rb + gNB_mac->sched_ctrlCommon->rbStart] = 1; + vrb_map[rb + rbStart] = 1; } } @@ -303,7 +307,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; pdsch_pdu_rel15->nrOfLayers = 1; pdsch_pdu_rel15->transmissionScheme = 0; - pdsch_pdu_rel15->refPoint = 0; // Point A + pdsch_pdu_rel15->refPoint = 0; // Point A FIXME 1 pdsch_pdu_rel15->dmrsConfigType = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; pdsch_pdu_rel15->SCID = 0; @@ -312,7 +316,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->resourceAlloc = 1; pdsch_pdu_rel15->rbStart = gNB_mac->sched_ctrlCommon->rbStart; pdsch_pdu_rel15->rbSize = gNB_mac->sched_ctrlCommon->rbSize; - pdsch_pdu_rel15->VRBtoPRBMapping = 0; + pdsch_pdu_rel15->VRBtoPRBMapping = 1; // FIXME 0 pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx); pdsch_pdu_rel15->TBSize[0] = TBS; pdsch_pdu_rel15->mcsTable[0] = gNB_mac->sched_ctrlCommon->mcsTableIdx; @@ -321,6 +325,10 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, pdsch_pdu_rel15->NrOfSymbols); + + printf("oooo scc->dmrs_TypeA_Position = %li\n", scc->dmrs_TypeA_Position); + + dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET]; memset(dci_pdu_rel15, 0, sizeof(dci_pdu_rel15_t) * MAX_DCI_CORESET); @@ -332,10 +340,11 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->rbStart, NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275)); + printf("==== pdsch_pdu_rel15->rbSize = %i\n", pdsch_pdu_rel15->rbSize); printf("==== pdsch_pdu_rel15->rbStart = %i\n", pdsch_pdu_rel15->rbStart); printf("==== BW = %i\n", NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275)); - + printf("==== RIV = %i\n", dci_pdu_rel15[0].frequency_domain_assignment.val); dci_pdu_rel15[0].time_domain_assignment.val = gNB_mac->sched_ctrlCommon->time_domain_allocation; @@ -369,6 +378,24 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, fill_dci_pdu_rel15(scc,secondaryCellGroup,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types,pdsch_pdu_rel15->BWPSize,gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id); dl_req->nPDUs += 2; + + printf("\n===================================================\n"); + LOG_I(MAC,"pdcch_pdu_rel15->BWPSize: %i\n", pdcch_pdu_rel15->BWPSize); + LOG_I(MAC,"pdcch_pdu_rel15->BWPStart: %i\n", pdcch_pdu_rel15->BWPStart); + LOG_I(MAC,"pdcch_pdu_rel15->SubcarrierSpacing: %i\n", pdcch_pdu_rel15->SubcarrierSpacing); + LOG_I(MAC,"pdcch_pdu_rel15->CyclicPrefix: %i\n", pdcch_pdu_rel15->CyclicPrefix); + LOG_I(MAC,"pdcch_pdu_rel15->StartSymbolIndex: %i\n", pdcch_pdu_rel15->StartSymbolIndex); + LOG_I(MAC,"pdcch_pdu_rel15->DurationSymbols: %i\n", pdcch_pdu_rel15->DurationSymbols); + for(int n=0;n<6;n++) LOG_I(MAC,"pdcch_pdu_rel15->FreqDomainResource[%i]: %x\n",n, pdcch_pdu_rel15->FreqDomainResource[n]); + LOG_I(MAC,"pdcch_pdu_rel15->CceRegMappingType: %i\n", pdcch_pdu_rel15->CceRegMappingType); + LOG_I(MAC,"pdcch_pdu_rel15->RegBundleSize: %i\n", pdcch_pdu_rel15->RegBundleSize); + LOG_I(MAC,"pdcch_pdu_rel15->InterleaverSize: %i\n", pdcch_pdu_rel15->InterleaverSize); + LOG_I(MAC,"pdcch_pdu_rel15->CoreSetType: %i\n", pdcch_pdu_rel15->CoreSetType); + LOG_I(MAC,"pdcch_pdu_rel15->ShiftIndex: %i\n", pdcch_pdu_rel15->ShiftIndex); + LOG_I(MAC,"pdcch_pdu_rel15->precoderGranularity: %i\n", pdcch_pdu_rel15->precoderGranularity); + LOG_I(MAC,"pdcch_pdu_rel15->numDlDci: %i\n", pdcch_pdu_rel15->numDlDci); + printf("\n===================================================\n"); + } void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { @@ -401,9 +428,14 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) // Calculate number of symbols int startSymbolIndex, nrOfSymbols; struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + //tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength = 53; const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + printf("oooo SLIV = %i\n", startSymbolAndLength); + printf("oooo startSymbolIndex = %i\n", startSymbolIndex); + printf("oooo nrOfSymbols = %i\n", nrOfSymbols); + //startSymbolIndex = 3; //nrOfSymbols = 12; From aa676235a3a5cf7de152d832aa22733f4c8d9bbd Mon Sep 17 00:00:00 2001 From: rmagueta Date: Fri, 13 Nov 2020 18:56:32 +0000 Subject: [PATCH 018/160] Minor fixes on used BWP of coreset0. --- .../gnb.band78.tm1.106PRB.usrpn300.conf | 2 +- openair1/PHY/NR_TRANSPORT/nr_dci.c | 7 +++- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 3 +- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 6 --- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 2 +- .../NR_MAC_UE/nr_ue_dci_configuration.c | 21 +++++++--- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 38 ++++++++++++++++--- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 2 +- 8 files changed, 59 insertions(+), 22 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index 35e2a093ee..2d60527bd0 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -53,7 +53,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 12956; #12925; 12956 28875 + initialDLBWPlocationAndBandwidth = 12956; #12925; 12956 28875 6366 # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index f358b6994c..a1ee83aab9 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -31,6 +31,7 @@ */ #include +#include #include "nr_dci.h" #include "nr_dlsch.h" #include "nr_sch_dmrs.h" @@ -87,7 +88,11 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset); cset_start_sc = frame_parms.first_carrier_offset + rb_offset*NR_NB_SC_PER_RB; if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1) { - cset_start_sc = cset_start_sc + RC.nrmac[gNB->Mod_id]->type0_PDCCH_CSS_config.cset_start_rb*NR_NB_SC_PER_RB; + // cset_start_sc = cset_start_sc + RC.nrmac[gNB->Mod_id]->type0_PDCCH_CSS_config.cset_start_rb*NR_NB_SC_PER_RB; + + gNB_MAC_INST *gNB_mac = RC.nrmac[gNB->Mod_id]; + int BWPStart = NRRIV2PRBOFFSET(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); + cset_start_sc = cset_start_sc + BWPStart*NR_NB_SC_PER_RB; } printf("==== cset_start_sc = %i\n", cset_start_sc); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 2e6ed40a9d..29995fd859 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -269,8 +269,9 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, /// Resource mapping // Non interleaved VRB to PRB mapping - uint16_t start_sc = frame_parms->first_carrier_offset + (rel15->rbStart+rel15->BWPStart)*NR_NB_SC_PER_RB; + /*uint16_t start_sc = frame_parms->first_carrier_offset + (rel15->rbStart+rel15->BWPStart)*NR_NB_SC_PER_RB;*/ + uint16_t start_sc = frame_parms->first_carrier_offset + rel15->rbStart*NR_NB_SC_PER_RB; printf(">>>> start_sc = %i\n", start_sc); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index e45f64b174..0cbb11d728 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -303,9 +303,6 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, pilots = ((1<dlDmrsSymbPos)>0 ? 1 : 0; if (frame_parms->nb_antenna_ports_gNB>1 && beamforming_mode==0) { - - printf("=== 1\n"); - #ifdef DEBUG_DLSCH_MOD LOG_I(PHY,"dlsch: using pmi %x (%p)\n",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),dlsch[0]); #endif @@ -335,9 +332,6 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #endif if (rx_type >= rx_IC_single_stream) { - - printf("=== 2\n"); - if (eNB_id_in_connected_eNB) // we are in TM5 nb_rb = nr_dlsch_extract_rbs_dual(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[nr_tti_rx]].rxdataF, pdsch_vars[eNB_id]->dl_ch_estimates, diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 4f6009a30e..8b5a65b605 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -733,7 +733,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ nr_tti_rx, 0 /*p*/, m, - ue->frame_parms.first_carrier_offset+(BWPStart + pdsch_start_rb)*12, + ue->frame_parms.first_carrier_offset+pdsch_start_rb*12, pdsch_nb_rb); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index aa42c471ce..8e0ca905cc 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -171,14 +171,23 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t rel15->rnti = 0xFFFF; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values - //rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); - //rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); - - - rel15->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; - rel15->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; + rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + //rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, 275); + //rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275); + //rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing; + + //rel15->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; + //rel15->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; + //rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + + printf("nr_ue_dci_configuration: rnti = %i\n", rel15->rnti); + printf("nr_ue_dci_configuration: BWPSize = %i\n", rel15->BWPSize); + printf("nr_ue_dci_configuration: BWPStart = %i\n", rel15->BWPStart); + printf("nr_ue_dci_configuration: SubcarrierSpacing = %i\n", rel15->SubcarrierSpacing); + for (int i = 0; i < rel15->num_dci_options; i++) { rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0); } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 6c224064a1..2aadd0c684 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -1126,7 +1126,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in fapi_nr_dl_config_dci_dl_pdu_rel15_t dci_config_rel15 = dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; - printf("\n===================================================\n"); + /*printf("\n===================================================\n"); LOG_I(MAC,"rnti: %i\n", dci_config_rel15.rnti); LOG_I(MAC,"pdcch_pdu_rel15->BWPSize: %i\n", dci_config_rel15.BWPSize); LOG_I(MAC,"pdcch_pdu_rel15->BWPStart: %i\n", dci_config_rel15.BWPStart); @@ -1142,7 +1142,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in LOG_I(MAC,"pdcch_pdu_rel15->ShiftIndex: %i\n", dci_config_rel15.coreset.ShiftIndex); LOG_I(MAC,"pdcch_pdu_rel15->precoderGranularity: %i\n", dci_config_rel15.coreset.precoder_granularity); LOG_I(MAC,"pdcch_pdu_rel15->numDlDci: %i\n", dl_config->number_pdus); - printf("\n===================================================\n"); + printf("\n===================================================\n");*/ } else if (ul_info) { @@ -2561,6 +2561,14 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *p dlsch_config_pdu->number_rbs = NRRIV2BW(riv,n_RB_DLBWP); dlsch_config_pdu->start_rb = NRRIV2PRBOFFSET(riv,n_RB_DLBWP); + + printf("nr_ue_process_dci_freq_dom_resource_assignment: riv = %i\n", riv); + printf("nr_ue_process_dci_freq_dom_resource_assignment: n_RB_DLBWP = %i\n", n_RB_DLBWP); + printf("nr_ue_process_dci_freq_dom_resource_assignment: dlsch_config_pdu->number_rbs = %i\n", dlsch_config_pdu->number_rbs); + printf("nr_ue_process_dci_freq_dom_resource_assignment: dlsch_config_pdu->start_rb = %i\n", dlsch_config_pdu->start_rb); + + + } if(pusch_config_pdu != NULL){ /* @@ -3259,14 +3267,31 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; - dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; - dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; + NR_ServingCellConfigCommon_t *scc = mac->scc; + NR_BWP_DownlinkCommon_t *initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP; + + dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + //dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); + //dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); + //dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; + + //dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; + //dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; + //dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + + printf("nr_ue_procedures: rnti = %i\n", rnti); + printf("nr_ue_procedures: BWPSize = %i\n", dlsch_config_pdu_1_0->BWPSize); + printf("nr_ue_procedures: BWPStart = %i\n", dlsch_config_pdu_1_0->BWPStart); + printf("nr_ue_procedures: SubcarrierSpacing = %i\n", dlsch_config_pdu_1_0->SubcarrierSpacing); + /* IDENTIFIER_DCI_FORMATS */ /* FREQ_DOM_RESOURCE_ASSIGNMENT_DL */ // TODO: Check if dlsch_config_pdu_1_0->BWPSize is correct nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_0,0,dlsch_config_pdu_1_0->BWPSize,dci->frequency_domain_assignment.val); + //nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_0,0,n_RB_DLBWP,dci->frequency_domain_assignment.val); /* TIME_DOM_RESOURCE_ASSIGNMENT */ if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val) < 0) @@ -3638,6 +3663,9 @@ void nr_ue_send_sdu(module_id_t module_idP, // N_RB configuration according to 7.3.1.0 (DCI size alignment) of TS 38.212 int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){ + fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; + fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; + int N_RB = 0, start_RB; switch(rnti_type) { case NR_RNTI_RA: @@ -3654,7 +3682,7 @@ int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){ } break; case NR_RNTI_SI: - N_RB = mac->type0_PDCCH_CSS_config.num_rbs; + N_RB = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); break; case NR_RNTI_C: N_RB = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, 275); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index dfac2447e0..7dc7b1dbdf 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -712,7 +712,7 @@ void nr_configure_pdcch(gNB_MAC_INST *nr_mac, } else{ pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; } - + //precoderGranularity pdcch_pdu->precoderGranularity = coreset->precoderGranularity; From 461406ab01758de7823d2317b57b11f8686c3aac Mon Sep 17 00:00:00 2001 From: rmagueta Date: Sat, 14 Nov 2020 14:51:32 +0000 Subject: [PATCH 019/160] Coreset0 / SIB1 configured using the configuration file. --- openair1/PHY/MODULATION/slot_fep_nr.c | 2 +- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 8 ++-- .../nr_dl_channel_estimation.c | 7 ++-- openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h | 1 + .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 2 + .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 9 +---- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 31 ++++++--------- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 37 ++++-------------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 39 ++++++++----------- 9 files changed, 49 insertions(+), 87 deletions(-) diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c index 2ffdb013a5..0cd307550d 100644 --- a/openair1/PHY/MODULATION/slot_fep_nr.c +++ b/openair1/PHY/MODULATION/slot_fep_nr.c @@ -211,7 +211,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, (int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], frame_parms->ofdm_symbol_size, 15); - + } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 29995fd859..69f5d20d05 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -269,11 +269,13 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, /// Resource mapping // Non interleaved VRB to PRB mapping - /*uint16_t start_sc = frame_parms->first_carrier_offset + (rel15->rbStart+rel15->BWPStart)*NR_NB_SC_PER_RB;*/ + uint16_t start_sc = frame_parms->first_carrier_offset + (rel15->rbStart+rel15->BWPStart)*NR_NB_SC_PER_RB; - uint16_t start_sc = frame_parms->first_carrier_offset + rel15->rbStart*NR_NB_SC_PER_RB; - printf(">>>> start_sc = %i\n", start_sc); + printf("nr_dlsch: rel15->BWPStart = %i\n", rel15->BWPStart); + printf("nr_dlsch: rel15->rbStart = %i\n", rel15->rbStart); + printf("nr_dlsch: frame_parms->first_carrier_offset = %i\n", frame_parms->first_carrier_offset); + printf("nr_dlsch: start_sc = %i\n", start_sc); if (start_sc >= frame_parms->ofdm_symbol_size) diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index 40730b9664..b3819e4d2f 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -645,6 +645,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, unsigned char Ns, unsigned short p, unsigned char symbol, + unsigned short BWPStart, unsigned short bwp_start_subcarrier, unsigned short nb_rb_pdsch) { @@ -715,7 +716,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, // generate pilot - uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12; + uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12 - BWPStart; int config_type = 0; // needs to be updated from higher layer nr_pdsch_dmrs_rx(ue,Ns,ue->nr_gold_pdsch[eNB_offset][Ns][0], &pilot[0],1000,0,nb_rb_pdsch+rb_offset); @@ -868,7 +869,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, dl_ch, 8); //} - + // check if PRB crosses DC and improve estimates around DC if ((bwp_start_subcarrier < ue->frame_parms.ofdm_symbol_size) && (bwp_start_subcarrier+nb_rb_pdsch*12 >= ue->frame_parms.ofdm_symbol_size)) { dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset]; @@ -931,7 +932,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, } printf("%d\n",idxP); } -#endif +#endif } return(0); diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h index 892c6b7692..824e752235 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h @@ -69,6 +69,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, unsigned char Ns, unsigned short p, unsigned char symbol, + unsigned short BWPStart, unsigned short bwp_start_subcarrier, unsigned short nb_rb_pdsch); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index f3485b0885..38272d3e85 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -605,6 +605,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ret = 1 + dlsch->max_ldpc_iterations; } + getchar(); + nb_total_decod++; if (no_iteration_ldpc > dlsch->max_ldpc_iterations){ nb_error_decod++; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 0cbb11d728..14282ed5dc 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -373,7 +373,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, pdsch_vars[eNB_id]->pmi_ext, symbol, pilots, - start_rb, + start_rb + dlsch0_harq->BWPStart, nb_rb_pdsch, nr_tti_rx, ue->high_speed_flag, @@ -1019,7 +1019,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, return(-1); break; } - } + } //nr_dlsch_deinterleaving(symbol,bundle_L,(int16_t*)pllr_symbol_cw0,(int16_t*)pllr_symbol_cw0_deint, nb_rb_pdsch); @@ -2374,11 +2374,6 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, k = frame_parms->first_carrier_offset + NR_NB_SC_PER_RB*start_rb; - printf("k = %i\n", k); - printf("frame_parms->first_carrier_offset = %i\n", frame_parms->first_carrier_offset); - printf("nr_dlsch_extract_rbs_single: start_rb = %i\n", start_rb); - //getchar(); - if (high_speed_flag == 1) dl_ch0 = &dl_ch_estimates[aarx][(2*(frame_parms->ofdm_symbol_size))]; else diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 8b5a65b605..49d1a830c4 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -728,25 +728,16 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ // do channel estimation for first DMRS only for (m = s0; m < 3; m++) { if (((1<harq_processes[harq_pid]->dlDmrsSymbPos) > 0) { - nr_pdsch_channel_estimation(ue, - 0 /*eNB_id*/, - nr_tti_rx, - 0 /*p*/, - m, - ue->frame_parms.first_carrier_offset+pdsch_start_rb*12, - pdsch_nb_rb); - - - printf("===== Total = %i\n", ue->frame_parms.first_carrier_offset+(BWPStart + pdsch_start_rb)*12); - printf("===== ue->frame_parms.first_carrier_offset = %i\n", ue->frame_parms.first_carrier_offset); - printf("===== BWPStart = %i\n", BWPStart); - printf("===== pdsch_start_rb = %i\n", pdsch_start_rb); - printf("===== pdsch_nb_rb = %i\n", pdsch_nb_rb); - //getchar(); - - - LOG_D(PHY,"Channel Estimation in symbol %d\n",m); - break; + nr_pdsch_channel_estimation(ue, + 0 /*eNB_id*/, + nr_tti_rx, + 0 /*p*/, + m, + BWPStart, + ue->frame_parms.first_carrier_offset+(BWPStart+pdsch_start_rb)*12, + pdsch_nb_rb); + LOG_D(PHY,"Channel Estimation in symbol %d\n",m); + break; } } for (m = s0; m < (s1 + s0); m++) { @@ -1840,7 +1831,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, SI_PDSCH, ue->dlsch_SI[gNB_id], NULL); - + nr_ue_dlsch_procedures(ue, proc, gNB_id, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 2aadd0c684..91506d3b9d 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -1126,24 +1126,6 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in fapi_nr_dl_config_dci_dl_pdu_rel15_t dci_config_rel15 = dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; - /*printf("\n===================================================\n"); - LOG_I(MAC,"rnti: %i\n", dci_config_rel15.rnti); - LOG_I(MAC,"pdcch_pdu_rel15->BWPSize: %i\n", dci_config_rel15.BWPSize); - LOG_I(MAC,"pdcch_pdu_rel15->BWPStart: %i\n", dci_config_rel15.BWPStart); - LOG_I(MAC,"pdcch_pdu_rel15->SubcarrierSpacing: %i\n", dci_config_rel15.SubcarrierSpacing); - //LOG_I(MAC,"pdcch_pdu_rel15->CyclicPrefix: %i\n", dci_config_rel15.coreset.CyclicPrefix); - LOG_I(MAC,"pdcch_pdu_rel15->StartSymbolIndex: %i\n", dci_config_rel15.coreset.StartSymbolIndex); - LOG_I(MAC,"pdcch_pdu_rel15->DurationSymbols: %i\n", dci_config_rel15.coreset.duration); - for(int n=0;n<6;n++) LOG_I(MAC,"pdcch_pdu_rel15->FreqDomainResource[%i]: %x\n",n, dci_config_rel15.coreset.frequency_domain_resource[n]); - LOG_I(MAC,"pdcch_pdu_rel15->CceRegMappingType: %i\n", dci_config_rel15.coreset.CceRegMappingType); - LOG_I(MAC,"pdcch_pdu_rel15->RegBundleSize: %i\n", dci_config_rel15.coreset.RegBundleSize); - LOG_I(MAC,"pdcch_pdu_rel15->InterleaverSize: %i\n", dci_config_rel15.coreset.InterleaverSize); - LOG_I(MAC,"pdcch_pdu_rel15->CoreSetType: %i\n", dci_config_rel15.coreset.CoreSetType); - LOG_I(MAC,"pdcch_pdu_rel15->ShiftIndex: %i\n", dci_config_rel15.coreset.ShiftIndex); - LOG_I(MAC,"pdcch_pdu_rel15->precoderGranularity: %i\n", dci_config_rel15.coreset.precoder_granularity); - LOG_I(MAC,"pdcch_pdu_rel15->numDlDci: %i\n", dl_config->number_pdus); - printf("\n===================================================\n");*/ - } else if (ul_info) { if (get_softmodem_params()->phy_test && ul_info->slot_tx == 8) { // ULSCH is handled only in phy-test mode (consistently with OAI gNB) @@ -2561,13 +2543,10 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *p dlsch_config_pdu->number_rbs = NRRIV2BW(riv,n_RB_DLBWP); dlsch_config_pdu->start_rb = NRRIV2PRBOFFSET(riv,n_RB_DLBWP); - - printf("nr_ue_process_dci_freq_dom_resource_assignment: riv = %i\n", riv); - printf("nr_ue_process_dci_freq_dom_resource_assignment: n_RB_DLBWP = %i\n", n_RB_DLBWP); - printf("nr_ue_process_dci_freq_dom_resource_assignment: dlsch_config_pdu->number_rbs = %i\n", dlsch_config_pdu->number_rbs); - printf("nr_ue_process_dci_freq_dom_resource_assignment: dlsch_config_pdu->start_rb = %i\n", dlsch_config_pdu->start_rb); - - + LOG_D(MAC,"riv = %i\n", riv); + LOG_D(MAC,"n_RB_DLBWP = %i\n", n_RB_DLBWP); + LOG_D(MAC,"number_rbs = %i\n", dlsch_config_pdu->number_rbs); + LOG_D(MAC,"start_rb = %i\n", dlsch_config_pdu->start_rb); } if(pusch_config_pdu != NULL){ @@ -2733,11 +2712,9 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, dlsch_config_pdu->start_symbol=S; dlsch_config_pdu->number_symbols=L; - - printf("SLIV = %i\n", startSymbolAndLength); - printf("dlsch_config_pdu->start_symbol = %i\n", dlsch_config_pdu->start_symbol); - printf("dlsch_config_pdu->number_symbols = %i\n", dlsch_config_pdu->number_symbols); - + LOG_D(MAC,"SLIV = %i\n", startSymbolAndLength); + LOG_D(MAC,"start_symbol = %i\n", dlsch_config_pdu->start_symbol); + LOG_D(MAC,"number_symbols = %i\n", dlsch_config_pdu->number_symbols); } else {// Default configuration from tables diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index c3cf4915a1..e6b4e117ae 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -307,7 +307,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; pdsch_pdu_rel15->nrOfLayers = 1; pdsch_pdu_rel15->transmissionScheme = 0; - pdsch_pdu_rel15->refPoint = 0; // Point A FIXME 1 + pdsch_pdu_rel15->refPoint = 1; pdsch_pdu_rel15->dmrsConfigType = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; pdsch_pdu_rel15->SCID = 0; @@ -316,7 +316,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->resourceAlloc = 1; pdsch_pdu_rel15->rbStart = gNB_mac->sched_ctrlCommon->rbStart; pdsch_pdu_rel15->rbSize = gNB_mac->sched_ctrlCommon->rbSize; - pdsch_pdu_rel15->VRBtoPRBMapping = 1; // FIXME 0 + pdsch_pdu_rel15->VRBtoPRBMapping = 0; pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx); pdsch_pdu_rel15->TBSize[0] = TBS; pdsch_pdu_rel15->mcsTable[0] = gNB_mac->sched_ctrlCommon->mcsTableIdx; @@ -325,10 +325,6 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, pdsch_pdu_rel15->NrOfSymbols); - - printf("oooo scc->dmrs_TypeA_Position = %li\n", scc->dmrs_TypeA_Position); - - dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET]; memset(dci_pdu_rel15, 0, sizeof(dci_pdu_rel15_t) * MAX_DCI_CORESET); @@ -346,7 +342,6 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, printf("==== BW = %i\n", NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275)); printf("==== RIV = %i\n", dci_pdu_rel15[0].frequency_domain_assignment.val); - dci_pdu_rel15[0].time_domain_assignment.val = gNB_mac->sched_ctrlCommon->time_domain_allocation; dci_pdu_rel15[0].mcs = gNB_mac->sched_ctrlCommon->mcs; dci_pdu_rel15[0].rv = pdsch_pdu_rel15->rvIndex[0]; @@ -379,22 +374,20 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, dl_req->nPDUs += 2; - printf("\n===================================================\n"); - LOG_I(MAC,"pdcch_pdu_rel15->BWPSize: %i\n", pdcch_pdu_rel15->BWPSize); - LOG_I(MAC,"pdcch_pdu_rel15->BWPStart: %i\n", pdcch_pdu_rel15->BWPStart); - LOG_I(MAC,"pdcch_pdu_rel15->SubcarrierSpacing: %i\n", pdcch_pdu_rel15->SubcarrierSpacing); - LOG_I(MAC,"pdcch_pdu_rel15->CyclicPrefix: %i\n", pdcch_pdu_rel15->CyclicPrefix); - LOG_I(MAC,"pdcch_pdu_rel15->StartSymbolIndex: %i\n", pdcch_pdu_rel15->StartSymbolIndex); - LOG_I(MAC,"pdcch_pdu_rel15->DurationSymbols: %i\n", pdcch_pdu_rel15->DurationSymbols); - for(int n=0;n<6;n++) LOG_I(MAC,"pdcch_pdu_rel15->FreqDomainResource[%i]: %x\n",n, pdcch_pdu_rel15->FreqDomainResource[n]); - LOG_I(MAC,"pdcch_pdu_rel15->CceRegMappingType: %i\n", pdcch_pdu_rel15->CceRegMappingType); - LOG_I(MAC,"pdcch_pdu_rel15->RegBundleSize: %i\n", pdcch_pdu_rel15->RegBundleSize); - LOG_I(MAC,"pdcch_pdu_rel15->InterleaverSize: %i\n", pdcch_pdu_rel15->InterleaverSize); - LOG_I(MAC,"pdcch_pdu_rel15->CoreSetType: %i\n", pdcch_pdu_rel15->CoreSetType); - LOG_I(MAC,"pdcch_pdu_rel15->ShiftIndex: %i\n", pdcch_pdu_rel15->ShiftIndex); - LOG_I(MAC,"pdcch_pdu_rel15->precoderGranularity: %i\n", pdcch_pdu_rel15->precoderGranularity); - LOG_I(MAC,"pdcch_pdu_rel15->numDlDci: %i\n", pdcch_pdu_rel15->numDlDci); - printf("\n===================================================\n"); + LOG_D(MAC,"BWPSize: %i\n", pdcch_pdu_rel15->BWPSize); + LOG_D(MAC,"BWPStart: %i\n", pdcch_pdu_rel15->BWPStart); + LOG_D(MAC,"SubcarrierSpacing: %i\n", pdcch_pdu_rel15->SubcarrierSpacing); + LOG_D(MAC,"CyclicPrefix: %i\n", pdcch_pdu_rel15->CyclicPrefix); + LOG_D(MAC,"StartSymbolIndex: %i\n", pdcch_pdu_rel15->StartSymbolIndex); + LOG_D(MAC,"DurationSymbols: %i\n", pdcch_pdu_rel15->DurationSymbols); + for(int n=0;n<6;n++) LOG_I(MAC,"FreqDomainResource[%i]: %x\n",n, pdcch_pdu_rel15->FreqDomainResource[n]); + LOG_D(MAC,"CceRegMappingType: %i\n", pdcch_pdu_rel15->CceRegMappingType); + LOG_D(MAC,"RegBundleSize: %i\n", pdcch_pdu_rel15->RegBundleSize); + LOG_D(MAC,"InterleaverSize: %i\n", pdcch_pdu_rel15->InterleaverSize); + LOG_D(MAC,"CoreSetType: %i\n", pdcch_pdu_rel15->CoreSetType); + LOG_D(MAC,"ShiftIndex: %i\n", pdcch_pdu_rel15->ShiftIndex); + LOG_D(MAC,"precoderGranularity: %i\n", pdcch_pdu_rel15->precoderGranularity); + LOG_D(MAC,"numDlDci: %i\n", pdcch_pdu_rel15->numDlDci); } From 2177e83ca79a41172937408aba7d3aa94c52ebba Mon Sep 17 00:00:00 2001 From: rmagueta Date: Sat, 14 Nov 2020 23:53:23 +0000 Subject: [PATCH 020/160] Coreset0 / SIB1 configured using the computed BWP considering the 3GPP. --- .../gnb.band78.tm1.106PRB.usrpn300.conf | 12 +- openair1/PHY/NR_TRANSPORT/nr_dci.c | 11 +- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 6 - .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 2 - openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 243 +++++++----------- openair2/LAYER2/NR_MAC_UE/config_ue.c | 3 +- .../NR_MAC_UE/nr_ue_dci_configuration.c | 18 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 57 ++-- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 60 +---- openair2/RRC/NR/nr_rrc_proto.h | 2 +- openair2/RRC/NR/rrc_gNB_reconfig.c | 5 +- 11 files changed, 149 insertions(+), 270 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index 2d60527bd0..0fd0a5340f 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -53,7 +53,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 12956; #12925; 12956 28875 6366 + initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -66,17 +66,17 @@ gNBs = #initialULBWPmappingType #0=typeA,1=typeB initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_0 = 53; initialDLBWPk0_1 = 0; initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_1 = 40; initialDLBWPk0_2 = 0; initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 + #this is SS=1,L=12 initialDLBWPstartSymbolAndLength_2 = 54; initialDLBWPk0_3 = 0; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index a1ee83aab9..f09f9ca890 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -88,18 +88,9 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset); cset_start_sc = frame_parms.first_carrier_offset + rb_offset*NR_NB_SC_PER_RB; if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1) { - // cset_start_sc = cset_start_sc + RC.nrmac[gNB->Mod_id]->type0_PDCCH_CSS_config.cset_start_rb*NR_NB_SC_PER_RB; - - gNB_MAC_INST *gNB_mac = RC.nrmac[gNB->Mod_id]; - int BWPStart = NRRIV2PRBOFFSET(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); - cset_start_sc = cset_start_sc + BWPStart*NR_NB_SC_PER_RB; + cset_start_sc = cset_start_sc + RC.nrmac[gNB->Mod_id]->type0_PDCCH_CSS_config.cset_start_rb*NR_NB_SC_PER_RB; } - printf("==== cset_start_sc = %i\n", cset_start_sc); - printf("==== frame_parms.first_carrier_offset = %i\n", frame_parms.first_carrier_offset); - printf("==== rb_offset = %i\n", rb_offset); - printf("==== RC.nrmac[gNB->Mod_id]->type0_PDCCH_CSS_config.cset_start_rb = %i\n", RC.nrmac[gNB->Mod_id]->type0_PDCCH_CSS_config.cset_start_rb); - for (int d=0;dnumDlDci;d++) { /*The coreset is initialised * in frequency: the first subcarrier is obtained by adding the first CRB overlapping the SSB and the rb_offset for coreset 0 diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 69f5d20d05..b7e59a0b42 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -272,12 +272,6 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, uint16_t start_sc = frame_parms->first_carrier_offset + (rel15->rbStart+rel15->BWPStart)*NR_NB_SC_PER_RB; - printf("nr_dlsch: rel15->BWPStart = %i\n", rel15->BWPStart); - printf("nr_dlsch: rel15->rbStart = %i\n", rel15->rbStart); - printf("nr_dlsch: frame_parms->first_carrier_offset = %i\n", frame_parms->first_carrier_offset); - printf("nr_dlsch: start_sc = %i\n", start_sc); - - if (start_sc >= frame_parms->ofdm_symbol_size) start_sc -= frame_parms->ofdm_symbol_size; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 38272d3e85..f3485b0885 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -605,8 +605,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ret = 1 + dlsch->max_ldpc_iterations; } - getchar(); - nb_total_decod++; if (no_iteration_ldpc > dlsch->max_ldpc_iterations){ nb_error_decod++; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 49d1a830c4..3aa02eb57c 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -32,6 +32,7 @@ #define _GNU_SOURCE +#include #include "assertions.h" #include "defs.h" #include "PHY/defs_nr_UE.h" @@ -1643,76 +1644,80 @@ int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, - runmode_t mode) -{ + runmode_t mode) { int frame_rx = proc->frame_rx; int nr_tti_rx = proc->nr_tti_rx; int slot_pbch; - NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][0]; + NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][0]; fapi_nr_config_request_t *cfg = &ue->nrUE_config; + NR_UE_MAC_INST_t *mac = get_mac_inst(ue->Mod_id); + fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; + uint8_t nb_symb_pdcch = pdcch_vars->nb_search_space > 0 ? pdcch_vars->pdcch_config[0].coreset.duration : 0; uint8_t dci_cnt = 0; NR_DL_FRAME_PARMS *fp = &ue->frame_parms; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN); - LOG_D(PHY," ****** start RX-Chain for Frame.Slot %d.%d ****** \n", frame_rx%1024, nr_tti_rx); + LOG_D(PHY, " ****** start RX-Chain for Frame.Slot %d.%d ****** \n", frame_rx % 1024, nr_tti_rx); /* uint8_t next1_thread_id = ue->current_thread_id[nr_tti_rx]== (RX_NB_TH-1) ? 0:(ue->current_thread_id[nr_tti_rx]+1); uint8_t next2_thread_id = next1_thread_id== (RX_NB_TH-1) ? 0:(next1_thread_id+1); */ - int coreset_nb_rb=0; - int coreset_start_rb=0; + int coreset_nb_rb = 0; + int coreset_start_rb = 0; if (pdcch_vars->nb_search_space > 0) - get_coreset_rballoc(pdcch_vars->pdcch_config[0].coreset.frequency_domain_resource,&coreset_nb_rb,&coreset_start_rb); + get_coreset_rballoc(pdcch_vars->pdcch_config[0].coreset.frequency_domain_resource, &coreset_nb_rb, + &coreset_start_rb); slot_pbch = is_pbch_in_slot(cfg, frame_rx, nr_tti_rx, fp); // looking for pbch only in slot where it is supposed to be - if ((ue->decode_MIB == 1) && slot_pbch) - { - LOG_D(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_tti_rx); - for (int i=1; i<4; i++) { + if ((ue->decode_MIB == 1) && slot_pbch) { + LOG_D(PHY, " ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx % 1024, nr_tti_rx); + for (int i = 1; i < 4; i++) { - nr_slot_fep(ue, - (ue->symbol_offset+i)%(fp->symbols_per_slot), - nr_tti_rx, - 0, - 0); + nr_slot_fep(ue, + (ue->symbol_offset + i) % (fp->symbols_per_slot), + nr_tti_rx, + 0, + 0); #if UE_TIMING_TRACE - start_meas(&ue->dlsch_channel_estimation_stats); + start_meas(&ue->dlsch_channel_estimation_stats); #endif - nr_pbch_channel_estimation(ue,0,nr_tti_rx,(ue->symbol_offset+i)%(fp->symbols_per_slot),i-1,(fp->ssb_index)&7,fp->half_frame_bit); + nr_pbch_channel_estimation(ue, 0, nr_tti_rx, (ue->symbol_offset + i) % (fp->symbols_per_slot), i - 1, + (fp->ssb_index) & 7, fp->half_frame_bit); #if UE_TIMING_TRACE - stop_meas(&ue->dlsch_channel_estimation_stats); + stop_meas(&ue->dlsch_channel_estimation_stats); #endif - - } - nr_ue_pbch_procedures(gNB_id, ue, proc, 0); - if (ue->no_timing_correction==0) { - LOG_D(PHY,"start adjust sync slot = %d no timing %d\n", nr_tti_rx, ue->no_timing_correction); - nr_adjust_synch_ue(fp, - ue, - gNB_id, - frame_rx, - nr_tti_rx, - 0, - 16384); - } } + nr_ue_pbch_procedures(gNB_id, ue, proc, 0); + + if (ue->no_timing_correction == 0) { + LOG_D(PHY, "start adjust sync slot = %d no timing %d\n", nr_tti_rx, ue->no_timing_correction); + nr_adjust_synch_ue(fp, + ue, + gNB_id, + frame_rx, + nr_tti_rx, + 0, + 16384); + } + } #ifdef NR_PDCCH_SCHED nr_gold_pdcch(ue, 0, 2); - LOG_D(PHY," ------ --> PDCCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_tti_rx); - for (uint16_t l=0; l PDCCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx % 1024, nr_tti_rx); + + for (uint16_t l = 0; l < nb_symb_pdcch; l++) { + #if UE_TIMING_TRACE start_meas(&ue->ofdm_demod_stats); #endif @@ -1725,28 +1730,30 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15; + dci_cnt = 0; for(int n_ss = 0; n_ssnb_search_space; n_ss++) { - // note: this only works if RBs for PDCCH are contigous! - LOG_D(PHY,"pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d\n", - fp->first_carrier_offset,pdcch_vars->pdcch_config[n_ss].BWPStart,coreset_start_rb); + // note: this only works if RBs for PDCCH are contigous! + LOG_D(PHY, "pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d\n", + fp->first_carrier_offset, pdcch_vars->pdcch_config[n_ss].BWPStart, coreset_start_rb); - rel15 = &pdcch_vars->pdcch_config[n_ss]; + rel15 = &pdcch_vars->pdcch_config[n_ss]; - if (coreset_nb_rb > 0) - nr_pdcch_channel_estimation(ue, - 0, - nr_tti_rx, - l, - fp->first_carrier_offset+(pdcch_vars->pdcch_config[n_ss].BWPStart + coreset_start_rb)*12, - coreset_nb_rb); + if (coreset_nb_rb > 0) + nr_pdcch_channel_estimation(ue, + 0, + nr_tti_rx, + l, + fp->first_carrier_offset + + (pdcch_vars->pdcch_config[n_ss].BWPStart + coreset_start_rb) * 12, + coreset_nb_rb); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); - #if UE_TIMING_TRACE - stop_meas(&ue->ofdm_demod_stats); - #endif + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); +#if UE_TIMING_TRACE + stop_meas(&ue->ofdm_demod_stats); +#endif - dci_cnt = dci_cnt + nr_ue_pdcch_procedures(gNB_id, ue, proc); + dci_cnt = dci_cnt + nr_ue_pdcch_procedures(gNB_id, ue, proc); } } @@ -1799,7 +1806,13 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // do procedures for C-RNTI int ret_pdsch = 0; if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->active == 1) { - //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); + + fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; + dlsch_config_pdu->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); + dlsch_config_pdu->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); + dlsch_config_pdu->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; + ret_pdsch = nr_ue_pdsch_procedures(ue, proc, gNB_id, @@ -1807,24 +1820,33 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0], NULL); - //printf("phy procedure pdsch start measurement\n"); + if (ret_pdsch >= 0) + nr_ue_dlsch_procedures(ue, + proc, + gNB_id, + PDSCH, + ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0], + ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][1], + &ue->dlsch_errors[gNB_id], + mode); + nr_ue_measurement_procedures(2,ue,proc,gNB_id,nr_tti_rx,mode); - /* - write_output("rxF.m","rxF",&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[nr_tti_rx]].rxdataF[0][0],fp->ofdm_symbol_size*14,1,1); - write_output("rxF_ch.m","rxFch",&ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->dl_ch_estimates[0][0],fp->ofdm_symbol_size*14,1,1); - write_output("rxF_ch_ext.m","rxFche",&ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->dl_ch_estimates_ext[0][2*50*12],50*12,1,1); - write_output("rxF_ext.m","rxFe",&ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->rxdataF_ext[0][0],50*12*14,1,1); - write_output("rxF_comp.m","rxFc",&ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->rxdataF_comp0[0][0],fp->N_RB_DL*12*14,1,1); - write_output("rxF_llr.m","rxFllr",ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->llr[0],(nb_symb_sch-1)*50*12+50*6,1,0); - */ + // deactivate dlsch once dlsch proc is done + ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->active = 0; - //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); } // do procedures for SI-RNTI if ((ue->dlsch_SI[gNB_id]) && (ue->dlsch_SI[gNB_id]->active == 1)) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_IN); + + fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; + dlsch_config_pdu->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; + dlsch_config_pdu->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; + dlsch_config_pdu->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + nr_ue_pdsch_procedures(ue, proc, gNB_id, @@ -1859,6 +1881,12 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // do procedures for P-RNTI if ((ue->dlsch_p[gNB_id]) && (ue->dlsch_p[gNB_id]->active == 1)) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_IN); + + fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; + dlsch_config_pdu->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); + dlsch_config_pdu->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); + dlsch_config_pdu->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; + nr_ue_pdsch_procedures(ue, proc, gNB_id, @@ -1884,6 +1912,12 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // do procedures for RA-RNTI if ((ue->dlsch_ra[gNB_id]) && (ue->dlsch_ra[gNB_id]->active == 1)) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_IN); + + fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; + dlsch_config_pdu->BWPSize = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + dlsch_config_pdu->BWPStart = NRRIV2PRBOFFSET(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + dlsch_config_pdu->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + nr_ue_pdsch_procedures(ue, proc, gNB_id, @@ -1905,46 +1939,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_OUT); } - - // do procedures for C-RNTI - if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->active == 1) { - LOG_D(PHY, "DLSCH data reception at nr_tti_rx: %d \n \n", nr_tti_rx); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); - -#if UE_TIMING_TRACE - start_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]]); -#endif - - if (ret_pdsch >= 0) - nr_ue_dlsch_procedures(ue, - proc, - gNB_id, - PDSCH, - ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0], - ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][1], - &ue->dlsch_errors[gNB_id], - mode); - - -#if UE_TIMING_TRACE - stop_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]]); -#if DISABLE_LOG_X - printf("[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_tti_rx,ue->pdsch_procedures_stat[ue->current_thread_id[nr_tti_rx]].p_time/(cpuf*1000.0)); - printf("[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_tti_rx,ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]].p_time/(cpuf*1000.0)); -#else - LOG_D(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_tti_rx,ue->pdsch_procedures_stat[ue->current_thread_id[nr_tti_rx]].p_time/(cpuf*1000.0)); - LOG_D(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_tti_rx,ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]].p_time/(cpuf*1000.0)); -#endif - -#endif - - // deactivate dlsch once dlsch proc is done - ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->active = 0; - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); - - } #if UE_TIMING_TRACE start_meas(&ue->generic_stat); #endif @@ -1970,48 +1965,6 @@ start_meas(&ue->generic_stat); } #endif - // do procedures for P-RNTI - if ((ue->dlsch_p[gNB_id]) && (ue->dlsch_p[gNB_id]->active == 1)) { - nr_ue_pdsch_procedures(ue, - proc, - gNB_id, - P_PDSCH, - ue->dlsch_p[gNB_id], - NULL); - - - /*ue_dlsch_procedures(ue, - proc, - gNB_id, - P_PDSCH, - ue->dlsch_p[gNB_id], - NULL, - &ue->dlsch_p_errors[gNB_id], - mode, - abstraction_flag);*/ - ue->dlsch_p[gNB_id]->active = 0; - } - // do procedures for RA-RNTI - if ((ue->dlsch_ra[gNB_id]) && (ue->dlsch_ra[gNB_id]->active == 1)) { - nr_ue_pdsch_procedures(ue, - proc, - gNB_id, - RA_PDSCH, - ue->dlsch_ra[gNB_id], - NULL); - - /*ue_dlsch_procedures(ue, - proc, - gNB_id, - RA_PDSCH, - ue->dlsch_ra[gNB_id], - NULL, - &ue->dlsch_ra_errors[gNB_id], - mode, - abstraction_flag);*/ - ue->dlsch_ra[gNB_id]->active = 0; - } - // duplicate harq structure /* uint8_t current_harq_pid = ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->current_harq_pid; @@ -2078,6 +2031,10 @@ LOG_D(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",nr_tti_rx,ue->phy_proc_ //#endif //pdsch LOG_D(PHY," ****** end RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, nr_tti_rx); + + // } + + return (0); } diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 84a04fb615..bc9de870de 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -443,10 +443,9 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ mac->coreset0->frequencyDomainResources.size = 6; mac->coreset0->frequencyDomainResources.bits_unused = 3; mac->coreset0->duration = 1; - //mac->coreset0->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved; // FIXME: Interleaved mac->coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*mac->coreset0->cce_REG_MappingType.choice.interleaved)); mac->coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; - mac->coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = 0; //scc->physCellId; + mac->coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = 0; // FIXME: mac->scc->physCellId; mac->coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; if(mac->coreset0->tci_StatesPDCCH_ToAddList == NULL) mac->coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*mac->coreset0->tci_StatesPDCCH_ToAddList)); NR_TCI_StateId_t *tci[8]; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 8e0ca905cc..b1c8ce5b35 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -170,24 +170,10 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); rel15->rnti = 0xFFFF; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values - - rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); - rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + rel15->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; + rel15->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; - //rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, 275); - //rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, 275); - //rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing; - - //rel15->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; - //rel15->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; - //rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; - - printf("nr_ue_dci_configuration: rnti = %i\n", rel15->rnti); - printf("nr_ue_dci_configuration: BWPSize = %i\n", rel15->BWPSize); - printf("nr_ue_dci_configuration: BWPStart = %i\n", rel15->BWPStart); - printf("nr_ue_dci_configuration: SubcarrierSpacing = %i\n", rel15->SubcarrierSpacing); - for (int i = 0; i < rel15->num_dci_options; i++) { rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0); } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 91506d3b9d..fe2230389d 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2712,9 +2712,9 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, dlsch_config_pdu->start_symbol=S; dlsch_config_pdu->number_symbols=L; - LOG_D(MAC,"SLIV = %i\n", startSymbolAndLength); - LOG_D(MAC,"start_symbol = %i\n", dlsch_config_pdu->start_symbol); - LOG_D(MAC,"number_symbols = %i\n", dlsch_config_pdu->number_symbols); + LOG_I(MAC,"SLIV = %i\n", startSymbolAndLength); + LOG_I(MAC,"start_symbol = %i\n", dlsch_config_pdu->start_symbol); + LOG_I(MAC,"number_symbols = %i\n", dlsch_config_pdu->number_symbols); } else {// Default configuration from tables @@ -3247,28 +3247,28 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc NR_ServingCellConfigCommon_t *scc = mac->scc; NR_BWP_DownlinkCommon_t *initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP; - dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); - dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); - dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; - - //dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); - //dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); - //dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; - - //dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; - //dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; - //dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; - - printf("nr_ue_procedures: rnti = %i\n", rnti); - printf("nr_ue_procedures: BWPSize = %i\n", dlsch_config_pdu_1_0->BWPSize); - printf("nr_ue_procedures: BWPStart = %i\n", dlsch_config_pdu_1_0->BWPStart); - printf("nr_ue_procedures: SubcarrierSpacing = %i\n", dlsch_config_pdu_1_0->SubcarrierSpacing); + if (mac->RA_window_cnt >= 0 && rnti == mac->ra_rnti){ + dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH; + dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + } + else if(rnti == SI_RNTI) { + dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH; + dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; + dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; + dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + } + else { + dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; + dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); + dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); + dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; + } /* IDENTIFIER_DCI_FORMATS */ /* FREQ_DOM_RESOURCE_ASSIGNMENT_DL */ - // TODO: Check if dlsch_config_pdu_1_0->BWPSize is correct nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_0,0,dlsch_config_pdu_1_0->BWPSize,dci->frequency_domain_assignment.val); - //nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_0,0,n_RB_DLBWP,dci->frequency_domain_assignment.val); /* TIME_DOM_RESOURCE_ASSIGNMENT */ if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val) < 0) @@ -3349,16 +3349,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, dc dlsch_config_pdu_1_0->pucch_resource_id, dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind); - if (mac->RA_window_cnt >= 0 && rnti == mac->ra_rnti){ - dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH; - } - else if(rnti == SI_RNTI) { - dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH; - } - else { - dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; - } - // dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP = n_RB_DLBWP; LOG_D(MAC,"(nr_ue_procedures.c) pdu_type=%d\n\n",dl_config->dl_config_list[dl_config->number_pdus].pdu_type); @@ -3640,9 +3630,6 @@ void nr_ue_send_sdu(module_id_t module_idP, // N_RB configuration according to 7.3.1.0 (DCI size alignment) of TS 38.212 int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){ - fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; - fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; - int N_RB = 0, start_RB; switch(rnti_type) { case NR_RNTI_RA: @@ -3659,7 +3646,7 @@ int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){ } break; case NR_RNTI_SI: - N_RB = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + N_RB = mac->type0_PDCCH_CSS_config.num_rbs; break; case NR_RNTI_C: N_RB = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, 275); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index e6b4e117ae..bcf86b9325 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -186,13 +186,10 @@ void schedule_control_sib1(module_id_t module_id, gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset)); gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp)); fill_default_searchSpaceZero(gNB_mac->sched_ctrlCommon->search_space); - fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset); + fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset,servingcellconfigcommon); fill_default_initialDownlinkBWP(gNB_mac->sched_ctrlCommon->active_bwp,servingcellconfigcommon); } - //gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth = - // gNB_mac->secondaryCellGroupCommon->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.locationAndBandwidth; - gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation; gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx; gNB_mac->sched_ctrlCommon->mcs = mcs; @@ -215,27 +212,21 @@ void schedule_control_sib1(module_id_t module_id, return; } - const uint16_t bwpSize = NRRIV2BW(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); - int rbStart = NRRIV2PRBOFFSET(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275); - - printf("====== rel15->BWPSize = %i\n", bwpSize); - printf("====== rel15->BWPStart = %i\n", rbStart); - - // Freq-domain allocation - while (rbStart < bwpSize && vrb_map[rbStart]) rbStart++; + const uint16_t bwpSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs; + int rbStart = gNB_mac->type0_PDCCH_CSS_config.cset_start_rb; // Calculate number of PRB_DMRS uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; // Calculate number of symbols struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - //tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength = 53; const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; int startSymbolIndex, nrOfSymbols; SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); - //startSymbolIndex = 3; - //nrOfSymbols = 12; + LOG_I(MAC,"SLIV = %i\n", startSymbolAndLength); + LOG_I(MAC,"startSymbolIndex = %i\n", startSymbolIndex); + LOG_I(MAC,"nrOfSymbols = %i\n", nrOfSymbols); int rbSize = 0; uint32_t TBS = 0; @@ -246,16 +237,12 @@ void schedule_control_sib1(module_id_t module_id, rbSize, nrOfSymbols, N_PRB_DMRS,0, 0,1) >> 3; } while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes); gNB_mac->sched_ctrlCommon->rbSize = rbSize; - - if(rbStart >= gNB_mac->type0_PDCCH_CSS_config.cset_start_rb) { - gNB_mac->sched_ctrlCommon->rbStart = rbStart - gNB_mac->type0_PDCCH_CSS_config.cset_start_rb; - } + gNB_mac->sched_ctrlCommon->rbStart = 0; // Mark the corresponding RBs as used for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) { vrb_map[rb + rbStart] = 1; } - } void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, @@ -289,8 +276,9 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->rnti = SI_RNTI; pdsch_pdu_rel15->pduIndex = gNB_mac->pdu_index[0]++; - pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); - pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,275); + pdsch_pdu_rel15->BWPSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs; + pdsch_pdu_rel15->BWPStart = gNB_mac->type0_PDCCH_CSS_config.cset_start_rb; + pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; if (bwp->bwp_Common->genericParameters.cyclicPrefix) { pdsch_pdu_rel15->CyclicPrefix = *bwp->bwp_Common->genericParameters.cyclicPrefix; @@ -334,13 +322,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, dci_pdu_rel15[0].frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbStart, - NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275)); - - - printf("==== pdsch_pdu_rel15->rbSize = %i\n", pdsch_pdu_rel15->rbSize); - printf("==== pdsch_pdu_rel15->rbStart = %i\n", pdsch_pdu_rel15->rbStart); - printf("==== BW = %i\n", NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth,275)); - printf("==== RIV = %i\n", dci_pdu_rel15[0].frequency_domain_assignment.val); + gNB_mac->type0_PDCCH_CSS_config.num_rbs); dci_pdu_rel15[0].time_domain_assignment.val = gNB_mac->sched_ctrlCommon->time_domain_allocation; dci_pdu_rel15[0].mcs = gNB_mac->sched_ctrlCommon->mcs; @@ -380,7 +362,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, LOG_D(MAC,"CyclicPrefix: %i\n", pdcch_pdu_rel15->CyclicPrefix); LOG_D(MAC,"StartSymbolIndex: %i\n", pdcch_pdu_rel15->StartSymbolIndex); LOG_D(MAC,"DurationSymbols: %i\n", pdcch_pdu_rel15->DurationSymbols); - for(int n=0;n<6;n++) LOG_I(MAC,"FreqDomainResource[%i]: %x\n",n, pdcch_pdu_rel15->FreqDomainResource[n]); + for(int n=0;n<6;n++) LOG_D(MAC,"FreqDomainResource[%i]: %x\n",n, pdcch_pdu_rel15->FreqDomainResource[n]); LOG_D(MAC,"CceRegMappingType: %i\n", pdcch_pdu_rel15->CceRegMappingType); LOG_D(MAC,"RegBundleSize: %i\n", pdcch_pdu_rel15->RegBundleSize); LOG_D(MAC,"InterleaverSize: %i\n", pdcch_pdu_rel15->InterleaverSize); @@ -397,14 +379,14 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) // static values const int CC_id = 0; - int time_domain_allocation = 2; + int time_domain_allocation = 0; uint8_t mcsTableIdx = 0; uint8_t mcs = 0; uint8_t numDmrsCdmGrpsNoData = 1; gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; - if( (frameP%2 == gNB_mac->type0_PDCCH_CSS_config.sfn_c) && (slotP == gNB_mac->type0_PDCCH_CSS_config.n_0 ) ) { + if( (frameP%2 == gNB_mac->type0_PDCCH_CSS_config.sfn_c) && (slotP == gNB_mac->type0_PDCCH_CSS_config.n_0) && (gNB_mac->type0_PDCCH_CSS_config.num_rbs > 0) ) { LOG_D(MAC,"> SIB1 transmission\n"); @@ -421,17 +403,9 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) // Calculate number of symbols int startSymbolIndex, nrOfSymbols; struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - //tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength = 53; const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); - printf("oooo SLIV = %i\n", startSymbolAndLength); - printf("oooo startSymbolIndex = %i\n", startSymbolIndex); - printf("oooo nrOfSymbols = %i\n", nrOfSymbols); - - //startSymbolIndex = 3; - //nrOfSymbols = 12; - // Calculate number of PRB_DMRS uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; @@ -439,10 +413,6 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS,0 ,0 ,1 ) >> 3; - - printf("TBS = %i\n", TBS); - printf("gNB_mac->sched_ctrlCommon->rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); - nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, TBS, startSymbolIndex, nrOfSymbols); @@ -460,9 +430,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) gNB_mac->TX_req[CC_id].Number_of_PDUs++; gNB_mac->TX_req[CC_id].SFN = frameP; gNB_mac->TX_req[CC_id].Slot = slotP; - } - } diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index e24293f8e1..675ba91d79 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -73,7 +73,7 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti); void fill_default_initialDownlinkBWP(NR_BWP_Downlink_t *bwp, NR_ServingCellConfigCommon_t *servingcellconfigcommon); -void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0); +void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0, NR_ServingCellConfigCommon_t *servingcellconfigcommon); void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index cc292ab2ea..f3c33c2dd2 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -73,7 +73,7 @@ void fill_default_initialDownlinkBWP(NR_BWP_Downlink_t *bwp, NR_ServingCellConfi *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; } -void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0) { +void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0, NR_ServingCellConfigCommon_t *servingcellconfigcommon) { coreset0->controlResourceSetId = 0; @@ -88,10 +88,9 @@ void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0) { coreset0->frequencyDomainResources.size = 6; coreset0->frequencyDomainResources.bits_unused = 3; coreset0->duration = 1; - //coreset0->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved; // FIXME: Interleaved coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset0->cce_REG_MappingType.choice.interleaved)); coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; - coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = 0; //scc->physCellId; + coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = servingcellconfigcommon->physCellId; coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; if(coreset0->tci_StatesPDCCH_ToAddList == NULL) coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*coreset0->tci_StatesPDCCH_ToAddList)); From ee516a07c8e63945f416732f48f8f379da49897a Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 18 Nov 2020 11:28:37 +0000 Subject: [PATCH 021/160] Add TDDIndex 4 in config file. --- ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf | 5 +++++ openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 4 ++-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index 0fd0a5340f..0f92876abd 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -84,6 +84,11 @@ gNBs = #this is SS=1,L=5 initialDLBWPstartSymbolAndLength_3 = 57; + initialDLBWPk0_4 = 0; + initialDLBWPmappingType_4 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_4 = 58; + #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index f22734462e..f64e6fb3de 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2756,8 +2756,8 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i if (dmrs_config->dmrs_AdditionalPosition == NULL) pos2=1; else if (dmrs_config->dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition == NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0 ) return(1< Date: Wed, 18 Nov 2020 13:06:08 +0000 Subject: [PATCH 022/160] Merge develop into this branch --- .../gnb.band78.tm1.106PRB.usrpn300.conf | 8 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 268 +++++++++++++++++- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 3 +- 3 files changed, 273 insertions(+), 6 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index d38aa5f53b..a771eefe33 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -66,13 +66,13 @@ gNBs = #initialULBWPmappingType #0=typeA,1=typeB initialDLBWPmappingType_0 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_0 = 53; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; initialDLBWPk0_1 = 0; initialDLBWPmappingType_1 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_1 = 40; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; initialDLBWPk0_2 = 0; initialDLBWPmappingType_2 = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 529c91c3d3..33dadcc9bb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -160,7 +160,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, for (int i = 0; i < 8; i++) { gNB_xtra_byte |= ((RC.gNB[module_idP]->pbch.pbch_a >> (31 - i)) & 1) << (7 - i); } - get_type0_PDCCH_CSS_config_parameters(&RC.gNB[module_idP]->type0_PDCCH_CSS_config, mib, gNB_xtra_byte, frame_parms->Lmax, + get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config, mib, gNB_xtra_byte, frame_parms->Lmax, frame_parms->ssb_index, frame_parms->ssb_start_subcarrier/NR_NB_SC_PER_RB); } @@ -223,3 +223,269 @@ void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, int CC_id) { for (int rb = 0; rb < 20; rb++) vrb_map[rbStart + rb] = 1; } + +void schedule_control_sib1(module_id_t module_id, + int CC_id, + int time_domain_allocation, + uint8_t mcsTableIdx, + uint8_t mcs, + uint8_t numDmrsCdmGrpsNoData, + int num_total_bytes) { + + gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; + NR_ServingCellConfigCommon_t *servingcellconfigcommon = gNB_mac->common_channels[CC_id].ServingCellConfigCommon; + uint8_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; + + if (gNB_mac->sched_ctrlCommon == NULL){ + gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon)); + gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space)); + gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp)); + gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset)); + gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp)); + fill_default_searchSpaceZero(gNB_mac->sched_ctrlCommon->search_space); + fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset,servingcellconfigcommon); + fill_default_initialDownlinkBWP(gNB_mac->sched_ctrlCommon->active_bwp,servingcellconfigcommon); + } + + gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation; + gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx; + gNB_mac->sched_ctrlCommon->mcs = mcs; + gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = numDmrsCdmGrpsNoData; + gNB_mac->sched_ctrlCommon->num_total_bytes = num_total_bytes; + + uint8_t nr_of_candidates; + find_aggregation_candidates(&gNB_mac->sched_ctrlCommon->aggregation_level, &nr_of_candidates, gNB_mac->sched_ctrlCommon->search_space); + + gNB_mac->sched_ctrlCommon->cce_index = allocate_nr_CCEs(RC.nrmac[module_id], + gNB_mac->sched_ctrlCommon->active_bwp, + gNB_mac->sched_ctrlCommon->coreset, + gNB_mac->sched_ctrlCommon->aggregation_level, + 0, + 0, + nr_of_candidates); + + if (gNB_mac->sched_ctrlCommon->cce_index < 0) { + LOG_E(MAC, "%s(): could not find CCE for coreset0\n", __func__); + return; + } + + const uint16_t bwpSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs; + int rbStart = gNB_mac->type0_PDCCH_CSS_config.cset_start_rb; + + // Calculate number of PRB_DMRS + uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; + + // Calculate number of symbols + struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; + int startSymbolIndex, nrOfSymbols; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + + LOG_I(MAC,"SLIV = %i\n", startSymbolAndLength); + LOG_I(MAC,"startSymbolIndex = %i\n", startSymbolIndex); + LOG_I(MAC,"nrOfSymbols = %i\n", nrOfSymbols); + + int rbSize = 0; + uint32_t TBS = 0; + do { + rbSize++; + TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + rbSize, nrOfSymbols, N_PRB_DMRS,0, 0,1) >> 3; + } while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes); + gNB_mac->sched_ctrlCommon->rbSize = rbSize; + gNB_mac->sched_ctrlCommon->rbStart = 0; + + // Mark the corresponding RBs as used + for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) { + vrb_map[rb + rbStart] = 1; + } +} + +void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, + nfapi_nr_dl_tti_request_body_t *dl_req, + uint32_t TBS, + int StartSymbolIndex, + int NrOfSymbols) { + + gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; + NR_COMMON_channels_t *cc = gNB_mac->common_channels; + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + NR_CellGroupConfig_t *secondaryCellGroup = gNB_mac->secondaryCellGroupCommon; + NR_BWP_Downlink_t *bwp = gNB_mac->sched_ctrlCommon->active_bwp; + + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; + memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE; + dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); + + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs+1]; + memset((void*)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; + dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu)); + + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; + nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; + + pdcch_pdu_rel15->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; + + pdsch_pdu_rel15->pduBitmap = 0; + pdsch_pdu_rel15->rnti = SI_RNTI; + pdsch_pdu_rel15->pduIndex = gNB_mac->pdu_index[0]++; + + pdsch_pdu_rel15->BWPSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs; + pdsch_pdu_rel15->BWPStart = gNB_mac->type0_PDCCH_CSS_config.cset_start_rb; + + pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; + if (bwp->bwp_Common->genericParameters.cyclicPrefix) { + pdsch_pdu_rel15->CyclicPrefix = *bwp->bwp_Common->genericParameters.cyclicPrefix; + } else { + pdsch_pdu_rel15->CyclicPrefix = 0; + } + + pdsch_pdu_rel15->NrOfCodewords = 1; + pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs,0); + pdsch_pdu_rel15->qamModOrder[0] = 2; + pdsch_pdu_rel15->mcsIndex[0] = gNB_mac->sched_ctrlCommon->mcs; + pdsch_pdu_rel15->mcsTable[0] = 0; + pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[0]; + pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; + pdsch_pdu_rel15->nrOfLayers = 1; + pdsch_pdu_rel15->transmissionScheme = 0; + pdsch_pdu_rel15->refPoint = 1; + pdsch_pdu_rel15->dmrsConfigType = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; + pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; + pdsch_pdu_rel15->SCID = 0; + pdsch_pdu_rel15->numDmrsCdmGrpsNoData = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData; + pdsch_pdu_rel15->dmrsPorts = 1; + pdsch_pdu_rel15->resourceAlloc = 1; + pdsch_pdu_rel15->rbStart = gNB_mac->sched_ctrlCommon->rbStart; + pdsch_pdu_rel15->rbSize = gNB_mac->sched_ctrlCommon->rbSize; + pdsch_pdu_rel15->VRBtoPRBMapping = 0; + pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx); + pdsch_pdu_rel15->TBSize[0] = TBS; + pdsch_pdu_rel15->mcsTable[0] = gNB_mac->sched_ctrlCommon->mcsTableIdx; + pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; + pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; + + pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, pdsch_pdu_rel15->NrOfSymbols); + + dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET]; + memset(dci_pdu_rel15, 0, sizeof(dci_pdu_rel15_t) * MAX_DCI_CORESET); + + dci_pdu_rel15[0].bwp_indicator.val = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id; + + // frequency domain assignment + dci_pdu_rel15[0].frequency_domain_assignment.val = + PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize, + pdsch_pdu_rel15->rbStart, + gNB_mac->type0_PDCCH_CSS_config.num_rbs); + + dci_pdu_rel15[0].time_domain_assignment.val = gNB_mac->sched_ctrlCommon->time_domain_allocation; + dci_pdu_rel15[0].mcs = gNB_mac->sched_ctrlCommon->mcs; + dci_pdu_rel15[0].rv = pdsch_pdu_rel15->rvIndex[0]; + dci_pdu_rel15[0].harq_pid = 0; + dci_pdu_rel15[0].ndi = 0; + dci_pdu_rel15[0].dai[0].val = 0; + dci_pdu_rel15[0].tpc = 0; // table 7.2.1-1 in 38.213 + dci_pdu_rel15[0].pucch_resource_indicator = 0; + dci_pdu_rel15[0].pdsch_to_harq_feedback_timing_indicator.val = 0; + dci_pdu_rel15[0].antenna_ports.val = 0; + dci_pdu_rel15[0].dmrs_sequence_initialization.val = pdsch_pdu_rel15->SCID; + + nr_configure_pdcch(gNB_mac, + pdcch_pdu_rel15, + SI_RNTI, + gNB_mac->sched_ctrlCommon->search_space, + gNB_mac->sched_ctrlCommon->coreset, + scc, + bwp, + gNB_mac->sched_ctrlCommon->aggregation_level, + gNB_mac->sched_ctrlCommon->cce_index); + + int dci_formats[2]; + int rnti_types[2]; + + dci_formats[0] = NR_DL_DCI_FORMAT_1_0; + rnti_types[0] = NR_RNTI_SI; + + fill_dci_pdu_rel15(scc,secondaryCellGroup,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types,pdsch_pdu_rel15->BWPSize,gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id); + + dl_req->nPDUs += 2; + + LOG_D(MAC,"BWPSize: %i\n", pdcch_pdu_rel15->BWPSize); + LOG_D(MAC,"BWPStart: %i\n", pdcch_pdu_rel15->BWPStart); + LOG_D(MAC,"SubcarrierSpacing: %i\n", pdcch_pdu_rel15->SubcarrierSpacing); + LOG_D(MAC,"CyclicPrefix: %i\n", pdcch_pdu_rel15->CyclicPrefix); + LOG_D(MAC,"StartSymbolIndex: %i\n", pdcch_pdu_rel15->StartSymbolIndex); + LOG_D(MAC,"DurationSymbols: %i\n", pdcch_pdu_rel15->DurationSymbols); + for(int n=0;n<6;n++) LOG_D(MAC,"FreqDomainResource[%i]: %x\n",n, pdcch_pdu_rel15->FreqDomainResource[n]); + LOG_D(MAC,"CceRegMappingType: %i\n", pdcch_pdu_rel15->CceRegMappingType); + LOG_D(MAC,"RegBundleSize: %i\n", pdcch_pdu_rel15->RegBundleSize); + LOG_D(MAC,"InterleaverSize: %i\n", pdcch_pdu_rel15->InterleaverSize); + LOG_D(MAC,"CoreSetType: %i\n", pdcch_pdu_rel15->CoreSetType); + LOG_D(MAC,"ShiftIndex: %i\n", pdcch_pdu_rel15->ShiftIndex); + LOG_D(MAC,"precoderGranularity: %i\n", pdcch_pdu_rel15->precoderGranularity); + LOG_D(MAC,"numDlDci: %i\n", pdcch_pdu_rel15->numDlDci); + +} + +void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { + + LOG_D(MAC,"Schedule_nr_sib1: frameP = %i, slotP = %i\n", frameP, slotP); + + // static values + const int CC_id = 0; + int time_domain_allocation = 2; // FIXME: For OAI-UE (2), For 3rd party implementation and 3GPP compliant (4) + uint8_t mcsTableIdx = 0; + uint8_t mcs = 0; + uint8_t numDmrsCdmGrpsNoData = 1; // FIXME: For OAI-UE (1), For 3rd party implementation and 3GPP compliant (2) + + gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; + + if( (frameP%2 == gNB_mac->type0_PDCCH_CSS_config.sfn_c) && (slotP == gNB_mac->type0_PDCCH_CSS_config.n_0) && (gNB_mac->type0_PDCCH_CSS_config.num_rbs > 0) ) { + + LOG_D(MAC,"> SIB1 transmission\n"); + + // Get SIB1 + uint8_t sib1_payload[100]; + uint8_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, 1, sib1_payload); + LOG_D(MAC,"sib1_sdu_length = %i\n", sib1_sdu_length); + LOG_I(MAC,"SIB1: \n"); + for (int i=0;isched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + + // Calculate number of PRB_DMRS + uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; + + const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS,0 ,0 ,1 ) >> 3; + + nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; + nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, TBS, startSymbolIndex, nrOfSymbols); + + const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs; + nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req]; + + // Data to be transmitted + bzero(tx_req->TLVs[0].value.direct,MAX_NR_DLSCH_PAYLOAD_BYTES); + memcpy(tx_req->TLVs[0].value.direct, sib1_payload, sib1_sdu_length); + + tx_req->PDU_length = TBS; + tx_req->PDU_index = gNB_mac->pdu_index[0]++; + tx_req->num_TLV = 1; + tx_req->TLVs[0].length = TBS + 2; + gNB_mac->TX_req[CC_id].Number_of_PDUs++; + gNB_mac->TX_req[CC_id].SFN = frameP; + gNB_mac->TX_req[CC_id].Slot = slotP; + } +} \ No newline at end of file diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 7a7fe1288c..b86d7b6e2a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -628,7 +628,8 @@ void nr_schedule_ue_spec(module_id_t module_id, gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; /* PREPROCESSOR */ - gNB_mac->pre_processor_dl(module_id, frame, slot, num_slots_per_tdd); + //gNB_mac->pre_processor_dl(module_id, frame, slot, num_slots_per_tdd); + nr_simple_dlsch_preprocessor(module_id, frame, slot, num_slots_per_tdd); // FIXME: gNB_mac->pre_processor_dl(module_id, frame, slot, num_slots_per_tdd); - Exit by assert NR_UE_info_t *UE_info = &gNB_mac->UE_info; From 749d6af42e256dbb61068bc0d4d6bceab59daf36 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 19 Nov 2020 02:22:47 +0000 Subject: [PATCH 023/160] Merge develop-sib1 into this branch --- .../gnb.band78.tm1.106PRB.usrpn300.conf | 20 +- .../nfapi/public_inc/fapi_nr_ue_constants.h | 2 +- openair1/PHY/NR_TRANSPORT/nr_dci.c | 27 +- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 4 +- .../nr_dl_channel_estimation.c | 3 +- openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h | 1 + openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 23 +- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 12 +- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 2 +- openair1/PHY/defs_nr_common.h | 2 + openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 3 + openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 170 ++++--- openair2/GNB_APP/RRC_nr_paramsvalues.h | 16 + openair2/GNB_APP/gnb_config.c | 16 + openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 464 ++++++++++++++++- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 73 +++ openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h | 61 +++ openair2/LAYER2/NR_MAC_UE/config_ue.c | 59 ++- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 34 +- openair2/LAYER2/NR_MAC_UE/mac_extern.h | 52 -- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 2 - openair2/LAYER2/NR_MAC_UE/mac_vars.c | 58 --- .../NR_MAC_UE/nr_ue_dci_configuration.c | 86 +++- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 475 ++++-------------- openair2/LAYER2/NR_MAC_gNB/config.c | 2 + openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 3 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 288 ++++++++++- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 3 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 70 ++- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 9 + openair2/LAYER2/NR_MAC_gNB/main.c | 2 + openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 14 + openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 1 + openair2/RRC/NR/L2_nr_interface.c | 178 +++++-- openair2/RRC/NR/MESSAGES/asn1_msg.c | 20 +- openair2/RRC/NR/nr_rrc_defs.h | 1 + openair2/RRC/NR/nr_rrc_proto.h | 6 + openair2/RRC/NR/rrc_gNB_reconfig.c | 93 +++- openair2/RRC/NR_UE/rrc_UE.c | 35 ++ openair2/RRC/NR_UE/rrc_defs.h | 4 +- openair2/RRC/NR_UE/rrc_proto.h | 5 + 41 files changed, 1685 insertions(+), 714 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index 6f081fa24f..82265d7ce6 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -23,7 +23,14 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; - + + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 10; + searchSpaceZero = 0; + } + ); + servingCellConfigCommon = ( { #spCellConfigCommon @@ -33,7 +40,7 @@ gNBs = # downlinkConfigCommon #frequencyInfoDL # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) - absoluteFrequencySSB = 641032; + absoluteFrequencySSB = 641272; dl_frequencyBand = 78; # this is 3600 MHz dl_absoluteFrequencyPointA = 640000; @@ -46,7 +53,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; + initialDLBWPlocationAndBandwidth = 6366; # 6366 12925 12956 28875 # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -77,7 +84,12 @@ gNBs = #this is SS=1,L=5 initialDLBWPstartSymbolAndLength_3 = 57; - #uplinkConfigCommon + initialDLBWPk0_4 = 0; + initialDLBWPmappingType_4 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_4 = 58; + + #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; #scs-SpecificCarrierList diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h index e1d06335f5..0a83c1a27f 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_constants.h @@ -44,7 +44,7 @@ #define FAPI_NR_DL_CONFIG_TYPE_DCI 0x01 #define FAPI_NR_DL_CONFIG_TYPE_DLSCH 0x02 #define FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH 0x03 - +#define FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH 0x04 #define FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED 0x01 #define FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED 0x02 diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index cc71e9dd97..f09f9ca890 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -30,6 +30,8 @@ * \warning */ +#include +#include #include "nr_dci.h" #include "nr_dlsch.h" #include "nr_sch_dmrs.h" @@ -81,17 +83,13 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, int rb_offset; int n_rb; - nr_fill_cce_list(gNB,0,pdcch_pdu_rel15); - - get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset); - // compute rb_offset and n_prb based on frequency allocation - + nr_fill_cce_list(gNB,0,pdcch_pdu_rel15); + get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset); + cset_start_sc = frame_parms.first_carrier_offset + rb_offset*NR_NB_SC_PER_RB; if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1) { - cset_start_sc = frame_parms.first_carrier_offset + - (frame_parms.ssb_start_subcarrier/NR_NB_SC_PER_RB + rb_offset)*NR_NB_SC_PER_RB; - } else - cset_start_sc = frame_parms.first_carrier_offset + rb_offset*NR_NB_SC_PER_RB; + cset_start_sc = cset_start_sc + RC.nrmac[gNB->Mod_id]->type0_PDCCH_CSS_config.cset_start_rb*NR_NB_SC_PER_RB; + } for (int d=0;dnumDlDci;d++) { /*The coreset is initialised @@ -105,8 +103,10 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, LOG_D(PHY, "Coreset rb_offset %d, nb_rb %d\n",rb_offset,n_rb); LOG_D(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb); // DMRS length is per OFDM symbol - AssertFatal(pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED, - "Interleaved CCE REG MAPPING not supported\n"); + + //AssertFatal(pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED, + //"Interleaved CCE REG MAPPING not supported\n"); + uint32_t dmrs_length = (pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED)? (n_rb*6) : (pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]*36/cset_nsymb); //2(QPSK)*3(per RB)*6(REG per CCE) uint32_t encoded_length = pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]*108; //2(QPSK)*9(per RB)*6(REG per CCE) @@ -225,7 +225,10 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, k -= frame_parms.ofdm_symbol_size; } // m } // reg_idx - + + LOG_I(PHY, ">> DCI: payloadSize = %d | payload = %llx\n", + *pdcch_pdu_rel15->dci_pdu.PayloadSizeBits,*(unsigned long long*)pdcch_pdu_rel15->dci_pdu.Payload); + } // for (int d=0;dnumDlDci;d++) } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 4461edb33b..b7e59a0b42 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -269,7 +269,9 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, /// Resource mapping // Non interleaved VRB to PRB mapping - uint16_t start_sc = frame_parms->first_carrier_offset + rel15->rbStart*NR_NB_SC_PER_RB; + uint16_t start_sc = frame_parms->first_carrier_offset + (rel15->rbStart+rel15->BWPStart)*NR_NB_SC_PER_RB; + + if (start_sc >= frame_parms->ofdm_symbol_size) start_sc -= frame_parms->ofdm_symbol_size; diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index 71cd4c44e4..7ca4db0b60 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -645,6 +645,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, unsigned char Ns, unsigned short p, unsigned char symbol, + unsigned short BWPStart, unsigned short bwp_start_subcarrier, unsigned short nb_rb_pdsch) { @@ -715,7 +716,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, // generate pilot - uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12; + uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12 - BWPStart; int config_type = 0; // needs to be updated from higher layer nr_pdsch_dmrs_rx(ue,Ns,ue->nr_gold_pdsch[eNB_offset][Ns][0], &pilot[0],1000,0,nb_rb_pdsch+rb_offset); diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h index 892c6b7692..824e752235 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h @@ -69,6 +69,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, unsigned char Ns, unsigned short p, unsigned char symbol, + unsigned short BWPStart, unsigned short bwp_start_subcarrier, unsigned short nb_rb_pdsch); diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 53456bb691..031cf0444f 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -36,6 +36,8 @@ #include #endif +#include +#include #include "executables/softmodem-common.h" #include "nr_transport_proto_ue.h" @@ -369,7 +371,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, LOG_DDD("n_BWP_start=%d, coreset_nbr_rb=%d\n",n_BWP_start,coreset_nbr_rb); int c_rb_by6; - c_rb = n_BWP_start; + c_rb = 0; for (int rb=0;rbN_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) { //if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): even case - rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))]; + rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; LOG_DDD("in even case c_rb (%d) is lower than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))); } @@ -389,7 +391,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, if ((c_rb >= (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) { // number of RBs is even and c_rb is higher than half system bandwidth (we don't skip DC) // if these conditions are true the pointer has to be situated at the 1st part of the rxdataF - rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol + rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; // we point at the 1st part of the rxdataF in symbol LOG_DDD("in even case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))); //rxF = &rxdataF[aarx][(1 + 12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol @@ -401,7 +403,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { //if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): odd case - rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))]; + rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; #ifdef NR_PDCCH_DCI_DEBUG LOG_D(PHY,"in odd case c_rb (%d) is lower or equal than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))); @@ -411,7 +413,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, if ((c_rb > (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { // number of RBs is odd and c_rb is higher than half system bandwidth + 1 // if these conditions are true the pointer has to be situated at the 1st part of the rxdataF just after the first IQ symbols of the RB containing DC - rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol + rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; // we point at the 1st part of the rxdataF in symbol #ifdef NR_PDCCH_DCI_DEBUG LOG_D(PHY,"in odd case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - frame_parms->N_RB_DL) - 5 + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))); @@ -421,7 +423,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF, if ((c_rb == (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { // treatment of RB containing the DC // if odd number RBs in system bandwidth and first RB to be treated is higher than middle system bandwidth (around DC) // we have to treat the RB in two parts: first part from i=0 to 5, the data is at the end of rxdataF (pointing at the end of the table) - rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))]; + rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))+n_BWP_start*12]; #ifdef NR_PDCCH_DCI_DEBUG LOG_D(PHY,"in odd case c_rb (%d) is half N_RB_DL + 1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n", c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))); @@ -889,13 +891,20 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, dci_ind->dci_list[dci_ind->number_of_dcis].payloadSize = dci_length; memcpy((void*)dci_ind->dci_list[dci_ind->number_of_dcis].payloadBits,(void*)dci_estimation,8); dci_ind->number_of_dcis++; + + LOG_I(PHY, "\n>> Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n\n", + n_rnti,rel15->dci_format_options[k],CCEind,dci_length,*(unsigned long long*)dci_estimation); + break; // If DCI is found, no need to check for remaining DCI lengths } else { - LOG_D(PHY,"Decoded crc %x does not match rnti %x for DCI format %d\n", crc, n_rnti, rel15->dci_format_options[k]); + LOG_I(PHY,"Decoded crc %x does not match rnti %x for DCI format %d\n", crc, n_rnti, rel15->dci_format_options[k]); } } } } + + LOG_I(PHY,"nr_dci_decoding_procedure: frame = %i, slot = %i\n", frame, slot); + return(dci_ind->number_of_dcis); } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index fb3f1ae133..cc98e24773 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -591,20 +591,22 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, // Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) { - LOG_D(PHY,"Segment %u CRC OK\n\033[0m",r); - if (r==0) - for (int i=0;i<10;i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]); + + LOG_I(PHY,"Segment %u CRC OK\n\033[0m",r); + + if (r==0) { + for (int i=0;i<10;i++) LOG_I(PHY,"byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]); + } //Temporary hack no_iteration_ldpc = dlsch->max_ldpc_iterations; ret = no_iteration_ldpc; } else { - LOG_D(PHY,"CRC NOK\n\033[0m"); + LOG_I(PHY,"CRC NOT OK\n\033[0m"); ret = 1 + dlsch->max_ldpc_iterations; } - nb_total_decod++; if (no_iteration_ldpc > dlsch->max_ldpc_iterations){ nb_error_decod++; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index fae97f6824..0808822dd9 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -377,7 +377,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, pdsch_vars[eNB_id]->pmi_ext, symbol, pilots, - start_rb, + start_rb + dlsch0_harq->BWPStart, nb_rb_pdsch, nr_tti_rx, ue->high_speed_flag, diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index e5678f894d..bcc0a5133c 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -108,6 +108,8 @@ #define MAX_NUM_NR_DLSCH_SEGMENTS 34 #define MAX_NR_DLSCH_PAYLOAD_BYTES (MAX_NUM_NR_DLSCH_SEGMENTS*1056) +#define MAX_NR_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1 - The physical layer imposes a limit to the maximum size a SIB can take. The maximum SIB1 or SI message size is 2976 bits. + #define MAX_NUM_NR_ULSCH_SEGMENTS MAX_NUM_NR_DLSCH_SEGMENTS #define MAX_NR_ULSCH_PAYLOAD_BYTES (MAX_NUM_NR_ULSCH_SEGMENTS*1056) diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 25bff31fcc..25b27aef98 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -81,6 +81,9 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH){ dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_ra[0]; } + else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH){ + dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_SI[0]; + } fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15; uint8_t current_harq_pid = dlsch_config_pdu->harq_process_nbr; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index b0d765b746..d33bb5acf8 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -32,6 +32,7 @@ #define _GNU_SOURCE +#include #include "assertions.h" #include "defs.h" #include "PHY/defs_nr_UE.h" @@ -738,15 +739,16 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ // do channel estimation for first DMRS only for (m = s0; m < 3; m++) { if (((1<harq_processes[harq_pid]->dlDmrsSymbPos) > 0) { - nr_pdsch_channel_estimation(ue, - 0 /*eNB_id*/, - nr_tti_rx, - 0 /*p*/, - m, - ue->frame_parms.first_carrier_offset+(BWPStart + pdsch_start_rb)*12, - pdsch_nb_rb); - LOG_D(PHY,"Channel Estimation in symbol %d\n",m); - break; + nr_pdsch_channel_estimation(ue, + 0 /*eNB_id*/, + nr_tti_rx, + 0 /*p*/, + m, + BWPStart, + ue->frame_parms.first_carrier_offset+(BWPStart+pdsch_start_rb)*12, + pdsch_nb_rb); + LOG_D(PHY,"Channel Estimation in symbol %d\n",m); + break; } } for (m = s0; m < (s1 + s0); m++) { @@ -782,8 +784,8 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ return -1; } else { // This is to adjust the llr offset in the case of skipping over a dmrs symbol (i.e. in case of no PDSCH REs in DMRS) - if (pdsch == RA_PDSCH) ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m]=ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m-1]; - else if (pdsch == PDSCH) { + if (pdsch == RA_PDSCH) ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m]=ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m-1]; + else if (pdsch == PDSCH || pdsch == SI_PDSCH) { if (nr_rx_pdsch(ue, pdsch, eNB_id, @@ -797,7 +799,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ dlsch0->current_harq_pid) < 0) return -1; } - else AssertFatal(1==0,"not RA_PDSCH or PDSCH\n"); + else AssertFatal(1==0,"not RA_PDSCH, SI_PDSCH or PDSCH\n"); } if (pdsch == PDSCH) LOG_D(PHY,"Done processing symbol %d : llr_offset %d\n",m,ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->llr_offset[m]); #if UE_TIMING_TRACE @@ -1190,6 +1192,9 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, case PDSCH: rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH; break; + case SI_PDSCH: + rx_ind.rx_indication_body[0].pdu_type = FAPI_NR_RX_PDU_TYPE_SIB; + break; default: break; } @@ -1711,15 +1716,16 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][0]; fapi_nr_config_request_t *cfg = &ue->nrUE_config; + NR_UE_MAC_INST_t *mac = get_mac_inst(ue->Mod_id); + fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; + uint8_t nb_symb_pdcch = pdcch_vars->nb_search_space > 0 ? pdcch_vars->pdcch_config[0].coreset.duration : 0; uint8_t dci_cnt = 0; NR_DL_FRAME_PARMS *fp = &ue->frame_parms; - //NR_UE_MAC_INST_t *mac = get_mac_inst(0); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN); - LOG_D(PHY," ****** start RX-Chain for Frame.Slot %d.%d ****** \n", frame_rx%1024, nr_tti_rx); + LOG_D(PHY, " ****** start RX-Chain for Frame.Slot %d.%d ****** \n", frame_rx % 1024, nr_tti_rx); /* uint8_t next1_thread_id = ue->current_thread_id[nr_tti_rx]== (RX_NB_TH-1) ? 0:(ue->current_thread_id[nr_tti_rx]+1); @@ -1798,28 +1804,35 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, 0, 0); + fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15; + + dci_cnt = 0; + for(int n_ss = 0; n_ssnb_search_space; n_ss++) { + // note: this only works if RBs for PDCCH are contigous! - LOG_D(PHY,"pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d\n", - fp->first_carrier_offset,pdcch_vars->pdcch_config[0].BWPStart,coreset_start_rb); + LOG_D(PHY, "pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d\n", + fp->first_carrier_offset, pdcch_vars->pdcch_config[n_ss].BWPStart, coreset_start_rb); + + rel15 = &pdcch_vars->pdcch_config[n_ss]; + if (coreset_nb_rb > 0) nr_pdcch_channel_estimation(ue, - 0, - nr_tti_rx, - l, - fp->first_carrier_offset+(pdcch_vars->pdcch_config[0].BWPStart + coreset_start_rb)*12, - coreset_nb_rb); - + 0, + nr_tti_rx, + l, + fp->first_carrier_offset + + (pdcch_vars->pdcch_config[n_ss].BWPStart + coreset_start_rb) * 12, + coreset_nb_rb); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); #if UE_TIMING_TRACE stop_meas(&ue->ofdm_demod_stats); #endif - - //printf("phy procedure pdcch start measurement l =%d\n",l); - //nr_ue_measurement_procedures(l,ue,proc,gNB_id,(nr_tti_rx),mode); - - } - dci_cnt = nr_ue_pdcch_procedures(gNB_id, ue, proc); + dci_cnt = dci_cnt + nr_ue_pdcch_procedures(gNB_id, ue, proc); + + } + } if (dci_cnt > 0) { @@ -1828,6 +1841,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, NR_UE_DLSCH_t *dlsch = NULL; if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->active == 1){ dlsch = ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]; + } else if (ue->dlsch_SI[0]->active == 1){ + dlsch = ue->dlsch_SI[0]; } else if (ue->dlsch_ra[0]->active == 1){ dlsch = ue->dlsch_ra[0]; } @@ -1867,7 +1882,13 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // do procedures for C-RNTI int ret_pdsch = 0; if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->active == 1) { - //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); + + fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; + dlsch_config_pdu->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); + dlsch_config_pdu->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); + dlsch_config_pdu->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; + ret_pdsch = nr_ue_pdsch_procedures(ue, proc, gNB_id, @@ -1875,24 +1896,33 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0], NULL); - //printf("phy procedure pdsch start measurement\n"); + if (ret_pdsch >= 0) + nr_ue_dlsch_procedures(ue, + proc, + gNB_id, + PDSCH, + ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0], + ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][1], + &ue->dlsch_errors[gNB_id], + mode); + nr_ue_measurement_procedures(2,ue,proc,gNB_id,nr_tti_rx,mode); - /* - write_output("rxF.m","rxF",&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[nr_tti_rx]].rxdataF[0][0],fp->ofdm_symbol_size*14,1,1); - write_output("rxF_ch.m","rxFch",&ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->dl_ch_estimates[0][0],fp->ofdm_symbol_size*14,1,1); - write_output("rxF_ch_ext.m","rxFche",&ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->dl_ch_estimates_ext[0][2*50*12],50*12,1,1); - write_output("rxF_ext.m","rxFe",&ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->rxdataF_ext[0][0],50*12*14,1,1); - write_output("rxF_comp.m","rxFc",&ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->rxdataF_comp0[0][0],fp->N_RB_DL*12*14,1,1); - write_output("rxF_llr.m","rxFllr",ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->llr[0],(nb_symb_sch-1)*50*12+50*6,1,0); - */ + // deactivate dlsch once dlsch proc is done + ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->active = 0; - //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); } // do procedures for SI-RNTI if ((ue->dlsch_SI[gNB_id]) && (ue->dlsch_SI[gNB_id]->active == 1)) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_IN); + + fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; + dlsch_config_pdu->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; + dlsch_config_pdu->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; + dlsch_config_pdu->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + nr_ue_pdsch_procedures(ue, proc, gNB_id, @@ -1912,12 +1942,27 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // deactivate dlsch once dlsch proc is done ue->dlsch_SI[gNB_id]->active = 0; + // FIXME: It was assumed that SIB1 has only one segment + int harq_pid = PHY_vars_UE_g[0][0]->dlsch_SI[0]->current_harq_pid; + if(ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->harq_ack.ack == 1) { + nr_rrc_ue_decode_NR_SIB1_Message(&ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->c[0][0], + ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->TBS); + } else { + LOG_D(PHY,"SIB1 CRC NOT OK"); + } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_OUT); } // do procedures for P-RNTI if ((ue->dlsch_p[gNB_id]) && (ue->dlsch_p[gNB_id]->active == 1)) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_IN); + + fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; + dlsch_config_pdu->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); + dlsch_config_pdu->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); + dlsch_config_pdu->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; + nr_ue_pdsch_procedures(ue, proc, gNB_id, @@ -1943,6 +1988,12 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // do procedures for RA-RNTI if ((ue->dlsch_ra[gNB_id]) && (ue->dlsch_ra[gNB_id]->active == 1)) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_IN); + + fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; + dlsch_config_pdu->BWPSize = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + dlsch_config_pdu->BWPStart = NRRIV2PRBOFFSET(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + dlsch_config_pdu->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + nr_ue_pdsch_procedures(ue, proc, gNB_id, @@ -1964,46 +2015,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_OUT); } - - // do procedures for C-RNTI - if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->active == 1) { - LOG_D(PHY, "DLSCH data reception at nr_tti_rx: %d \n \n", nr_tti_rx); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); - -#if UE_TIMING_TRACE - start_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]]); -#endif - - if (ret_pdsch >= 0) - nr_ue_dlsch_procedures(ue, - proc, - gNB_id, - PDSCH, - ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0], - ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][1], - &ue->dlsch_errors[gNB_id], - mode); - - -#if UE_TIMING_TRACE - stop_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]]); -#if DISABLE_LOG_X - printf("[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_tti_rx,ue->pdsch_procedures_stat[ue->current_thread_id[nr_tti_rx]].p_time/(cpuf*1000.0)); - printf("[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_tti_rx,ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]].p_time/(cpuf*1000.0)); -#else - LOG_D(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_tti_rx,ue->pdsch_procedures_stat[ue->current_thread_id[nr_tti_rx]].p_time/(cpuf*1000.0)); - LOG_D(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_tti_rx,ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]].p_time/(cpuf*1000.0)); -#endif - -#endif - - // deactivate dlsch once dlsch proc is done - ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->active = 0; - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); - - } #if UE_TIMING_TRACE start_meas(&ue->generic_stat); #endif diff --git a/openair2/GNB_APP/RRC_nr_paramsvalues.h b/openair2/GNB_APP/RRC_nr_paramsvalues.h index 231aeb34f4..1f1d076e9d 100644 --- a/openair2/GNB_APP/RRC_nr_paramsvalues.h +++ b/openair2/GNB_APP/RRC_nr_paramsvalues.h @@ -39,6 +39,7 @@ /* cell configuration section name */ #define GNB_CONFIG_STRING_GNB_LIST "gNBs" +#define GNB_CONFIG_STRING_PDCCH_CONFIGSIB1 "pdcch_ConfigSIB1" #define GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON "servingCellConfigCommon" #define GNB_CONFIG_STRING_PHYSCELLID "physCellId" #define GNB_CONFIG_STRING_NTIMINGADVANCEOFFSET "n_TimingAdvanceOffset" @@ -210,6 +211,21 @@ #define CARRIERBANDWIDTH_OKVALUES {11,18,24,25,31,32,38,51,52,65,66,78,79,93,106,107,121,132,133,135,160,162,189,216,217,245,264,270,273} +/*--------------------------------------------------------------------------------------------------------------------*/ +/* pdcch_ConfigSIB1 parameters */ +/*--------------------------------------------------------------------------------------------------------------------*/ +#define CONTROL_RESOURCE_SET_ZERO "controlResourceSetZero" +#define SEARCH_SPACE_ZERO "searchSpaceZero" + +#define PDCCH_CONFIGSIB1PARAMS_DESC(pdcch_ConfigSIB1) { \ +{CONTROL_RESOURCE_SET_ZERO, NULL, 0, i64ptr:&pdcch_ConfigSIB1->controlResourceSetZero, defintval:0, TYPE_INT64, 0}, \ +{SEARCH_SPACE_ZERO, NULL, 0, i64ptr:&pdcch_ConfigSIB1->searchSpaceZero, defintval:0, TYPE_INT64, 0} \ +} + +#define CONTROL_RESOURCE_SET_ZERO_IDX 0 +#define SEARCH_SPACE_ZERO_IDX 1 +/*--------------------------------------------------------------------------------------------------------------------*/ + /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* Serving Cell Config Common configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 977807d150..7a7a465f06 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -572,6 +572,22 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { gnb_id = *(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr); } + // pdcch_ConfigSIB1 + rrc->carrier.pdcch_ConfigSIB1 = calloc(1,sizeof(NR_PDCCH_ConfigSIB1_t)); + paramdef_t pdcch_ConfigSIB1[] = PDCCH_CONFIGSIB1PARAMS_DESC(rrc->carrier.pdcch_ConfigSIB1); + paramlist_def_t pdcch_ConfigSIB1ParamList = {GNB_CONFIG_STRING_PDCCH_CONFIGSIB1, NULL, 0}; + sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); + config_getlist(&pdcch_ConfigSIB1ParamList, NULL, 0, aprefix); + if (pdcch_ConfigSIB1ParamList.numelt > 0) { + sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_PDCCH_CONFIGSIB1, 0); + config_get(pdcch_ConfigSIB1,sizeof(pdcch_ConfigSIB1)/sizeof(paramdef_t),aprefix); + } + + AssertFatal(rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero == 10 + || rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero == 11 + || rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero == 12, + "controlResourceSetZero %li not suported yet\n", rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero); + sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); config_getlist(&SCCsParamList, NULL, 0, aprefix); diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 9a5946498d..6b3d6e1c3a 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -33,6 +33,8 @@ #include "LAYER2/NR_MAC_gNB/mac_proto.h" #include +#define reserved 0xffff + const uint8_t nr_slots_per_frame[5] = {10, 20, 40, 80, 160}; // Table 6.3.3.1-5 (38.211) NCS for preamble formats with delta_f_RA = 1.25 KHz @@ -48,6 +50,74 @@ uint16_t NCS_restricted_TypeB_delta_f_RA_5[14] = {36,57,60,63,65,68,71,77,81,8 // Table 6.3.3.1-7 (38.211) NCS for preamble formats with delta_f_RA = 15 * 2mu KHz where mu = {0,1,2,3} uint16_t NCS_unrestricted_delta_f_RA_15[16] = {0,2,4,6,8,10,12,13,15,17,19,23,27,34,46,69}; + +// specification mapping talbe, table_38$x_$y_$z_c$a +// - $x: specification +// - $y: subclause-major +// - $z: subclause-minor +// - $a: ($a)th of column in table, start from zero +const int32_t table_38213_13_1_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, reserved}; // index 15 reserved +const int32_t table_38213_13_1_c2[16] = {24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, 96, 96, 96, reserved}; // index 15 reserved +const int32_t table_38213_13_1_c3[16] = { 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved}; // index 15 reserved +const int32_t table_38213_13_1_c4[16] = { 0, 2, 4, 0, 2, 4, 12, 16, 12, 16, 12, 16, 38, 38, 38, reserved}; // index 15 reserved + +const int32_t table_38213_13_2_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved}; // index 14-15 reserved +const int32_t table_38213_13_2_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved}; // index 14-15 reserved +const int32_t table_38213_13_2_c3[16] = { 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved}; // index 14-15 reserved +const int32_t table_38213_13_2_c4[16] = { 5, 6, 7, 8, 5, 6, 7, 8, 18, 20, 18, 20, 18, 20, reserved, reserved}; // index 14-15 reserved + +const int32_t table_38213_13_3_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_3_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_3_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_3_c4[16] = { 2, 6, 2, 6, 2, 6, 28, 28, 28, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved + +const int32_t table_38213_13_4_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; +const int32_t table_38213_13_4_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48}; +const int32_t table_38213_13_4_c3[16] = { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 1, 1, 1, 2, 2, 2}; +const int32_t table_38213_13_4_c4[16] = { 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 12, 14, 16, 12, 14, 16}; + +const int32_t table_38213_13_5_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_5_c2[16] = {48, 48, 48, 96, 96, 96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_5_c3[16] = { 1, 2, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_5_c4[16] = { 4, 4, 4, 0, 56, 0, 56, 0, 56, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved + +const int32_t table_38213_13_6_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved +const int32_t table_38213_13_6_c2[16] = {24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved +const int32_t table_38213_13_6_c3[16] = { 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved +const int32_t table_38213_13_6_c4[16] = { 0, 4, 0, 4, 0, 28, 0, 28, 0, 28, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved + +const int32_t table_38213_13_7_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, reserved, reserved, reserved, reserved}; // index 12-15 reserved +const int32_t table_38213_13_7_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 48, 48, 96, 96, reserved, reserved, reserved, reserved}; // index 12-15 reserved +const int32_t table_38213_13_7_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved}; // index 12-15 reserved +const int32_t table_38213_13_7_c4[16] = { 0, 8, 0, 8, 0, 8, 28, 28,-41, 49,-41, 97, reserved, reserved, reserved, reserved}; // index 12-15 reserved, condition A as default + +const int32_t table_38213_13_8_c1[16] = { 1, 1, 1, 1, 3, 3, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved +const int32_t table_38213_13_8_c2[16] = {24, 24, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved +const int32_t table_38213_13_8_c3[16] = { 2, 2, 1, 2, 2, 2, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved +const int32_t table_38213_13_8_c4[16] = { 0, 4, 14, 14,-20, 24,-20, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved, condition A as default + +const int32_t table_38213_13_9_c1[16] = {1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved +const int32_t table_38213_13_9_c2[16] = {96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved +const int32_t table_38213_13_9_c3[16] = { 1, 1, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved +const int32_t table_38213_13_9_c4[16] = { 0, 16, 0, 16, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved + +const int32_t table_38213_13_10_c1[16] = {1, 1, 1, 1, 2, 2, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved +const int32_t table_38213_13_10_c2[16] = {48, 48, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved +const int32_t table_38213_13_10_c3[16] = { 1, 1, 2, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved +const int32_t table_38213_13_10_c4[16] = { 0, 8, 0, 8,-41, 25,-41, 49, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved, condition A as default + +const float table_38213_13_11_c1[16] = { 0, 0, 2, 2, 5, 5, 7, 7, 0, 5, 0, 0, 2, 2, 5, 5}; // O +const int32_t table_38213_13_11_c2[16] = { 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1}; +const float table_38213_13_11_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 1, 1, 1, 1, 1, 1, 1}; // M +const int32_t table_38213_13_11_c4[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2}; // i is even as default + +const float table_38213_13_12_c1[16] = { 0, 0, 2.5f, 2.5f, 5, 5, 0, 2.5f, 5, 7.5f, 7.5f, 7.5f, 0, 5, reserved, reserved}; // O, index 14-15 reserved +const int32_t table_38213_13_12_c2[16] = { 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, reserved, reserved}; // index 14-15 reserved +const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f, 0.5f, 1, 0.5f, 0.5f, 1, 1, reserved, reserved}; // M, index 14-15 reserved + +const int32_t table_38213_10_1_1_c2[5] = { 0, 0, 4, 2, 1 }; + +const char *prachfmt03[]={"0","1","2","3"}; const char *prachfmt[]={"0","1","2","3", "A1","A2","A3","B1","B4","C0","C2","A1/B1","A2/B2","A3/B3"}; const char *duplex_mode[]={"FDD","TDD"}; @@ -2283,11 +2353,19 @@ uint16_t nr_dci_size(NR_ServingCellConfigCommon_t *scc, long rbg_size_config; int num_entries = 0; int pusch_antenna_ports = 1; // TODO hardcoded number of antenna ports for pusch - NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; - NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]; - NR_PDSCH_Config_t *pdsch_config = bwp->bwp_Dedicated->pdsch_Config->choice.setup; - NR_PUSCH_Config_t *pusch_Config = ubwp->bwp_Dedicated->pusch_Config->choice.setup; - NR_SRS_Config_t *srs_config = ubwp->bwp_Dedicated->srs_Config->choice.setup; + + NR_BWP_Downlink_t *bwp = NULL; + NR_BWP_Uplink_t *ubwp = NULL; + NR_PDSCH_Config_t *pdsch_config = NULL; + NR_PUSCH_Config_t *pusch_Config = NULL; + NR_SRS_Config_t *srs_config = NULL; + if(bwp_id > 0) { + bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; + ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]; + pdsch_config = bwp->bwp_Dedicated->pdsch_Config->choice.setup; + pusch_Config = ubwp->bwp_Dedicated->pusch_Config->choice.setup; + srs_config = ubwp->bwp_Dedicated->srs_Config->choice.setup; + } switch(format) { /*Only sizes for 0_0 and 1_0 are correct at the moment*/ @@ -2494,6 +2572,11 @@ uint16_t nr_dci_size(NR_ServingCellConfigCommon_t *scc, /// fixed: Format identifier 1, VRB2PRB 1, MCS 5, NDI 1, RV 2, HARQ PID 4, DAI 2, PUCCH TPC 2, PUCCH RInd 3, PDSCH to HARQ TInd 3 Time Domain assgnmt 4 -- 28 size += 28; size += (uint8_t)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); // Freq domain assignment + + dci_pdu->frequency_domain_assignment.nbits = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); + dci_pdu->time_domain_assignment.nbits = 4; + dci_pdu->vrb_to_prb_mapping.nbits = 1; + break; case NR_DL_DCI_FORMAT_1_1: @@ -2846,3 +2929,374 @@ int binomial(int n, int k) { return c; } +uint32_t get_ssb_slot(uint32_t ssb_index){ + // this function now only support f <= 3GHz + return ssb_index & 0x3 ; + + // return first_symbol(case, freq, ssb_index) / 14 +} + +int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, + NR_MIB_t *mib, + uint8_t extra_bits, + uint32_t ssb_length, + uint32_t ssb_index, + uint32_t ssb_offset_point_a) { + + // deafult for testing + subcarrier_spacing_t scs_ssb = scs_30kHz; + channel_bandwidth_t min_channel_bw = bw_10MHz; + frequency_range_t frequency_range = FR1; + const uint32_t num_slot_per_frame = 20; + + type0_PDCCH_CSS_config->ssb_length = ssb_length; + type0_PDCCH_CSS_config->ssb_index = ssb_index; + type0_PDCCH_CSS_config->frame = (mib->systemFrameNumber.buf[0] >> mib->systemFrameNumber.bits_unused); + + uint16_t frame_number_4lsb = 0; + for (int i=0; i<4; i++) { + frame_number_4lsb |= ((extra_bits>>i)&1)<<(3-i); + } + + uint8_t ssb_subcarrier_offset_msb = ( extra_bits >> 5 ) & 0x1; // extra bits[5] + uint8_t ssb_subcarrier_offset = (uint8_t)mib->ssb_SubcarrierOffset; + + type0_PDCCH_CSS_config->frame = type0_PDCCH_CSS_config->frame << 4; + type0_PDCCH_CSS_config->frame = type0_PDCCH_CSS_config->frame | frame_number_4lsb; + + if(type0_PDCCH_CSS_config->ssb_length == 64){ + type0_PDCCH_CSS_config->ssb_index = type0_PDCCH_CSS_config->ssb_index & (( extra_bits >> 2 ) & 0x1C ); // { extra_bits[5:7], ssb_index[2:0] } + }else{ + if(ssb_subcarrier_offset_msb){ + ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10; + } + } + + // assume carrier frequency < 6GHz + subcarrier_spacing_t scs_pdcch; + if(mib->subCarrierSpacingCommon == NR_MIB__subCarrierSpacingCommon_scs15or60){ + scs_pdcch = scs_15kHz; + }else{ //NR_MIB__subCarrierSpacingCommon_scs30or120 + scs_pdcch = scs_30kHz; + } + + uint32_t is_condition_A = (ssb_subcarrier_offset == 0); // 38.213 ch.13 + uint32_t index_4msb = (mib->pdcch_ConfigSIB1.controlResourceSetZero); + uint32_t index_4lsb = (mib->pdcch_ConfigSIB1.searchSpaceZero); + + type0_PDCCH_CSS_config->num_rbs = -1; + type0_PDCCH_CSS_config->num_symbols = -1; + type0_PDCCH_CSS_config->rb_offset = -1; + + // type0-pdcch coreset + switch( (scs_ssb << 5) | scs_pdcch ){ + case (scs_15kHz << 5) | scs_15kHz : + AssertFatal(index_4msb < 15, "38.213 Table 13-1 4 MSB out of range\n"); + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + type0_PDCCH_CSS_config->num_rbs = table_38213_13_1_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_1_c3[index_4msb]; + type0_PDCCH_CSS_config->rb_offset = table_38213_13_1_c4[index_4msb]; + break; + + case (scs_15kHz << 5) | scs_30kHz: + AssertFatal(index_4msb < 14, "38.213 Table 13-2 4 MSB out of range\n"); + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + type0_PDCCH_CSS_config->num_rbs = table_38213_13_2_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_2_c3[index_4msb]; + type0_PDCCH_CSS_config->rb_offset = table_38213_13_2_c4[index_4msb]; + break; + + case (scs_30kHz << 5) | scs_15kHz: + if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){ + AssertFatal(index_4msb < 9, "38.213 Table 13-3 4 MSB out of range\n"); + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + type0_PDCCH_CSS_config->num_rbs = table_38213_13_3_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_3_c3[index_4msb]; + type0_PDCCH_CSS_config->rb_offset = table_38213_13_3_c4[index_4msb]; + }else if(min_channel_bw & bw_40MHz){ + AssertFatal(index_4msb < 9, "38.213 Table 13-5 4 MSB out of range\n"); + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + type0_PDCCH_CSS_config->num_rbs = table_38213_13_5_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_5_c3[index_4msb]; + type0_PDCCH_CSS_config->rb_offset = table_38213_13_5_c4[index_4msb]; + }else{ ; } + + break; + + case (scs_30kHz << 5) | scs_30kHz: + if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){ + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + type0_PDCCH_CSS_config->num_rbs = table_38213_13_4_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_4_c3[index_4msb]; + type0_PDCCH_CSS_config->rb_offset = table_38213_13_4_c4[index_4msb]; + + LOG_I(MAC,"<<<<<<<<num_rbs,type0_PDCCH_CSS_config->num_symbols,type0_PDCCH_CSS_config->rb_offset ); + + }else if(min_channel_bw & bw_40MHz){ + AssertFatal(index_4msb < 10, "38.213 Table 13-6 4 MSB out of range\n"); + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + type0_PDCCH_CSS_config->num_rbs = table_38213_13_6_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_6_c3[index_4msb]; + type0_PDCCH_CSS_config->rb_offset = table_38213_13_6_c4[index_4msb]; + }else{ ; } + break; + + case (scs_120kHz << 5) | scs_60kHz: + AssertFatal(index_4msb < 12, "38.213 Table 13-7 4 MSB out of range\n"); + if(index_4msb & 0x7){ + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + }else if(index_4msb & 0x18){ + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 2; + }else{ ; } + + type0_PDCCH_CSS_config->num_rbs = table_38213_13_7_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_7_c3[index_4msb]; + if(!is_condition_A && (index_4msb == 8 || index_4msb == 10)){ + type0_PDCCH_CSS_config->rb_offset = table_38213_13_7_c4[index_4msb] - 1; + }else{ + type0_PDCCH_CSS_config->rb_offset = table_38213_13_7_c4[index_4msb]; + } + break; + + case (scs_120kHz << 5) | scs_120kHz: + AssertFatal(index_4msb < 8, "38.213 Table 13-8 4 MSB out of range\n"); + if(index_4msb & 0x3){ + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + }else if(index_4msb & 0x0c){ + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 3; + } + + type0_PDCCH_CSS_config->num_rbs = table_38213_13_8_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_8_c3[index_4msb]; + if(!is_condition_A && (index_4msb == 4 || index_4msb == 6)){ + type0_PDCCH_CSS_config->rb_offset = table_38213_13_8_c4[index_4msb] - 1; + }else{ + type0_PDCCH_CSS_config->rb_offset = table_38213_13_8_c4[index_4msb]; + } + break; + + case (scs_240kHz << 5) | scs_60kHz: + AssertFatal(index_4msb < 4, "38.213 Table 13-9 4 MSB out of range\n"); + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + type0_PDCCH_CSS_config->num_rbs = table_38213_13_9_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_9_c3[index_4msb]; + type0_PDCCH_CSS_config->rb_offset = table_38213_13_9_c4[index_4msb]; + break; + + case (scs_240kHz << 5) | scs_120kHz: + AssertFatal(index_4msb < 8, "38.213 Table 13-10 4 MSB out of range\n"); + if(index_4msb & 0x3){ + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; + }else if(index_4msb & 0x0c){ + type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 2; + } + type0_PDCCH_CSS_config->num_rbs = table_38213_13_10_c2[index_4msb]; + type0_PDCCH_CSS_config->num_symbols = table_38213_13_10_c3[index_4msb]; + if(!is_condition_A && (index_4msb == 4 || index_4msb == 6)){ + type0_PDCCH_CSS_config->rb_offset = table_38213_13_10_c4[index_4msb]-1; + }else{ + type0_PDCCH_CSS_config->rb_offset = table_38213_13_10_c4[index_4msb]; + } + + break; + + default: + break; + } + + AssertFatal(type0_PDCCH_CSS_config->num_rbs != -1, "Type0 PDCCH coreset num_rbs undefined"); + AssertFatal(type0_PDCCH_CSS_config->num_symbols != -1, "Type0 PDCCH coreset num_symbols undefined"); + AssertFatal(type0_PDCCH_CSS_config->rb_offset != -1, "Type0 PDCCH coreset rb_offset undefined"); + + + //uint32_t cell_id = 0; // obtain from L1 later + + //mac->type0_pdcch_dci_config.coreset.rb_start = rb_offset; + //mac->type0_pdcch_dci_config.coreset.rb_end = rb_offset + num_rbs - 1; + +// uint64_t mask = 0x0; +// uint8_t i; +// for(i=0; i<(type0_PDCCH_CSS_config->num_rbs/6); ++i){ // 38.331 Each bit corresponds a group of 6 RBs +// mask = mask >> 1; +// mask = mask | 0x100000000000; +// } + + //LOG_I(MAC,">>>>>>>>mask %x num_rbs %d rb_offset %d\n", mask, num_rbs, rb_offset); + +// mac->type0_pdcch_dci_config.coreset.frequency_domain_resource = mask; +// mac->type0_pdcch_dci_config.coreset.rb_offset = rb_offset; // additional parameter other than coreset +// +// //mac->type0_pdcch_dci_config.type0_pdcch_coreset.duration = num_symbols; +// mac->type0_pdcch_dci_config.coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED; +// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_reg_bundle_size = 6; // L 38.211 7.3.2.2 +// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_interleaver_size = 2; // R 38.211 7.3.2.2 +// mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_shift_index = cell_id; +// mac->type0_pdcch_dci_config.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE; +// mac->type0_pdcch_dci_config.coreset.pdcch_dmrs_scrambling_id = cell_id; + + + // type0-pdcch search space + float big_o; + float big_m; + uint32_t temp; + type0_PDCCH_CSS_config->sfn_c=SFN_C_IMPOSSIBLE; // only valid for mux=1 + type0_PDCCH_CSS_config->n_c=UINT_MAX; + type0_PDCCH_CSS_config->number_of_search_space_per_slot=UINT_MAX; + type0_PDCCH_CSS_config->first_symbol_index=UINT_MAX; + type0_PDCCH_CSS_config->search_space_duration; // element of search space + // 38.213 table 10.1-1 + + /// MUX PATTERN 1 + if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){ + big_o = table_38213_13_11_c1[index_4lsb]; + type0_PDCCH_CSS_config->number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; + big_m = table_38213_13_11_c3[index_4lsb]; + + temp = (uint32_t)(big_o*pow(2, scs_pdcch)) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m); + type0_PDCCH_CSS_config->n_c = temp / num_slot_per_frame; + if((temp/num_slot_per_frame) & 0x1){ + type0_PDCCH_CSS_config->sfn_c = SFN_C_MOD_2_EQ_1; + }else{ + type0_PDCCH_CSS_config->sfn_c = SFN_C_MOD_2_EQ_0; + } + + if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 7) && (type0_PDCCH_CSS_config->ssb_index&1)){ + type0_PDCCH_CSS_config->first_symbol_index = type0_PDCCH_CSS_config->num_symbols; + }else{ + type0_PDCCH_CSS_config->first_symbol_index = table_38213_13_11_c4[index_4lsb]; + } + // 38.213 chapter 13: over two consecutive slots + type0_PDCCH_CSS_config->search_space_duration = 2; + } + + if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR2){ + big_o = table_38213_13_12_c1[index_4lsb]; + type0_PDCCH_CSS_config->number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; + big_m = table_38213_13_12_c3[index_4lsb]; + + if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 10) && (type0_PDCCH_CSS_config->ssb_index&1)){ + type0_PDCCH_CSS_config->first_symbol_index = 7; + }else if((index_4lsb == 6 || index_4lsb == 7 || index_4lsb == 8 || index_4lsb == 11) && (type0_PDCCH_CSS_config->ssb_index&1)){ + type0_PDCCH_CSS_config->first_symbol_index = type0_PDCCH_CSS_config->num_symbols; + }else{ + type0_PDCCH_CSS_config->first_symbol_index = 0; + } + // 38.213 chapter 13: over two consecutive slots + type0_PDCCH_CSS_config->search_space_duration = 2; + } + + /// MUX PATTERN 2 + if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 2){ + + if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){ + // 38.213 Table 13-13 + AssertFatal(index_4lsb == 0, "38.213 Table 13-13 4 LSB out of range\n"); + // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot + // sfn_c = SFN_C_EQ_SFN_SSB; + type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index); + switch(type0_PDCCH_CSS_config->ssb_index & 0x3){ // ssb_index(i) mod 4 + case 0: + type0_PDCCH_CSS_config->first_symbol_index = 0; + break; + case 1: + type0_PDCCH_CSS_config->first_symbol_index = 1; + break; + case 2: + type0_PDCCH_CSS_config->first_symbol_index = 6; + break; + case 3: + type0_PDCCH_CSS_config->first_symbol_index = 7; + break; + default: break; + } + + }else if((scs_ssb == scs_240kHz) && (scs_pdcch == scs_120kHz)){ + // 38.213 Table 13-14 + AssertFatal(index_4lsb == 0, "38.213 Table 13-14 4 LSB out of range\n"); + // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot + // sfn_c = SFN_C_EQ_SFN_SSB; + type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index); + switch(type0_PDCCH_CSS_config->ssb_index & 0x7){ // ssb_index(i) mod 8 + case 0: + type0_PDCCH_CSS_config->first_symbol_index = 0; + break; + case 1: + type0_PDCCH_CSS_config->first_symbol_index = 1; + break; + case 2: + type0_PDCCH_CSS_config->first_symbol_index = 2; + break; + case 3: + type0_PDCCH_CSS_config->first_symbol_index = 3; + break; + case 4: + type0_PDCCH_CSS_config->first_symbol_index = 12; + type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index) - 1; + break; + case 5: + type0_PDCCH_CSS_config->first_symbol_index = 13; + type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index) - 1; + break; + case 6: + type0_PDCCH_CSS_config->first_symbol_index = 0; + break; + case 7: + type0_PDCCH_CSS_config->first_symbol_index = 1; + break; + default: break; + } + }else{ ; } + // 38.213 chapter 13: over one slot + type0_PDCCH_CSS_config->search_space_duration = 1; + } + + /// MUX PATTERN 3 + if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 3){ + if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_120kHz)){ + // 38.213 Table 13-15 + AssertFatal(index_4lsb == 0, "38.213 Table 13-15 4 LSB out of range\n"); + // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot + // sfn_c = SFN_C_EQ_SFN_SSB; + type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index); + switch(type0_PDCCH_CSS_config->ssb_index & 0x3){ // ssb_index(i) mod 4 + case 0: + type0_PDCCH_CSS_config->first_symbol_index = 4; + break; + case 1: + type0_PDCCH_CSS_config->first_symbol_index = 8; + break; + case 2: + type0_PDCCH_CSS_config->first_symbol_index = 2; + break; + case 3: + type0_PDCCH_CSS_config->first_symbol_index = 6; + break; + default: break; + } + }else{ ; } + // 38.213 chapter 13: over one slot + type0_PDCCH_CSS_config->search_space_duration = 1; + } + + AssertFatal(type0_PDCCH_CSS_config->number_of_search_space_per_slot!=UINT_MAX,""); + +// uint32_t coreset_duration = num_symbols * number_of_search_space_per_slot; +// mac->type0_pdcch_dci_config.number_of_candidates[0] = table_38213_10_1_1_c2[0]; +// mac->type0_pdcch_dci_config.number_of_candidates[1] = table_38213_10_1_1_c2[1]; +// mac->type0_pdcch_dci_config.number_of_candidates[2] = table_38213_10_1_1_c2[2]; // CCE aggregation level = 4 +// mac->type0_pdcch_dci_config.number_of_candidates[3] = table_38213_10_1_1_c2[3]; // CCE aggregation level = 8 +// mac->type0_pdcch_dci_config.number_of_candidates[4] = table_38213_10_1_1_c2[4]; // CCE aggregation level = 16 +// mac->type0_pdcch_dci_config.duration = search_space_duration; +// mac->type0_pdcch_dci_config.coreset.duration = coreset_duration; // coreset +// AssertFatal(first_symbol_index!=UINT_MAX,""); +// mac->type0_pdcch_dci_config.monitoring_symbols_within_slot = (0x3fff << first_symbol_index) & (0x3fff >> (14-coreset_duration-first_symbol_index)) & 0x3fff; + + AssertFatal(type0_PDCCH_CSS_config->sfn_c!=SFN_C_IMPOSSIBLE,""); + AssertFatal(type0_PDCCH_CSS_config->n_c!=UINT_MAX,""); + + type0_PDCCH_CSS_config->n_0 = ((uint32_t)(big_o*pow(2, scs_pdcch)) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m))%num_slot_per_frame; + type0_PDCCH_CSS_config->cset_start_rb = ssb_offset_point_a - type0_PDCCH_CSS_config->rb_offset; + + return 0; +} diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index f31723a7d6..8fbced9186 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -32,9 +32,24 @@ #ifndef __LAYER2_NR_MAC_COMMON_H__ #define __LAYER2_NR_MAC_COMMON_H__ +#include "NR_MIB.h" #include "NR_PDSCH-Config.h" #include "NR_CellGroupConfig.h" #include "nr_mac.h" +#include "openair1/PHY/impl_defs_nr.h" + +#define TABLE_38213_13_1_NUM_INDEXES 15 +#define TABLE_38213_13_2_NUM_INDEXES 14 +#define TABLE_38213_13_3_NUM_INDEXES 9 +#define TABLE_38213_13_4_NUM_INDEXES 16 +#define TABLE_38213_13_5_NUM_INDEXES 9 +#define TABLE_38213_13_6_NUM_INDEXES 10 +#define TABLE_38213_13_7_NUM_INDEXES 12 +#define TABLE_38213_13_8_NUM_INDEXES 8 +#define TABLE_38213_13_9_NUM_INDEXES 4 +#define TABLE_38213_13_10_NUM_INDEXES 8 +#define TABLE_38213_13_11_NUM_INDEXES 16 +#define TABLE_38213_13_12_NUM_INDEXES 14 // =============================================== @@ -94,6 +109,57 @@ typedef enum { NR_RNTI_MCS_C, } nr_rnti_type_t; +typedef enum subcarrier_spacing_e { + scs_15kHz = 0x1, + scs_30kHz = 0x2, + scs_60kHz = 0x4, + scs_120kHz = 0x8, + scs_240kHz = 0x16 +} subcarrier_spacing_t; + +typedef enum channel_bandwidth_e { + bw_5MHz = 0x1, + bw_10MHz = 0x2, + bw_20MHz = 0x4, + bw_40MHz = 0x8, + bw_80MHz = 0x16, + bw_100MHz = 0x32 +} channel_bandwidth_t; + +typedef enum frequency_range_e { + FR1 = 0, + FR2 +} frequency_range_t; + +typedef enum nr_ssb_and_cset_mux_pattern_type_e { + NR_SSB_AND_CSET_MUX_PATTERN_TYPE1=1, + NR_SSB_AND_CSET_MUX_PATTERN_TYPE2, + NR_SSB_AND_CSET_MUX_PATTERN_TYPE3 +} nr_ssb_and_cset_mux_pattern_type_t; + +typedef enum { + SFN_C_MOD_2_EQ_0, + SFN_C_MOD_2_EQ_1, + SFN_C_IMPOSSIBLE +} SFN_C_TYPE; + +typedef struct Type0_PDCCH_CSS_config_s { + int32_t num_rbs; + int32_t num_symbols; + int32_t rb_offset; // Offset from SSB RB0 + uint32_t type0_pdcch_ss_mux_pattern; + uint16_t frame; + SFN_C_TYPE sfn_c; + uint32_t n_c; + uint32_t n_0; + uint32_t number_of_search_space_per_slot; + uint32_t first_symbol_index; + uint32_t search_space_duration; + uint32_t ssb_length; + uint32_t ssb_index; + uint32_t cset_start_rb; +} NR_Type0_PDCCH_CSS_config_t; + uint16_t config_bandwidth(int mu, int nb_rb, int nr_band); void get_frame_type(uint16_t nr_bandP, uint8_t scs_index, lte_frame_type_t *current_type); @@ -178,5 +244,12 @@ int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmr uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint8_t mcs_table); uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB); +int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, + NR_MIB_t *mib, + uint8_t extra_bits, + uint32_t ssb_length, + uint32_t ssb_index, + uint32_t ssb_offset_point_a); + int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH); #endif diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h index 5c714e4a93..50918b2e76 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h @@ -75,5 +75,66 @@ extern boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX]; extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; #endif*/ +// Type0-PDCCH search space +extern const int32_t table_38213_13_1_c1[16]; +extern const int32_t table_38213_13_1_c2[16]; +extern const int32_t table_38213_13_1_c3[16]; +extern const int32_t table_38213_13_1_c4[16]; + +extern const int32_t table_38213_13_2_c1[16]; +extern const int32_t table_38213_13_2_c2[16]; +extern const int32_t table_38213_13_2_c3[16]; +extern const int32_t table_38213_13_2_c4[16]; + +extern const int32_t table_38213_13_3_c1[16]; +extern const int32_t table_38213_13_3_c2[16]; +extern const int32_t table_38213_13_3_c3[16]; +extern const int32_t table_38213_13_3_c4[16]; + +extern const int32_t table_38213_13_4_c1[16]; +extern const int32_t table_38213_13_4_c2[16]; +extern const int32_t table_38213_13_4_c3[16]; +extern const int32_t table_38213_13_4_c4[16]; + +extern const int32_t table_38213_13_5_c1[16]; +extern const int32_t table_38213_13_5_c2[16]; +extern const int32_t table_38213_13_5_c3[16]; +extern const int32_t table_38213_13_5_c4[16]; + +extern const int32_t table_38213_13_6_c1[16]; +extern const int32_t table_38213_13_6_c2[16]; +extern const int32_t table_38213_13_6_c3[16]; +extern const int32_t table_38213_13_6_c4[16]; + +extern const int32_t table_38213_13_7_c1[16]; +extern const int32_t table_38213_13_7_c2[16]; +extern const int32_t table_38213_13_7_c3[16]; +extern const int32_t table_38213_13_7_c4[16]; + +extern const int32_t table_38213_13_8_c1[16]; +extern const int32_t table_38213_13_8_c2[16]; +extern const int32_t table_38213_13_8_c3[16]; +extern const int32_t table_38213_13_8_c4[16]; + +extern const int32_t table_38213_13_9_c1[16]; +extern const int32_t table_38213_13_9_c2[16]; +extern const int32_t table_38213_13_9_c3[16]; +extern const int32_t table_38213_13_9_c4[16]; + +extern const int32_t table_38213_13_10_c1[16]; +extern const int32_t table_38213_13_10_c2[16]; +extern const int32_t table_38213_13_10_c3[16]; +extern const int32_t table_38213_13_10_c4[16]; + +extern const float table_38213_13_11_c1[16]; +extern const int32_t table_38213_13_11_c2[16]; +extern const float table_38213_13_11_c3[16]; +extern const int32_t table_38213_13_11_c4[16]; + +extern const float table_38213_13_12_c1[16]; +extern const int32_t table_38213_13_12_c2[16]; +extern const float table_38213_13_12_c3[16]; + +extern const int32_t table_38213_10_1_1_c2[5]; #endif //DEF_H diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 7f98af2453..828b05c9fc 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -387,13 +387,70 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ NR_SearchSpace_t *css = commonSearchSpaceList->list.array[css_id]; AssertFatal(css->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n"); AssertFatal(*css->controlResourceSetId == mac->coreset[bwp_id - 1][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n"); - AssertFatal(css->searchSpaceId != 0, "css->searchSpaceId is 0\n"); + AssertFatal(&css->searchSpaceId != NULL, "css->searchSpaceId is null\n"); AssertFatal(css->searchSpaceType != NULL, "css->searchSpaceType is null\n"); AssertFatal(css->monitoringSymbolsWithinSlot != NULL, "css->monitoringSymbolsWithinSlot is null\n"); AssertFatal(css->monitoringSymbolsWithinSlot->buf != NULL, "css->monitoringSymbolsWithinSlot->buf is null\n"); mac->SSpace[0][0][ss_id] = css; ss_id++; } + + // TODO: Merge this code in a single function as fill_default_searchSpaceZero() in rrc_gNB_reconfig.c + // Search space zero + if(mac->search_space_zero == NULL) mac->search_space_zero=calloc(1,sizeof(*mac->search_space_zero)); + if(mac->search_space_zero->controlResourceSetId == NULL) mac->search_space_zero->controlResourceSetId=calloc(1,sizeof(*mac->search_space_zero->controlResourceSetId)); + if(mac->search_space_zero->monitoringSymbolsWithinSlot == NULL) mac->search_space_zero->monitoringSymbolsWithinSlot = calloc(1,sizeof(*mac->search_space_zero->monitoringSymbolsWithinSlot)); + if(mac->search_space_zero->monitoringSymbolsWithinSlot->buf == NULL) mac->search_space_zero->monitoringSymbolsWithinSlot->buf = calloc(1,2); + if(mac->search_space_zero->nrofCandidates == NULL) mac->search_space_zero->nrofCandidates = calloc(1,sizeof(*mac->search_space_zero->nrofCandidates)); + if(mac->search_space_zero->searchSpaceType == NULL) mac->search_space_zero->searchSpaceType = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType)); + if(mac->search_space_zero->searchSpaceType->choice.common == NULL) mac->search_space_zero->searchSpaceType->choice.common=calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common)); + if(mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 == NULL) mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*mac->search_space_zero->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); + mac->search_space_zero->searchSpaceId = 0; + *mac->search_space_zero->controlResourceSetId = 0; + mac->search_space_zero->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*mac->search_space_zero->monitoringSlotPeriodicityAndOffset)); + mac->search_space_zero->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; + mac->search_space_zero->duration=NULL; + // should be '1100 0000 0000 00'B (LSB first!), first two symbols in slot, adjust if needed + mac->search_space_zero->monitoringSymbolsWithinSlot->buf[1] = 0; + mac->search_space_zero->monitoringSymbolsWithinSlot->buf[0] = (1<<7) | (1<<6); + mac->search_space_zero->monitoringSymbolsWithinSlot->size = 2; + mac->search_space_zero->monitoringSymbolsWithinSlot->bits_unused = 2; + mac->search_space_zero->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; + mac->search_space_zero->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; + mac->search_space_zero->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n0; + mac->search_space_zero->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n1; + mac->search_space_zero->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; + mac->search_space_zero->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; + + // Coreset0 + if(mac->coreset0 == NULL) mac->coreset0 = calloc(1,sizeof(*mac->coreset0)); + mac->coreset0->controlResourceSetId = 0; + // frequencyDomainResources '11111111 00000000 00000000 00000000 00000000 00000'B, + if(mac->coreset0->frequencyDomainResources.buf == NULL) mac->coreset0->frequencyDomainResources.buf = calloc(1,6); + mac->coreset0->frequencyDomainResources.buf[0] = 0xff; + mac->coreset0->frequencyDomainResources.buf[1] = 0; + mac->coreset0->frequencyDomainResources.buf[2] = 0; + mac->coreset0->frequencyDomainResources.buf[3] = 0; + mac->coreset0->frequencyDomainResources.buf[4] = 0; + mac->coreset0->frequencyDomainResources.buf[5] = 0; + mac->coreset0->frequencyDomainResources.size = 6; + mac->coreset0->frequencyDomainResources.bits_unused = 3; + mac->coreset0->duration = 1; + mac->coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*mac->coreset0->cce_REG_MappingType.choice.interleaved)); + mac->coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; + mac->coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = 0; // FIXME: mac->scc->physCellId; + mac->coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; + if(mac->coreset0->tci_StatesPDCCH_ToAddList == NULL) mac->coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*mac->coreset0->tci_StatesPDCCH_ToAddList)); + NR_TCI_StateId_t *tci[8]; + for (int i=0;i<8;i++) { + tci[i]=calloc(1,sizeof(*tci[i])); + *tci[i] = i; + ASN_SEQUENCE_ADD(&mac->coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]); + } + mac->coreset0->tci_StatesPDCCH_ToReleaseList = NULL; + mac->coreset0->tci_PresentInDCI = NULL; + mac->coreset0->pdcch_DMRS_ScramblingID = NULL; + } int nr_rrc_mac_config_req_ue( diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index e97695e201..7bf68f9981 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -76,13 +76,6 @@ /*!\brief value for indicating BSR Timer is not running */ #define NR_MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF) - -typedef enum { - SFN_C_MOD_2_EQ_0, - SFN_C_MOD_2_EQ_1, - SFN_C_IMPOSSIBLE -} SFN_C_TYPE; - // LTE structure, might need to be adapted for NR typedef struct { /// buffer status for each lcgid @@ -265,6 +258,11 @@ typedef struct { /// PHR uint8_t PHR_reporting_active; + + NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config; + NR_SearchSpace_t *search_space_zero; + NR_ControlResourceSet_t *coreset0; + } NR_UE_MAC_INST_t; typedef enum seach_space_mask_e { @@ -275,28 +273,6 @@ typedef enum seach_space_mask_e { type3_pdcch = 0x10 } search_space_mask_t; -typedef enum subcarrier_spacing_e { - scs_15kHz = 0x1, - scs_30kHz = 0x2, - scs_60kHz = 0x4, - scs_120kHz = 0x8, - scs_240kHz = 0x16 -} subcarrier_spacing_t; - -typedef enum channel_bandwidth_e { - bw_5MHz = 0x1, - bw_10MHz = 0x2, - bw_20MHz = 0x4, - bw_40MHz = 0x8, - bw_80MHz = 0x16, - bw_100MHz = 0x32 -} channel_bandwidth_t; - -typedef enum frequency_range_e { - FR1 = 0, - FR2 -} frequency_range_t; - typedef struct { uint8_t identifier_dci_formats ; // 0 IDENTIFIER_DCI_FORMATS: uint8_t carrier_ind ; // 1 CARRIER_IND: 0 or 3 bits, as defined in Subclause x.x of [5, TS38.213] diff --git a/openair2/LAYER2/NR_MAC_UE/mac_extern.h b/openair2/LAYER2/NR_MAC_UE/mac_extern.h index 54cdc4d149..79d671b8fb 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_extern.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_extern.h @@ -34,58 +34,6 @@ //extern NR_UE_MAC_INST_t *UE_mac_inst; -// Type0-PDCCH search space -extern const int32_t table_38213_13_1_c2[16]; -extern const int32_t table_38213_13_1_c3[16]; -extern const int32_t table_38213_13_1_c4[16]; - -extern const int32_t table_38213_13_2_c2[16]; -extern const int32_t table_38213_13_2_c3[16]; -extern const int32_t table_38213_13_2_c4[16]; - -extern const int32_t table_38213_13_3_c2[16]; -extern const int32_t table_38213_13_3_c3[16]; -extern const int32_t table_38213_13_3_c4[16]; - -extern const int32_t table_38213_13_4_c2[16]; -extern const int32_t table_38213_13_4_c3[16]; -extern const int32_t table_38213_13_4_c4[16]; - -extern const int32_t table_38213_13_5_c2[16]; -extern const int32_t table_38213_13_5_c3[16]; -extern const int32_t table_38213_13_5_c4[16]; - -extern const int32_t table_38213_13_6_c2[16]; -extern const int32_t table_38213_13_6_c3[16]; -extern const int32_t table_38213_13_6_c4[16]; - -extern const int32_t table_38213_13_7_c2[16]; -extern const int32_t table_38213_13_7_c3[16]; -extern const int32_t table_38213_13_7_c4[16]; - -extern const int32_t table_38213_13_8_c2[16]; -extern const int32_t table_38213_13_8_c3[16]; -extern const int32_t table_38213_13_8_c4[16]; - -extern const int32_t table_38213_13_9_c2[16]; -extern const int32_t table_38213_13_9_c3[16]; -extern const int32_t table_38213_13_9_c4[16]; - -extern const int32_t table_38213_13_10_c2[16]; -extern const int32_t table_38213_13_10_c3[16]; -extern const int32_t table_38213_13_10_c4[16]; - -extern const float table_38213_13_11_c1[16]; -extern const int32_t table_38213_13_11_c2[16]; -extern const float table_38213_13_11_c3[16]; -extern const int32_t table_38213_13_11_c4[16]; - -extern const float table_38213_13_12_c1[16]; -extern const int32_t table_38213_13_12_c2[16]; -extern const float table_38213_13_12_c3[16]; - -extern const int32_t table_38213_10_1_1_c2[5]; - // DCI extraction // for PUSCH from TS 38.214 subclause 6.1.2.1.1 extern uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3]; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index ab6a047500..1eaa02e77b 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -123,8 +123,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr int nr_ue_process_dci_indication_pdu(module_id_t module_id, int cc_id, int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci); uint32_t get_ssb_frame(uint32_t test); -uint32_t get_ssb_slot(uint32_t ssb_index); - uint32_t mr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe); diff --git a/openair2/LAYER2/NR_MAC_UE/mac_vars.c b/openair2/LAYER2/NR_MAC_UE/mac_vars.c index 95dea61a45..4986ab5883 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_vars.c +++ b/openair2/LAYER2/NR_MAC_UE/mac_vars.c @@ -32,64 +32,6 @@ #include "mac_defs.h" -#define reserved 0xffff - -// specification mapping talbe, table_38$x_$y_$z_c$a -// - $x: specification -// - $y: subclause-major -// - $z: subclause-minor -// - $a: ($a)th of column in table, start from zero -const int32_t table_38213_13_1_c2[16] = {24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, 96, 96, 96, reserved}; // index 15 reserved -const int32_t table_38213_13_1_c3[16] = { 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved}; // index 15 reserved -const int32_t table_38213_13_1_c4[16] = { 0, 2, 4, 0, 2, 4, 12, 16, 12, 16, 12, 16, 38, 38, 38, reserved}; // index 15 reserved - -const int32_t table_38213_13_2_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved}; // index 14-15 reserved -const int32_t table_38213_13_2_c3[16] = { 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved}; // index 14-15 reserved -const int32_t table_38213_13_2_c4[16] = { 5, 6, 7, 8, 5, 6, 7, 8, 18, 20, 18, 20, 18, 20, reserved, reserved}; // index 14-15 reserved - -const int32_t table_38213_13_3_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved -const int32_t table_38213_13_3_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved -const int32_t table_38213_13_3_c4[16] = { 2, 6, 2, 6, 2, 6, 28, 28, 28, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved - -const int32_t table_38213_13_4_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48}; -const int32_t table_38213_13_4_c3[16] = { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 1, 1, 1, 2, 2, 2}; -const int32_t table_38213_13_4_c4[16] = { 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 12, 14, 16, 12, 14, 16}; - -const int32_t table_38213_13_5_c2[16] = {48, 48, 48, 96, 96, 96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved -const int32_t table_38213_13_5_c3[16] = { 1, 2, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved -const int32_t table_38213_13_5_c4[16] = { 4, 4, 4, 0, 56, 0, 56, 0, 56, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved - -const int32_t table_38213_13_6_c2[16] = {24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved -const int32_t table_38213_13_6_c3[16] = { 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved -const int32_t table_38213_13_6_c4[16] = { 0, 4, 0, 4, 0, 28, 0, 28, 0, 28, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved - -const int32_t table_38213_13_7_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 48, 48, 96, 96, reserved, reserved, reserved, reserved}; // index 12-15 reserved -const int32_t table_38213_13_7_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved}; // index 12-15 reserved -const int32_t table_38213_13_7_c4[16] = { 0, 8, 0, 8, 0, 8, 28, 28,-41, 49,-41, 97, reserved, reserved, reserved, reserved}; // index 12-15 reserved, condition A as default - -const int32_t table_38213_13_8_c2[16] = { 1, 1, 1, 1, 3, 3, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved -const int32_t table_38213_13_8_c3[16] = {24, 24, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved -const int32_t table_38213_13_8_c4[16] = { 0, 4, 14, 14,-20, 24,-20, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved, condition A as default - -const int32_t table_38213_13_9_c2[16] = {96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved -const int32_t table_38213_13_9_c3[16] = { 1, 1, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved -const int32_t table_38213_13_9_c4[16] = { 0, 16, 0, 16, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved - -const int32_t table_38213_13_10_c2[16] = {48, 48, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved -const int32_t table_38213_13_10_c3[16] = { 1, 1, 2, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved -const int32_t table_38213_13_10_c4[16] = { 0, 8, 0, 8,-41, 25,-41, 49, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved, condition A as default - -const float table_38213_13_11_c1[16] = { 0, 0, 2, 2, 5, 5, 7, 7, 0, 5, 0, 0, 2, 2, 5, 5}; // O -const int32_t table_38213_13_11_c2[16] = { 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1}; -const float table_38213_13_11_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 1, 1, 1, 1, 1, 1, 1}; // M -const int32_t table_38213_13_11_c4[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2}; // i is even as default - -const float table_38213_13_12_c1[16] = { 0, 0, 2.5f, 2.5f, 5, 5, 0, 2.5f, 5, 7.5f, 7.5f, 7.5f, 0, 5, reserved, reserved}; // O, index 14-15 reserved -const int32_t table_38213_13_12_c2[16] = { 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, reserved, reserved}; // index 14-15 reserved -const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f, 0.5f, 1, 0.5f, 0.5f, 1, 1, reserved, reserved}; // M, index 14-15 reserved - -const int32_t table_38213_10_1_1_c2[5] = { 0, 0, 4, 2, 1 }; - /* #define mu_pusch 1 // definition table j Table 6.1.2.1.1-4 diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 4c950a92e6..07dce96f51 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -38,6 +38,7 @@ #include "common/utils/nr/nr_common.h" #include "executables/softmodem-common.h" #include +#include "nfapi_nr_interface.h" #ifdef NR_PDCCH_DCI_TOOLS_DEBUG #define LOG_DCI_D(a...) printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) ->" a) @@ -53,16 +54,22 @@ dci_pdu_rel15_t *def_dci_pdu_rel15; void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) { LOG_D(MAC,"Filling search candidates for DCI\n"); - - rel15->number_of_candidates=4; - rel15->CCE[0]=0; - rel15->L[0]=4; - rel15->CCE[1]=4; - rel15->L[1]=4; - rel15->CCE[2]=8; - rel15->L[2]=4; - rel15->CCE[3]=12; - rel15->L[3]=4; + + if(ss->searchSpaceId == 0) { + rel15->number_of_candidates=1; + rel15->CCE[0]=0; + rel15->L[0]=6; + } else { + rel15->number_of_candidates=4; + rel15->CCE[0]=0; + rel15->L[0]=4; + rel15->CCE[1]=4; + rel15->L[1]=4; + rel15->CCE[2]=8; + rel15->L[2]=4; + rel15->CCE[3]=12; + rel15->L[3]=4; + } } @@ -76,10 +83,19 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t NR_ServingCellConfigCommon_t *scc = mac->scc; NR_BWP_DownlinkCommon_t *bwp_Common = mac->DLbwp[bwp_id - 1]->bwp_Common; NR_BWP_DownlinkCommon_t *initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP; - NR_SearchSpace_t *ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id]; - // CORESET configuration - NR_ControlResourceSet_t *coreset = mac->coreset[bwp_id - 1][coreset_id - 1]; + NR_SearchSpace_t *ss; + NR_ControlResourceSet_t *coreset; + if(ss_id>=0) { + ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id]; + coreset = mac->coreset[bwp_id - 1][coreset_id - 1]; + rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; + } else { + ss = mac->search_space_zero; + coreset = mac->coreset0; + rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; + } + rel15->coreset.duration = coreset->duration; for (int i = 0; i < 6; i++) rel15->coreset.frequency_domain_resource[i] = coreset->frequencyDomainResources.buf[i]; @@ -95,7 +111,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t rel15->coreset.InterleaverSize = 0; rel15->coreset.ShiftIndex = 0; } - rel15->coreset.CoreSetType = 1; + rel15->coreset.precoder_granularity = coreset->precoderGranularity; // Scrambling RNTI @@ -145,7 +161,24 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t case NR_RNTI_SP_CSI: break; case NR_RNTI_SI: + + // we use DL BWP dedicated + sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12; + + // for SPS=14 8 MSBs in positions 13 down to 6 + monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); + + rel15->rnti = 0xFFFF; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values + rel15->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; + rel15->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; + rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + + for (int i = 0; i < rel15->num_dci_options; i++) { + rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0); + } + break; + case NR_RNTI_SFI: break; case NR_RNTI_INT: @@ -205,6 +238,10 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl // Fetch configuration for searchSpaceZero // note: The search space with the SearchSpaceId = 0 identifies the search space configured via PBCH (MIB) and in ServingCellConfigCommon (searchSpaceZero). if (pdcch_ConfigCommon->choice.setup->searchSpaceZero){ + if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 == NULL){ + pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1)); + } + *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = 0; LOG_D(MAC, "[DCI_CONFIG] Configure SearchSpace#0 of the initial BWP\n"); LOG_W(MAC, "[DCI_CONFIG] This should not be available yet..."); } @@ -326,4 +363,25 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl break; } } + + // Search space 0, CORESET ID 0 + + NR_BWP_DownlinkCommon_t *bwp_Common = bwp->bwp_Common; + NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon; + + if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ + + NR_SearchSpace_t *ss0 = mac->search_space_zero; + fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; + + if (ss0->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){ + if( (frame%2 == mac->type0_PDCCH_CSS_config.sfn_c) && (slot == mac->type0_PDCCH_CSS_config.n_0) ){ + rel15->num_dci_options = 1; + rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; + config_dci_pdu(mac, rel15, dl_config, NR_RNTI_SI, -1); + fill_dci_search_candidates(ss0, rel15); + } + } + } + } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index a22291092b..359b631582 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -49,6 +49,7 @@ #include "NR_MAC_COMMON/nr_mac.h" #include "NR_MAC_UE/mac_proto.h" #include "NR_MAC_UE/mac_extern.h" +#include "NR_MAC_COMMON/nr_mac_extern.h" #include "common/utils/nr/nr_common.h" /* PHY */ @@ -787,12 +788,6 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, } -uint32_t get_ssb_slot(uint32_t ssb_index){ - // this function now only support f <= 3GHz - return ssb_index & 0x3 ; - - // return first_symbol(case, freq, ssb_index) / 14 -} uint8_t table_9_2_2_1[16][8]={ {0,12,2, 0, 0,3,0,0}, @@ -970,7 +965,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, uint16_t frame_number_4lsb = 0; for (int i=0; i<4; i++) frame_number_4lsb |= ((extra_bits>>i)&1)<<(3-i); - //uint8_t half_frame_bit = ( extra_bits >> 4 ) & 0x1; // extra bits[4] + uint8_t half_frame_bit = ( extra_bits >> 4 ) & 0x1; // extra bits[4] uint8_t ssb_subcarrier_offset_msb = ( extra_bits >> 5 ) & 0x1; // extra bits[5] uint8_t ssb_subcarrier_offset = (uint8_t)mac->mib->ssb_SubcarrierOffset; @@ -993,351 +988,26 @@ int8_t nr_ue_decode_mib(module_id_t module_id, LOG_I(MAC,"subcarrier spacing (0=15or60, 1=30or120): %d\n", (int)mac->mib->subCarrierSpacingCommon); LOG_I(MAC,"ssb carrier offset(with MSB): %d\n", (int)ssb_subcarrier_offset); LOG_I(MAC,"dmrs type A position (0=pos2,1=pos3): %d\n", (int)mac->mib->dmrs_TypeA_Position); - LOG_I(MAC,"pdcch config sib1: %d\n", (int)mac->mib->pdcch_ConfigSIB1); + LOG_I(MAC,"pdcch config sib1.controlResourceSetZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.controlResourceSetZero); + LOG_I(MAC,"pdcch config sib1.searchSpaceZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.searchSpaceZero); LOG_I(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred); LOG_I(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection); LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit); LOG_I(MAC,"ssb index(extra bits): %d\n", (int)ssb_index); #endif - subcarrier_spacing_t scs_ssb = scs_30kHz; // default for - //const uint32_t scs_index = 0; - const uint32_t num_slot_per_frame = 20; - subcarrier_spacing_t scs_pdcch; + get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config, mac->mib, extra_bits, ssb_length, ssb_index, + mac->phy_config.config_req.ssb_table.ssb_offset_point_a); - // assume carrier frequency < 6GHz - if(mac->mib->subCarrierSpacingCommon == NR_MIB__subCarrierSpacingCommon_scs15or60){ - scs_pdcch = scs_15kHz; - }else{ //NR_MIB__subCarrierSpacingCommon_scs30or120 - scs_pdcch = scs_30kHz; - } + ssb_index = mac->type0_PDCCH_CSS_config.ssb_index; // TODO: ssb_index should obtain from L1 in case Lssb != 64 + mac->type0_pdcch_ss_mux_pattern = mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern; + mac->type0_pdcch_ss_sfn_c = mac->type0_PDCCH_CSS_config.sfn_c; + mac->type0_pdcch_ss_n_c = mac->type0_PDCCH_CSS_config.n_c; + mac->dl_config_request.sfn = mac->type0_PDCCH_CSS_config.frame; + mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS + channel_bandwidth_t min_channel_bw = bw_10MHz; // default for testing - channel_bandwidth_t min_channel_bw = bw_10MHz; // deafult for testing - - uint32_t is_condition_A = (ssb_subcarrier_offset == 0); // 38.213 ch.13 - frequency_range_t frequency_range = FR1; - uint32_t index_4msb = (mac->mib->pdcch_ConfigSIB1.controlResourceSetZero); - uint32_t index_4lsb = (mac->mib->pdcch_ConfigSIB1.searchSpaceZero); - int32_t num_rbs = -1; - int32_t num_symbols = -1; - int32_t rb_offset = -1; - //LOG_I(MAC,"<<<<<<<<mib->pdcch_ConfigSIB1,index_4msb,index_4lsb,scs_ssb,scs_pdcch, (scs_ssb << 5)|scs_pdcch); - - // type0-pdcch coreset - switch( (scs_ssb << 5)|scs_pdcch ){ - case (scs_15kHz << 5) | scs_15kHz : - AssertFatal(index_4msb < 15, "38.213 Table 13-1 4 MSB out of range\n"); - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_1_c2[index_4msb]; - num_symbols = table_38213_13_1_c3[index_4msb]; - rb_offset = table_38213_13_1_c4[index_4msb]; - break; - - case (scs_15kHz << 5) | scs_30kHz: - AssertFatal(index_4msb < 14, "38.213 Table 13-2 4 MSB out of range\n"); - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_2_c2[index_4msb]; - num_symbols = table_38213_13_2_c3[index_4msb]; - rb_offset = table_38213_13_2_c4[index_4msb]; - break; - - case (scs_30kHz << 5) | scs_15kHz: - if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){ - AssertFatal(index_4msb < 9, "38.213 Table 13-3 4 MSB out of range\n"); - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_3_c2[index_4msb]; - num_symbols = table_38213_13_3_c3[index_4msb]; - rb_offset = table_38213_13_3_c4[index_4msb]; - }else if(min_channel_bw & bw_40MHz){ - AssertFatal(index_4msb < 9, "38.213 Table 13-5 4 MSB out of range\n"); - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_5_c2[index_4msb]; - num_symbols = table_38213_13_5_c3[index_4msb]; - rb_offset = table_38213_13_5_c4[index_4msb]; - }else{ ; } - - break; - - case (scs_30kHz << 5) | scs_30kHz: - if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){ - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_4_c2[index_4msb]; - num_symbols = table_38213_13_4_c3[index_4msb]; - rb_offset = table_38213_13_4_c4[index_4msb]; - LOG_I(MAC,"<<<<<<<<type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_6_c2[index_4msb]; - num_symbols = table_38213_13_6_c3[index_4msb]; - rb_offset = table_38213_13_6_c4[index_4msb]; - }else{ ; } - break; - - case (scs_120kHz << 5) | scs_60kHz: - AssertFatal(index_4msb < 12, "38.213 Table 13-7 4 MSB out of range\n"); - if(index_4msb & 0x7){ - mac->type0_pdcch_ss_mux_pattern = 1; - }else if(index_4msb & 0x18){ - mac->type0_pdcch_ss_mux_pattern = 2; - }else{ ; } - - num_rbs = table_38213_13_7_c2[index_4msb]; - num_symbols = table_38213_13_7_c3[index_4msb]; - if(!is_condition_A && (index_4msb == 8 || index_4msb == 10)){ - rb_offset = table_38213_13_7_c4[index_4msb] - 1; - }else{ - rb_offset = table_38213_13_7_c4[index_4msb]; - } - break; - - case (scs_120kHz << 5) | scs_120kHz: - AssertFatal(index_4msb < 8, "38.213 Table 13-8 4 MSB out of range\n"); - if(index_4msb & 0x3){ - mac->type0_pdcch_ss_mux_pattern = 1; - }else if(index_4msb & 0x0c){ - mac->type0_pdcch_ss_mux_pattern = 3; - } - - num_rbs = table_38213_13_8_c2[index_4msb]; - num_symbols = table_38213_13_8_c3[index_4msb]; - if(!is_condition_A && (index_4msb == 4 || index_4msb == 6)){ - rb_offset = table_38213_13_8_c4[index_4msb] - 1; - }else{ - rb_offset = table_38213_13_8_c4[index_4msb]; - } - break; - - case (scs_240kHz << 5) | scs_60kHz: - AssertFatal(index_4msb < 4, "38.213 Table 13-9 4 MSB out of range\n"); - mac->type0_pdcch_ss_mux_pattern = 1; - num_rbs = table_38213_13_9_c2[index_4msb]; - num_symbols = table_38213_13_9_c3[index_4msb]; - rb_offset = table_38213_13_9_c4[index_4msb]; - break; - - case (scs_240kHz << 5) | scs_120kHz: - AssertFatal(index_4msb < 8, "38.213 Table 13-10 4 MSB out of range\n"); - if(index_4msb & 0x3){ - mac->type0_pdcch_ss_mux_pattern = 1; - }else if(index_4msb & 0x0c){ - mac->type0_pdcch_ss_mux_pattern = 2; - } - num_rbs = table_38213_13_10_c2[index_4msb]; - num_symbols = table_38213_13_10_c3[index_4msb]; - if(!is_condition_A && (index_4msb == 4 || index_4msb == 6)){ - rb_offset = table_38213_13_10_c4[index_4msb]-1; - }else{ - rb_offset = table_38213_13_10_c4[index_4msb]; - } - - break; - - default: - break; - } - - AssertFatal(num_rbs != -1, "Type0 PDCCH coreset num_rbs undefined"); - AssertFatal(num_symbols != -1, "Type0 PDCCH coreset num_symbols undefined"); - AssertFatal(rb_offset != -1, "Type0 PDCCH coreset rb_offset undefined"); - - //uint32_t cell_id = 0; // obtain from L1 later - - //mac->type0_pdcch_dci_config.coreset.rb_start = rb_offset; - //mac->type0_pdcch_dci_config.coreset.rb_end = rb_offset + num_rbs - 1; - uint64_t mask = 0x0; - uint8_t i; - for(i=0; i<(num_rbs/6); ++i){ // 38.331 Each bit corresponds a group of 6 RBs - mask = mask >> 1; - mask = mask | 0x100000000000; - } - //LOG_I(MAC,">>>>>>>>mask %x num_rbs %d rb_offset %d\n", mask, num_rbs, rb_offset); - /* - mac->type0_pdcch_dci_config.coreset.frequency_domain_resource = mask; - mac->type0_pdcch_dci_config.coreset.rb_offset = rb_offset; // additional parameter other than coreset - - //mac->type0_pdcch_dci_config.type0_pdcch_coreset.duration = num_symbols; - mac->type0_pdcch_dci_config.coreset.cce_reg_mapping_type = CCE_REG_MAPPING_TYPE_INTERLEAVED; - mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_reg_bundle_size = 6; // L 38.211 7.3.2.2 - mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_interleaver_size = 2; // R 38.211 7.3.2.2 - mac->type0_pdcch_dci_config.coreset.cce_reg_interleaved_shift_index = cell_id; - mac->type0_pdcch_dci_config.coreset.precoder_granularity = PRECODER_GRANULARITY_SAME_AS_REG_BUNDLE; - mac->type0_pdcch_dci_config.coreset.pdcch_dmrs_scrambling_id = cell_id; - */ - - - // type0-pdcch search space - float big_o; - float big_m; - uint32_t temp; - SFN_C_TYPE sfn_c=SFN_C_IMPOSSIBLE; // only valid for mux=1 - uint32_t n_c=UINT_MAX; - uint32_t number_of_search_space_per_slot=UINT_MAX; -// uint32_t first_symbol_index=UINT_MAX; -// uint32_t search_space_duration; // element of search space - // 38.213 table 10.1-1 - - /// MUX PATTERN 1 - if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){ - big_o = table_38213_13_11_c1[index_4lsb]; - number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; - big_m = table_38213_13_11_c3[index_4lsb]; - - temp = (uint32_t)(big_o*pow(2, scs_pdcch)) + (uint32_t)(ssb_index*big_m); - n_c = temp / num_slot_per_frame; - if((temp/num_slot_per_frame) & 0x1){ - sfn_c = SFN_C_MOD_2_EQ_1; - }else{ - sfn_c = SFN_C_MOD_2_EQ_0; - } - -// if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 7) && (ssb_index&1)){ -// first_symbol_index = num_symbols; -// }else{ -// first_symbol_index = table_38213_13_11_c4[index_4lsb]; -// } - // 38.213 chapter 13: over two consecutive slots -// search_space_duration = 2; - } - - if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR2){ - big_o = table_38213_13_12_c1[index_4lsb]; - number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; - big_m = table_38213_13_12_c3[index_4lsb]; - -// if((index_4lsb == 1 || index_4lsb == 3 || index_4lsb == 5 || index_4lsb == 10) && (ssb_index&1)){ -// first_symbol_index = 7; -// }else if((index_4lsb == 6 || index_4lsb == 7 || index_4lsb == 8 || index_4lsb == 11) && (ssb_index&1)){ -// first_symbol_index = num_symbols; -// }else{ -// first_symbol_index = 0; -// } - // 38.213 chapter 13: over two consecutive slots - //search_space_duration = 2; - } - - /// MUX PATTERN 2 - if(mac->type0_pdcch_ss_mux_pattern == 2){ - - if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){ - // 38.213 Table 13-13 - AssertFatal(index_4lsb == 0, "38.213 Table 13-13 4 LSB out of range\n"); - // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot - // sfn_c = SFN_C_EQ_SFN_SSB; - n_c = get_ssb_slot(ssb_index); -// switch(ssb_index & 0x3){ // ssb_index(i) mod 4 -// case 0: -// first_symbol_index = 0; -// break; -// case 1: -// first_symbol_index = 1; -// break; -// case 2: -// first_symbol_index = 6; -// break; -// case 3: -// first_symbol_index = 7; -// break; -// default: break; -// } - - }else if((scs_ssb == scs_240kHz) && (scs_pdcch == scs_120kHz)){ - // 38.213 Table 13-14 - AssertFatal(index_4lsb == 0, "38.213 Table 13-14 4 LSB out of range\n"); - // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot - // sfn_c = SFN_C_EQ_SFN_SSB; - n_c = get_ssb_slot(ssb_index); - switch(ssb_index & 0x7){ // ssb_index(i) mod 8 - case 0: -// first_symbol_index = 0; - break; - case 1: -// first_symbol_index = 1; - break; - case 2: -// first_symbol_index = 2; - break; - case 3: -// first_symbol_index = 3; - break; - case 4: -// first_symbol_index = 12; - n_c = get_ssb_slot(ssb_index) - 1; - break; - case 5: -// first_symbol_index = 13; - n_c = get_ssb_slot(ssb_index) - 1; - break; - case 6: -// first_symbol_index = 0; - break; - case 7: -// first_symbol_index = 1; - break; - default: break; - } - }else{ ; } - // 38.213 chapter 13: over one slot -// search_space_duration = 1; - } - - /// MUX PATTERN 3 - if(mac->type0_pdcch_ss_mux_pattern == 3){ - if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_120kHz)){ - // 38.213 Table 13-15 - AssertFatal(index_4lsb == 0, "38.213 Table 13-15 4 LSB out of range\n"); - // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot - // sfn_c = SFN_C_EQ_SFN_SSB; - n_c = get_ssb_slot(ssb_index); -// switch(ssb_index & 0x3){ // ssb_index(i) mod 4 -// case 0: -// first_symbol_index = 4; -// break; -// case 1: -// first_symbol_index = 8; -// break; -// case 2: -// first_symbol_index = 2; -// break; -// case 3: -// first_symbol_index = 6; -// break; -// default: break; -// } - }else{ ; } - // 38.213 chapter 13: over one slot -// search_space_duration = 1; - } - - AssertFatal(number_of_search_space_per_slot!=UINT_MAX,""); - /* - uint32_t coreset_duration = num_symbols * number_of_search_space_per_slot; - mac->type0_pdcch_dci_config.number_of_candidates[0] = table_38213_10_1_1_c2[0]; - mac->type0_pdcch_dci_config.number_of_candidates[1] = table_38213_10_1_1_c2[1]; - mac->type0_pdcch_dci_config.number_of_candidates[2] = table_38213_10_1_1_c2[2]; // CCE aggregation level = 4 - mac->type0_pdcch_dci_config.number_of_candidates[3] = table_38213_10_1_1_c2[3]; // CCE aggregation level = 8 - mac->type0_pdcch_dci_config.number_of_candidates[4] = table_38213_10_1_1_c2[4]; // CCE aggregation level = 16 - mac->type0_pdcch_dci_config.duration = search_space_duration; - mac->type0_pdcch_dci_config.coreset.duration = coreset_duration; // coreset - AssertFatal(first_symbol_index!=UINT_MAX,""); - mac->type0_pdcch_dci_config.monitoring_symbols_within_slot = (0x3fff << first_symbol_index) & (0x3fff >> (14-coreset_duration-first_symbol_index)) & 0x3fff; - */ - AssertFatal(sfn_c!=SFN_C_IMPOSSIBLE,""); - AssertFatal(n_c!=UINT_MAX,""); - mac->type0_pdcch_ss_sfn_c = sfn_c; - mac->type0_pdcch_ss_n_c = n_c; - - // fill in the elements in config request inside P5 message - mac->phy_config.Mod_id = module_id; - mac->phy_config.CC_id = cc_id; - - mac->dl_config_request.sfn = frame; - mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS - - //} return 0; - } @@ -2895,6 +2565,11 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *p dlsch_config_pdu->number_rbs = NRRIV2BW(riv,n_RB_DLBWP); dlsch_config_pdu->start_rb = NRRIV2PRBOFFSET(riv,n_RB_DLBWP); + LOG_D(MAC,"riv = %i\n", riv); + LOG_D(MAC,"n_RB_DLBWP = %i\n", n_RB_DLBWP); + LOG_D(MAC,"number_rbs = %i\n", dlsch_config_pdu->number_rbs); + LOG_D(MAC,"start_rb = %i\n", dlsch_config_pdu->start_rb); + } if(pusch_config_pdu != NULL){ /* @@ -3058,6 +2733,11 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, SLIV2SL(startSymbolAndLength,&S,&L); dlsch_config_pdu->start_symbol=S; dlsch_config_pdu->number_symbols=L; + + LOG_I(MAC,"SLIV = %i\n", startSymbolAndLength); + LOG_I(MAC,"start_symbol = %i\n", dlsch_config_pdu->start_symbol); + LOG_I(MAC,"number_symbols = %i\n", dlsch_config_pdu->number_symbols); + } else {// Default configuration from tables // k_offset = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0]; @@ -3643,14 +3323,35 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr */ dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti; - //fapi_nr_dl_config_dlsch_pdu_rel15_t dlsch_config_pdu_1_0 = dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; + fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; - dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); - dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); - dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; + + NR_ServingCellConfigCommon_t *scc = mac->scc; + NR_BWP_DownlinkCommon_t *initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP; + + if (mac->RA_window_cnt >= 0 && rnti == mac->ra_rnti){ + dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH; + dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + } + else if(rnti == SI_RNTI) { + dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH; + dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; + dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; + dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + } + else { + dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; + dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); + dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); + dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; + } + /* IDENTIFIER_DCI_FORMATS */ /* FREQ_DOM_RESOURCE_ASSIGNMENT_DL */ - nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_0,0,n_RB_DLBWP,dci->frequency_domain_assignment.val); + nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_0,0,dlsch_config_pdu_1_0->BWPSize,dci->frequency_domain_assignment.val); + /* TIME_DOM_RESOURCE_ASSIGNMENT */ if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val) < 0) return -1; @@ -3659,11 +3360,17 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr mac->scc->dmrs_TypeA_Position, dlsch_config_pdu_1_0->number_symbols); dlsch_config_pdu_1_0->dmrsConfigType = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; + /* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */ - if (dlsch_config_pdu_1_0->number_symbols == 2) - dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1; - else - dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 2; + //if (dlsch_config_pdu_1_0->number_symbols == 2) + // dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1; + //else + // dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 2; + + /* TODO: fix number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214, + using tables 7.3.1.2.2-1, 7.3.1.2.2-2, 7.3.1.2.2-3, 7.3.1.2.2-4 of 3GPP TS 38.212 */ + dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1; + /* VRB_TO_PRB_MAPPING */ dlsch_config_pdu_1_0->vrb_to_prb_mapping = (dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved:vrb_to_prb_mapping_interleaved; /* MCS */ @@ -3724,12 +3431,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_0->pucch_resource_id, dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind); - if (mac->RA_window_cnt >= 0 && rnti == mac->ra_rnti){ - dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH; - } else { - dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; - } - // dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15.N_RB_BWP = n_RB_DLBWP; LOG_D(MAC,"(nr_ue_procedures.c) pdu_type=%d\n\n",dl_config->dl_config_list[dl_config->number_pdus].pdu_type); @@ -4014,7 +3715,7 @@ int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){ case NR_RNTI_RA: case NR_RNTI_TC: case NR_RNTI_P: - case NR_RNTI_SI: + //case NR_RNTI_SI: if (mac->DLbwp[0]->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero) { uint8_t bwp_id = 1; uint8_t coreset_id = 0; // assuming controlResourceSetId is 0 for controlResourceSetZero @@ -4024,6 +3725,9 @@ int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){ N_RB = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); } break; + case NR_RNTI_SI: + N_RB = mac->type0_PDCCH_CSS_config.num_rbs; + break; case NR_RNTI_C: N_RB = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, 275); break; @@ -4263,23 +3967,42 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac, break; case NR_RNTI_SI: - /* - // Freq domain assignment 0-16 bit - fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); - for (int i=0; ifrequency_domain_assignment>>(fsize-i-1))&1)<<(dci_size-pos++); - // Time domain assignment 4 bit - for (int i=0; i<4; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment>>(3-i))&1)<<(dci_size-pos++); - // VRB to PRB mapping 1 bit - *dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val&1)<<(dci_size-pos++); - // MCS 5bit //bit over 32, so dci_pdu ++ - for (int i=0; i<5; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs>>(4-i))&1)<<(dci_size-pos++); - // Redundancy version 2bit - for (int i=0; i<2; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->rv>>(1-i))&1)<<(dci_size-pos++); - */ + + // Freq domain assignment 0-16 bit + fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); + pos+=fsize; + dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<time_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&0xf; + + // VRB to PRB mapping 1 bit + pos++; + dci_pdu_rel15->vrb_to_prb_mapping.val = (*dci_pdu>>(dci_size-pos))&0x1; + + // MCS 5bit //bit over 32, so dci_pdu ++ + pos+=5; + dci_pdu_rel15->mcs = (*dci_pdu>>(dci_size-pos))&0x1f; + + // Redundancy version 2 bit + pos+=2; + dci_pdu_rel15->rv = (*dci_pdu>>(dci_size-pos))&3; + + // System information indicator 1 bit + pos++; + dci_pdu_rel15->system_info_indicator = (*dci_pdu>>(dci_size-pos))&0x1; + + LOG_D(MAC,"N_RB = %i\n", N_RB); + LOG_D(MAC,"dci_size = %i\n", dci_size); + LOG_D(MAC,"fsize = %i\n", fsize); + LOG_D(MAC,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val); + LOG_D(MAC,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val); + LOG_D(MAC,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val); + LOG_D(MAC,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs); + LOG_D(MAC,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); + LOG_D(MAC,"dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator); + break; case NR_RNTI_TC: diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index ab49fcdc8c..674d30b794 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -357,6 +357,8 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, if (secondaryCellGroup) { + RC.nrmac[Mod_idP]->secondaryCellGroupCommon = secondaryCellGroup; + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; if (add_ue == 1 && get_softmodem_params()->phy_test) { const int UE_id = add_new_nr_ue(Mod_idP,rnti); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 5d701bf5b8..b2f1f82d7b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -491,6 +491,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, // This schedules MIB schedule_nr_mib(module_idP, frame, slot, slots_per_frame[*scc->ssbSubcarrierSpacing]); + // This schedules SIB1 + schedule_nr_sib1(module_idP, frame, slot); + // This schedule PRACH if we are not in phy_test mode if (get_softmodem_params()->phy_test == 0) schedule_nr_prach(module_idP, frame, slot); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 92af24a04d..40691b3315 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -30,6 +30,7 @@ */ +#include "GNB_APP/RRC_nr_paramsvalues.h" #include "assertions.h" #include "NR_MAC_gNB/nr_mac_gNB.h" #include "NR_MAC_gNB/mac_proto.h" @@ -38,21 +39,19 @@ #include "common/utils/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 "common/utils/nr/nr_common.h" -//#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" -#include "intertask_interface.h" - #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 #include "common/ran_context.h" +#include "executables/softmodem-common.h" + extern RAN_CONTEXT_t RC; extern uint8_t SSB_Table[38]; @@ -153,6 +152,17 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload = (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1); dl_req->nPDUs++; } + + // Get type0_PDCCH_CSS_config parameters + NR_DL_FRAME_PARMS *frame_parms = &RC.gNB[module_idP]->frame_parms; + NR_MIB_t *mib = RC.nrrrc[module_idP]->carrier.mib.message.choice.mib; + uint8_t gNB_xtra_byte = 0; + for (int i = 0; i < 8; i++) { + gNB_xtra_byte |= ((RC.gNB[module_idP]->pbch.pbch_a >> (31 - i)) & 1) << (7 - i); + } + get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config, mib, gNB_xtra_byte, frame_parms->Lmax, + frame_parms->ssb_index, frame_parms->ssb_start_subcarrier/NR_NB_SC_PER_RB); + } // checking if there is any SSB in slot @@ -212,3 +222,271 @@ void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, int CC_id) { for (int rb = 0; rb < 20; rb++) vrb_map[rbStart + rb] = 1; } + +void schedule_control_sib1(module_id_t module_id, + int CC_id, + int time_domain_allocation, + uint8_t mcsTableIdx, + uint8_t mcs, + uint8_t numDmrsCdmGrpsNoData, + int num_total_bytes) { + + gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; + NR_ServingCellConfigCommon_t *servingcellconfigcommon = gNB_mac->common_channels[CC_id].ServingCellConfigCommon; + uint8_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; + + if (gNB_mac->sched_ctrlCommon == NULL){ + gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon)); + gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space)); + gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp)); + gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset)); + gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp)); + fill_default_searchSpaceZero(gNB_mac->sched_ctrlCommon->search_space); + fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset,servingcellconfigcommon); + fill_default_initialDownlinkBWP(gNB_mac->sched_ctrlCommon->active_bwp,servingcellconfigcommon); + } + + gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation; + gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx; + gNB_mac->sched_ctrlCommon->mcs = mcs; + gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = numDmrsCdmGrpsNoData; + gNB_mac->sched_ctrlCommon->num_total_bytes = num_total_bytes; + + uint8_t nr_of_candidates; + find_aggregation_candidates(&gNB_mac->sched_ctrlCommon->aggregation_level, &nr_of_candidates, gNB_mac->sched_ctrlCommon->search_space); + + gNB_mac->sched_ctrlCommon->cce_index = allocate_nr_CCEs(RC.nrmac[module_id], + gNB_mac->sched_ctrlCommon->active_bwp, + gNB_mac->sched_ctrlCommon->coreset, + gNB_mac->sched_ctrlCommon->aggregation_level, + 0, + 0, + nr_of_candidates); + + if (gNB_mac->sched_ctrlCommon->cce_index < 0) { + LOG_E(MAC, "%s(): could not find CCE for coreset0\n", __func__); + return; + } + + const uint16_t bwpSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs; + int rbStart = gNB_mac->type0_PDCCH_CSS_config.cset_start_rb; + + // Calculate number of PRB_DMRS + uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; + + // Calculate number of symbols + struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; + int startSymbolIndex, nrOfSymbols; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + + LOG_I(MAC,"SLIV = %i\n", startSymbolAndLength); + LOG_I(MAC,"startSymbolIndex = %i\n", startSymbolIndex); + LOG_I(MAC,"nrOfSymbols = %i\n", nrOfSymbols); + + int rbSize = 0; + uint32_t TBS = 0; + do { + rbSize++; + TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + rbSize, nrOfSymbols, N_PRB_DMRS,0, 0,1) >> 3; + } while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes); + gNB_mac->sched_ctrlCommon->rbSize = rbSize; + gNB_mac->sched_ctrlCommon->rbStart = 0; + + // Mark the corresponding RBs as used + for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) { + vrb_map[rb + rbStart] = 1; + } +} + +void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, + nfapi_nr_dl_tti_request_body_t *dl_req, + uint32_t TBS, + int StartSymbolIndex, + int NrOfSymbols) { + + gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; + NR_COMMON_channels_t *cc = gNB_mac->common_channels; + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + NR_CellGroupConfig_t *secondaryCellGroup = gNB_mac->secondaryCellGroupCommon; + NR_BWP_Downlink_t *bwp = gNB_mac->sched_ctrlCommon->active_bwp; + + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; + memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE; + dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); + + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs+1]; + memset((void*)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; + dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu)); + + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; + nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; + + pdcch_pdu_rel15->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; + + pdsch_pdu_rel15->pduBitmap = 0; + pdsch_pdu_rel15->rnti = SI_RNTI; + pdsch_pdu_rel15->pduIndex = gNB_mac->pdu_index[0]++; + + pdsch_pdu_rel15->BWPSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs; + pdsch_pdu_rel15->BWPStart = gNB_mac->type0_PDCCH_CSS_config.cset_start_rb; + + pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; + if (bwp->bwp_Common->genericParameters.cyclicPrefix) { + pdsch_pdu_rel15->CyclicPrefix = *bwp->bwp_Common->genericParameters.cyclicPrefix; + } else { + pdsch_pdu_rel15->CyclicPrefix = 0; + } + + pdsch_pdu_rel15->NrOfCodewords = 1; + pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs,0); + pdsch_pdu_rel15->qamModOrder[0] = 2; + pdsch_pdu_rel15->mcsIndex[0] = gNB_mac->sched_ctrlCommon->mcs; + pdsch_pdu_rel15->mcsTable[0] = 0; + pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[0]; + pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; + pdsch_pdu_rel15->nrOfLayers = 1; + pdsch_pdu_rel15->transmissionScheme = 0; + pdsch_pdu_rel15->refPoint = 1; + pdsch_pdu_rel15->dmrsConfigType = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; + pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; + pdsch_pdu_rel15->SCID = 0; + pdsch_pdu_rel15->numDmrsCdmGrpsNoData = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData; + pdsch_pdu_rel15->dmrsPorts = 1; + pdsch_pdu_rel15->resourceAlloc = 1; + pdsch_pdu_rel15->rbStart = gNB_mac->sched_ctrlCommon->rbStart; + pdsch_pdu_rel15->rbSize = gNB_mac->sched_ctrlCommon->rbSize; + pdsch_pdu_rel15->VRBtoPRBMapping = 0; + pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx); + pdsch_pdu_rel15->TBSize[0] = TBS; + pdsch_pdu_rel15->mcsTable[0] = gNB_mac->sched_ctrlCommon->mcsTableIdx; + pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; + pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; + + pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, pdsch_pdu_rel15->NrOfSymbols); + + dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET]; + memset(dci_pdu_rel15, 0, sizeof(dci_pdu_rel15_t) * MAX_DCI_CORESET); + + dci_pdu_rel15[0].bwp_indicator.val = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id; + + // frequency domain assignment + dci_pdu_rel15[0].frequency_domain_assignment.val = + PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize, + pdsch_pdu_rel15->rbStart, + gNB_mac->type0_PDCCH_CSS_config.num_rbs); + + dci_pdu_rel15[0].time_domain_assignment.val = gNB_mac->sched_ctrlCommon->time_domain_allocation; + dci_pdu_rel15[0].mcs = gNB_mac->sched_ctrlCommon->mcs; + dci_pdu_rel15[0].rv = pdsch_pdu_rel15->rvIndex[0]; + dci_pdu_rel15[0].harq_pid = 0; + dci_pdu_rel15[0].ndi = 0; + dci_pdu_rel15[0].dai[0].val = 0; + dci_pdu_rel15[0].tpc = 0; // table 7.2.1-1 in 38.213 + dci_pdu_rel15[0].pucch_resource_indicator = 0; + dci_pdu_rel15[0].pdsch_to_harq_feedback_timing_indicator.val = 0; + dci_pdu_rel15[0].antenna_ports.val = 0; + dci_pdu_rel15[0].dmrs_sequence_initialization.val = pdsch_pdu_rel15->SCID; + + nr_configure_pdcch(gNB_mac, + pdcch_pdu_rel15, + SI_RNTI, + gNB_mac->sched_ctrlCommon->search_space, + gNB_mac->sched_ctrlCommon->coreset, + scc, + bwp, + gNB_mac->sched_ctrlCommon->aggregation_level, + gNB_mac->sched_ctrlCommon->cce_index); + + int dci_formats[2]; + int rnti_types[2]; + + dci_formats[0] = NR_DL_DCI_FORMAT_1_0; + rnti_types[0] = NR_RNTI_SI; + + fill_dci_pdu_rel15(scc,secondaryCellGroup,pdcch_pdu_rel15,dci_pdu_rel15,dci_formats,rnti_types,pdsch_pdu_rel15->BWPSize,gNB_mac->sched_ctrlCommon->active_bwp->bwp_Id); + + dl_req->nPDUs += 2; + + LOG_D(MAC,"BWPSize: %i\n", pdcch_pdu_rel15->BWPSize); + LOG_D(MAC,"BWPStart: %i\n", pdcch_pdu_rel15->BWPStart); + LOG_D(MAC,"SubcarrierSpacing: %i\n", pdcch_pdu_rel15->SubcarrierSpacing); + LOG_D(MAC,"CyclicPrefix: %i\n", pdcch_pdu_rel15->CyclicPrefix); + LOG_D(MAC,"StartSymbolIndex: %i\n", pdcch_pdu_rel15->StartSymbolIndex); + LOG_D(MAC,"DurationSymbols: %i\n", pdcch_pdu_rel15->DurationSymbols); + for(int n=0;n<6;n++) LOG_D(MAC,"FreqDomainResource[%i]: %x\n",n, pdcch_pdu_rel15->FreqDomainResource[n]); + LOG_D(MAC,"CceRegMappingType: %i\n", pdcch_pdu_rel15->CceRegMappingType); + LOG_D(MAC,"RegBundleSize: %i\n", pdcch_pdu_rel15->RegBundleSize); + LOG_D(MAC,"InterleaverSize: %i\n", pdcch_pdu_rel15->InterleaverSize); + LOG_D(MAC,"CoreSetType: %i\n", pdcch_pdu_rel15->CoreSetType); + LOG_D(MAC,"ShiftIndex: %i\n", pdcch_pdu_rel15->ShiftIndex); + LOG_D(MAC,"precoderGranularity: %i\n", pdcch_pdu_rel15->precoderGranularity); + LOG_D(MAC,"numDlDci: %i\n", pdcch_pdu_rel15->numDlDci); + +} + +void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { + + LOG_D(MAC,"Schedule_nr_sib1: frameP = %i, slotP = %i\n", frameP, slotP); + + // static values + const int CC_id = 0; + int time_domain_allocation = 2; // FIXME: For OAI-UE (2), For 3rd party implementation and 3GPP compliant (4) + uint8_t mcsTableIdx = 0; + uint8_t mcs = 0; + uint8_t numDmrsCdmGrpsNoData = 1; // FIXME: For OAI-UE (1), For 3rd party implementation and 3GPP compliant (2) + + gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; + + if( (frameP%2 == gNB_mac->type0_PDCCH_CSS_config.sfn_c) && (slotP == gNB_mac->type0_PDCCH_CSS_config.n_0) && (gNB_mac->type0_PDCCH_CSS_config.num_rbs > 0) ) { + + LOG_D(MAC,"> SIB1 transmission\n"); + + // Get SIB1 + uint8_t sib1_payload[100]; + uint8_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, 1, sib1_payload); + LOG_D(MAC,"sib1_sdu_length = %i\n", sib1_sdu_length); + LOG_I(MAC,"SIB1: \n"); + for (int i=0;ipre_processor_sib1(module_idP, CC_id, time_domain_allocation, mcsTableIdx, mcs, numDmrsCdmGrpsNoData, sib1_sdu_length);; + + // Calculate number of symbols + int startSymbolIndex, nrOfSymbols; + struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + + // Calculate number of PRB_DMRS + uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; + + const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS,0 ,0 ,1 ) >> 3; + + nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; + nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, TBS, startSymbolIndex, nrOfSymbols); + + const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs; + nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req]; + + // Data to be transmitted + bzero(tx_req->TLVs[0].value.direct,MAX_NR_DLSCH_PAYLOAD_BYTES); + memcpy(tx_req->TLVs[0].value.direct, sib1_payload, sib1_sdu_length); + + tx_req->PDU_length = TBS; + tx_req->PDU_index = gNB_mac->pdu_index[0]++; + tx_req->num_TLV = 1; + tx_req->TLVs[0].length = TBS + 2; + gNB_mac->TX_req[CC_id].Number_of_PDUs++; + gNB_mac->TX_req[CC_id].SFN = frameP; + gNB_mac->TX_req[CC_id].Slot = slotP; + } +} \ No newline at end of file diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 7a7fe1288c..5853486e7b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -628,7 +628,8 @@ void nr_schedule_ue_spec(module_id_t module_id, gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; /* PREPROCESSOR */ - gNB_mac->pre_processor_dl(module_id, frame, slot, num_slots_per_tdd); + //gNB_mac->pre_processor_dl(module_id, frame, slot, num_slots_per_tdd); + nr_simple_dlsch_preprocessor(module_id, frame, slot, num_slots_per_tdd); NR_UE_info_t *UE_info = &gNB_mac->UE_info; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index c6d9a86fce..c927eba687 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -180,7 +180,14 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, // NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; int coreset_id = coreset->controlResourceSetId; - int *cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id]; + + int *cce_list; + if(bwp->bwp_Id == 0) { + cce_list = nr_mac->cce_list[1][0]; + } else { + cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id]; + } + int n_rb=0; for (int i=0;i<6;i++) @@ -678,8 +685,12 @@ void nr_configure_pdcch(gNB_MAC_INST *nr_mac, pdcch_pdu->ShiftIndex = 0; } - pdcch_pdu->CoreSetType = 1; - + if(coreset->controlResourceSetId == 0) { + pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; + } else{ + pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; + } + //precoderGranularity pdcch_pdu->precoderGranularity = coreset->precoderGranularity; @@ -1248,22 +1259,43 @@ void fill_dci_pdu_rel15(NR_ServingCellConfigCommon_t *scc, break; case NR_RNTI_SI: - // Freq domain assignment 0-16 bit - fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); - for (int i=0; ifrequency_domain_assignment.val>>(fsize-i-1))&1)<<(dci_size-pos++); - // Time domain assignment 4 bit - for (int i=0; i<4; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val>>(3-i))&1)<<(dci_size-pos++); - // VRB to PRB mapping 1 bit - *dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val&1)<<(dci_size-pos++); - // MCS 5bit //bit over 32, so dci_pdu ++ - for (int i=0; i<5; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs>>(4-i))&1)<<(dci_size-pos++); - // Redundancy version 2bit - for (int i=0; i<2; i++) - *dci_pdu |= (((uint64_t)dci_pdu_rel15->rv>>(1-i))&1)<<(dci_size-pos++); - + + pos=1; + + // Freq domain assignment 0-16 bit + fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); + for (int i=0; ifrequency_domain_assignment.val>>(fsize-1-i))&1)<<(dci_size-pos++); + + // Time domain assignment 4 bit + for (int i=0; i<4; i++) + *dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val>>(3-i))&1)<<(dci_size-pos++); + + // VRB to PRB mapping 1 bit + *dci_pdu |= ((uint64_t)dci_pdu_rel15->vrb_to_prb_mapping.val&1)<<(dci_size-pos++); + + // MCS 5bit //bit over 32, so dci_pdu ++ + for (int i=0; i<5; i++) + *dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs>>(4-i))&1)<<(dci_size-pos++); + + // Redundancy version 2 bit + for (int i=0; i<2; i++) + *dci_pdu |= (((uint64_t)dci_pdu_rel15->rv>>(1-i))&1)<<(dci_size-pos++); + + // System information indicator 1bit + *dci_pdu |= ((uint64_t)dci_pdu_rel15->system_info_indicator&1)<<(dci_size-pos++); + + // reserved 15 bits + + LOG_D(PHY,"dci_size = %i\n", dci_size); + LOG_D(PHY,"fsize = %i\n", fsize); + LOG_D(PHY,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val); + LOG_D(PHY,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val); + LOG_D(PHY,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val); + LOG_D(PHY,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs); + LOG_D(PHY,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); + LOG_D(PHY,"dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator); + break; case NR_RNTI_TC: diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index b3cd91fd01..f98ceb3935 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -80,6 +80,15 @@ void nr_schedule_ue_spec(module_id_t module_id, sub_frame_t slot, int num_slots_per_tdd); +void schedule_control_sib1(module_id_t module_id, + int CC_id, + int time_domain_allocation, + uint8_t mcsTableIdx, + uint8_t mcs, + uint8_t numDmrsCdmGrpsNoData, + int num_total_bytes); + +void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP); /* \brief default preprocessor */ void nr_simple_dlsch_preprocessor(module_id_t module_id, frame_t frame, diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index b7db1f67aa..6c65a5789d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -87,6 +87,8 @@ void mac_top_init_gNB(void) else RC.nrmac[i]->pre_processor_dl = nr_simple_dlsch_preprocessor; + RC.nrmac[i]->pre_processor_sib1 = schedule_control_sib1; + }//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++) AssertFatal(rlc_module_init(1) == 0,"Could not initialize RLC layer\n"); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 656d1c3e7c..1780aa3f9f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -442,6 +442,14 @@ typedef void (*nr_pp_impl_dl)(module_id_t mod_id, sub_frame_t slot, int num_slots_per_tdd); +typedef void (*nr_pp_impl_sib1)(module_id_t module_id, + int CC_id, + int time_domain_allocation, + uint8_t mcsTableIdx, + uint8_t mcs, + uint8_t numDmrsCdmGrpsNoData, + int num_total_bytes); + /*! \brief top level eNB MAC structure */ typedef struct gNB_MAC_INST_s { /// Ethernet parameters for northbound midhaul interface @@ -507,6 +515,12 @@ typedef struct gNB_MAC_INST_s { /// DL preprocessor for differentiated scheduling nr_pp_impl_dl pre_processor_dl; + + NR_UE_sched_ctrl_t *sched_ctrlCommon; + NR_CellGroupConfig_t *secondaryCellGroupCommon; + NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config; + nr_pp_impl_sib1 pre_processor_sib1; + } gNB_MAC_INST; #endif /*__LAYER2_NR_MAC_GNB_H__ */ diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index d680e454e8..e15c365375 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -191,6 +191,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ (dl_info->rx_ind->rx_indication_body+i)->sib_pdu.pdu, (dl_info->rx_ind->rx_indication_body+i)->sib_pdu.pdu_length)) << FAPI_NR_RX_PDU_TYPE_SIB; + LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], SIB case Number of PDUs: %d \n", dl_info->rx_ind->number_pdus); break; case FAPI_NR_RX_PDU_TYPE_DLSCH: diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index d117b18199..57e723aff5 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -30,11 +30,11 @@ #include "platform_types.h" #include "nr_rrc_defs.h" -#include "nr_rrc_extern.h" #include "common/utils/LOG/log.h" #include "pdcp.h" -#include "msc.h" #include "common/ran_context.h" +#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" +#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" #include "intertask_interface.h" @@ -43,6 +43,104 @@ extern RAN_CONTEXT_t RC; + +int generate_pdcch_ConfigSIB1(NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1, + long ssbSubcarrierSpacing, + long subCarrierSpacingCommon, + channel_bandwidth_t min_channel_bw) { + + nr_ssb_and_cset_mux_pattern_type_t mux_pattern; + + switch (ssbSubcarrierSpacing) { + + case NR_SubcarrierSpacing_kHz15: + if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz15) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_1_NUM_INDEXES; + mux_pattern = table_38213_13_1_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz30) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_2_NUM_INDEXES; + mux_pattern = table_38213_13_2_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + case NR_SubcarrierSpacing_kHz30: + if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz15) { + + if ( (min_channel_bw == bw_5MHz) || (min_channel_bw == bw_10MHz) ) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_3_NUM_INDEXES; + mux_pattern = table_38213_13_3_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else if (min_channel_bw == bw_40MHz) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_5_NUM_INDEXES; + mux_pattern = table_38213_13_5_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else { + AssertFatal(true,"Invalid min_bandwidth\n"); + } + + } else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz30) { + + if ( (min_channel_bw == bw_5MHz) || (min_channel_bw == bw_10MHz) ) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_4_NUM_INDEXES; + mux_pattern = table_38213_13_4_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else if (min_channel_bw == bw_40MHz) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_6_NUM_INDEXES; + mux_pattern = table_38213_13_6_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else { + AssertFatal(true,"Invalid min_bandwidth\n"); + } + + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + case NR_SubcarrierSpacing_kHz120: + if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz60) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_7_NUM_INDEXES; + mux_pattern = table_38213_13_7_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz120) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_8_NUM_INDEXES; + mux_pattern = table_38213_13_8_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + case NR_SubcarrierSpacing_kHz240: + if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz60) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_9_NUM_INDEXES; + mux_pattern = table_38213_13_9_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz120) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_10_NUM_INDEXES; + mux_pattern = table_38213_13_10_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + default: + AssertFatal(true,"Invalid ssbSubcarrierSpacing\n"); + break; + } + + + frequency_range_t frequency_range = FR1; + if(ssbSubcarrierSpacing>=60) { + frequency_range = FR2; + } + + pdcch_ConfigSIB1->searchSpaceZero = 0; + if(mux_pattern == NR_SSB_AND_CSET_MUX_PATTERN_TYPE1 && frequency_range == FR1){ + pdcch_ConfigSIB1->searchSpaceZero = rand() % TABLE_38213_13_11_NUM_INDEXES; + } + if(mux_pattern == NR_SSB_AND_CSET_MUX_PATTERN_TYPE1 && frequency_range == FR2){ + pdcch_ConfigSIB1->searchSpaceZero = rand() % TABLE_38213_13_12_NUM_INDEXES; + } + + return 0; +} + int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, const int CC_id, const frame_t frameP, @@ -58,41 +156,57 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id); #endif - gNB_RRC_INST *rrc; - rrc_gNB_carrier_data_t *carrier; - NR_BCCH_BCH_Message_t *mib; - NR_SRB_INFO * srb_info; - char payload_size, *payload_pP; - - rrc = RC.nrrrc[Mod_idP]; - carrier = &rrc->carrier; - mib = &carrier->mib; - srb_info = &carrier->Srb0; + rrc_gNB_carrier_data_t *carrier; + NR_BCCH_BCH_Message_t *mib; + NR_SRB_INFO *srb_info; + char payload_size, *payload_pP; - /* MIBCH */ - if( (Srb_id & RAB_OFFSET ) == MIBCH) { - mib->message.choice.mib->systemFrameNumber.buf[0] = sfn_msb << 2; - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message, - NULL, - (void *)mib, - carrier->MIB, - 24); - LOG_D(NR_RRC,"Encoded MIB for frame %d sfn_msb %d (%p), bits %lu\n",frameP,sfn_msb,carrier->MIB,enc_rval.encoded); - buffer_pP[0]=carrier->MIB[0]; - buffer_pP[1]=carrier->MIB[1]; - buffer_pP[2]=carrier->MIB[2]; - LOG_D(NR_RRC,"MIB PDU buffer_pP[0]=%x , buffer_pP[1]=%x, buffer_pP[2]=%x\n",buffer_pP[0],buffer_pP[1],buffer_pP[2]); - AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return(3); - } + carrier = &RC.nrrrc[Mod_idP]->carrier; + mib = &carrier->mib; + srb_info = &carrier->Srb0; + + /* MIBCH */ + if ((Srb_id & RAB_OFFSET) == MIBCH) { + + // Currently we are getting the pdcch_ConfigSIB1 from the configuration file. + // 3GPP is not clear about the static/semi-static/dynamic behaviour of the pdcch_ConfigSIB1 value + // on the gNB side. + // Uncomment this function for a dynamic pdcch_ConfigSIB1. + // TODO: Update this static value + //channel_bandwidth_t min_channel_bw = bw_10MHz; // Must be obtained based on TS 38.101-1 Table 5.3.5-1 + //generate_pdcch_ConfigSIB1(carrier->pdcch_ConfigSIB1, + // *carrier->servingcellconfigcommon->ssbSubcarrierSpacing, + // carrier->mib.message.choice.mib->subCarrierSpacingCommon, + // min_channel_bw); + + mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = carrier->pdcch_ConfigSIB1->controlResourceSetZero; + mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = carrier->pdcch_ConfigSIB1->searchSpaceZero; + + mib->message.choice.mib->systemFrameNumber.buf[0] = sfn_msb << 2; + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message, + NULL, + (void *) mib, + carrier->MIB, + 24); + LOG_D(NR_RRC, "Encoded MIB for frame %d sfn_msb %d (%p), bits %lu\n", frameP, sfn_msb, carrier->MIB, + enc_rval.encoded); + buffer_pP[0] = carrier->MIB[0]; + buffer_pP[1] = carrier->MIB[1]; + buffer_pP[2] = carrier->MIB[2]; + LOG_D(NR_RRC, "MIB PDU buffer_pP[0]=%x , buffer_pP[1]=%x, buffer_pP[2]=%x\n", buffer_pP[0], buffer_pP[1], + buffer_pP[2]); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return (3); + } /* TODO BCCH SIB1 SIBs */ if ((Srb_id & RAB_OFFSET ) == BCCH) { - memcpy(&buffer_pP[0], - RC.rrc[Mod_idP]->carrier[CC_id].SIB1_MBMS, - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_MBMS); + memcpy(&buffer_pP[0], + RC.nrrrc[Mod_idP]->carrier.SIB1, + RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1); + return RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1; } /* CCCH */ diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 4cfa2c9f3f..4ec5a5c6bc 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -39,6 +39,7 @@ #include #include /* for _ASN_DEFAULT_STACK_MAX */ #include +#include #include "asn1_msg.h" #include "RRC/NR/nr_rrc_extern.h" @@ -201,11 +202,13 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) { mib->message.choice.mib->ssb_SubcarrierOffset = (carrier->ssb_SubcarrierOffset)&15; /* - * The SIB1 will be sent in this allocation (Type0-PDCCH) : 38.213, 13-4 Table and 38.213 13-11 to 13-14 tables - * the reverse allocation is in nr_ue_decode_mib() - */ - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero; - mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero; + * The SIB1 will be sent in this allocation (Type0-PDCCH) : 38.213, 13-4 Table and 38.213 13-11 to 13-14 tables + * the reverse allocation is in nr_ue_decode_mib() + */ + mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero; + mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rrc->carrier.pdcch_ConfigSIB1->searchSpaceZero; + + AssertFatal(scc->ssbSubcarrierSpacing != NULL, "scc->ssbSubcarrierSpacing is null\n"); switch (*scc->ssbSubcarrierSpacing) { case NR_SubcarrierSpacing_kHz15: @@ -334,13 +337,16 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, nr_uac_BarringInfoSet.uac_BarringForAccessIdentity.bits_unused = 1; ASN_SEQUENCE_ADD(&sib1->uac_BarringInfo->uac_BarringInfoSetList, &nr_uac_BarringInfoSet); #endif + + xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)sib1_message->message.choice.c1->choice.systemInformationBlockType1); + //encode SIB1 to data - carrier->SIB1=(uint8_t *) malloc16(128); + if(carrier->SIB1 == NULL) carrier->SIB1=(uint8_t *) malloc16(MAX_NR_SIB_LENGTH/8); enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_DL_SCH_Message, NULL, (void *)sib1_message, carrier->SIB1, - 128); + MAX_NR_SIB_LENGTH/8); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 9a53a5bbe0..ec608f1a29 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -383,6 +383,7 @@ typedef struct { int pucch_TargetSNRx10; NR_BCCH_DL_SCH_Message_t *siblock1; NR_ServingCellConfigCommon_t *servingcellconfigcommon; + NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1; NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS]; NR_SRB_INFO SI; NR_SRB_INFO Srb0; diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index dd5fdddbaa..e5541a434b 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -71,6 +71,12 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti); +void fill_default_initialDownlinkBWP(NR_BWP_Downlink_t *bwp, NR_ServingCellConfigCommon_t *servingcellconfigcommon); + +void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0, NR_ServingCellConfigCommon_t *servingcellconfigcommon); + +void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0); + void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CellGroupConfig_t *secondaryCellGroup, int scg_id, diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index a9e27da95d..edd4213dc4 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -47,6 +47,96 @@ #define false 0 #define true 1 +void fill_default_initialDownlinkBWP(NR_BWP_Downlink_t *bwp, NR_ServingCellConfigCommon_t *servingcellconfigcommon) { + + bwp->bwp_Id = 0; + + bwp->bwp_Common=calloc(1,sizeof(*bwp->bwp_Common)); + memcpy((void*)&bwp->bwp_Common, + &servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP, + sizeof(bwp->bwp_Common)); + + bwp->bwp_Dedicated=calloc(1,sizeof(*bwp->bwp_Dedicated)); + bwp->bwp_Dedicated->pdsch_Config = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config)); + bwp->bwp_Dedicated->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup; + bwp->bwp_Dedicated->pdsch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); + *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0; +} + +void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0, NR_ServingCellConfigCommon_t *servingcellconfigcommon) { + + coreset0->controlResourceSetId = 0; + + // frequencyDomainResources '11111111 00000000 00000000 00000000 00000000 00000'B, + if(coreset0->frequencyDomainResources.buf == NULL) coreset0->frequencyDomainResources.buf = calloc(1,6); + coreset0->frequencyDomainResources.buf[0] = 0xff; + coreset0->frequencyDomainResources.buf[1] = 0; + coreset0->frequencyDomainResources.buf[2] = 0; + coreset0->frequencyDomainResources.buf[3] = 0; + coreset0->frequencyDomainResources.buf[4] = 0; + coreset0->frequencyDomainResources.buf[5] = 0; + coreset0->frequencyDomainResources.size = 6; + coreset0->frequencyDomainResources.bits_unused = 3; + coreset0->duration = 1; + coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset0->cce_REG_MappingType.choice.interleaved)); + coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; + coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = servingcellconfigcommon->physCellId; + coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; + + if(coreset0->tci_StatesPDCCH_ToAddList == NULL) coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*coreset0->tci_StatesPDCCH_ToAddList)); + + NR_TCI_StateId_t *tci[8]; + for (int i=0;i<8;i++) { + tci[i]=calloc(1,sizeof(*tci[i])); + *tci[i] = i; + ASN_SEQUENCE_ADD(&coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]); + } + coreset0->tci_StatesPDCCH_ToReleaseList = NULL; + coreset0->tci_PresentInDCI = NULL; + coreset0->pdcch_DMRS_ScramblingID = NULL; + +} + +void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0) { + + if(ss0->controlResourceSetId == NULL) ss0->controlResourceSetId=calloc(1,sizeof(*ss0->controlResourceSetId)); + if(ss0->monitoringSymbolsWithinSlot == NULL) ss0->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss0->monitoringSymbolsWithinSlot)); + if(ss0->monitoringSymbolsWithinSlot->buf == NULL) ss0->monitoringSymbolsWithinSlot->buf = calloc(1,2); + if(ss0->nrofCandidates == NULL) ss0->nrofCandidates = calloc(1,sizeof(*ss0->nrofCandidates)); + if(ss0->searchSpaceType == NULL) ss0->searchSpaceType = calloc(1,sizeof(*ss0->searchSpaceType)); + if(ss0->searchSpaceType->choice.common == NULL) ss0->searchSpaceType->choice.common=calloc(1,sizeof(*ss0->searchSpaceType->choice.common)); + if(ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 == NULL) ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss0->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); + + ss0->searchSpaceId = 0; + *ss0->controlResourceSetId = 0; + ss0->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*ss0->monitoringSlotPeriodicityAndOffset)); + ss0->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; + ss0->duration=NULL; + + // should be '1100 0000 0000 00'B (LSB first!), first two symols in slot, adjust if needed + ss0->monitoringSymbolsWithinSlot->buf[1] = 0; + ss0->monitoringSymbolsWithinSlot->buf[0] = (1<<7) | (1<<6); + ss0->monitoringSymbolsWithinSlot->size = 2; + ss0->monitoringSymbolsWithinSlot->bits_unused = 2; + + ss0->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; + ss0->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; + ss0->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n0; + ss0->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n1; + ss0->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0; + + ss0->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; +} void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CellGroupConfig_t *secondaryCellGroup, @@ -475,7 +565,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss); - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=NULL; + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1)); + *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=0; bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation=NULL; bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->pagingSearchSpace=NULL; bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace)); diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 1e182eff8b..8afc3165ef 100755 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -432,6 +432,41 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message( return 0; } +/*brief decode SIB1 message*/ +int8_t nr_rrc_ue_decode_NR_SIB1_Message(uint8_t *const bufferP, const uint8_t buffer_len){ + + NR_BCCH_DL_SCH_Message_t *bcch_message = NULL; + + asn_dec_rval_t dec_rval = uper_decode_complete(NULL, + &asn_DEF_NR_BCCH_DL_SCH_Message, + (void **)&bcch_message, + (const void *)bufferP, + buffer_len); + + if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) { + + printf("NR_BCCH_DL_SCH decode error\n"); + for (int i=0; isib1 != NULL){ + SEQUENCE_free(&asn_DEF_NR_BCCH_BCH_Message, (void *)NR_UE_rrc_inst->sib1, 1 ); + } + NR_UE_rrc_inst->sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; + xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)NR_UE_rrc_inst->sib1); + + } + + return 0; +} + // from NR SRB3 int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message( diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index 6481fb0cea..30c803eff3 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -51,6 +51,7 @@ #include "NR_asn_constant.h" #include "NR_SchedulingRequestToAddMod.h" #include "NR_MIB.h" +#include "NR_SIB1.h" #include "NR_BCCH-BCH-Message.h" #include "NR_DL-DCCH-Message.h" @@ -70,7 +71,8 @@ typedef struct NR_UE_RRC_INST_s { NR_RadioBearerConfig_t *radio_bearer_config; NR_MIB_t *mib; - + NR_SIB1_t *sib1; + // lists // CellGroupConfig.rlc-BearerToAddModList RRC_LIST_TYPE(NR_RLC_BearerConfig_t, NR_maxLC_ID) RLC_Bearer_Config_list; diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 7bc7e4b90c..292eae10d4 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -86,6 +86,11 @@ int8_t nr_rrc_ue_process_radio_bearer_config(NR_RadioBearerConfig_t *radio_beare \param sdu_len length of buffer*/ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len); +/**\brief decode NR SIB1 message + \param sduP pointer to buffer of ASN message + \param sdu_len length of buffer*/ +int8_t nr_rrc_ue_decode_NR_SIB1_Message(uint8_t *const bufferP, const uint8_t buffer_len); + /**\brief Decode NR DCCH from gNB, sent from lower layer through SRB3 \param module_id module id \param gNB_index gNB index From 3b9bdfc7d4dd0db8d888885cb3c207eb17744689 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 19 Nov 2020 10:18:09 +0000 Subject: [PATCH 024/160] Minor corrections --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 4 +--- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 3 +-- openair2/LAYER2/NR_MAC_gNB/main.c | 2 -- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 9 --------- 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 40691b3315..512f808253 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -454,9 +454,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) for (int i=0;ipre_processor_sib1(module_idP, CC_id, time_domain_allocation, mcsTableIdx, mcs, numDmrsCdmGrpsNoData, sib1_sdu_length);; + schedule_control_sib1(module_idP, CC_id, time_domain_allocation, mcsTableIdx, mcs, numDmrsCdmGrpsNoData, sib1_sdu_length); // Calculate number of symbols int startSymbolIndex, nrOfSymbols; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 5853486e7b..7a7fe1288c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -628,8 +628,7 @@ void nr_schedule_ue_spec(module_id_t module_id, gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; /* PREPROCESSOR */ - //gNB_mac->pre_processor_dl(module_id, frame, slot, num_slots_per_tdd); - nr_simple_dlsch_preprocessor(module_id, frame, slot, num_slots_per_tdd); + gNB_mac->pre_processor_dl(module_id, frame, slot, num_slots_per_tdd); NR_UE_info_t *UE_info = &gNB_mac->UE_info; diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 6c65a5789d..b7db1f67aa 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -87,8 +87,6 @@ void mac_top_init_gNB(void) else RC.nrmac[i]->pre_processor_dl = nr_simple_dlsch_preprocessor; - RC.nrmac[i]->pre_processor_sib1 = schedule_control_sib1; - }//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++) AssertFatal(rlc_module_init(1) == 0,"Could not initialize RLC layer\n"); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 1780aa3f9f..2def264c5e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -442,14 +442,6 @@ typedef void (*nr_pp_impl_dl)(module_id_t mod_id, sub_frame_t slot, int num_slots_per_tdd); -typedef void (*nr_pp_impl_sib1)(module_id_t module_id, - int CC_id, - int time_domain_allocation, - uint8_t mcsTableIdx, - uint8_t mcs, - uint8_t numDmrsCdmGrpsNoData, - int num_total_bytes); - /*! \brief top level eNB MAC structure */ typedef struct gNB_MAC_INST_s { /// Ethernet parameters for northbound midhaul interface @@ -519,7 +511,6 @@ typedef struct gNB_MAC_INST_s { NR_UE_sched_ctrl_t *sched_ctrlCommon; NR_CellGroupConfig_t *secondaryCellGroupCommon; NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config; - nr_pp_impl_sib1 pre_processor_sib1; } gNB_MAC_INST; From 4d290f71cf35dde3a143e2a2a2e7b42e9e7099f1 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 19 Nov 2020 10:53:08 +0000 Subject: [PATCH 025/160] Minor correction in the gNB_scheduler --- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 95 ++++++++++++--------- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 3 +- 2 files changed, 55 insertions(+), 43 deletions(-) diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index d33bb5acf8..809cddcf7c 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1716,16 +1716,15 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][0]; fapi_nr_config_request_t *cfg = &ue->nrUE_config; - NR_UE_MAC_INST_t *mac = get_mac_inst(ue->Mod_id); - fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; - uint8_t nb_symb_pdcch = pdcch_vars->nb_search_space > 0 ? pdcch_vars->pdcch_config[0].coreset.duration : 0; uint8_t dci_cnt = 0; NR_DL_FRAME_PARMS *fp = &ue->frame_parms; + //NR_UE_MAC_INST_t *mac = get_mac_inst(0); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN); - LOG_D(PHY, " ****** start RX-Chain for Frame.Slot %d.%d ****** \n", frame_rx % 1024, nr_tti_rx); + LOG_D(PHY," ****** start RX-Chain for Frame.Slot %d.%d ****** \n", frame_rx%1024, nr_tti_rx); /* uint8_t next1_thread_id = ue->current_thread_id[nr_tti_rx]== (RX_NB_TH-1) ? 0:(ue->current_thread_id[nr_tti_rx]+1); @@ -1882,13 +1881,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // do procedures for C-RNTI int ret_pdsch = 0; if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->active == 1) { - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); - - fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; - dlsch_config_pdu->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); - dlsch_config_pdu->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); - dlsch_config_pdu->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; - + //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); ret_pdsch = nr_ue_pdsch_procedures(ue, proc, gNB_id, @@ -1896,33 +1889,24 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0], NULL); - if (ret_pdsch >= 0) - nr_ue_dlsch_procedures(ue, - proc, - gNB_id, - PDSCH, - ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0], - ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][1], - &ue->dlsch_errors[gNB_id], - mode); - + //printf("phy procedure pdsch start measurement\n"); nr_ue_measurement_procedures(2,ue,proc,gNB_id,nr_tti_rx,mode); - // deactivate dlsch once dlsch proc is done - ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->active = 0; + /* + write_output("rxF.m","rxF",&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[nr_tti_rx]].rxdataF[0][0],fp->ofdm_symbol_size*14,1,1); + write_output("rxF_ch.m","rxFch",&ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->dl_ch_estimates[0][0],fp->ofdm_symbol_size*14,1,1); + write_output("rxF_ch_ext.m","rxFche",&ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->dl_ch_estimates_ext[0][2*50*12],50*12,1,1); + write_output("rxF_ext.m","rxFe",&ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->rxdataF_ext[0][0],50*12*14,1,1); + write_output("rxF_comp.m","rxFc",&ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->rxdataF_comp0[0][0],fp->N_RB_DL*12*14,1,1); + write_output("rxF_llr.m","rxFllr",ue->pdsch_vars[ue->current_thread_id[nr_tti_rx]][gNB_id]->llr[0],(nb_symb_sch-1)*50*12+50*6,1,0); + */ - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); + //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); } // do procedures for SI-RNTI if ((ue->dlsch_SI[gNB_id]) && (ue->dlsch_SI[gNB_id]->active == 1)) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_IN); - - fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; - dlsch_config_pdu->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; - dlsch_config_pdu->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; - dlsch_config_pdu->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; - nr_ue_pdsch_procedures(ue, proc, gNB_id, @@ -1957,12 +1941,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // do procedures for P-RNTI if ((ue->dlsch_p[gNB_id]) && (ue->dlsch_p[gNB_id]->active == 1)) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_IN); - - fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; - dlsch_config_pdu->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); - dlsch_config_pdu->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); - dlsch_config_pdu->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; - nr_ue_pdsch_procedures(ue, proc, gNB_id, @@ -1988,12 +1966,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // do procedures for RA-RNTI if ((ue->dlsch_ra[gNB_id]) && (ue->dlsch_ra[gNB_id]->active == 1)) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_IN); - - fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; - dlsch_config_pdu->BWPSize = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); - dlsch_config_pdu->BWPStart = NRRIV2PRBOFFSET(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); - dlsch_config_pdu->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; - nr_ue_pdsch_procedures(ue, proc, gNB_id, @@ -2016,6 +1988,45 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_OUT); } + // do procedures for C-RNTI + if (ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->active == 1) { + + LOG_D(PHY, "DLSCH data reception at nr_tti_rx: %d \n \n", nr_tti_rx); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); + +#if UE_TIMING_TRACE + start_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]]); +#endif + + if (ret_pdsch >= 0) + nr_ue_dlsch_procedures(ue, + proc, + gNB_id, + PDSCH, + ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0], + ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][1], + &ue->dlsch_errors[gNB_id], + mode); + + +#if UE_TIMING_TRACE + stop_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]]); +#if DISABLE_LOG_X + printf("[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_tti_rx,ue->pdsch_procedures_stat[ue->current_thread_id[nr_tti_rx]].p_time/(cpuf*1000.0)); + printf("[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_tti_rx,ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]].p_time/(cpuf*1000.0)); +#else + LOG_D(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_tti_rx,ue->pdsch_procedures_stat[ue->current_thread_id[nr_tti_rx]].p_time/(cpuf*1000.0)); + LOG_D(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_tti_rx,ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]].p_time/(cpuf*1000.0)); +#endif + +#endif + + // deactivate dlsch once dlsch proc is done + ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->active = 0; + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); + + } #if UE_TIMING_TRACE start_meas(&ue->generic_stat); #endif diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index b2f1f82d7b..58782918b7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -492,7 +492,8 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, schedule_nr_mib(module_idP, frame, slot, slots_per_frame[*scc->ssbSubcarrierSpacing]); // This schedules SIB1 - schedule_nr_sib1(module_idP, frame, slot); + if (get_softmodem_params()->phy_test == 0) + schedule_nr_sib1(module_idP, frame, slot); // This schedule PRACH if we are not in phy_test mode if (get_softmodem_params()->phy_test == 0) From 479019a70f114b8690f2bb3a0859ca547adc7aba Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 19 Nov 2020 11:06:54 +0000 Subject: [PATCH 026/160] Minor correction in the gNB_scheduler --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index b86d7b6e2a..7a7fe1288c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -628,8 +628,7 @@ void nr_schedule_ue_spec(module_id_t module_id, gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; /* PREPROCESSOR */ - //gNB_mac->pre_processor_dl(module_id, frame, slot, num_slots_per_tdd); - nr_simple_dlsch_preprocessor(module_id, frame, slot, num_slots_per_tdd); // FIXME: gNB_mac->pre_processor_dl(module_id, frame, slot, num_slots_per_tdd); - Exit by assert + gNB_mac->pre_processor_dl(module_id, frame, slot, num_slots_per_tdd); NR_UE_info_t *UE_info = &gNB_mac->UE_info; From f86437c519959902146fa8849c432068e8937a8f Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 19 Nov 2020 14:16:22 +0000 Subject: [PATCH 027/160] Minor correction of rnti_type in the fapi_nr_ue_l1 --- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 25b27aef98..8c8f4a46c8 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -83,6 +83,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ } else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH){ dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_SI[0]; + dlsch0->rnti_type = _SI_RNTI_; } fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15; @@ -96,6 +97,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ if (dlsch0_harq){ + dlsch0_harq->status = ACTIVE; dlsch0_harq->BWPStart = dlsch_config_pdu->BWPStart; dlsch0_harq->BWPSize = dlsch_config_pdu->BWPSize; dlsch0_harq->nb_rb = dlsch_config_pdu->number_rbs; From 93d93c81dd70b6864911ffb2b8f3702376eb63a1 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Fri, 20 Nov 2020 19:19:20 +0000 Subject: [PATCH 028/160] Minor correction in the fill_dmrs_mask() function --- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 12 ++++++------ openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 10 +++++----- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 2 ++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 3 +++ 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index b7e59a0b42..4bc67ba732 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -248,13 +248,13 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, /// Antenna port mapping //to be moved to init phase potentially, for now tx_layers 1-8 are mapped on antenna ports 1000-1007 - + /// DMRS QPSK modulation - - + + l0 = get_l0(rel15->dlDmrsSymbPos); nr_modulation(pdsch_dmrs[l0][0], n_dmrs, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated - + #ifdef DEBUG_DLSCH printf("DMRS modulation (single symbol %d, %d symbols, type %d):\n", l0, n_dmrs>>1, dmrs_Type); for (int i=0; i>4; i++) { @@ -299,7 +299,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, dmrs_idx = rel15->rbStart*6; else dmrs_idx = rel15->rbStart*4; - + for (int l=rel15->StartSymbolIndex; lStartSymbolIndex+rel15->NrOfSymbols; l++) { k = start_sc; for (int i=0; irbSize*NR_NB_SC_PER_RB; i++) { @@ -316,7 +316,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, k_prime&=1; n+=(k_prime)?0:1; } - + else { if( (l != dmrs_symbol) || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,rel15->numDmrsCdmGrpsNoData,dmrs_Type)) { ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (amp * tx_layers[ap][m<<1]) >> 15; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 62effe87ce..b5b1594d63 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2835,26 +2835,26 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i break; case 10: case 11: - if (*dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) + if (dmrs_config->dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) return(1<dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) + if (dmrs_config->dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) return(1<dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos3) + else if (dmrs_config->dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos3) return(1<dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) + if (dmrs_config->dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) return(1<dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos3) + else if (dmrs_config->dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos3) return(1<number_symbols); dlsch_config_pdu_1_0->dmrsConfigType = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; + LOG_D(MAC,"dlDmrsSymbPos = 0x%x\n", dlsch_config_pdu_1_0->dlDmrsSymbPos); + /* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */ //if (dlsch_config_pdu_1_0->number_symbols == 2) // dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 33dadcc9bb..89156d6400 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -246,6 +246,7 @@ void schedule_control_sib1(module_id_t module_id, fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset,servingcellconfigcommon); fill_default_initialDownlinkBWP(gNB_mac->sched_ctrlCommon->active_bwp,servingcellconfigcommon); } + //gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation; gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx; @@ -370,6 +371,8 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, pdsch_pdu_rel15->NrOfSymbols); + LOG_D(MAC,"dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos); + dci_pdu_rel15_t dci_pdu_rel15[MAX_DCI_CORESET]; memset(dci_pdu_rel15, 0, sizeof(dci_pdu_rel15_t) * MAX_DCI_CORESET); From c02287171ad40e3664e48aa712ed9e37b927e69a Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 23 Nov 2020 23:39:18 +0000 Subject: [PATCH 029/160] File configuration for the SA. --- .../gnb.band78.tm1.106PRB.usrpn300.conf | 48 +-- .../gnb.band78.tm1.fr1.106PRB.usrpb210.conf | 40 +-- ...gnb.sa.band78.tm1.fr1.106PRB.usrpb210.conf | 308 ++++++++++++++++++ .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 4 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 19 ++ 5 files changed, 367 insertions(+), 52 deletions(-) create mode 100755 ci-scripts/conf_files/gnb.sa.band78.tm1.fr1.106PRB.usrpb210.conf diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index 82265d7ce6..109234b602 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -15,7 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); tr_s_preference = "local_mac" @@ -24,13 +24,6 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; - pdcch_ConfigSIB1 = ( - { - controlResourceSetZero = 10; - searchSpaceZero = 0; - } - ); - servingCellConfigCommon = ( { #spCellConfigCommon @@ -40,22 +33,22 @@ gNBs = # downlinkConfigCommon #frequencyInfoDL # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) - absoluteFrequencySSB = 641272; + absoluteFrequencySSB = 641032; dl_frequencyBand = 78; # this is 3600 MHz dl_absoluteFrequencyPointA = 640000; #scs-SpecificCarrierList dl_offstToCarrier = 0; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 dl_subcarrierSpacing = 1; dl_carrierBandwidth = 106; #initialDownlinkBWP #genericParameters # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; # 6366 12925 12956 28875 + initialDLBWPlocationAndBandwidth = 6366; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; #pdcch-ConfigCommon initialDLBWPcontrolResourceSetZero = 12; @@ -71,12 +64,12 @@ gNBs = initialDLBWPk0_1 = 0; initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 + #this is SS=2,L=12 initialDLBWPstartSymbolAndLength_1 = 53; initialDLBWPk0_2 = 0; initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 + #this is SS=1,L=12 initialDLBWPstartSymbolAndLength_2 = 54; initialDLBWPk0_3 = 0; @@ -84,18 +77,13 @@ gNBs = #this is SS=1,L=5 initialDLBWPstartSymbolAndLength_3 = 57; - initialDLBWPk0_4 = 0; - initialDLBWPmappingType_4 = 0; - #this is SS=1,L=5 - initialDLBWPstartSymbolAndLength_4 = 58; - #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; #scs-SpecificCarrierList ul_offstToCarrier = 0; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 ul_subcarrierSpacing = 1; ul_carrierBandwidth = 106; pMax = 20; @@ -103,7 +91,7 @@ gNBs = #genericParameters initialULBWPlocationAndBandwidth = 6366; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; #rach-ConfigCommon #rach-ConfigGeneric @@ -136,7 +124,7 @@ gNBs = prach_RootSequenceIndex_PR = 2; prach_RootSequenceIndex = 1; # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex - # + # msg1_SubcarrierSpacing = 1, # restrictedSetConfig # 0=unrestricted, 1=restricted type A, 2=restricted type B @@ -173,7 +161,7 @@ gNBs = ssb_PositionsInBurst_Bitmap = 1; # ssb_periodicityServingCell -# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 ssb_periodicityServingCell = 2; # dmrs_TypeA_position @@ -181,15 +169,15 @@ gNBs = dmrs_TypeA_Position = 0; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 subcarrierSpacing = 1; #tdd-UL-DL-ConfigurationCommon # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 referenceSubcarrierSpacing = 1; - # pattern1 + # pattern1 # dl_UL_TransmissionPeriodicity # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 dl_UL_TransmissionPeriodicity = 6; @@ -238,18 +226,18 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; - } + } ); L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; - } + } ); RUs = ( - { + { local_rf = "yes" nb_tx = 1 nb_rx = 1 @@ -264,7 +252,7 @@ RUs = ( sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; clock_src = "external"; } -); +); THREAD_STRUCT = ( { diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf index 179e3ba10d..8a3cb780b6 100755 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf @@ -13,7 +13,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;}); + plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;}); tr_s_preference = "local_mac" @@ -21,7 +21,7 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; - + servingCellConfigCommon = ( { #spCellConfigCommon @@ -38,7 +38,7 @@ gNBs = #scs-SpecificCarrierList dl_offstToCarrier = 0; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 dl_subcarrierSpacing = 1; dl_carrierBandwidth = 106; #initialDownlinkBWP @@ -46,7 +46,7 @@ gNBs = # this is RBstart=84,L=13 (275*(L-1))+RBstart initialDLBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; #pdcch-ConfigCommon initialDLBWPcontrolResourceSetZero = 0; @@ -62,25 +62,25 @@ gNBs = initialDLBWPk0_1 = 0; initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 + #this is SS=2,L=12 initialDLBWPstartSymbolAndLength_1 = 53; initialDLBWPk0_2 = 0; initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 + #this is SS=1,L=12 initialDLBWPstartSymbolAndLength_2 = 54; initialDLBWPk0_3 = 0; initialDLBWPmappingType_3 = 0; #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; - #uplinkConfigCommon + #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; #scs-SpecificCarrierList ul_offstToCarrier = 0; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 ul_subcarrierSpacing = 1; ul_carrierBandwidth = 106; pMax = 20; @@ -88,7 +88,7 @@ gNBs = #genericParameters initialULBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; #rach-ConfigCommon #rach-ConfigGeneric @@ -106,7 +106,7 @@ gNBs = powerRampingStep = 1; #ra_ReponseWindow #1,2,4,8,10,20,40,80 - ra_ResponseWindow = 5; + ra_ResponseWindow = 4; #ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR #1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; @@ -121,7 +121,7 @@ gNBs = prach_RootSequenceIndex_PR = 2; prach_RootSequenceIndex = 1; # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex - # + # msg1_SubcarrierSpacing = 1, # restrictedSetConfig @@ -132,7 +132,7 @@ gNBs = initialULBWPmappingType_0 = 1 # this is SS=0 L=11 initialULBWPstartSymbolAndLength_0 = 55; - + initialULBWPk2_1 = 2; initialULBWPmappingType_1 = 1; # this is SS=0 L=12 @@ -158,7 +158,7 @@ gNBs = ssb_PositionsInBurst_Bitmap = 1; #0x80; # ssb_periodicityServingCell -# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 ssb_periodicityServingCell = 2; # dmrs_TypeA_position @@ -166,15 +166,15 @@ gNBs = dmrs_TypeA_Position = 0; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 subcarrierSpacing = 1; #tdd-UL-DL-ConfigurationCommon # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 referenceSubcarrierSpacing = 1; - # pattern1 + # pattern1 # dl_UL_TransmissionPeriodicity # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 dl_UL_TransmissionPeriodicity = 6; @@ -238,18 +238,18 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; - } + } ); L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; - } + } ); RUs = ( - { + { local_rf = "yes" nb_tx = 1 nb_rx = 1 @@ -261,7 +261,7 @@ RUs = ( eNB_instances = [0]; clock_src = "external"; } -); +); THREAD_STRUCT = ( { diff --git a/ci-scripts/conf_files/gnb.sa.band78.tm1.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.sa.band78.tm1.fr1.106PRB.usrpb210.conf new file mode 100755 index 0000000000..3558122f24 --- /dev/null +++ b/ci-scripts/conf_files/gnb.sa.band78.tm1.fr1.106PRB.usrpb210.conf @@ -0,0 +1,308 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ({mcc = 222; mnc = 93; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 10; + searchSpaceZero = 0; + } + ); + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 641272; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 106; + #initialDownlinkBWP + #genericParameters + # this is RBstart=41,L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6366; # 6366 12925 12956 28875 +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_3 = 57; + + initialDLBWPk0_4 = 0; + initialDLBWPmappingType_4 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_4 = 58; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 106; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6366; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -100; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = 10; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + ///X2 + enable_x2 = "no"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + target_enb_x2_ip_address = ( + { ipv4 = "CI_FR1_CTL_ENB_IP_ADDR"; + ipv6 = "192:168:30::17"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "CI_GNB_IP_ADDR"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "CI_GNB_IP_ADDR"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + GNB_IPV4_ADDRESS_FOR_X2C = "CI_GNB_IP_ADDR"; + GNB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; + #beamforming 1x4 matrix: + bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; + clock_src = "internal"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 89156d6400..e949585c3b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -439,10 +439,10 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) // static values const int CC_id = 0; - int time_domain_allocation = 2; // FIXME: For OAI-UE (2), For 3rd party implementation and 3GPP compliant (4) + int time_domain_allocation = 4; // FIXME: For OAI-UE (2), For 3rd party implementation and 3GPP compliant (4) uint8_t mcsTableIdx = 0; uint8_t mcs = 0; - uint8_t numDmrsCdmGrpsNoData = 1; // FIXME: For OAI-UE (1), For 3rd party implementation and 3GPP compliant (2) + uint8_t numDmrsCdmGrpsNoData = 2; // FIXME: For OAI-UE (1), For 3rd party implementation and 3GPP compliant (2) gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 732f41bdd9..45b71dc872 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -326,6 +326,25 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, nr_plmn_info->cellIdentity.bits_unused= 4; nr_plmn_info->cellReservedForOperatorUse = 0; ASN_SEQUENCE_ADD(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list, nr_plmn_info); + + /* + sib1->si_SchedulingInfo = CALLOC(1,sizeof(*sib1->si_SchedulingInfo)); + + NR_SchedulingInfo_t schedulingInfo; + e_NR_SIB_TypeInfo__type sib_type; + + memset(&schedulingInfo,0,sizeof(NR_SchedulingInfo_t)); + memset(&sib_type,0,sizeof(e_NR_SIB_TypeInfo__type)); + + schedulingInfo.si_Periodicity = NR_SchedulingInfo__si_Periodicity_rf8; + + sib_type = NR_SIB_TypeInfo__type_sibType3; + ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,&sib_type); + ASN_SEQUENCE_ADD(&sib1->si_SchedulingInfo->schedulingInfoList.list,&schedulingInfo); + + sib1->si_SchedulingInfo->si_WindowLength = NR_SI_SchedulingInfo__si_WindowLength_s20; + */ + #if 0 sib1->uac_BarringInfo = CALLOC(1, sizeof(struct NR_SIB1__uac_BarringInfo)); memset(sib1->uac_BarringInfo, 0, sizeof(struct NR_SIB1__uac_BarringInfo)); From 301fd4740607aefbba3ce281121bbf6aaf78a98c Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 25 Nov 2020 16:08:57 +0000 Subject: [PATCH 030/160] SIB1: Added more parameters to the message --- openair2/COMMON/rrc_messages_types.h | 4 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 11 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 133 +++++++++++++----- 3 files changed, 107 insertions(+), 41 deletions(-) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 6f37c8be1c..ef76e6a7b4 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -399,8 +399,8 @@ typedef struct NbIoTRrcConfigurationReq_s { // gNB: GNB_APP -> RRC messages typedef struct NRRrcConfigurationReq_s { - uint32_t cell_identity; - uint16_t tac; + long cell_identity; + uint32_t tac; uint16_t mcc[PLMN_LIST_MAX_SIZE]; uint16_t mnc[PLMN_LIST_MAX_SIZE]; uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE]; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index e949585c3b..bd3700c67b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -439,10 +439,10 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) // static values const int CC_id = 0; - int time_domain_allocation = 4; // FIXME: For OAI-UE (2), For 3rd party implementation and 3GPP compliant (4) + int time_domain_allocation = 2; // FIXME: For OAI-UE (2), For 3rd party implementation and 3GPP compliant (4) uint8_t mcsTableIdx = 0; - uint8_t mcs = 0; - uint8_t numDmrsCdmGrpsNoData = 2; // FIXME: For OAI-UE (1), For 3rd party implementation and 3GPP compliant (2) + uint8_t mcs = 8; + uint8_t numDmrsCdmGrpsNoData = 1; // FIXME: For OAI-UE (1), For 3rd party implementation and 3GPP compliant (2) gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; @@ -473,6 +473,11 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS,0 ,0 ,1 ) >> 3; + + printf("===================================================\n"); + printf("gNB_mac->sched_ctrlCommon->rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); + printf("===================================================\n"); + nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, TBS, startSymbolIndex, nrOfSymbols); diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 45b71dc872..7f2b09c5e2 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -274,8 +274,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, asn_enc_rval_t enc_rval; // TODO : Add support for more than one PLMN - //int num_plmn = configuration->num_plmn; - int num_plmn = 1; + int num_plmn = 1; // int num_plmn = configuration->num_plmn; struct NR_PLMN_Identity nr_plmn[num_plmn]; NR_MCC_MNC_Digit_t nr_mcc_digit[num_plmn][3]; NR_MCC_MNC_Digit_t nr_mnc_digit[num_plmn][3]; @@ -283,7 +282,6 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, memset(nr_mcc_digit,0,sizeof(nr_mcc_digit)); memset(nr_mnc_digit,0,sizeof(nr_mnc_digit)); - // struct NR_UAC_BarringInfoSet nr_uac_BarringInfoSet; NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t)); carrier->siblock1 = sib1_message; sib1_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1; @@ -292,9 +290,12 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, sib1_message->message.choice.c1->choice.systemInformationBlockType1 = CALLOC(1,sizeof(struct NR_SIB1)); struct NR_SIB1 *sib1 = sib1_message->message.choice.c1->choice.systemInformationBlockType1; + + // cellSelectionInfo sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo)); sib1->cellSelectionInfo->q_RxLevMin = -50; + // cellAccessRelatedInfo struct NR_PLMN_IdentityInfo *nr_plmn_info=CALLOC(1,sizeof(struct NR_PLMN_IdentityInfo)); asn_set_empty(&nr_plmn_info->plmn_IdentityList.list); for (int i = 0; i < num_plmn; ++i) { @@ -317,49 +318,109 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, ASN_SEQUENCE_ADD(&nr_plmn_info->plmn_IdentityList.list, &nr_plmn[i]); }//end plmn loop - nr_plmn_info->cellIdentity.buf = CALLOC(1,8); - nr_plmn_info->cellIdentity.buf[0]= (configuration->cell_identity >> 20) & 0xff; - nr_plmn_info->cellIdentity.buf[1]= (configuration->cell_identity >> 12) & 0xff; - nr_plmn_info->cellIdentity.buf[2]= (configuration->cell_identity >> 4) & 0xff; - nr_plmn_info->cellIdentity.buf[3]= (configuration->cell_identity << 4) & 0xff; - nr_plmn_info->cellIdentity.size= 4; + nr_plmn_info->cellIdentity.buf = CALLOC(1,5); + nr_plmn_info->cellIdentity.buf[0]= (configuration->cell_identity >> 28) & 0xff; + nr_plmn_info->cellIdentity.buf[1]= (configuration->cell_identity >> 20) & 0xff; + nr_plmn_info->cellIdentity.buf[2]= (configuration->cell_identity >> 12) & 0xff; + nr_plmn_info->cellIdentity.buf[3]= (configuration->cell_identity >> 4) & 0xff; + nr_plmn_info->cellIdentity.buf[4]= (configuration->cell_identity << 4) & 0xff; + nr_plmn_info->cellIdentity.size= 5; nr_plmn_info->cellIdentity.bits_unused= 4; - nr_plmn_info->cellReservedForOperatorUse = 0; + nr_plmn_info->cellReservedForOperatorUse = NR_PLMN_IdentityInfo__cellReservedForOperatorUse_reserved; + + nr_plmn_info->trackingAreaCode = CALLOC(1,sizeof(NR_TrackingAreaCode_t)); + nr_plmn_info->trackingAreaCode->buf = CALLOC(1,3); + nr_plmn_info->trackingAreaCode->buf[0] = ( ((uint32_t)configuration->tac) >> 16) & 0xff; + nr_plmn_info->trackingAreaCode->buf[1] = ( ((uint32_t)configuration->tac) >> 8) & 0xff; + nr_plmn_info->trackingAreaCode->buf[2] = ( ((uint32_t)configuration->tac) >> 0) & 0xff; + nr_plmn_info->trackingAreaCode->size = 3; + nr_plmn_info->trackingAreaCode->bits_unused = 0; + ASN_SEQUENCE_ADD(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list, nr_plmn_info); - /* - sib1->si_SchedulingInfo = CALLOC(1,sizeof(*sib1->si_SchedulingInfo)); - - NR_SchedulingInfo_t schedulingInfo; - e_NR_SIB_TypeInfo__type sib_type; - - memset(&schedulingInfo,0,sizeof(NR_SchedulingInfo_t)); - memset(&sib_type,0,sizeof(e_NR_SIB_TypeInfo__type)); - - schedulingInfo.si_Periodicity = NR_SchedulingInfo__si_Periodicity_rf8; - - sib_type = NR_SIB_TypeInfo__type_sibType3; - ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,&sib_type); - ASN_SEQUENCE_ADD(&sib1->si_SchedulingInfo->schedulingInfoList.list,&schedulingInfo); + // connEstFailureControl + // TODO: add connEstFailureControl + //si-SchedulingInfo + sib1->si_SchedulingInfo = CALLOC(1,sizeof(struct NR_SI_SchedulingInfo)); + asn_set_empty(&sib1->si_SchedulingInfo->schedulingInfoList.list); sib1->si_SchedulingInfo->si_WindowLength = NR_SI_SchedulingInfo__si_WindowLength_s20; - */ + struct NR_SchedulingInfo *schedulingInfo = CALLOC(1,sizeof(struct NR_SchedulingInfo)); + schedulingInfo->si_BroadcastStatus = NR_SchedulingInfo__si_BroadcastStatus_broadcasting; + schedulingInfo->si_Periodicity = NR_SchedulingInfo__si_Periodicity_rf8; + asn_set_empty(&schedulingInfo->sib_MappingInfo.list); + e_NR_SIB_TypeInfo__type *sib_type = CALLOC(1,sizeof(e_NR_SIB_TypeInfo__type)); + *sib_type = NR_SIB_TypeInfo__type_sibType3; + ASN_SEQUENCE_ADD(&schedulingInfo->sib_MappingInfo.list,sib_type); + ASN_SEQUENCE_ADD(&sib1->si_SchedulingInfo->schedulingInfoList.list,schedulingInfo); -#if 0 + // servingCellConfigCommon + sib1->servingCellConfigCommon = CALLOC(1,sizeof(struct NR_ServingCellConfigCommonSIB)); + + asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list); + asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list); + sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth; + sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters.subcarrierSpacing = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing; + sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters.cyclicPrefix = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.cyclicPrefix; + for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count; i++) { + struct NR_NR_MultiBandInfo *nrMultiBandInfo = CALLOC(1,sizeof(struct NR_NR_MultiBandInfo)); + nrMultiBandInfo->freqBandIndicatorNR = configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i]; + ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list,nrMultiBandInfo); + } + for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.count; i++) { + ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list,configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]); + } + sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon; + sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon; + sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = 0; + sib1->servingCellConfigCommon->downlinkConfigCommon.bcch_Config.modificationPeriodCoeff = NR_BCCH_Config__modificationPeriodCoeff_n2; + sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.defaultPagingCycle = 0; + sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.present = NR_PCCH_Config__nAndPagingFrameOffset_PR_oneT; + sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.ns = NR_PCCH_Config__ns_four; + + sib1->servingCellConfigCommon->uplinkConfigCommon = CALLOC(1,sizeof(struct NR_UplinkConfigCommonSIB)); + sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon; + asn_set_empty(&sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list); + for(int i = 0; i< configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.count; i++) { + ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list,configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]); + } + + sib1->servingCellConfigCommon->n_TimingAdvanceOffset = configuration->scc->n_TimingAdvanceOffset; + sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.shortBitmap; + sib1->servingCellConfigCommon->ssb_PeriodicityServingCell = *configuration->scc->ssb_periodicityServingCell; + sib1->servingCellConfigCommon->ss_PBCH_BlockPower = configuration->scc->ss_PBCH_BlockPower; + + // ims-EmergencySupport + // TODO: add ims-EmergencySupport + + // eCallOverIMS-Support + // TODO: add eCallOverIMS-Support + + // ue-TimersAndConstants + // TODO: add ue-TimersAndConstants + + // uac-BarringInfo sib1->uac_BarringInfo = CALLOC(1, sizeof(struct NR_SIB1__uac_BarringInfo)); - memset(sib1->uac_BarringInfo, 0, sizeof(struct NR_SIB1__uac_BarringInfo)); - nr_uac_BarringInfoSet.uac_BarringFactor = NR_UAC_BarringInfoSet__uac_BarringFactor_p95; - nr_uac_BarringInfoSet.uac_BarringTime = NR_UAC_BarringInfoSet__uac_BarringTime_s4; - nr_uac_BarringInfoSet.uac_BarringForAccessIdentity.buf = MALLOC(1); - memset(nr_uac_BarringInfoSet.uac_BarringForAccessIdentity.buf,0,1); - nr_uac_BarringInfoSet.uac_BarringForAccessIdentity.size = 1; - nr_uac_BarringInfoSet.uac_BarringForAccessIdentity.bits_unused = 1; - ASN_SEQUENCE_ADD(&sib1->uac_BarringInfo->uac_BarringInfoSetList, &nr_uac_BarringInfoSet); -#endif + NR_UAC_BarringInfoSet_t *nr_uac_BarringInfoSet = CALLOC(1, sizeof(NR_UAC_BarringInfoSet_t)); + asn_set_empty(&sib1->uac_BarringInfo->uac_BarringInfoSetList); + nr_uac_BarringInfoSet->uac_BarringFactor = NR_UAC_BarringInfoSet__uac_BarringFactor_p95; + nr_uac_BarringInfoSet->uac_BarringTime = NR_UAC_BarringInfoSet__uac_BarringTime_s4; + nr_uac_BarringInfoSet->uac_BarringForAccessIdentity.buf = CALLOC(1, 1); + nr_uac_BarringInfoSet->uac_BarringForAccessIdentity.size = 1; + nr_uac_BarringInfoSet->uac_BarringForAccessIdentity.bits_unused = 1; + ASN_SEQUENCE_ADD(&sib1->uac_BarringInfo->uac_BarringInfoSetList, nr_uac_BarringInfoSet); + + // useFullResumeID + // TODO: add useFullResumeID + + // lateNonCriticalExtension + // TODO: add lateNonCriticalExtension + + // nonCriticalExtension + // TODO: add nonCriticalExtension xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)sib1_message->message.choice.c1->choice.systemInformationBlockType1); - //encode SIB1 to data if(carrier->SIB1 == NULL) carrier->SIB1=(uint8_t *) malloc16(MAX_NR_SIB_LENGTH/8); enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_DL_SCH_Message, NULL, From e9109ee9e1fa6912c7647fa911f5613a1aff741d Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 25 Nov 2020 16:16:54 +0000 Subject: [PATCH 031/160] New folder for gNB NR-5GC config files --- .../CONF}/gnb.sa.band78.tm1.fr1.106PRB.usrpb210.conf | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {ci-scripts/conf_files => targets/PROJECTS/GENERIC-NR-5GC/CONF}/gnb.sa.band78.tm1.fr1.106PRB.usrpb210.conf (100%) diff --git a/ci-scripts/conf_files/gnb.sa.band78.tm1.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.tm1.fr1.106PRB.usrpb210.conf similarity index 100% rename from ci-scripts/conf_files/gnb.sa.band78.tm1.fr1.106PRB.usrpb210.conf rename to targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.tm1.fr1.106PRB.usrpb210.conf From 9bbe4f7cd83efeb0e73e08dc2942fe781a0db520 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 25 Nov 2020 22:21:24 +0000 Subject: [PATCH 032/160] Minor corrections --- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 2 +- openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 2 ++ openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 5 +++-- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 2 ++ openair2/RRC/NR_UE/rrc_UE.c | 12 +++++++----- openair2/RRC/NR_UE/rrc_defs.h | 2 -- openair2/RRC/NR_UE/rrc_proto.h | 4 +++- 7 files changed, 18 insertions(+), 11 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 2b744306c7..269a906119 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -908,7 +908,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, } } - LOG_I(PHY,"nr_dci_decoding_procedure: frame = %i, slot = %i\n", frame, slot); + LOG_I(PHY,"nr_dci_decoding_procedure: frame = %i, slot = %i\n", proc->frame_rx, proc->nr_slot_rx); return(dci_ind->number_of_dcis); } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 4db1f90f86..f7a6a55764 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -609,6 +609,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ret = 1 + dlsch->max_ldpc_iterations; } + getchar(); + nb_total_decod++; if (no_iteration_ldpc > dlsch->max_ldpc_iterations){ nb_error_decod++; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 8fc457d83b..df85bbc70b 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -744,6 +744,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ nr_slot_rx, aatx /*p*/, m, + BWPStart, ue->frame_parms.first_carrier_offset+(BWPStart + pdsch_start_rb)*12, pdsch_nb_rb); LOG_D(PHY,"PDSCH Channel estimation gNB id %d, PDSCH antenna port %d, slot %d, symbol %d\n",0,aatx,nr_slot_rx,m); @@ -1936,9 +1937,9 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ue->dlsch_SI[gNB_id]->active = 0; // FIXME: It was assumed that SIB1 has only one segment - int harq_pid = PHY_vars_UE_g[0][0]->dlsch_SI[0]->current_harq_pid; + int harq_pid = PHY_vars_UE_g[ue->Mod_id][ue->CC_id]->dlsch_SI[0]->current_harq_pid; if(ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->harq_ack.ack == 1) { - nr_rrc_ue_decode_NR_SIB1_Message(&ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->c[0][0], + nr_rrc_ue_decode_NR_SIB1_Message(ue->Mod_id, gNB_id, &ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->c[0][0], ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->TBS); } else { LOG_D(PHY,"SIB1 CRC NOT OK"); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 68e8885af7..34344f8d87 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -4013,6 +4013,8 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac, LOG_D(MAC,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); LOG_D(MAC,"dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator); + getchar(); + break; case NR_RNTI_TC: diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 2337fd7caa..c74758a9b1 100755 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1478,7 +1478,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB } /*brief decode SIB1 message*/ -int8_t nr_rrc_ue_decode_NR_SIB1_Message(uint8_t *const bufferP, const uint8_t buffer_len){ +int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) { NR_BCCH_DL_SCH_Message_t *bcch_message = NULL; @@ -1501,11 +1501,13 @@ int8_t nr_rrc_ue_decode_NR_SIB1_Message(uint8_t *const bufferP, const uint8_t bu } else { - if(NR_UE_rrc_inst->sib1 != NULL){ - SEQUENCE_free(&asn_DEF_NR_BCCH_BCH_Message, (void *)NR_UE_rrc_inst->sib1, 1 ); + NR_SIB1_t *sib1 = NR_UE_rrc_inst[module_id].sib1[gNB_index]; + + if(sib1 != NULL){ + SEQUENCE_free(&asn_DEF_NR_BCCH_BCH_Message, (void *)sib1, 1 ); } - NR_UE_rrc_inst->sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; - xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)NR_UE_rrc_inst->sib1); + sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; + xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)sib1); } diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index d9342bb9f2..8f61ebe0c3 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -124,8 +124,6 @@ typedef struct NR_UE_RRC_INST_s { NR_UE_RRC_INFO Info[NB_SIG_CNX_UE]; NR_MIB_t *mib; - NR_SIB1_t *sib1; // QQQQQ - /* KeNB as computed from parameters within USIM card */ uint8_t kgnb[32]; diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 4e6c7f2b47..4019248441 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -87,9 +87,11 @@ int8_t nr_rrc_ue_process_radio_bearer_config(NR_RadioBearerConfig_t *radio_beare int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len); /**\brief decode NR SIB1 message + \param module_idP module id + \param gNB_index gNB index \param sduP pointer to buffer of ASN message \param sdu_len length of buffer*/ -int8_t nr_rrc_ue_decode_NR_SIB1_Message(uint8_t *const bufferP, const uint8_t buffer_len); +int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len); /**\brief Decode NR DCCH from gNB, sent from lower layer through SRB3 \param module_id module id From 81d64b3decb0b6e47a7577695ae87ef5106bf959 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 26 Nov 2020 03:12:59 +0000 Subject: [PATCH 033/160] Minor corrections --- .../gnb.band78.tm1.106PRB.usrpn300.conf | 36 +++---- .../gnb.band78.tm1.fr1.106PRB.usrpb210.conf | 40 ++++---- openair1/PHY/MODULATION/slot_fep_nr.c | 2 +- .../nr_dl_channel_estimation.c | 4 +- openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 5 +- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 2 - openair1/SCHED_NR/phy_procedures_nr_gNB.c | 2 +- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 2 +- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 6 +- openair1/SCHED_NR_UE/pucch_uci_ue_nr.c | 4 +- openair2/GNB_APP/gnb_config.c | 4 + openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 28 +++--- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 31 ++---- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 7 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 2 - openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 1 - openair2/RRC/NR/L2_nr_interface.c | 2 +- openair2/RRC/NR/rrc_gNB.c | 2 +- openair2/RRC/NR_UE/rrc_UE.c | 96 +++++++++---------- openair2/RRC/NR_UE/rrc_defs.h | 2 +- 20 files changed, 126 insertions(+), 152 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index 84769189ff..aeba400cad 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -15,7 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); tr_s_preference = "local_mac" @@ -23,7 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; - + servingCellConfigCommon = ( { #spCellConfigCommon @@ -40,7 +40,7 @@ gNBs = #scs-SpecificCarrierList dl_offstToCarrier = 0; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 dl_subcarrierSpacing = 1; dl_carrierBandwidth = 106; #initialDownlinkBWP @@ -48,7 +48,7 @@ gNBs = # this is RBstart=41,L=24 (275*(L-1))+RBstart initialDLBWPlocationAndBandwidth = 6366; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; #pdcch-ConfigCommon initialDLBWPcontrolResourceSetZero = 12; @@ -64,12 +64,12 @@ gNBs = initialDLBWPk0_1 = 0; initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 + #this is SS=2,L=12 initialDLBWPstartSymbolAndLength_1 = 53; initialDLBWPk0_2 = 0; initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 + #this is SS=1,L=12 initialDLBWPstartSymbolAndLength_2 = 54; initialDLBWPk0_3 = 0; @@ -77,13 +77,13 @@ gNBs = #this is SS=1,L=5 initialDLBWPstartSymbolAndLength_3 = 57; - #uplinkConfigCommon + #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; #scs-SpecificCarrierList ul_offstToCarrier = 0; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 ul_subcarrierSpacing = 1; ul_carrierBandwidth = 106; pMax = 20; @@ -91,7 +91,7 @@ gNBs = #genericParameters initialULBWPlocationAndBandwidth = 6366; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; #rach-ConfigCommon #rach-ConfigGeneric @@ -124,7 +124,7 @@ gNBs = prach_RootSequenceIndex_PR = 2; prach_RootSequenceIndex = 1; # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex - # + # msg1_SubcarrierSpacing = 1, # restrictedSetConfig # 0=unrestricted, 1=restricted type A, 2=restricted type B @@ -161,7 +161,7 @@ gNBs = ssb_PositionsInBurst_Bitmap = 1; # ssb_periodicityServingCell -# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 ssb_periodicityServingCell = 2; # dmrs_TypeA_position @@ -169,15 +169,15 @@ gNBs = dmrs_TypeA_Position = 0; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 subcarrierSpacing = 1; #tdd-UL-DL-ConfigurationCommon # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 referenceSubcarrierSpacing = 1; - # pattern1 + # pattern1 # dl_UL_TransmissionPeriodicity # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 dl_UL_TransmissionPeriodicity = 6; @@ -227,18 +227,18 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; - } + } ); L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; - } + } ); RUs = ( - { + { local_rf = "yes" nb_tx = 1 nb_rx = 1 @@ -253,7 +253,7 @@ RUs = ( sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; clock_src = "external"; } -); +); THREAD_STRUCT = ( { diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf index f10a6fe30f..0d9691966b 100755 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf @@ -13,7 +13,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;}); + plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;}); tr_s_preference = "local_mac" @@ -21,7 +21,7 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; - + servingCellConfigCommon = ( { #spCellConfigCommon @@ -38,7 +38,7 @@ gNBs = #scs-SpecificCarrierList dl_offstToCarrier = 0; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 dl_subcarrierSpacing = 1; dl_carrierBandwidth = 106; #initialDownlinkBWP @@ -46,7 +46,7 @@ gNBs = # this is RBstart=84,L=13 (275*(L-1))+RBstart initialDLBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; #pdcch-ConfigCommon initialDLBWPcontrolResourceSetZero = 0; @@ -62,25 +62,25 @@ gNBs = initialDLBWPk0_1 = 0; initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 + #this is SS=2,L=12 initialDLBWPstartSymbolAndLength_1 = 53; initialDLBWPk0_2 = 0; initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 + #this is SS=1,L=12 initialDLBWPstartSymbolAndLength_2 = 54; initialDLBWPk0_3 = 0; initialDLBWPmappingType_3 = 0; #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; - #uplinkConfigCommon + #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; #scs-SpecificCarrierList ul_offstToCarrier = 0; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 ul_subcarrierSpacing = 1; ul_carrierBandwidth = 106; pMax = 20; @@ -88,7 +88,7 @@ gNBs = #genericParameters initialULBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; #rach-ConfigCommon #rach-ConfigGeneric @@ -106,7 +106,7 @@ gNBs = powerRampingStep = 1; #ra_ReponseWindow #1,2,4,8,10,20,40,80 - ra_ResponseWindow = 4; + ra_ResponseWindow = 5; #ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR #1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; @@ -121,7 +121,7 @@ gNBs = prach_RootSequenceIndex_PR = 2; prach_RootSequenceIndex = 1; # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex - # + # msg1_SubcarrierSpacing = 1, # restrictedSetConfig @@ -132,7 +132,7 @@ gNBs = initialULBWPmappingType_0 = 1 # this is SS=0 L=11 initialULBWPstartSymbolAndLength_0 = 55; - + initialULBWPk2_1 = 2; initialULBWPmappingType_1 = 1; # this is SS=0 L=12 @@ -158,7 +158,7 @@ gNBs = ssb_PositionsInBurst_Bitmap = 1; #0x80; # ssb_periodicityServingCell -# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 ssb_periodicityServingCell = 2; # dmrs_TypeA_position @@ -166,15 +166,15 @@ gNBs = dmrs_TypeA_Position = 0; # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 subcarrierSpacing = 1; #tdd-UL-DL-ConfigurationCommon # subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 referenceSubcarrierSpacing = 1; - # pattern1 + # pattern1 # dl_UL_TransmissionPeriodicity # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 dl_UL_TransmissionPeriodicity = 6; @@ -239,18 +239,18 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; - } + } ); L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; - } + } ); RUs = ( - { + { local_rf = "yes" nb_tx = 1 nb_rx = 1 @@ -262,7 +262,7 @@ RUs = ( eNB_instances = [0]; clock_src = "external"; } -); +); THREAD_STRUCT = ( { diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c index cde57717f7..60b28d4ad1 100644 --- a/openair1/PHY/MODULATION/slot_fep_nr.c +++ b/openair1/PHY/MODULATION/slot_fep_nr.c @@ -212,7 +212,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, (int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], frame_parms->ofdm_symbol_size, 15); - + } diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index dee3c995ff..8708c365cf 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -770,8 +770,6 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, } } - - for (aarx=0; aarxframe_parms.nb_antennas_rx; aarx++) { pil = (int16_t *)&pilot[rb_offset*((config_type==pdsch_dmrs_type1) ? 6:4)]; k = k % ue->frame_parms.ofdm_symbol_size; @@ -921,7 +919,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, ch, dl_ch, 8); - + // check if PRB crosses DC and improve estimates around DC if ((bwp_start_subcarrier < ue->frame_parms.ofdm_symbol_size) && (bwp_start_subcarrier+nb_rb_pdsch*12 >= ue->frame_parms.ofdm_symbol_size)) { dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset]; diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 269a906119..1c6cce8070 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -679,14 +679,11 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, uint8_t log2_maxh, aarx; int32_t avgs; int32_t avgP[4]; - for (int i=0;inb_search_space;i++) { rel15 = &pdcch_vars->pdcch_config[i]; int n_rb,rb_offset; - get_coreset_rballoc(rel15->coreset.frequency_domain_resource,&n_rb,&rb_offset); - for (int s=rel15->coreset.StartSymbolIndex; s<(rel15->coreset.StartSymbolIndex+rel15->coreset.duration); s++) { LOG_D(PHY,"in nr_pdcch_extract_rbs_single(rxdataF -> rxdataF_ext || dl_ch_estimates -> dl_ch_estimates_ext)\n"); @@ -880,7 +877,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, #endif uint16_t crc = polar_decoder_int16(tmp_e, - dci_estimation, + dci_estimation, 1, currentPtrDCI); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index f7a6a55764..4db1f90f86 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -609,8 +609,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ret = 1 + dlsch->max_ldpc_iterations; } - getchar(); - nb_total_decod++; if (no_iteration_ldpc > dlsch->max_ldpc_iterations){ nb_error_decod++; diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 0f093b4bca..ff6495c493 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -108,7 +108,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol); nr_generate_pss(gNB->d_pss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); nr_generate_sss(gNB->d_sss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); - + if (cfg->carrier_config.num_tx_ant.value <= 4) nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); else diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 2d5fb81f39..6da9c8ebea 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -84,6 +84,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH){ dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_SI[0]; dlsch0->rnti_type = _SI_RNTI_; + dlsch0->harq_processes[dlsch0->current_harq_pid]->status = ACTIVE; } fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15; @@ -97,7 +98,6 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ if (dlsch0_harq){ - dlsch0_harq->status = ACTIVE; dlsch0_harq->BWPStart = dlsch_config_pdu->BWPStart; dlsch0_harq->BWPSize = dlsch_config_pdu->BWPSize; dlsch0_harq->nb_rb = dlsch_config_pdu->number_rbs; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index df85bbc70b..f6a0b625c1 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1808,8 +1808,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, 0, 0); - fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15; - dci_cnt = 0; for(int n_ss = 0; n_ssnb_search_space; n_ss++) { @@ -1817,15 +1815,13 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, LOG_D(PHY, "pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d\n", fp->first_carrier_offset, pdcch_vars->pdcch_config[n_ss].BWPStart, coreset_start_rb); - rel15 = &pdcch_vars->pdcch_config[n_ss]; - if (coreset_nb_rb > 0) nr_pdcch_channel_estimation(ue, proc, 0, nr_slot_rx, l, - (pdcch_vars->pdcch_config[n_ss].BWPStart + coreset_start_rb) * 12, + fp->first_carrier_offset+(pdcch_vars->pdcch_config[n_ss].BWPStart + coreset_start_rb)*12, coreset_nb_rb); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c index 9a19aef985..d602afb69a 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c @@ -446,7 +446,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ return (FALSE); } - int max_code_rate = 0; + //int max_code_rate = 0; //int Q_m = BITS_PER_SYMBOL_QPSK; /* default pucch modulation type is QPSK with 2 bits per symbol */ int N_sc_ctrl_RB = 0; int O_CRC = 0; @@ -503,7 +503,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_ if (format != pucch_format0_nr) { if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1 != NULL) { - max_code_rate = code_rate_r_time_100[mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1->choice.setup->maxCodeRate[0]]; /* it is code rate * 10 */ + //max_code_rate = code_rate_r_time_100[mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1->choice.setup->maxCodeRate[0]]; /* it is code rate * 10 */ if ((O_ACK != 0) && (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format1->choice.setup->simultaneousHARQ_ACK_CSI[0] == 0)) { N_UCI = N_UCI - O_CSI; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 26d9198c82..dd1692c365 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1024,9 +1024,13 @@ void NRRCConfig(void) { paramdef_t GNBSParams[] = GNBSPARAMS_DESC; /* get global parameters, defined outside any section in the config file */ + LOG_I(GNB_APP, "Getting GNBSParams\n"); + config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); RC.nb_nr_inst = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; + + // Get num MACRLC instances config_getlist( &MACRLCParamList,NULL,0, NULL); RC.nb_macrlc_inst = MACRLCParamList.numelt; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index b5b1594d63..1fb5e653ed 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -180,7 +180,7 @@ int16_t table_6_3_3_2_1[16][5] = { /* Function to get number of RBs required for prach occasion based on * 38.211 Table 6.3.3.2-1 */ int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH) { - + int8_t index = 0; switch(delta_f_RA_PRACH) { case 0 : index = 6; @@ -206,8 +206,8 @@ int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH) { index += 0; else index += 1; - break; - + break; + case 3: index = 13; if (delta_f_PUSCH == 2) index += 0; @@ -216,11 +216,11 @@ int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH) { break; default : index = 10;/*30khz prach scs and 30khz pusch scs*/ - + } - + return table_6_3_3_2_1[index][3]; -} +} // Table 6.3.3.2-2: Random access configurations for FR1 and paired spectrum/supplementary uplink // the column 5, (SFN_nbr is a bitmap where we set bit to '1' in the position of the subframe where the RACH can be sent. // E.g. in row 4, and column 5 we have set value 512 ('1000000000') which means RACH can be sent at subframe 9. @@ -1131,14 +1131,14 @@ int get_nr_prach_occasion_info_from_index(uint8_t index, } } *N_RA_slot = table_6_3_3_2_4_prachConfig_Index[index][7]; // Number of RACH slots within a subframe - *max_association_period = 160/(x * 10); + *max_association_period = 160/(x * 10); if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){ *start_symbol = table_6_3_3_2_4_prachConfig_Index[index][6];//multiple prach occasions in diff slot *N_t_slot = table_6_3_3_2_4_prachConfig_Index[index][8]; *N_dur = table_6_3_3_2_4_prachConfig_Index[index][9]; if (table_6_3_3_2_4_prachConfig_Index[index][1] != -1) format2 = (uint8_t) table_6_3_3_2_4_prachConfig_Index[index][1]; - + *format = ((uint8_t) table_6_3_3_2_4_prachConfig_Index[index][0]) | (format2<<8); LOG_D(MAC,"Getting Total PRACH info from index %d absoluteFrequencyPointA %u mu %u frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_sfn = %u\n", index, @@ -1163,7 +1163,7 @@ int get_nr_prach_occasion_info_from_index(uint8_t index, } } *N_RA_slot = table_6_3_3_2_3_prachConfig_Index[index][6]; // Number of RACH slots within a subframe - *max_association_period = 160/(x * 10); + *max_association_period = 160/(x * 10); if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){ *start_symbol = table_6_3_3_2_3_prachConfig_Index[index][5]; *N_t_slot = table_6_3_3_2_3_prachConfig_Index[index][7]; @@ -1352,8 +1352,8 @@ int get_nr_prach_info_from_index(uint8_t index, *N_RA_slot = table_6_3_3_2_3_prachConfig_Index[index][6]; // Number of RACH slots within a subframe if (mu == 1) { if ( (*N_RA_slot <= 1) && (slot%2 == 0) ) - return 0; // no prach in even slots @ 30kHz for 1 prach per subframe - } + return 0; // no prach in even slots @ 30kHz for 1 prach per subframe + } if (start_symbol != NULL && N_t_slot != NULL && N_dur != NULL && format != NULL){ *config_period = x; *start_symbol = table_6_3_3_2_3_prachConfig_Index[index][5]; @@ -2817,8 +2817,8 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i if (dmrs_config->dmrs_AdditionalPosition == NULL) pos2=1; else if (dmrs_config->dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition == NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0 ) return(1<n_c=UINT_MAX; type0_PDCCH_CSS_config->number_of_search_space_per_slot=UINT_MAX; type0_PDCCH_CSS_config->first_symbol_index=UINT_MAX; - type0_PDCCH_CSS_config->search_space_duration; // element of search space + type0_PDCCH_CSS_config->search_space_duration=0; // element of search space // 38.213 table 10.1-1 /// MUX PATTERN 1 diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 34344f8d87..83ffa57250 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -789,7 +789,6 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, scheduled_response->thread_id = thread_id; } - uint8_t table_9_2_2_1[16][8]={ {0,12,2, 0, 0,3,0,0}, {0,12,2, 0, 0,4,8,0}, @@ -958,10 +957,6 @@ int8_t nr_ue_decode_mib(module_id_t module_id, NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); - // fill in the elements in config request inside P5 message - mac->phy_config.Mod_id = module_id; - mac->phy_config.CC_id = cc_id; - nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU AssertFatal(mac->mib != NULL, "nr_ue_decode_mib() mac->mib == NULL\n"); @@ -970,7 +965,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, uint16_t frame_number_4lsb = 0; for (int i=0; i<4; i++) frame_number_4lsb |= ((extra_bits>>i)&1)<<(3-i); - uint8_t half_frame_bit = ( extra_bits >> 4 ) & 0x1; // extra bits[4] + //uint8_t half_frame_bit = ( extra_bits >> 4 ) & 0x1; // extra bits[4] uint8_t ssb_subcarrier_offset_msb = ( extra_bits >> 5 ) & 0x1; // extra bits[5] uint8_t ssb_subcarrier_offset = (uint8_t)mac->mib->ssb_SubcarrierOffset; @@ -997,7 +992,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, LOG_I(MAC,"pdcch config sib1.searchSpaceZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.searchSpaceZero); LOG_I(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred); LOG_I(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection); - LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit); + //LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit); LOG_I(MAC,"ssb index(extra bits): %d\n", (int)ssb_index); #endif @@ -1010,7 +1005,6 @@ int8_t nr_ue_decode_mib(module_id_t module_id, mac->type0_pdcch_ss_n_c = mac->type0_PDCCH_CSS_config.n_c; mac->dl_config_request.sfn = mac->type0_PDCCH_CSS_config.frame; mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS - channel_bandwidth_t min_channel_bw = bw_10MHz; // default for testing return 0; } @@ -1179,9 +1173,6 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in } */ } - - fapi_nr_dl_config_dci_dl_pdu_rel15_t dci_config_rel15 = dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; - } else if (ul_info) { // ULSCH is handled only in phy-test mode (consistently with OAI gNB) @@ -3372,14 +3363,10 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr LOG_D(MAC,"dlDmrsSymbPos = 0x%x\n", dlsch_config_pdu_1_0->dlDmrsSymbPos); /* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */ - //if (dlsch_config_pdu_1_0->number_symbols == 2) - // dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1; - //else - // dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 2; - - /* TODO: fix number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214, - using tables 7.3.1.2.2-1, 7.3.1.2.2-2, 7.3.1.2.2-3, 7.3.1.2.2-4 of 3GPP TS 38.212 */ - dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1; + if (dlsch_config_pdu_1_0->number_symbols == 2) + dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1; + else + dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 2; /* VRB_TO_PRB_MAPPING */ dlsch_config_pdu_1_0->vrb_to_prb_mapping = (dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved:vrb_to_prb_mapping_interleaved; @@ -4013,8 +4000,6 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac, LOG_D(MAC,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); LOG_D(MAC,"dci_pdu_rel15->system_info_indicator = %i\n", dci_pdu_rel15->system_info_indicator); - getchar(); - break; case NR_RNTI_TC: @@ -4325,8 +4310,8 @@ int nr_extract_dci_info(NR_UE_MAC_INST_t *mac, break; } break; - } - + } + return dci_format; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 8902c32916..a34520a154 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -215,9 +215,8 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, } - void schedule_nr_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) { -//---------------------------------------- +//---------------------------------------- } void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, int CC_id) { @@ -236,7 +235,7 @@ void schedule_control_sib1(module_id_t module_id, gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; NR_ServingCellConfigCommon_t *servingcellconfigcommon = gNB_mac->common_channels[CC_id].ServingCellConfigCommon; - uint8_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; + uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; if (gNB_mac->sched_ctrlCommon == NULL){ gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon)); @@ -444,7 +443,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) int time_domain_allocation = 2; // FIXME: For OAI-UE (2), For 3rd party implementation and 3GPP compliant (4) uint8_t mcsTableIdx = 0; uint8_t mcs = 8; - uint8_t numDmrsCdmGrpsNoData = 1; // FIXME: For OAI-UE (1), For 3rd party implementation and 3GPP compliant (2) + uint8_t numDmrsCdmGrpsNoData = 2; gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 2ab89c5762..26ce866b54 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -63,7 +63,6 @@ #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_gNB_SCHEDULER 1 - #include "common/ran_context.h" extern RAN_CONTEXT_t RC; @@ -189,7 +188,6 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id]; } - int n_rb=0; for (int i=0;i<6;i++) for (int j=0;j<8;j++) { diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index fc5d727915..075c77982a 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -191,7 +191,6 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ (dl_info->rx_ind->rx_indication_body+i)->sib_pdu.pdu, (dl_info->rx_ind->rx_indication_body+i)->sib_pdu.pdu_length)) << FAPI_NR_RX_PDU_TYPE_SIB; - LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][RX_IND], SIB case Number of PDUs: %d \n", dl_info->rx_ind->number_pdus); break; case FAPI_NR_RX_PDU_TYPE_DLSCH: diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 75af67aa99..5953c136fd 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -50,7 +50,7 @@ int generate_pdcch_ConfigSIB1(NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1, long subCarrierSpacingCommon, channel_bandwidth_t min_channel_bw) { - nr_ssb_and_cset_mux_pattern_type_t mux_pattern; + nr_ssb_and_cset_mux_pattern_type_t mux_pattern = 0; switch (ssbSubcarrierSpacing) { diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index a4dd3d8dda..71e0bd13ad 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -212,7 +212,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); rrc->carrier.MIB = (uint8_t *) malloc16(4); rrc->carrier.sizeof_MIB = do_MIB_NR(rrc,0); - rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier,configuration); + rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier,configuration); LOG_I(NR_RRC,"Done init_NR_SI\n"); rrc_mac_config_req_gNB(rrc->module_id, rrc->carrier.ssb_SubcarrierOffset, diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index c74758a9b1..ccbd3b3bf2 100755 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -246,7 +246,7 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR case NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration: if(rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig != NULL){ if(NR_UE_rrc_inst[module_id].radio_bearer_config == NULL){ - NR_UE_rrc_inst[module_id].radio_bearer_config = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig; + NR_UE_rrc_inst[module_id].radio_bearer_config = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig; }else{ nr_rrc_ue_process_RadioBearerConfig(rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig); } @@ -257,7 +257,7 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR &asn_DEF_NR_CellGroupConfig, //might be added prefix later (void **)&cellGroupConfig, (uint8_t *)rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->secondaryCellGroup->buf, - rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->secondaryCellGroup->size, 0, 0); + rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->secondaryCellGroup->size, 0, 0); xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)cellGroupConfig); @@ -287,13 +287,13 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR // unuse now } break; - + case NR_RRCReconfiguration__criticalExtensions_PR_NOTHING: case NR_RRCReconfiguration__criticalExtensions_PR_criticalExtensionsFuture: default: break; } - //nr_rrc_mac_config_req_ue(); + //nr_rrc_mac_config_req_ue(); return 0; } @@ -341,7 +341,7 @@ int8_t nr_rrc_ue_process_scg_config(const module_id_t module_id, NR_CellGroupCon } } } - } + } return 0; } @@ -357,8 +357,8 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, &asn_DEF_NR_RRCReconfiguration, (void **)&RRCReconfiguration, (uint8_t *)message, - msg_len); - + msg_len); + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { LOG_E(RRC,"NR_RRCReconfiguration decode error\n"); // free the memory @@ -368,7 +368,7 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, nr_rrc_ue_process_rrcReconfiguration(module_id,RRCReconfiguration); } break; - + case nr_RadioBearerConfigX_r15: { NR_RadioBearerConfig_t *RadioBearerConfig=NULL; @@ -376,8 +376,8 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, &asn_DEF_NR_RadioBearerConfig, (void **)&RadioBearerConfig, (uint8_t *)message, - msg_len); - + msg_len); + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { LOG_E(RRC,"NR_RadioBearerConfig decode error\n"); // free the memory @@ -387,7 +387,7 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, nr_rrc_ue_process_RadioBearerConfig(RadioBearerConfig); } break; - + default: AssertFatal(1==0,"Unknown message %d\n",nsa_message_type); break; @@ -488,7 +488,7 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* rrc_config_path){ strerror(errno)); msg_len=fread(buffer,1,1024,fd); fclose(fd); - process_nsa_message(NR_UE_rrc_inst, nr_RadioBearerConfigX_r15, buffer,msg_len); + process_nsa_message(NR_UE_rrc_inst, nr_RadioBearerConfigX_r15, buffer,msg_len); } }else{ NR_UE_rrc_inst = NULL; @@ -635,22 +635,22 @@ void nr_dump_sib2( NR_SIB2_t *sib2 ){ *sib2->cellReselectionServingFreqInfo.s_NonIntraSearchP ); else LOG_I( RRC, "cellReselectionServingFreqInfo->s_NonIntraSearchP : not defined\n" ); - + if( sib2->cellReselectionServingFreqInfo.s_NonIntraSearchQ) LOG_I( RRC, "cellReselectionServingFreqInfo.s_NonIntraSearchQ : %ld\n", *sib2->cellReselectionServingFreqInfo.s_NonIntraSearchQ ); else LOG_I( RRC, "cellReselectionServingFreqInfo->s_NonIntraSearchQ : not defined\n" ); - + LOG_I( RRC, "cellReselectionServingFreqInfo.threshServingLowP : %ld\n", sib2->cellReselectionServingFreqInfo.threshServingLowP ); - + if( sib2->cellReselectionServingFreqInfo.threshServingLowQ) LOG_I( RRC, "cellReselectionServingFreqInfo.threshServingLowQ : %ld\n", *sib2->cellReselectionServingFreqInfo.threshServingLowQ ); else LOG_I( RRC, "cellReselectionServingFreqInfo->threshServingLowQ : not defined\n" ); - + LOG_I( RRC, "cellReselectionServingFreqInfo.cellReselectionPriority : %ld\n", sib2->cellReselectionServingFreqInfo.cellReselectionPriority ); if( sib2->cellReselectionServingFreqInfo.cellReselectionSubPriority) @@ -662,28 +662,28 @@ void nr_dump_sib2( NR_SIB2_t *sib2 ){ //intraFreqCellReselectionInfo LOG_I( RRC, "intraFreqCellReselectionInfo.q_RxLevMin : %ld\n", sib2->intraFreqCellReselectionInfo.q_RxLevMin ); - + if( sib2->intraFreqCellReselectionInfo.q_RxLevMinSUL) LOG_I( RRC, "intraFreqCellReselectionInfo.q_RxLevMinSUL : %ld\n", *sib2->intraFreqCellReselectionInfo.q_RxLevMinSUL ); else LOG_I( RRC, "intraFreqCellReselectionInfo->q_RxLevMinSUL : not defined\n" ); - + if( sib2->intraFreqCellReselectionInfo.q_QualMin) LOG_I( RRC, "intraFreqCellReselectionInfo.q_QualMin : %ld\n", *sib2->intraFreqCellReselectionInfo.q_QualMin ); else LOG_I( RRC, "intraFreqCellReselectionInfo->q_QualMin : not defined\n" ); - + LOG_I( RRC, "intraFreqCellReselectionInfo.s_IntraSearchP : %ld\n", sib2->intraFreqCellReselectionInfo.s_IntraSearchP ); - + if( sib2->intraFreqCellReselectionInfo.s_IntraSearchQ) LOG_I( RRC, "intraFreqCellReselectionInfo.s_IntraSearchQ : %ld\n", *sib2->intraFreqCellReselectionInfo.s_IntraSearchQ ); else LOG_I( RRC, "intraFreqCellReselectionInfo->s_IntraSearchQ : not defined\n" ); - + LOG_I( RRC, "intraFreqCellReselectionInfo.t_ReselectionNR : %ld\n", sib2->intraFreqCellReselectionInfo.t_ReselectionNR ); @@ -692,25 +692,25 @@ void nr_dump_sib2( NR_SIB2_t *sib2 ){ sib2->intraFreqCellReselectionInfo.frequencyBandList ); else LOG_I( RRC, "intraFreqCellReselectionInfo->frequencyBandList : not defined\n" ); - + if( sib2->intraFreqCellReselectionInfo.frequencyBandListSUL) LOG_I( RRC, "intraFreqCellReselectionInfo.frequencyBandListSUL : %p\n", sib2->intraFreqCellReselectionInfo.frequencyBandListSUL ); else LOG_I( RRC, "intraFreqCellReselectionInfo->frequencyBandListSUL : not defined\n" ); - + if( sib2->intraFreqCellReselectionInfo.p_Max) LOG_I( RRC, "intraFreqCellReselectionInfo.p_Max : %ld\n", *sib2->intraFreqCellReselectionInfo.p_Max ); else LOG_I( RRC, "intraFreqCellReselectionInfo->p_Max : not defined\n" ); - + if( sib2->intraFreqCellReselectionInfo.smtc) LOG_I( RRC, "intraFreqCellReselectionInfo.smtc : %p\n", sib2->intraFreqCellReselectionInfo.smtc ); else LOG_I( RRC, "intraFreqCellReselectionInfo->smtc : not defined\n" ); - + if( sib2->intraFreqCellReselectionInfo.ss_RSSI_Measurement) LOG_I( RRC, "intraFreqCellReselectionInfo.ss_RSSI_Measurement : %p\n", sib2->intraFreqCellReselectionInfo.ss_RSSI_Measurement ); @@ -722,7 +722,7 @@ void nr_dump_sib2( NR_SIB2_t *sib2 ){ sib2->intraFreqCellReselectionInfo.ssb_ToMeasure ); else LOG_I( RRC, "intraFreqCellReselectionInfo->ssb_ToMeasure : not defined\n" ); - + LOG_I( RRC, "intraFreqCellReselectionInfo.deriveSSB_IndexFromCell : %d\n", sib2->intraFreqCellReselectionInfo.deriveSSB_IndexFromCell ); @@ -732,7 +732,7 @@ void nr_dump_sib3( NR_SIB3_t *sib3 ) { //intraFreqNeighCellList if( sib3->intraFreqNeighCellList){ LOG_I( RRC, "intraFreqNeighCellList : %p\n", - sib3->intraFreqNeighCellList ); + sib3->intraFreqNeighCellList ); const int n = sib3->intraFreqNeighCellList->list.count; for (int i = 0; i < n; ++i){ LOG_I( RRC, "intraFreqNeighCellList->physCellId : %ld\n", @@ -745,13 +745,13 @@ void nr_dump_sib3( NR_SIB3_t *sib3 ) { *sib3->intraFreqNeighCellList->list.array[i]->q_RxLevMinOffsetCell ); else LOG_I( RRC, "intraFreqNeighCellList->q_RxLevMinOffsetCell : not defined\n" ); - + if( sib3->intraFreqNeighCellList->list.array[i]->q_RxLevMinOffsetCellSUL) LOG_I( RRC, "intraFreqNeighCellList->q_RxLevMinOffsetCellSUL : %ld\n", *sib3->intraFreqNeighCellList->list.array[i]->q_RxLevMinOffsetCellSUL ); else LOG_I( RRC, "intraFreqNeighCellList->q_RxLevMinOffsetCellSUL : not defined\n" ); - + if( sib3->intraFreqNeighCellList->list.array[i]->q_QualMinOffsetCell) LOG_I( RRC, "intraFreqNeighCellList->q_QualMinOffsetCell : %ld\n", *sib3->intraFreqNeighCellList->list.array[i]->q_QualMinOffsetCell ); @@ -765,7 +765,7 @@ void nr_dump_sib3( NR_SIB3_t *sib3 ) { //intraFreqBlackCellList if( sib3->intraFreqBlackCellList){ LOG_I( RRC, "intraFreqBlackCellList : %p\n", - sib3->intraFreqBlackCellList ); + sib3->intraFreqBlackCellList ); const int n = sib3->intraFreqBlackCellList->list.count; for (int i = 0; i < n; ++i){ LOG_I( RRC, "intraFreqBlackCellList->start : %ld\n", @@ -983,7 +983,7 @@ int nr_decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index memcpy( NR_UE_rrc_inst[ctxt_pP->module_id].sib12[gNB_index], typeandinfo->choice.sib14_v1610, sizeof(NR_SIB14_r16_t) ); LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB14 from gNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, gNB_index ); } - + break; default: @@ -991,10 +991,10 @@ int nr_decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index } if (new_sib == 1) { NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt++; - + if (NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt == sib1->si_SchedulingInfo->schedulingInfoList.list.count) nr_rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE ); - + LOG_I(RRC,"SIStatus %x, SIcnt %d/%d\n", NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIStatus, NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].SIcnt, @@ -1346,7 +1346,7 @@ static void rrc_ue_generate_RRCSetupComplete( const uint8_t gNB_index, const uint8_t Transaction_id, uint8_t sel_plmn_id){ - + uint8_t buffer[100]; uint8_t size; const char *nas_msg; @@ -1405,17 +1405,17 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB (void **)&dl_ccch_msg, (uint8_t *)Srb_info->Rx_buffer.Payload, 100,0,0); - + // if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout,&asn_DEF_NR_DL_CCCH_Message,(void *)dl_ccch_msg); // } - + if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) { LOG_E(RRC,"[UE %d] Frame %d : Failed to decode DL-CCCH-Message (%zu bytes)\n",ctxt_pP->module_id,ctxt_pP->frame,dec_rval.consumed); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_OUT); return -1; } - + if (dl_ccch_msg->message.present == NR_DL_CCCH_MessageType_PR_c1) { if (NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].State == NR_RRC_SI_RECEIVED) { switch (dl_ccch_msg->message.choice.c1->present) { @@ -1425,7 +1425,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB ctxt_pP->frame); rval = 0; break; - + case NR_DL_CCCH_MessageType__c1_PR_rrcReject: LOG_I(NR_RRC, "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n", @@ -1433,7 +1433,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB ctxt_pP->frame); rval = 0; break; - + case NR_DL_CCCH_MessageType__c1_PR_rrcSetup: LOG_I(NR_RRC, "[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received NR_RRCSetup RNTI %x\n", @@ -1443,7 +1443,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB // Get configuration // Release T300 timer NR_UE_rrc_inst[ctxt_pP->module_id].Info[gNB_index].T300_active = 0; - + nr_rrc_ue_process_masterCellGroup( ctxt_pP, gNB_index, @@ -1462,7 +1462,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB NR_UE_rrc_inst[ctxt_pP->module_id].selected_plmn_identity); rval = 0; break; - + default: LOG_E(NR_RRC, "[UE%d] Frame %d : Unknown message\n", ctxt_pP->module_id, @@ -1472,7 +1472,7 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB } } } - + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_OUT); return rval; } @@ -1522,13 +1522,13 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message( const uint8_t *bufferP, const uint32_t buffer_len ){ // uper_decode by nr R15 rrc_connection_reconfiguration - + int32_t i; NR_DL_DCCH_Message_t *nr_dl_dcch_msg = NULL; MessageDef *msg_p; asn_dec_rval_t dec_rval = uper_decode( NULL, - &asn_DEF_NR_DL_DCCH_Message, + &asn_DEF_NR_DL_DCCH_Message, (void**)&nr_dl_dcch_msg, (uint8_t *)bufferP, buffer_len, 0, 0); @@ -1543,7 +1543,7 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message( } if(nr_dl_dcch_msg != NULL){ - switch(nr_dl_dcch_msg->message.present){ + switch(nr_dl_dcch_msg->message.present){ case NR_DL_DCCH_MessageType_PR_c1: switch(nr_dl_dcch_msg->message.choice.c1->present){ case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration: @@ -1563,7 +1563,7 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message( } itti_send_msg_to_task(TASK_RRC_NRUE,module_id,msg_p); break; - + case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment: case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand: case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: @@ -1588,7 +1588,7 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message( // not supported or unused break; } - + // release memory allocation SEQUENCE_free( &asn_DEF_NR_DL_DCCH_Message, (void *)nr_dl_dcch_msg, 1 ); }else{ @@ -2546,7 +2546,7 @@ nr_rrc_ue_process_ueCapabilityEnquiry( NR_UE_rrc_inst[ctxt_pP->module_id].UECap = UECap; NR_UE_rrc_inst[ctxt_pP->module_id].UECapability = UECap->sdu; - NR_UE_rrc_inst[ctxt_pP->module_id].UECapability_size = UECap->sdu_size; + NR_UE_rrc_inst[ctxt_pP->module_id].UECapability_size = UECap->sdu_size; OCTET_STRING_fromBuf(&ue_CapabilityRAT_Container.ue_CapabilityRAT_Container, (const char *)NR_UE_rrc_inst[ctxt_pP->module_id].UECapability, NR_UE_rrc_inst[ctxt_pP->module_id].UECapability_size); diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index 8f61ebe0c3..c164434d85 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -129,7 +129,7 @@ typedef struct NR_UE_RRC_INST_s { uint8_t kgnb[32]; NR_CipheringAlgorithm_t cipheringAlgorithm; e_NR_IntegrityProtAlgorithm integrityProtAlgorithm; - + // lists // CellGroupConfig.rlc-BearerToAddModList RRC_LIST_TYPE(NR_RLC_BearerConfig_t, NR_maxLC_ID) RLC_Bearer_Config_list; From ce405789d366a315c09a5e426c8fd26758dbb293 Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Wed, 4 Dec 2019 09:57:52 +0900 Subject: [PATCH 034/160] Fix: interference power measurement on DRS. --- .../PHY/LTE_TRANSPORT/ulsch_demodulation.c | 20 ++++-- openair1/PHY/TOOLS/signal_energy.c | 63 +++++++++++++++++++ openair1/PHY/TOOLS/tools_defs.h | 3 + openair1/PHY/defs_eNB.h | 2 + openair1/SCHED/phy_procedures_lte_eNb.c | 2 +- 5 files changed, 85 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c index 1b23fc99bf..62fabc87af 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c @@ -1072,10 +1072,22 @@ void rx_ulsch(PHY_VARS_eNB *eNB, } for (i=0; inb_antennas_rx; i++) { - pusch_vars->ulsch_power[i] = signal_energy_nodc(pusch_vars->drs_ch_estimates[i], - ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)/correction_factor; - LOG_D(PHY,"%4.4d.%d power harq_pid %d rb %2.2d TBS %2.2d (MPR_times_Ks %d correction %d) power %d dBtimes10\n", proc->frame_rx, proc->subframe_rx, harq_pid, - ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, ulsch[UE_id]->harq_processes[harq_pid]->TBS,MPR_times_100Ks,correction_factor,dB_fixed_times10(pusch_vars->ulsch_power[i])); + + + pusch_vars->ulsch_interference_power[i] = interference_power(pusch_vars->drs_ch_estimates[i],ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)/correction_factor; + pusch_vars->ulsch_power[i] = signal_power(pusch_vars->drs_ch_estimates[i],ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)/correction_factor; + + if(pusch_vars->ulsch_power[i]>0x20000000){ + pusch_vars->ulsch_power[i] = 0x20000000; + pusch_vars->ulsch_interference_power[i] = 1; + }else{ + pusch_vars->ulsch_power[i] -= pusch_vars->ulsch_interference_power[i]; + if(pusch_vars->ulsch_power[i]<1) pusch_vars->ulsch_power[i] = 1; + if(pusch_vars->ulsch_interference_power[i]<1)pusch_vars->ulsch_interference_power[i] = 1; + } + + LOG_D(PHY,"%4.4d.%d power harq_pid %d rb %2.2d TBS %2.2d (MPR_times_Ks %d correction %d) power %d dBtimes10\n", proc->frame_rx, proc->subframe_rx, harq_pid, ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, ulsch[UE_id]->harq_processes[harq_pid]->TBS,MPR_times_100Ks,correction_factor,dB_fixed_times10(pusch_vars->ulsch_power[i])); + } ulsch_channel_level(pusch_vars->drs_ch_estimates, diff --git a/openair1/PHY/TOOLS/signal_energy.c b/openair1/PHY/TOOLS/signal_energy.c index 83bcb7b764..687d38bda7 100644 --- a/openair1/PHY/TOOLS/signal_energy.c +++ b/openair1/PHY/TOOLS/signal_energy.c @@ -364,3 +364,66 @@ main(int argc,char **argv) } #endif +#define SHRT_MIN -32768 +int32_t signal_power(int32_t *input, uint32_t length) +{ + + uint32_t i; + int32_t temp; + + __m128i in, in_clp, i16_min; + __m128 num0, num1; + __m128 recp1; + + //init + num0 = _mm_setzero_ps(); + i16_min = _mm_set1_epi16(SHRT_MIN); + recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length))); + //Acc + for (i = 0; i < (length >> 2); i++) { + in = _mm_loadu_si128((__m128i *)input); + in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min));//if in=SHRT_MIN in+1, else in + num0 = _mm_add_ps(num0, _mm_cvtepi32_ps(_mm_madd_epi16(in_clp, in_clp))); + input += 4; + } + //Ave + num1 = _mm_dp_ps(num0, recp1, 0xFF); + temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(num1)); + + return temp; +} + +int32_t interference_power(int32_t *input, uint32_t length) +{ + + uint32_t i; + int32_t temp; + + __m128i in, in_clp, i16_min; + __m128i num0, num1, num2, num3; + __m128 num4, num5, num6; + __m128 recp1; + + //init + i16_min = _mm_set1_epi16(SHRT_MIN); + num5 = _mm_setzero_ps(); + recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length>>2)));// 1/n, n= length/4 + //Acc + for (i = 0; i < (length >> 2); i++) { + in = _mm_loadu_si128((__m128i *)input); + in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min)); //if in=SHRT_MIN, in+1, else in + num0 = _mm_cvtepi16_epi32(in_clp); //lower 2 complex [0], [1] + num1 = _mm_cvtepi16_epi32(_mm_shuffle_epi32(in_clp, 0x4E)); //upper 2 complex [2], [3] + num2 = _mm_srai_epi32(_mm_add_epi32(num0, num1), 0x01); //average A=complex( [0] + [2] ) / 2, B=complex( [1] + [3] ) / 2 + num3 = _mm_sub_epi32(num2, _mm_shuffle_epi32(num2, 0x4E)); //complexA-complexB, B-A + num4 = _mm_dp_ps(_mm_cvtepi32_ps(num3), _mm_cvtepi32_ps(num3), 0x3F);//C = num3 lower complex power, C, C, C + num5 = _mm_add_ps(num5, num4); //Acc Cn, Cn, Cn, Cn, + input += 4; + } + //Interference ve + num6 = _mm_mul_ps(num5, recp1); //Cn / n + temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(num6)); + + return temp; +} + diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index 9c9b8aa821..9f0a089903 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -431,6 +431,9 @@ int32_t subcarrier_energy(int32_t *,uint32_t, int32_t* subcarrier_energy, uint16 */ int32_t signal_energy_nodc(int32_t *,uint32_t); +int32_t signal_power(int32_t *,uint32_t); +int32_t interference_power(int32_t *,uint32_t); + /*!\fn double signal_energy_fp(double *s_re[2], double *s_im[2],uint32_t, uint32_t,uint32_t); \brief Computes the signal energy per subcarrier */ diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h index 557b8bfc30..b3f7e1ef70 100644 --- a/openair1/PHY/defs_eNB.h +++ b/openair1/PHY/defs_eNB.h @@ -166,6 +166,8 @@ typedef struct { int32_t **ul_ch_magb; /// measured RX power based on DRS int ulsch_power[2]; + /// measured Interference power based on DRS + int ulsch_interference_power[2]; /// \brief llr values. /// - first index: ? [0..1179743] (hard coded) int16_t *llr; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 5f0ff6cff0..f2a246fbc3 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1605,7 +1605,7 @@ void fill_rx_indication(PHY_VARS_eNB *eNB, pdu->rx_indication_rel8.timing_advance = timing_advance_update; // estimate UL_CQI for MAC (from antenna port 0 only) - int SNRtimes10 = dB_fixed_times10(eNB->pusch_vars[UE_id]->ulsch_power[0]) - 10 * eNB->measurements.n0_subband_power_dB[0][0]; + int SNRtimes10 = dB_fixed_times10(eNB->pusch_vars[UE_id]->ulsch_power[0]) - dB_fixed_times10(eNB->pusch_vars[UE_id]->ulsch_interference_power[0]); if (SNRtimes10 < -640) pdu->rx_indication_rel8.ul_cqi = 0; From 2edcf2647c42680d0cd07cb735a50286476419be Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Thu, 12 Dec 2019 17:20:12 +0900 Subject: [PATCH 035/160] Fix: freq_offset_estimation overflow. (cherry picked from commit 5e7eb7c94857f5765bb7f18afc7f4c748acb048b) --- .../lte_ul_channel_estimation.c | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c index 755111feb8..1d1b16e036 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c @@ -786,33 +786,38 @@ int16_t lte_ul_freq_offset_estimation(LTE_DL_FRAME_PARMS *frame_parms, Ravg[0]=0; Ravg[1]=0; int16_t iv, rv, phase_idx = 0; - __m128i avg128U1, avg128U2, R[3], mmtmpD0, mmtmpD1, mmtmpD2, mmtmpD3; + __m128i R[3], mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3; + __m128 avg128U1, avg128U2; // round(tan((pi/4)*[1:1:N]/N)*pow2(15)) int16_t alpha[128] = {201, 402, 603, 804, 1006, 1207, 1408, 1610, 1811, 2013, 2215, 2417, 2619, 2822, 3024, 3227, 3431, 3634, 3838, 4042, 4246, 4450, 4655, 4861, 5066, 5272, 5479, 5686, 5893, 6101, 6309, 6518, 6727, 6937, 7147, 7358, 7570, 7782, 7995, 8208, 8422, 8637, 8852, 9068, 9285, 9503, 9721, 9940, 10160, 10381, 10603, 10825, 11049, 11273, 11498, 11725, 11952, 12180, 12410, 12640, 12872, 13104, 13338, 13573, 13809, 14046, 14285, 14525, 14766, 15009, 15253, 15498, 15745, 15993, 16243, 16494, 16747, 17001, 17257, 17515, 17774, 18035, 18298, 18563, 18829, 19098, 19368, 19640, 19915, 20191, 20470, 20750, 21033, 21318, 21605, 21895, 22187, 22481, 22778, 23078, 23380, 23685, 23992, 24302, 24615, 24931, 25250, 25572, 25897, 26226, 26557, 26892, 27230, 27572, 27917, 28266, 28618, 28975, 29335, 29699, 30067, 30440, 30817, 31198, 31583, 31973, 32368, 32767}; // compute log2_maxh (output_shift) - avg128U1 = _mm_setzero_si128(); - avg128U2 = _mm_setzero_si128(); + avg128U1 = _mm_setzero_ps(); + avg128U2 = _mm_setzero_ps(); for (rb=0; rb Date: Wed, 4 Dec 2019 10:25:46 +0900 Subject: [PATCH 036/160] Fix: TPC control with average SNR value. (cherry picked from commit 243c90f647a1f97dc3a1486502dc6263b5705e39) --- openair2/LAYER2/MAC/eNB_scheduler_primitives.c | 1 + openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 89c2ecc83d..a3046a9939 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -2216,6 +2216,7 @@ add_new_ue(module_id_t mod_idP, sizeof(eNB_UE_STATS)); UE_info->UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0; UE_info->UE_sched_ctrl[UE_id].ta_update = 31; + UE_info->UE_sched_ctrl[UE_id].pusch_snr[cc_idP] = 0; for (j = 0; j < 8; j++) { UE_info->UE_template[cc_idP][UE_id].oldNDI[j] = 0; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 997fc6691e..049267ed14 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -166,7 +166,14 @@ rx_sdu(const module_id_t enb_mod_idP, * maybe it's even not correct at all? */ UE_scheduling_control->ta_update = (UE_scheduling_control->ta_update * 3 + timing_advance) / 4; - UE_scheduling_control->pusch_snr[CC_idP] = ul_cqi; + + if(UE_scheduling_control->pusch_snr[CC_idP] == 0) { + UE_scheduling_control->pusch_snr[CC_idP] = ul_cqi; + } + else { + UE_scheduling_control->pusch_snr[CC_idP] = (UE_scheduling_control->pusch_snr[CC_idP] * 3 + ul_cqi) / 4; + } + UE_scheduling_control->ul_consecutive_errors = 0; first_rb = UE_template_ptr->first_rb_ul[harq_pid]; From 04d6de7d58926e458fe835b40b9521bcf15566cd Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Thu, 5 Dec 2019 13:01:56 +0900 Subject: [PATCH 037/160] add variables TPC command interval and forgetting filter of UL SNR. --- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 10 ++++++---- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index f6220fa46d..1e82da6d6f 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -2003,9 +2003,10 @@ schedule_ue_spec_fairRR(module_id_t module_idP, // this assumes accumulated tpc // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out int32_t framex10psubframe = UE_info->UE_template[CC_id][UE_id].pucch_tpc_tx_frame*10+UE_info->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe; + int pucch_tpc_interval=10; - if (((framex10psubframe+10)<=(frameP*10+subframeP)) || //normal case - ((framex10psubframe>(frameP*10+subframeP)) && (((10240-framex10psubframe+frameP*10+subframeP)>=10)))) //frame wrap-around + if (((framex10psubframe+pucch_tpc_interval)<=(frameP*10+subframeP)) || //normal case + ((framex10psubframe>(frameP*10+subframeP)) && (((10240-framex10psubframe+frameP*10+subframeP)>=pucch_tpc_interval)))) //frame wrap-around if (ue_sched_ctl->pucch1_cqi_update[CC_id] == 1) { ue_sched_ctl->pucch1_cqi_update[CC_id] = 0; UE_info->UE_template[CC_id][UE_id].pucch_tpc_tx_frame=frameP; @@ -3087,9 +3088,10 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, // this assumes accumulated tpc // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out int32_t framex10psubframe = UE_template->pusch_tpc_tx_frame*10+UE_template->pusch_tpc_tx_subframe; + int pusch_tpc_interval=10; - if (((framex10psubframe+10)<=(frameP*10+subframeP)) || //normal case - ((framex10psubframe>(frameP*10+subframeP)) && (((10240-framex10psubframe+frameP*10+subframeP)>=10)))) { //frame wrap-around + if (((framex10psubframe+pusch_tpc_interval)<=(frameP*10+subframeP)) || //normal case + ((framex10psubframe>(frameP*10+subframeP)) && (((10240-framex10psubframe+frameP*10+subframeP)>=pusch_tpc_interval)))) { //frame wrap-around UE_template->pusch_tpc_tx_frame=frameP; UE_template->pusch_tpc_tx_subframe=subframeP; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 049267ed14..9459cd121a 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -166,12 +166,12 @@ rx_sdu(const module_id_t enb_mod_idP, * maybe it's even not correct at all? */ UE_scheduling_control->ta_update = (UE_scheduling_control->ta_update * 3 + timing_advance) / 4; - + double tpc_forgetting_filter=0.75; if(UE_scheduling_control->pusch_snr[CC_idP] == 0) { UE_scheduling_control->pusch_snr[CC_idP] = ul_cqi; } else { - UE_scheduling_control->pusch_snr[CC_idP] = (UE_scheduling_control->pusch_snr[CC_idP] * 3 + ul_cqi) / 4; + UE_scheduling_control->pusch_snr[CC_idP] = (int)((double)UE_scheduling_control->pusch_snr[CC_idP] * tpc_foggot_filter + (double)ul_cqi * (1-tpc_foggot_filter)); } UE_scheduling_control->ul_consecutive_errors = 0; From 1b61e10af6a7de3c3d9105ad410b83d9aebdcb38 Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Fri, 13 Dec 2019 11:39:51 +0900 Subject: [PATCH 038/160] fix compilation. --- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 9459cd121a..9cfdc3622b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -171,7 +171,7 @@ rx_sdu(const module_id_t enb_mod_idP, UE_scheduling_control->pusch_snr[CC_idP] = ul_cqi; } else { - UE_scheduling_control->pusch_snr[CC_idP] = (int)((double)UE_scheduling_control->pusch_snr[CC_idP] * tpc_foggot_filter + (double)ul_cqi * (1-tpc_foggot_filter)); + UE_scheduling_control->pusch_snr[CC_idP] = (int)((double)UE_scheduling_control->pusch_snr[CC_idP] * tpc_forgetting_filter + (double)ul_cqi * (1-tpc_forgetting_filter)); } UE_scheduling_control->ul_consecutive_errors = 0; From 66f99a9020516e06a2802e1590b85986e1f339ce Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Mon, 16 Dec 2019 15:17:25 +0900 Subject: [PATCH 039/160] Fix: ULSCH AMC by instantaneous SINR value. --- openair2/LAYER2/MAC/defs.h | 1346 +++++++++++++++++ openair2/LAYER2/MAC/eNB_scheduler.c | 2 +- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 12 +- .../LAYER2/MAC/eNB_scheduler_primitives.c | 1 + openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 12 +- openair2/LAYER2/MAC/mac.h | 1 + 6 files changed, 1366 insertions(+), 8 deletions(-) create mode 100644 openair2/LAYER2/MAC/defs.h diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h new file mode 100644 index 0000000000..7c18d958ab --- /dev/null +++ b/openair2/LAYER2/MAC/defs.h @@ -0,0 +1,1346 @@ +/* + * 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 LAYER2/MAC/defs.h +* \brief MAC data structures, constant, and function prototype +* \author Navid Nikaein and Raymond Knopp +* \date 2011 +* \version 0.5 +* \email navid.nikaein@eurecom.fr + +*/ +/** @defgroup _oai2 openair2 Reference Implementation + * @ingroup _ref_implementation_ + * @{ + */ + +/*@}*/ + +#ifndef __LAYER2_MAC_DEFS_H__ +#define __LAYER2_MAC_DEFS_H__ + + + +#ifdef USER_MODE +#include +#include +#include +#endif + +//#include "COMMON/openair_defs.h" + + + +#include "PHY/defs.h" +#include "PHY/LTE_TRANSPORT/defs.h" +#include "COMMON/platform_constants.h" +#include "BCCH-BCH-Message.h" +#include "RadioResourceConfigCommon.h" +#include "RadioResourceConfigDedicated.h" +#include "MeasGapConfig.h" +#include "SchedulingInfoList.h" +#include "TDD-Config.h" +#include "RACH-ConfigCommon.h" +#include "MeasObjectToAddModList.h" +#include "MobilityControlInfo.h" +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +#include "MBSFN-AreaInfoList-r9.h" +#include "MBSFN-SubframeConfigList.h" +#include "PMCH-InfoList-r9.h" +#include "SCellToAddMod-r10.h" +#endif +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#include "SystemInformationBlockType1-v1310-IEs.h" +#endif + +#include "nfapi_interface.h" +#include "PHY_INTERFACE/IF_Module.h" + +/** @defgroup _mac MAC + * @ingroup _oai2 + * @{ + */ + +#define BCCH_PAYLOAD_SIZE_MAX 128 +#define CCCH_PAYLOAD_SIZE_MAX 128 +#define PCCH_PAYLOAD_SIZE_MAX 128 +#define RAR_PAYLOAD_SIZE_MAX 128 + +#define SCH_PAYLOAD_SIZE_MAX 4096 +/// Logical channel ids from 36-311 (Note BCCH is not specified in 36-311, uses the same as first DRB) + +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + +// Mask for identifying subframe for MBMS +#define MBSFN_TDD_SF3 0x80// for TDD +#define MBSFN_TDD_SF4 0x40 +#define MBSFN_TDD_SF7 0x20 +#define MBSFN_TDD_SF8 0x10 +#define MBSFN_TDD_SF9 0x08 +#define MBSFN_FDD_SF1 0x80// for FDD +#define MBSFN_FDD_SF2 0x40 +#define MBSFN_FDD_SF3 0x20 +#define MBSFN_FDD_SF6 0x10 +#define MBSFN_FDD_SF7 0x08 +#define MBSFN_FDD_SF8 0x04 + +#define MAX_MBSFN_AREA 8 +#define MAX_PMCH_perMBSFN 15 +/*!\brief MAX MCCH payload size */ +#define MCCH_PAYLOAD_SIZE_MAX 128 +//#define MCH_PAYLOAD_SIZE_MAX 16384// this value is using in case mcs and TBS index are high +#endif + +#ifdef USER_MODE +#define printk printf +#endif //USER_MODE + +/*!\brief Maximum number of logical channl group IDs */ +#define MAX_NUM_LCGID 4 +/*!\brief logical channl group ID 0 */ +#define LCGID0 0 +/*!\brief logical channl group ID 1 */ +#define LCGID1 1 +/*!\brief logical channl group ID 2 */ +#define LCGID2 2 +/*!\brief logical channl group ID 3 */ +#define LCGID3 3 +/*!\brief Maximum number of logical chanels */ +#define MAX_NUM_LCID 11 +/*!\brief Maximum number od control elemenets */ +#define MAX_NUM_CE 5 +/*!\brief Maximum number of random access process */ +#define NB_RA_PROC_MAX 4 +/*!\brief size of buffer status report table */ +#define BSR_TABLE_SIZE 64 +/*!\brief The power headroom reporting range is from -23 ...+40 dB and beyond, with step 1 */ +#define PHR_MAPPING_OFFSET 23 // if ( x>= -23 ) val = floor (x + 23) +/*!\brief maximum number of resource block groups */ +#define N_RBG_MAX 25 // for 20MHz channel BW +/*!\brief minimum value for channel quality indicator */ +#define MIN_CQI_VALUE 0 +/*!\brief maximum value for channel quality indicator */ +#define MAX_CQI_VALUE 15 +/*!\briefmaximum number of supported bandwidth (1.4, 5, 10, 20 MHz) */ +#define MAX_SUPPORTED_BW 4 +/*!\brief CQI values range from 1 to 15 (4 bits) */ +#define CQI_VALUE_RANGE 16 + +/*!\brief value for indicating BSR Timer is not running */ +#define MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF) + +#define LCID_EMPTY 0 +#define LCID_NOT_EMPTY 1 + +/*!\brief minimum RLC PDU size to be transmitted = min RLC Status PDU or RLC UM PDU SN 5 bits */ +#define MIN_RLC_PDU_SIZE (2) + +/*!\brief minimum MAC data needed for transmitting 1 min RLC PDU size + 1 byte MAC subHeader */ +#define MIN_MAC_HDR_RLC_SIZE (1 + MIN_RLC_PDU_SIZE) + +/*!\brief maximum number of slices / groups */ +#define MAX_NUM_SLICES 4 + +/* + * eNB part + */ + + +/* + * UE/ENB common part + */ +/*!\brief MAC header of Random Access Response for Random access preamble identifier (RAPID) */ +typedef struct { + uint8_t RAPID:6; + uint8_t T:1; + uint8_t E:1; +} __attribute__((__packed__))RA_HEADER_RAPID; + +/*!\brief MAC header of Random Access Response for backoff indicator (BI)*/ +typedef struct { + uint8_t BI:4; + uint8_t R:2; + uint8_t T:1; + uint8_t E:1; +} __attribute__((__packed__))RA_HEADER_BI; +/* +typedef struct { + uint64_t padding:16; + uint64_t t_crnti:16; + uint64_t hopping_flag:1; + uint64_t rb_alloc:10; + uint64_t mcs:4; + uint64_t TPC:3; + uint64_t UL_delay:1; + uint64_t cqi_req:1; + uint64_t Timing_Advance_Command:11; // first/2nd octet LSB + uint64_t R:1; // octet MSB + } __attribute__((__packed__))RAR_PDU; + +typedef struct { + uint64_t padding:16; + uint64_t R:1; // octet MSB + uint64_t Timing_Advance_Command:11; // first/2nd octet LSB + uint64_t cqi_req:1; + uint64_t UL_delay:1; + uint64_t TPC:3; + uint64_t mcs:4; + uint64_t rb_alloc:10; + uint64_t hopping_flag:1; + uint64_t t_crnti:16; + } __attribute__((__packed__))RAR_PDU; + +#define sizeof_RAR_PDU 6 +*/ +/*!\brief MAC subheader short with 7bit Length field */ +typedef struct { + uint8_t LCID:5; // octet 1 LSB + uint8_t E:1; + uint8_t R:2; // octet 1 MSB + uint8_t L:7; // octet 2 LSB + uint8_t F:1; // octet 2 MSB +} __attribute__((__packed__))SCH_SUBHEADER_SHORT; +/*!\brief MAC subheader long with 15bit Length field */ +typedef struct { + uint8_t LCID:5; // octet 1 LSB + uint8_t E:1; + uint8_t R:2; // octet 1 MSB + uint8_t L_MSB:7; + uint8_t F:1; // octet 2 MSB + uint8_t L_LSB:8; + uint8_t padding; +} __attribute__((__packed__))SCH_SUBHEADER_LONG; +/*!\brief MAC subheader short without length field */ +typedef struct { + uint8_t LCID:5; + uint8_t E:1; + uint8_t R:2; +} __attribute__((__packed__))SCH_SUBHEADER_FIXED; + +/*!\brief mac control element: short buffer status report for a specific logical channel group ID*/ +typedef struct { + uint8_t Buffer_size:6; // octet 1 LSB + uint8_t LCGID:2; // octet 1 MSB +} __attribute__((__packed__))BSR_SHORT; + +typedef BSR_SHORT BSR_TRUNCATED; +/*!\brief mac control element: long buffer status report for all logical channel group ID*/ +typedef struct { + uint8_t Buffer_size3:6; + uint8_t Buffer_size2:6; + uint8_t Buffer_size1:6; + uint8_t Buffer_size0:6; +} __attribute__((__packed__))BSR_LONG; + +#define BSR_LONG_SIZE (sizeof(BSR_LONG)) +/*!\brief mac control element: timing advance */ +typedef struct { + uint8_t TA:6; + uint8_t R:2; +} __attribute__((__packed__))TIMING_ADVANCE_CMD; +/*!\brief mac control element: power headroom report */ +typedef struct { + uint8_t PH:6; + uint8_t R:2; +} __attribute__((__packed__))POWER_HEADROOM_CMD; + +/*! \brief MIB payload */ +typedef struct { + uint8_t payload[3] ; +} __attribute__((__packed__))MIB_PDU; +/*! \brief CCCH payload */ +typedef struct { + uint8_t payload[CCCH_PAYLOAD_SIZE_MAX] ; +} __attribute__((__packed__))CCCH_PDU; +/*! \brief BCCH payload */ +typedef struct { + uint8_t payload[BCCH_PAYLOAD_SIZE_MAX] ; +} __attribute__((__packed__))BCCH_PDU; +/*! \brief RAR payload */ +typedef struct { + uint8_t payload[RAR_PAYLOAD_SIZE_MAX]; +} __attribute__ ((__packed__)) RAR_PDU; +/*! \brief BCCH payload */ +typedef struct { + uint8_t payload[PCCH_PAYLOAD_SIZE_MAX] ; +} __attribute__((__packed__))PCCH_PDU; + +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +/*! \brief MCCH payload */ +typedef struct { + uint8_t payload[MCCH_PAYLOAD_SIZE_MAX] ; +} __attribute__((__packed__))MCCH_PDU; +/*!< \brief MAC control element for activation and deactivation of component carriers */ +typedef struct { + uint8_t C7:1;/*!< \brief Component carrier 7 */ + uint8_t C6:1;/*!< \brief Component carrier 6 */ + uint8_t C5:1;/*!< \brief Component carrier 5 */ + uint8_t C4:1;/*!< \brief Component carrier 4 */ + uint8_t C3:1;/*!< \brief Component carrier 3 */ + uint8_t C2:1;/*!< \brief Component carrier 2 */ + uint8_t C1:1;/*!< \brief Component carrier 1 */ + uint8_t R:1;/*!< \brief Reserved */ +} __attribute__((__packed__))CC_ELEMENT; +/*! \brief MAC control element: MCH Scheduling Information */ +typedef struct { + uint8_t stop_sf_MSB:3; // octet 1 LSB + uint8_t lcid:5; // octet 2 MSB + uint8_t stop_sf_LSB:8; +} __attribute__((__packed__))MSI_ELEMENT; +#endif +/*! \brief Values of CCCH LCID for DLSCH */ +#define CCCH_LCHANID 0 +/*!\brief Values of BCCH logical channel (fake)*/ +#define BCCH 3 // SI +/*!\brief Values of PCCH logical channel (fake)*/ +#define PCCH 4 // Paging +/*!\brief Values of PCCH logical channel (fake) */ +#define MIBCH 5 // MIB +/*!\brief Values of BCCH SIB1_BR logical channel (fake) */ +#define BCCH_SIB1_BR 6 // SIB1_BR +/*!\brief Values of BCCH SIB_BR logical channel (fake) */ +#define BCCH_SI_BR 7 // SI-BR +/*!\brief Value of CCCH / SRB0 logical channel */ +#define CCCH 0 // srb0 +/*!\brief DCCH / SRB1 logical channel */ +#define DCCH 1 // srb1 +/*!\brief DCCH1 / SRB2 logical channel */ +#define DCCH1 2 // srb2 +/*!\brief DTCH DRB1 logical channel */ +#define DTCH 3 // LCID +/*!\brief MCCH logical channel */ +#define MCCH 4 +/*!\brief MTCH logical channel */ +#define MTCH 1 +// DLSCH LCHAN ID +/*!\brief LCID of UE contention resolution identity for DLSCH*/ +#define UE_CONT_RES 28 +/*!\brief LCID of timing advance for DLSCH */ +#define TIMING_ADV_CMD 29 +/*!\brief LCID of discontinous reception mode for DLSCH */ +#define DRX_CMD 30 +/*!\brief LCID of padding LCID for DLSCH */ +#define SHORT_PADDING 31 + +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) +// MCH LCHAN IDs (table6.2.1-4 TS36.321) +/*!\brief LCID of MCCH for DL */ +#define MCCH_LCHANID 0 +/*!\brief LCID of MCH scheduling info for DL */ +#define MCH_SCHDL_INFO 3 +/*!\brief LCID of Carrier component activation/deactivation */ +#define CC_ACT_DEACT 27 +#endif + +// ULSCH LCHAN IDs +/*!\brief LCID of extended power headroom for ULSCH */ +#define EXTENDED_POWER_HEADROOM 25 +/*!\brief LCID of power headroom for ULSCH */ +#define POWER_HEADROOM 26 +/*!\brief LCID of CRNTI for ULSCH */ +#define CRNTI 27 +/*!\brief LCID of truncated BSR for ULSCH */ +#define TRUNCATED_BSR 28 +/*!\brief LCID of short BSR for ULSCH */ +#define SHORT_BSR 29 +/*!\brief LCID of long BSR for ULSCH */ +#define LONG_BSR 30 +/*!\bitmaps for BSR Triggers */ +#define BSR_TRIGGER_NONE (0) /* No BSR Trigger */ +#define BSR_TRIGGER_REGULAR (1) /* For Regular and ReTxBSR Expiry Triggers */ +#define BSR_TRIGGER_PERIODIC (2) /* For BSR Periodic Timer Expiry Trigger */ +#define BSR_TRIGGER_PADDING (4) /* For Padding BSR Trigger */ + + +/*! \brief Downlink SCH PDU Structure */ +typedef struct { + uint8_t payload[8][SCH_PAYLOAD_SIZE_MAX]; + uint16_t Pdu_size[8]; +} __attribute__ ((__packed__)) DLSCH_PDU; + + +/*! \brief MCH PDU Structure */ +typedef struct { + int8_t payload[SCH_PAYLOAD_SIZE_MAX]; + uint16_t Pdu_size; + uint8_t mcs; + uint8_t sync_area; + uint8_t msi_active; + uint8_t mcch_active; + uint8_t mtch_active; +} __attribute__ ((__packed__)) MCH_PDU; + +/*! \brief Uplink SCH PDU Structure */ +typedef struct { + int8_t payload[SCH_PAYLOAD_SIZE_MAX]; /*!< \brief SACH payload */ + uint16_t Pdu_size; +} __attribute__ ((__packed__)) ULSCH_PDU; + +#include "PHY/impl_defs_top.h" + +/*!\brief UE ULSCH scheduling states*/ +typedef enum { + S_UL_NONE =0, + S_UL_WAITING, + S_UL_SCHEDULED, + S_UL_BUFFERED, + S_UL_NUM_STATUS +} UE_ULSCH_STATUS; + +/*!\brief UE DLSCH scheduling states*/ +typedef enum { + S_DL_NONE =0, + S_DL_WAITING, + S_DL_SCHEDULED, + S_DL_BUFFERED, + S_DL_NUM_STATUS +} UE_DLSCH_STATUS; + +/*!\brief scheduling policy for the contention-based access */ +typedef enum { + CBA_ES=0, /// equal share of RB among groups w + CBA_ES_S, /// equal share of RB among groups with small allocation + CBA_PF, /// proportional fair (kind of) + CBA_PF_S, /// proportional fair (kind of) with small RB allocation + CBA_RS /// random allocation +} CBA_POLICY; + + +/*! \brief temporary struct for ULSCH sched */ +typedef struct { + rnti_t rnti; + uint16_t subframe; + uint16_t serving_num; + UE_ULSCH_STATUS status; +} eNB_ULSCH_INFO; +/*! \brief temp struct for DLSCH sched */ +typedef struct { + rnti_t rnti; + uint16_t weight; + uint16_t subframe; + uint16_t serving_num; + UE_DLSCH_STATUS status; +} eNB_DLSCH_INFO; +/*! \brief eNB overall statistics */ +typedef struct { + /// num BCCH PDU per CC + uint32_t total_num_bcch_pdu; + /// BCCH buffer size + uint32_t bcch_buffer; + /// total BCCH buffer size + uint32_t total_bcch_buffer; + /// BCCH MCS + uint32_t bcch_mcs; + + /// num CCCH PDU per CC + uint32_t total_num_ccch_pdu; + /// BCCH buffer size + uint32_t ccch_buffer; + /// total BCCH buffer size + uint32_t total_ccch_buffer; + /// BCCH MCS + uint32_t ccch_mcs; + +/// num active users + uint16_t num_dlactive_UEs; + /// available number of PRBs for a give SF + uint16_t available_prbs; + /// total number of PRB available for the user plane + uint32_t total_available_prbs; + /// aggregation + /// total avilable nccc : num control channel element + uint16_t available_ncces; + // only for a new transmission, should be extended for retransmission + // current dlsch bit rate for all transport channels + uint32_t dlsch_bitrate; + // + uint32_t dlsch_bytes_tx; + // + uint32_t dlsch_pdus_tx; + // + uint32_t total_dlsch_bitrate; + // + uint32_t total_dlsch_bytes_tx; + // + uint32_t total_dlsch_pdus_tx; + + // here for RX + // + uint32_t ulsch_bitrate; + // + uint32_t ulsch_bytes_rx; + // + uint64_t ulsch_pdus_rx; + + uint32_t total_ulsch_bitrate; + // + uint32_t total_ulsch_bytes_rx; + // + uint32_t total_ulsch_pdus_rx; + + + /// MAC agent-related stats + /// total number of scheduling decisions + int sched_decisions; + /// missed deadlines + int missed_deadlines; + +} eNB_STATS; +/*! \brief eNB statistics for the connected UEs*/ +typedef struct { + + /// CRNTI of UE + rnti_t crnti; ///user id (rnti) of connected UEs + // rrc status + uint8_t rrc_status; + /// harq pid + uint8_t harq_pid; + /// harq rounf + uint8_t harq_round; + /// total available number of PRBs for a new transmission + uint16_t rbs_used; + /// total available number of PRBs for a retransmission + uint16_t rbs_used_retx; + /// total nccc used for a new transmission: num control channel element + uint16_t ncce_used; + /// total avilable nccc for a retransmission: num control channel element + uint16_t ncce_used_retx; + + // mcs1 before the rate adaptaion + uint8_t dlsch_mcs1; + /// Target mcs2 after rate-adaptation + uint8_t dlsch_mcs2; + // current TBS with mcs2 + uint32_t TBS; + // total TBS with mcs2 + // uint32_t total_TBS; + // total rb used for a new transmission + uint32_t total_rbs_used; + // total rb used for retransmission + uint32_t total_rbs_used_retx; + + /// TX + /// Num pkt + uint32_t num_pdu_tx[NB_RB_MAX]; + /// num bytes + uint32_t num_bytes_tx[NB_RB_MAX]; + /// num retransmission / harq + uint32_t num_retransmission; + /// instantaneous tx throughput for each TTI + // uint32_t tti_throughput[NB_RB_MAX]; + + /// overall + // + uint32_t dlsch_bitrate; + //total + uint32_t total_dlsch_bitrate; + /// headers+ CE + padding bytes for a MAC PDU + uint64_t overhead_bytes; + /// headers+ CE + padding bytes for a MAC PDU + uint64_t total_overhead_bytes; + /// headers+ CE + padding bytes for a MAC PDU + uint64_t avg_overhead_bytes; + // MAC multiplexed payload + uint64_t total_sdu_bytes; + // total MAC pdu bytes + uint64_t total_pdu_bytes; + + // total num pdu + uint32_t total_num_pdus; + // + // uint32_t avg_pdu_size; + + /// RX + + /// PUCCH1a/b power (dBm) + int32_t Po_PUCCH_dBm; + /// Indicator that Po_PUCCH has been updated by PHY + int32_t Po_PUCCH_update; + /// Uplink measured RSSI + int32_t UL_rssi; + /// preassigned mcs after rate adaptation + uint8_t ulsch_mcs1; + /// adjusted mcs + uint8_t ulsch_mcs2; + + /// estimated average pdu inter-departure time + uint32_t avg_pdu_idt; + /// estimated average pdu size + uint32_t avg_pdu_ps; + /// + uint32_t aggregated_pdu_size; + uint32_t aggregated_pdu_arrival; + + /// uplink transport block size + uint32_t ulsch_TBS; + + /// total rb used for a new uplink transmission + uint32_t num_retransmission_rx; + /// total rb used for a new uplink transmission + uint32_t rbs_used_rx; + /// total rb used for a new uplink retransmission + uint32_t rbs_used_retx_rx; + /// total rb used for a new uplink transmission + uint32_t total_rbs_used_rx; + /// snr + int32_t snr; + /// target snr + int32_t target_snr; + + /// num rx pdu + uint32_t num_pdu_rx[NB_RB_MAX]; + /// num bytes rx + uint32_t num_bytes_rx[NB_RB_MAX]; + /// instantaneous rx throughput for each TTI + // uint32_t tti_goodput[NB_RB_MAX]; + /// errors + uint32_t num_errors_rx; + + uint64_t overhead_bytes_rx; + /// headers+ CE + padding bytes for a MAC PDU + uint64_t total_overhead_bytes_rx; + /// headers+ CE + padding bytes for a MAC PDU + uint64_t avg_overhead_bytes_rx; + // + uint32_t ulsch_bitrate; + //total + uint32_t total_ulsch_bitrate; + /// overall + /// MAC pdu bytes + uint64_t pdu_bytes_rx; + /// total MAC pdu bytes + uint64_t total_pdu_bytes_rx; + /// total num pdu + uint32_t total_num_pdus_rx; + /// num of error pdus + uint32_t total_num_errors_rx; + +} eNB_UE_STATS; +/*! \brief eNB template for UE context information */ +typedef struct { + /// C-RNTI of UE + rnti_t rnti; + /// NDI from last scheduling + uint8_t oldNDI[8]; + /// mcs1 from last scheduling + uint8_t oldmcs1[8]; + /// mcs2 from last scheduling + uint8_t oldmcs2[8]; + /// NDI from last UL scheduling + uint8_t oldNDI_UL[8]; + /// mcs from last UL scheduling + uint8_t mcs_UL[8]; + /// TBS from last UL scheduling + uint8_t TBS_UL[8]; + /// CQI_req from last scheduling + uint8_t oldCQI_UL[8]; + /// TPC from last scheduling + uint8_t oldTPC_UL[8]; + /// Flag to indicate UL has been scheduled at least once + boolean_t ul_active; + /// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received) + boolean_t configured; + + /// MCS from last scheduling + uint8_t mcs[8]; + + /// TPC from last scheduling + uint8_t oldTPC[8]; + + // PHY interface info + + /// Number of Allocated RBs for DL after scheduling (prior to frequency allocation) + uint16_t nb_rb[8]; // num_max_harq + + /// Number of Allocated RBs for UL after scheduling + uint16_t nb_rb_ul[8]; // num_max_harq + + /// Number of Allocated RBs for UL after scheduling + uint16_t first_rb_ul[8]; // num_max_harq + + /// Is CQI requested for UL after scheduling 1st transmission + uint8_t cqi_req[8]; // num_max_harq + + /// Cyclic shift for DMRS after scheduling + uint16_t cshift[8]; // num_max_harq + + /// Number of Allocated RBs by the ulsch preprocessor + uint8_t pre_allocated_nb_rb_ul; + + /// index of Allocated RBs by the ulsch preprocessor + int8_t pre_allocated_rb_table_index_ul; + + /// total allocated RBs + int8_t total_allocated_rbs; + + /// pre-assigned MCS by the ulsch preprocessor + uint8_t pre_assigned_mcs_ul; + + /// assigned MCS by the ulsch scheduler + uint8_t assigned_mcs_ul; + + /// DL DAI + uint8_t DAI; + + /// UL DAI + uint8_t DAI_ul[10]; + + /// UL Scheduling Request Received + uint8_t ul_SR; + + ///Resource Block indication for each sub-band in MU-MIMO + uint8_t rballoc_subband[8][50]; + + // Logical channel info for link with RLC + + /// Last received UE BSR info for each logical channel group id + uint8_t bsr_info[MAX_NUM_LCGID]; + + /// LCGID mapping + long lcgidmap[11]; + + /// phr information + int8_t phr_info; + + /// phr information + int8_t phr_info_configured; + + ///dl buffer info + uint32_t dl_buffer_info[MAX_NUM_LCID]; + /// total downlink buffer info + uint32_t dl_buffer_total; + /// total downlink pdus + uint32_t dl_pdus_total; + /// downlink pdus for each LCID + uint32_t dl_pdus_in_buffer[MAX_NUM_LCID]; + /// creation time of the downlink buffer head for each LCID + uint32_t dl_buffer_head_sdu_creation_time[MAX_NUM_LCID]; + /// maximum creation time of the downlink buffer head across all LCID + uint32_t dl_buffer_head_sdu_creation_time_max; + /// a flag indicating that the downlink head SDU is segmented + uint8_t dl_buffer_head_sdu_is_segmented[MAX_NUM_LCID]; + /// size of remaining size to send for the downlink head SDU + uint32_t dl_buffer_head_sdu_remaining_size_to_send[MAX_NUM_LCID]; + + /// total uplink buffer size + uint32_t ul_total_buffer; + /// uplink buffer creation time for each LCID + uint32_t ul_buffer_creation_time[MAX_NUM_LCGID]; + /// maximum uplink buffer creation time across all the LCIDs + uint32_t ul_buffer_creation_time_max; + /// uplink buffer size per LCID + uint32_t ul_buffer_info[MAX_NUM_LCGID]; + + /// UE tx power + int32_t ue_tx_power; + + /// stores the frame where the last TPC was transmitted + uint32_t pusch_tpc_tx_frame; + uint32_t pusch_tpc_tx_subframe; + uint32_t pucch_tpc_tx_frame; + uint32_t pucch_tpc_tx_subframe; + +#ifdef LOCALIZATION + eNB_UE_estimated_distances distance; +#endif + +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + uint8_t rach_resource_type; + + uint16_t mpdcch_repetition_cnt; + struct PhysicalConfigDedicated *physicalConfigDedicated; + frame_t Msg2_frame; + sub_frame_t Msg2_subframe; +#endif +} UE_TEMPLATE; + +/*! \brief scheduling control information set through an API (not used)*/ +typedef struct { + ///UL transmission bandwidth in RBs + uint8_t ul_bandwidth[MAX_NUM_LCID]; + ///DL transmission bandwidth in RBs + uint8_t dl_bandwidth[MAX_NUM_LCID]; + + //To do GBR bearer + uint8_t min_ul_bandwidth[MAX_NUM_LCID]; + + uint8_t min_dl_bandwidth[MAX_NUM_LCID]; + + ///aggregated bit rate of non-gbr bearer per UE + uint64_t ue_AggregatedMaximumBitrateDL; + ///aggregated bit rate of non-gbr bearer per UE + uint64_t ue_AggregatedMaximumBitrateUL; + ///CQI scheduling interval in subframes. + uint16_t cqiSchedInterval; + ///Contention resolution timer used during random access + uint8_t mac_ContentionResolutionTimer; + + uint16_t max_allowed_rbs[MAX_NUM_LCID]; + + uint8_t max_mcs[MAX_NUM_LCID]; + + uint16_t priority[MAX_NUM_LCID]; + + // resource scheduling information + + /// Current DL harq round per harq_pid on each CC + uint8_t round[MAX_NUM_CCs][10]; + /// Current Active TBs per harq_pid on each CC + uint8_t tbcnt[MAX_NUM_CCs][10]; + /// Current UL harq round per harq_pid on each CC + uint8_t round_UL[MAX_NUM_CCs][8]; + uint8_t dl_pow_off[MAX_NUM_CCs]; + uint16_t pre_nb_available_rbs[MAX_NUM_CCs]; + unsigned char rballoc_sub_UE[MAX_NUM_CCs][N_RBG_MAX]; + uint16_t ta_timer; + int16_t ta_update; + uint16_t ul_consecutive_errors; + int32_t context_active_timer; + int32_t cqi_req_timer; + int32_t ul_inactivity_timer; + int32_t ul_failure_timer; + int32_t ul_scheduled; + int32_t ra_pdcch_order_sent; + int32_t ul_out_of_sync; + int32_t phr_received; + uint8_t periodic_ri_received[NFAPI_CC_MAX]; + uint8_t aperiodic_ri_received[NFAPI_CC_MAX]; + uint32_t pucch_tpc_accumulated[NFAPI_CC_MAX]; + uint8_t pucch1_cqi_update[NFAPI_CC_MAX]; + uint8_t pucch1_snr[NFAPI_CC_MAX]; + uint8_t pucch2_cqi_update[NFAPI_CC_MAX]; + uint8_t pucch2_snr[NFAPI_CC_MAX]; + uint8_t pucch3_cqi_update[NFAPI_CC_MAX]; + uint8_t pucch3_snr[NFAPI_CC_MAX]; + uint8_t pusch_snr[NFAPI_CC_MAX]; + uint8_t pusch_snr_avg[NFAPI_CC_MAX]; + uint16_t feedback_cnt[NFAPI_CC_MAX]; + uint16_t timing_advance; + uint16_t timing_advance_r9; + uint8_t periodic_wideband_cqi[NFAPI_CC_MAX]; + uint8_t periodic_wideband_spatial_diffcqi[NFAPI_CC_MAX]; + uint8_t periodic_wideband_pmi[NFAPI_CC_MAX]; + uint8_t periodic_subband_cqi[NFAPI_CC_MAX][16]; + uint8_t periodic_subband_spatial_diffcqi[NFAPI_CC_MAX][16]; + uint8_t aperiodic_subband_cqi0[NFAPI_CC_MAX][25]; + uint8_t aperiodic_subband_pmi[NFAPI_CC_MAX][25]; + uint8_t aperiodic_subband_diffcqi0[NFAPI_CC_MAX][25]; + uint8_t aperiodic_subband_cqi1[NFAPI_CC_MAX][25]; + uint8_t aperiodic_subband_diffcqi1[NFAPI_CC_MAX][25]; + uint8_t aperiodic_wideband_cqi0[NFAPI_CC_MAX]; + uint8_t aperiodic_wideband_pmi[NFAPI_CC_MAX]; + uint8_t aperiodic_wideband_cqi1[NFAPI_CC_MAX]; + uint8_t aperiodic_wideband_pmi1[NFAPI_CC_MAX]; + uint8_t dl_cqi[NFAPI_CC_MAX]; +} UE_sched_ctrl; +/*! \brief eNB template for the Random access information */ +typedef struct { + /// Flag to indicate this process is active + boolean_t RA_active; + /// Size of DCI for RA-Response (bytes) + uint8_t RA_dci_size_bytes1; + /// Size of DCI for RA-Response (bits) + uint8_t RA_dci_size_bits1; + /// Actual DCI to transmit for RA-Response + uint8_t RA_alloc_pdu1[(MAX_DCI_SIZE_BITS>>3)+1]; + /// DCI format for RA-Response (should be 1A) + uint8_t RA_dci_fmt1; + /// Size of DCI for Msg4/ContRes (bytes) + uint8_t RA_dci_size_bytes2; + /// Size of DCI for Msg4/ContRes (bits) + uint8_t RA_dci_size_bits2; + /// Actual DCI to transmit for Msg4/ContRes + uint8_t RA_alloc_pdu2[(MAX_DCI_SIZE_BITS>>3)+1]; + /// DCI format for Msg4/ContRes (should be 1A) + uint8_t RA_dci_fmt2; + /// Flag to indicate the eNB should generate RAR. This is triggered by detection of PRACH + uint8_t generate_rar; + /// Subframe where preamble was received + uint8_t preamble_subframe; + /// Subframe where Msg2 is to be sent + uint8_t Msg2_subframe; + /// Frame where Msg2 is to be sent + frame_t Msg2_frame; + /// Subframe where Msg3 is to be sent + sub_frame_t Msg3_subframe; + /// Frame where Msg3 is to be sent + frame_t Msg3_frame; + /// Subframe where Msg4 is to be sent + sub_frame_t Msg4_subframe; + /// Frame where Msg4 is to be sent + frame_t Msg4_frame; + /// Flag to indicate the eNB should generate Msg4 upon reception of SDU from RRC. This is triggered by first ULSCH reception at eNB for new user. + uint8_t generate_Msg4; + /// Flag to indicate that eNB is waiting for ACK that UE has received Msg3. + uint8_t wait_ack_Msg4; + /// harq_pid used for Msg4 transmission + uint8_t harq_pid; + /// UE RNTI allocated during RAR + rnti_t rnti; + /// RA RNTI allocated from received PRACH + uint16_t RA_rnti; + /// Received preamble_index + uint8_t preamble_index; + /// Received UE Contention Resolution Identifier + uint8_t cont_res_id[6]; + /// Timing offset indicated by PHY + int16_t timing_offset; + /// Timeout for RRC connection + int16_t RRC_timer; + /// Msg3 first RB + uint8_t msg3_first_rb; + /// Msg3 number of RB + uint8_t msg3_nb_rb; + /// Msg3 MCS + uint8_t msg3_mcs; + /// Msg3 TPC command + uint8_t msg3_TPC; + /// Msg3 ULdelay command + uint8_t msg3_ULdelay; + /// Msg3 cqireq command + uint8_t msg3_cqireq; + /// Round of Msg3 HARQ + uint8_t msg3_round; + /// TBS used for Msg4 + int msg4_TBsize; + /// MCS used for Msg4 + int msg4_mcs; + /// size off piggybacked RRC SDU + uint8_t msg4_rrc_sdu_length; + uint32_t msg4_delay; + +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + uint8_t rach_resource_type; + uint8_t msg2_mpdcch_repetition_cnt; + uint8_t msg2_mpdcch_done; + uint8_t msg4_mpdcch_repetition_cnt; + uint8_t msg4_mpdcch_done; + uint8_t msg2_narrowband; + uint32_t msg34_narrowband; +#endif +} RA_TEMPLATE; + + +/*! \brief subband bitmap confguration (for ALU icic algo purpose), in test phase */ +typedef struct { + uint8_t sbmap[NUMBER_OF_SUBBANDS_MAX]; //13 = number of SB MAX for 100 PRB + uint8_t periodicity; + uint8_t first_subframe; + uint8_t sb_size; + uint8_t nb_active_sb; +} SBMAP_CONF; +/*! \brief UE list used by eNB to order UEs/CC for scheduling*/ +typedef struct { + /// Dedicated information for UEs + struct PhysicalConfigDedicated *physicalConfigDedicated[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + /// DLSCH pdu + DLSCH_PDU DLSCH_pdu[MAX_NUM_CCs][2][NUMBER_OF_UE_MAX]; + /// DCI template and MAC connection parameters for UEs + UE_TEMPLATE UE_template[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + /// DCI template and MAC connection for RA processes + int pCC_id[NUMBER_OF_UE_MAX]; + /// sorted downlink component carrier for the scheduler + int ordered_CCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + /// number of downlink active component carrier + int numactiveCCs[NUMBER_OF_UE_MAX]; + /// sorted uplink component carrier for the scheduler + int ordered_ULCCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + /// number of uplink active component carrier + int numactiveULCCs[NUMBER_OF_UE_MAX]; + /// number of downlink active component carrier + uint8_t dl_CC_bitmap[NUMBER_OF_UE_MAX]; + /// eNB to UE statistics + eNB_UE_STATS eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + /// scheduling control info + UE_sched_ctrl UE_sched_ctrl[NUMBER_OF_UE_MAX]; + int next[NUMBER_OF_UE_MAX]; + int head; + int next_ul[NUMBER_OF_UE_MAX]; + int head_ul; + int avail; + int num_UEs; + boolean_t active[NUMBER_OF_UE_MAX]; +} UE_list_t; + +/*! \brief eNB common channels */ +typedef struct { + int physCellId; + int p_eNB; + int Ncp; + int eutra_band; + uint32_t dl_CarrierFreq; + BCCH_BCH_Message_t *mib; + RadioResourceConfigCommonSIB_t *radioResourceConfigCommon; +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + RadioResourceConfigCommonSIB_t *radioResourceConfigCommon_BR; +#endif + TDD_Config_t *tdd_Config; + SchedulingInfoList_t *schedulingInfoList; + 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 RAR pdu for PHY + RAR_PDU RAR_pdu; + /// Template for RA computations + RA_TEMPLATE RA_template[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]; + /// MBSFN SubframeConfig + struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; + /// number of subframe allocation pattern available for MBSFN sync area + uint8_t num_sf_allocation_pattern; +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + /// MBMS Flag + uint8_t MBMS_flag; + /// Outgoing MCCH pdu for PHY + MCCH_PDU MCCH_pdu; + /// MCCH active flag + uint8_t msi_active; + /// MCCH active flag + uint8_t mcch_active; + /// MTCH active flag + uint8_t mtch_active; + /// number of active MBSFN area + uint8_t num_active_mbsfn_area; + /// MBSFN Area Info + struct MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA]; + /// PMCH Config + struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN]; + /// MBMS session info list + struct MBMS_SessionInfoList_r9 *mbms_SessionList[MAX_PMCH_perMBSFN]; + /// Outgoing MCH pdu for PHY + MCH_PDU MCH_pdu; +#endif +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + /// Rel13 parameters from SIB1 + SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext; + /// Counter for SIB1-BR scheduling + int SIB1_BR_cnt; + /// Outgoing BCCH-BR pdu for PHY + BCCH_PDU BCCH_BR_pdu[20]; +#endif +} COMMON_channels_t; +/*! \brief top level eNB MAC structure */ +typedef struct eNB_MAC_INST_s { + /// Ethernet parameters for northbound midhaul interface + eth_params_t eth_params_n; + /// Ethernet parameters for fronthaul interface + eth_params_t eth_params_s; + /// + module_id_t Mod_id; + /// frame counter + frame_t frame; + /// subframe counter + sub_frame_t subframe; + /// Pointer to IF module instance for PHY + IF_Module_t *if_inst; + /// Common cell resources + COMMON_channels_t common_channels[MAX_NUM_CCs]; + /// current PDU index (BCH,MCH,DLSCH) + uint16_t pdu_index[MAX_NUM_CCs]; + + /// NFAPI Config Request Structure + nfapi_config_request_t config[MAX_NUM_CCs]; + /// Preallocated DL pdu list + nfapi_dl_config_request_pdu_t dl_config_pdu_list[MAX_NUM_CCs][MAX_NUM_DL_PDU]; + /// NFAPI DL Config Request Structure + nfapi_dl_config_request_t DL_req[MAX_NUM_CCs]; + /// Preallocated UL pdu list + nfapi_ul_config_request_pdu_t ul_config_pdu_list[MAX_NUM_CCs][MAX_NUM_UL_PDU]; + /// Preallocated UL pdu list for ULSCH (n+k delay) + nfapi_ul_config_request_pdu_t ul_config_pdu_list_tmp[MAX_NUM_CCs][10][MAX_NUM_UL_PDU]; + /// NFAPI UL Config Request Structure, send to L1 4 subframes before processing takes place + nfapi_ul_config_request_t UL_req[MAX_NUM_CCs]; + /// NFAPI "Temporary" UL Config Request Structure, holds future UL_config requests + nfapi_ul_config_request_t UL_req_tmp[MAX_NUM_CCs][10]; + /// Preallocated HI_DCI0 pdu list + nfapi_hi_dci0_request_pdu_t hi_dci0_pdu_list[MAX_NUM_CCs][MAX_NUM_HI_DCI0_PDU]; + /// NFAPI HI/DCI0 Config Request Structure + nfapi_hi_dci0_request_t HI_DCI0_req[MAX_NUM_CCs]; + /// Prealocated TX pdu list + nfapi_tx_request_pdu_t tx_request_pdu[MAX_NUM_CCs][MAX_NUM_TX_REQUEST_PDU]; + /// NFAPI DL PDU structure + nfapi_tx_request_t TX_req[MAX_NUM_CCs]; + /// UL handle + uint32_t ul_handle; + UE_list_t UE_list; + + ///subband bitmap configuration + SBMAP_CONF sbmap_conf; + /// CCE table used to build DCI scheduling information + int CCE_table[MAX_NUM_CCs][800]; + /// active flag for Other lcid + uint8_t lcid_active[NB_RB_MAX]; + /// eNB stats + eNB_STATS eNB_stats[MAX_NUM_CCs]; + // MAC function execution peformance profiler + /// processing time of eNB scheduler + time_stats_t eNB_scheduler; + /// processing time of eNB scheduler for SI + time_stats_t schedule_si; + /// processing time of eNB scheduler for Random access + time_stats_t schedule_ra; + /// processing time of eNB ULSCH scheduler + time_stats_t schedule_ulsch; + /// processing time of eNB DCI generation + time_stats_t fill_DLSCH_dci; + /// processing time of eNB MAC preprocessor + time_stats_t schedule_dlsch_preprocessor; + /// processing time of eNB DLSCH scheduler + time_stats_t schedule_dlsch; // include rlc_data_req + MAC header + preprocessor + /// processing time of eNB MCH scheduler + time_stats_t schedule_mch; + /// processing time of eNB ULSCH reception + time_stats_t rx_ulsch_sdu; // include rlc_data_ind +} eNB_MAC_INST; + +/* + * UE part + */ + +typedef enum { + TYPE0, + TYPE1, + TYPE1A, + TYPE2, + TYPE2A, + TYPEUESPEC +} MPDCCH_TYPES_t; + +/*!\brief UE layer 2 status */ +typedef enum { + CONNECTION_OK=0, + CONNECTION_LOST, + PHY_RESYNCH, + PHY_HO_PRACH +} UE_L2_STATE_t; + +/*!\brief UE scheduling info */ +typedef struct { + /// buffer status for each lcgid + uint8_t BSR[MAX_NUM_LCGID]; // should be more for mesh topology + /// keep the number of bytes in rlc buffer for each lcgid + int32_t BSR_bytes[MAX_NUM_LCGID]; + /// after multiplexing buffer remain for each lcid + int32_t LCID_buffer_remain[MAX_NUM_LCID]; + /// sum of all lcid buffer size + uint16_t All_lcid_buffer_size_lastTTI; + /// buffer status for each lcid + uint8_t LCID_status[MAX_NUM_LCID]; + /// SR pending as defined in 36.321 + uint8_t SR_pending; + /// SR_COUNTER as defined in 36.321 + uint16_t SR_COUNTER; + /// logical channel group ide for each LCID + uint8_t LCGID[MAX_NUM_LCID]; + /// retxBSR-Timer, default value is sf2560 + uint16_t retxBSR_Timer; + /// retxBSR_SF, number of subframe before triggering a regular BSR + uint16_t retxBSR_SF; + /// periodicBSR-Timer, default to infinity + uint16_t periodicBSR_Timer; + /// periodicBSR_SF, number of subframe before triggering a periodic BSR + uint16_t periodicBSR_SF; + /// default value is 0: not configured + uint16_t sr_ProhibitTimer; + /// sr ProhibitTime running + uint8_t sr_ProhibitTimer_Running; + /// default value to n5 + uint16_t maxHARQ_Tx; + /// default value is false + uint16_t ttiBundling; + /// default value is release + struct DRX_Config *drx_config; + /// default value is release + struct MAC_MainConfig__phr_Config *phr_config; + ///timer before triggering a periodic PHR + uint16_t periodicPHR_Timer; + ///timer before triggering a prohibit PHR + uint16_t prohibitPHR_Timer; + ///DL Pathloss change value + uint16_t PathlossChange; + ///number of subframe before triggering a periodic PHR + int16_t periodicPHR_SF; + ///number of subframe before triggering a prohibit PHR + int16_t prohibitPHR_SF; + ///DL Pathloss Change in db + uint16_t PathlossChange_db; + + /// default value is false + uint16_t extendedBSR_Sizes_r10; + /// default value is false + uint16_t extendedPHR_r10; + + //Bj bucket usage per lcid + int16_t Bj[MAX_NUM_LCID]; + // Bucket size per lcid + int16_t bucket_size[MAX_NUM_LCID]; +} UE_SCHEDULING_INFO; +/*!\brief Top level UE MAC structure */ +typedef struct { + uint16_t Node_id; + /// RX frame counter + frame_t rxFrame; + /// RX subframe counter + sub_frame_t rxSubframe; + /// TX frame counter + frame_t txFrame; + /// TX subframe counter + sub_frame_t txSubframe; + /// C-RNTI of UE + uint16_t crnti; + /// C-RNTI of UE before HO + rnti_t crnti_before_ho; ///user id (rnti) of connected UEs + /// uplink active flag + uint8_t ul_active; + /// pointer to RRC PHY configuration + RadioResourceConfigCommonSIB_t *radioResourceConfigCommon; + /// pointer to RACH_ConfigDedicated (NULL when not active, i.e. upon HO completion or T304 expiry) + struct RACH_ConfigDedicated *rach_ConfigDedicated; + /// pointer to RRC PHY configuration + struct PhysicalConfigDedicated *physicalConfigDedicated; +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + /// pointer to RRC PHY configuration SCEll + struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10; +#endif + /// pointer to TDD Configuration (NULL for FDD) + TDD_Config_t *tdd_Config; + /// Number of adjacent cells to measure + uint8_t n_adj_cells; + /// Array of adjacent physical cell ids + uint32_t adj_cell_id[6]; + /// Pointer to RRC MAC configuration + MAC_MainConfig_t *macConfig; + /// Pointer to RRC Measurement gap configuration + MeasGapConfig_t *measGapConfig; + /// Pointers to LogicalChannelConfig indexed by LogicalChannelIdentity. Note NULL means LCHAN is inactive. + LogicalChannelConfig_t *logicalChannelConfig[MAX_NUM_LCID]; + /// Scheduling Information + UE_SCHEDULING_INFO scheduling_info; + /// Outgoing CCCH pdu for PHY + CCCH_PDU CCCH_pdu; + /// Outgoing RAR pdu for PHY + RAR_PDU RAR_pdu; + /// Incoming DLSCH pdu for PHY + DLSCH_PDU DLSCH_pdu[NUMBER_OF_UE_MAX][2]; + /// number of attempt for rach + uint8_t RA_attempt_number; + /// Random-access procedure flag + uint8_t RA_active; + /// Random-access window counter + int8_t RA_window_cnt; + /// Random-access Msg3 size in bytes + uint8_t RA_Msg3_size; + /// Random-access prachMaskIndex + uint8_t RA_prachMaskIndex; + /// Flag indicating Preamble set (A,B) used for first Msg3 transmission + uint8_t RA_usedGroupA; + /// Random-access Resources + PRACH_RESOURCES_t RA_prach_resources; + /// Random-access PREAMBLE_TRANSMISSION_COUNTER + uint8_t RA_PREAMBLE_TRANSMISSION_COUNTER; + /// Random-access backoff counter + int16_t RA_backoff_cnt; + /// Random-access variable for window calculation (frame of last change in window counter) + uint32_t RA_tx_frame; + /// Random-access variable for window calculation (subframe of last change in window counter) + uint8_t RA_tx_subframe; + /// Random-access Group B maximum path-loss + /// Random-access variable for backoff (frame of last change in backoff counter) + uint32_t RA_backoff_frame; + /// Random-access variable for backoff (subframe of last change in backoff counter) + uint8_t RA_backoff_subframe; + /// Random-access Group B maximum path-loss + uint16_t RA_maxPL; + /// Random-access Contention Resolution Timer active flag + uint8_t RA_contention_resolution_timer_active; + /// Random-access Contention Resolution Timer count value + uint8_t RA_contention_resolution_cnt; + /// power headroom reporitng reconfigured + uint8_t PHR_reconfigured; + /// power headroom state as configured by the higher layers + uint8_t PHR_state; + /// power backoff due to power management (as allowed by P-MPRc) for this cell + uint8_t PHR_reporting_active; + /// power backoff due to power management (as allowed by P-MPRc) for this cell + uint8_t power_backoff_db[NUMBER_OF_eNB_MAX]; + /// BSR report falg management + uint8_t BSR_reporting_active; + /// retxBSR-Timer expires flag + uint8_t retxBSRTimer_expires_flag; + /// periodBSR-Timer expires flag + uint8_t periodBSRTimer_expires_flag; + + /// MBSFN_Subframe Configuration + struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA? + /// number of subframe allocation pattern available for MBSFN sync area + uint8_t num_sf_allocation_pattern; +#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) + /// number of active MBSFN area + uint8_t num_active_mbsfn_area; + /// MBSFN Area Info + struct MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA]; + /// PMCH Config + struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN]; + /// MCCH status + uint8_t mcch_status; + /// MSI status + uint8_t msi_status;// could be an array if there are >1 MCH in one MBSFN area +#endif + //#ifdef CBA + /// CBA RNTI for each group + uint16_t cba_rnti[NUM_MAX_CBA_GROUP]; + /// last SFN for CBA channel access + uint8_t cba_last_access[NUM_MAX_CBA_GROUP]; + //#endif + /// total UE scheduler processing time + time_stats_t ue_scheduler; // total + /// UE ULSCH tx processing time inlcuding RLC interface (rlc_data_req) and mac header generation + time_stats_t tx_ulsch_sdu; + /// UE DLSCH rx processing time inlcuding RLC interface (mac_rrc_data_ind or mac_rlc_status_ind+mac_rlc_data_ind) and mac header parser + time_stats_t rx_dlsch_sdu ; + /// UE query for MCH subframe processing time + time_stats_t ue_query_mch; + /// UE MCH rx processing time + time_stats_t rx_mch_sdu; + /// UE BCCH rx processing time including RLC interface (mac_rrc_data_ind) + time_stats_t rx_si; + /// UE PCCH rx processing time including RLC interface (mac_rrc_data_ind) + time_stats_t rx_p; +} UE_MAC_INST; +/*! \brief ID of the neighboring cells used for HO*/ +typedef struct { + uint16_t cell_ids[6]; + uint8_t n_adj_cells; +} neigh_cell_id_t; + +#include "proto.h" +/*@}*/ +#endif /*__LAYER2_MAC_DEFS_H__ */ diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 8f5aab99a7..b2bd428e89 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -601,7 +601,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, UE_scheduling_control->ul_out_of_sync == 0 ? "in synch" : "out of sync", UE_info->UE_template[CC_id][UE_id].phr_info, UE_scheduling_control->dl_cqi[CC_id], - (5 * UE_scheduling_control->pusch_snr[CC_id] - 640) / 10, + (5 * UE_scheduling_control->pusch_snr_avg[CC_id] - 640) / 10, (5 * UE_scheduling_control->pucch1_snr[CC_id] - 640) / 10); } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 1e82da6d6f..6b3f788ee0 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -2571,6 +2571,8 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, uint8_t average_rbs; uint16_t first_rb[MAX_NUM_CCs]; uint8_t mcs; + uint8_t snr; + uint8_t snr2mcs_offset = 4; uint8_t rb_table_index; uint8_t num_pucch_rb; uint32_t tbs; @@ -2665,7 +2667,13 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, UE_template = &UE_info->UE_template[CC_id][UE_id]; if ( UE_info->UE_sched_ctrl[UE_id].phr_received == 1 ) { - mcs = 20; + snr = (5 * UE_info->UE_sched_ctrl[UE_id].pusch_snr[CC_id] - 640) / 10; + if((snr + snr2mcs_offset) >= 20) { + mcs = 20; + } + else { + mcs = snr + snr2mcs_offset; + } } else { mcs = 10; } @@ -3083,7 +3091,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, //power control //compute the expected ULSCH RX power (for the stats) // this is the normalized RX power and this should be constant (regardless of mcs - snr = (5 * UE_sched_ctrl->pusch_snr[CC_id] - 640) / 10; + snr = (5 * UE_sched_ctrl->pusch_snr_avg[CC_id] - 640) / 10; target_snr = eNB->puSch10xSnr / 10; // this assumes accumulated tpc // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index a3046a9939..147becca3a 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -2217,6 +2217,7 @@ add_new_ue(module_id_t mod_idP, UE_info->UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0; UE_info->UE_sched_ctrl[UE_id].ta_update = 31; UE_info->UE_sched_ctrl[UE_id].pusch_snr[cc_idP] = 0; + UE_info->UE_sched_ctrl[UE_id].pusch_snr_avg[cc_idP] = 0; for (j = 0; j < 8; j++) { UE_info->UE_template[cc_idP][UE_id].oldNDI[j] = 0; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 9cfdc3622b..a1b142eff4 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -166,14 +166,16 @@ rx_sdu(const module_id_t enb_mod_idP, * maybe it's even not correct at all? */ UE_scheduling_control->ta_update = (UE_scheduling_control->ta_update * 3 + timing_advance) / 4; + UE_scheduling_control->pusch_snr[CC_idP] = ul_cqi; + double tpc_forgetting_filter=0.75; - if(UE_scheduling_control->pusch_snr[CC_idP] == 0) { - UE_scheduling_control->pusch_snr[CC_idP] = ul_cqi; + if(UE_scheduling_control->pusch_snr_avg[CC_idP] == 0) { + UE_scheduling_control->pusch_snr_avg[CC_idP] = ul_cqi; } else { - UE_scheduling_control->pusch_snr[CC_idP] = (int)((double)UE_scheduling_control->pusch_snr[CC_idP] * tpc_forgetting_filter + (double)ul_cqi * (1-tpc_forgetting_filter)); + UE_scheduling_control->pusch_snr_avg[CC_idP] = (int)((double)UE_scheduling_control->pusch_snr_avg[CC_idP] * tpc_forgetting_filter + (double)ul_cqi * (1-tpc_forgetting_filter)); } - + UE_scheduling_control->ul_consecutive_errors = 0; first_rb = UE_template_ptr->first_rb_ul[harq_pid]; @@ -1992,7 +1994,7 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP, cqi_req = 0; /* Power control: compute the expected ULSCH RX snr (for the stats) */ /* This is the normalized snr and this should be constant (regardless of mcs) */ - snr = (5 * UE_sched_ctrl->pusch_snr[CC_id] - 640) / 10; + snr = (5 * UE_sched_ctrl->pusch_snr_avg[CC_id] - 640) / 10; target_snr = eNB->puSch10xSnr / 10; /* TODO: target_rx_power was 178, what to put? */ /* This assumes accumulated tpc */ /* Make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out */ diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index 7eccc6222d..1727403631 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -961,6 +961,7 @@ typedef struct { uint8_t pucch3_cqi_update[NFAPI_CC_MAX]; uint8_t pucch3_snr[NFAPI_CC_MAX]; uint8_t pusch_snr[NFAPI_CC_MAX]; + uint8_t pusch_snr_avg[NFAPI_CC_MAX]; uint16_t feedback_cnt[NFAPI_CC_MAX]; uint16_t timing_advance; uint16_t timing_advance_r9; From 55207a5062caae261e950d151b0d1b7121400ed7 Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Wed, 18 Dec 2019 09:59:05 +0900 Subject: [PATCH 040/160] Fix: add SNR filter for ULSCH AMC. --- openair2/LAYER2/MAC/defs.h | 1 + openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 15 +++++++++------ openair2/LAYER2/MAC/eNB_scheduler_primitives.c | 2 +- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 12 ++++++++++-- openair2/LAYER2/MAC/mac.h | 1 + 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index 7c18d958ab..020be61fb1 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -832,6 +832,7 @@ typedef struct { uint8_t pucch3_snr[NFAPI_CC_MAX]; uint8_t pusch_snr[NFAPI_CC_MAX]; uint8_t pusch_snr_avg[NFAPI_CC_MAX]; + uint8_t pusch_snr_amc[NFAPI_CC_MAX]; uint16_t feedback_cnt[NFAPI_CC_MAX]; uint16_t timing_advance; uint16_t timing_advance_r9; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 6b3f788ee0..13d02f9407 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -2572,7 +2572,7 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, uint16_t first_rb[MAX_NUM_CCs]; uint8_t mcs; uint8_t snr; - uint8_t snr2mcs_offset = 4; + uint8_t snr2mcs_offset = 0; uint8_t rb_table_index; uint8_t num_pucch_rb; uint32_t tbs; @@ -2667,10 +2667,13 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, UE_template = &UE_info->UE_template[CC_id][UE_id]; if ( UE_info->UE_sched_ctrl[UE_id].phr_received == 1 ) { - snr = (5 * UE_info->UE_sched_ctrl[UE_id].pusch_snr[CC_id] - 640) / 10; + snr = (5 * UE_info->UE_sched_ctrl[UE_id].pusch_snr_amc[CC_id] - 640) / 10; if((snr + snr2mcs_offset) >= 20) { mcs = 20; } + else if((snr + snr2mcs_offset) < 3) { + mcs = 3; + } else { mcs = snr + snr2mcs_offset; } @@ -3204,8 +3207,8 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, nfapi_hi_dci0_request_t *nfapi_hi_dci0_req = &eNB->HI_DCI0_req[CC_id][subframeP]; nfapi_hi_dci0_req->sfn_sf = frameP<<4|subframeP; // sfnsf_add_subframe(sched_frame, sched_subframeP, 0); // sunday! nfapi_hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; - LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n", - harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP); + LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d mcs %d first_rb %d num_rb %d round %d\n", + harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,UE_template->mcs_UL[harq_pid],first_rb[CC_id],rb_table[rb_table_index],0); ul_req_index = 0; dlsch_flag = 0; @@ -3355,8 +3358,8 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, hi_dci0_pdu->dci_pdu.dci_pdu_rel8.harq_pid = harq_pid; hi_dci0_req->number_of_dci++; // Add UL_config PDUs - LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d\n", - harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP); + LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d mcs %d first_rb %d num_rb %d round %d\n", + harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,mcs_rv,ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb,ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb,UE_sched_ctrl->round_UL[CC_id][harq_pid]); ul_req_index = 0; dlsch_flag = 0; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 147becca3a..95a5b48598 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -2218,7 +2218,7 @@ add_new_ue(module_id_t mod_idP, UE_info->UE_sched_ctrl[UE_id].ta_update = 31; UE_info->UE_sched_ctrl[UE_id].pusch_snr[cc_idP] = 0; UE_info->UE_sched_ctrl[UE_id].pusch_snr_avg[cc_idP] = 0; - + UE_info->UE_sched_ctrl[UE_id].pusch_snr_amc[cc_idP] = 0; for (j = 0; j < 8; j++) { UE_info->UE_template[cc_idP][UE_id].oldNDI[j] = 0; UE_info->UE_template[cc_idP][UE_id].oldNDI_UL[j] = 0; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index a1b142eff4..d8a8983ac1 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -168,12 +168,20 @@ rx_sdu(const module_id_t enb_mod_idP, UE_scheduling_control->ta_update = (UE_scheduling_control->ta_update * 3 + timing_advance) / 4; UE_scheduling_control->pusch_snr[CC_idP] = ul_cqi; - double tpc_forgetting_filter=0.75; + double snr_filter_tpc=0.75; if(UE_scheduling_control->pusch_snr_avg[CC_idP] == 0) { UE_scheduling_control->pusch_snr_avg[CC_idP] = ul_cqi; } else { - UE_scheduling_control->pusch_snr_avg[CC_idP] = (int)((double)UE_scheduling_control->pusch_snr_avg[CC_idP] * tpc_forgetting_filter + (double)ul_cqi * (1-tpc_forgetting_filter)); + UE_scheduling_control->pusch_snr_avg[CC_idP] = (int)((double)UE_scheduling_control->pusch_snr_avg[CC_idP] * snr_filter_tpc + (double)ul_cqi * (1-snr_filter_tpc)); + } + + double snr_filter_amc=0.5; + if(UE_scheduling_control->pusch_snr_amc[CC_idP] == 0) { + UE_scheduling_control->pusch_snr_amc[CC_idP] = ul_cqi; + } + else { + UE_scheduling_control->pusch_snr_amc[CC_idP] = (int)((double)UE_scheduling_control->pusch_snr_amc[CC_idP] * snr_filter_amc + (double)ul_cqi * (1-snr_filter_amc)); } UE_scheduling_control->ul_consecutive_errors = 0; diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index 1727403631..3c15bd5ac9 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -962,6 +962,7 @@ typedef struct { uint8_t pucch3_snr[NFAPI_CC_MAX]; uint8_t pusch_snr[NFAPI_CC_MAX]; uint8_t pusch_snr_avg[NFAPI_CC_MAX]; + uint8_t pusch_snr_amc[NFAPI_CC_MAX]; uint16_t feedback_cnt[NFAPI_CC_MAX]; uint16_t timing_advance; uint16_t timing_advance_r9; From ffdc67daa4fbebfacba4c29ebd9ba0b5da39d63f Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Tue, 24 Dec 2019 19:10:52 +0900 Subject: [PATCH 041/160] Add: PUSCH AMC using average BLER. (cherry picked from commit 1ab0a979fdbcc933ae249838841dc7f61c0e5aba) --- openair2/LAYER2/MAC/defs.h | 12 ++- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 91 ++++++++++++++----- .../LAYER2/MAC/eNB_scheduler_primitives.c | 7 ++ openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 3 + openair2/LAYER2/MAC/mac.h | 11 +++ 5 files changed, 101 insertions(+), 23 deletions(-) diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index 020be61fb1..a16b145039 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -757,7 +757,11 @@ typedef struct { uint32_t pusch_tpc_tx_subframe; uint32_t pucch_tpc_tx_frame; uint32_t pucch_tpc_tx_subframe; - + + /// stores the frame where the last bler was calculated + uint32_t pusch_bler_calc_frame; + uint32_t pusch_bler_calc_subframe; + #ifdef LOCALIZATION eNB_UE_estimated_distances distance; #endif @@ -833,6 +837,12 @@ typedef struct { uint8_t pusch_snr[NFAPI_CC_MAX]; uint8_t pusch_snr_avg[NFAPI_CC_MAX]; uint8_t pusch_snr_amc[NFAPI_CC_MAX]; + uint64_t pusch_rx_num[NFAPI_CC_MAX]; + uint64_t pusch_rx_num_old[NFAPI_CC_MAX]; + uint64_t pusch_rx_error_num[NFAPI_CC_MAX]; + uint64_t pusch_rx_error_num_old[NFAPI_CC_MAX]; + double pusch_bler[NFAPI_CC_MAX]; + uint8_t mcs_offset[NFAPI_CC_MAX]; uint16_t feedback_cnt[NFAPI_CC_MAX]; uint16_t timing_advance; uint16_t timing_advance_r9; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 13d02f9407..774fac80eb 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -2570,9 +2570,11 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, uint8_t total_rbs=0; uint8_t average_rbs; uint16_t first_rb[MAX_NUM_CCs]; - uint8_t mcs; + int8_t mcs; uint8_t snr; - uint8_t snr2mcs_offset = 0; + uint8_t snr2mcs_offset = 3; + double bler_filter=0.9; + double bler; uint8_t rb_table_index; uint8_t num_pucch_rb; uint32_t tbs; @@ -2666,16 +2668,61 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, } else { UE_template = &UE_info->UE_template[CC_id][UE_id]; - if ( UE_info->UE_sched_ctrl[UE_id].phr_received == 1 ) { - snr = (5 * UE_info->UE_sched_ctrl[UE_id].pusch_snr_amc[CC_id] - 640) / 10; - if((snr + snr2mcs_offset) >= 20) { - mcs = 20; - } - else if((snr + snr2mcs_offset) < 3) { - mcs = 3; + int32_t framex10psubframe = UE_template->pusch_bler_calc_frame*10+UE_template->pusch_bler_calc_subframe; + int pusch_bler_interval=100; + double total_bler; + + if(UE_info->UE_sched_ctrl[UE_id].pusch_rx_num[CC_id] == 0 && UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num[CC_id] == 0) { + total_bler = 0; + } + else { + total_bler = (double)UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num[CC_id] / (double)(UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num[CC_id] + UE_info->UE_sched_ctrl[UE_id].pusch_rx_num[CC_id]) * 100; + } + + if (((framex10psubframe+pusch_bler_interval)<=(frameP*10+subframeP)) || //normal case + ((framex10psubframe>(frameP*10+subframeP)) && (((10240-framex10psubframe+frameP*10+subframeP)>=pusch_bler_interval)))) { //frame wrap-around + + UE_template->pusch_bler_calc_frame=frameP; + UE_template->pusch_bler_calc_subframe=subframeP; + + int pusch_rx_num_diff = UE_info->UE_sched_ctrl[UE_id].pusch_rx_num[CC_id] - UE_info->UE_sched_ctrl[UE_id].pusch_rx_num_old[CC_id]; + int pusch_rx_error_num_diff = UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num[CC_id] - UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num_old[CC_id]; + + if((pusch_rx_num_diff == 0) && (pusch_rx_error_num_diff == 0)) { /* first rx case or no rx among interval time */ + bler = UE_info->UE_sched_ctrl[UE_id].pusch_bler[CC_id]; } else { - mcs = snr + snr2mcs_offset; + bler = (double)pusch_rx_error_num_diff / (double)(pusch_rx_num_diff + pusch_rx_error_num_diff) * 100; + } + UE_info->UE_sched_ctrl[UE_id].pusch_bler[CC_id] = UE_info->UE_sched_ctrl[UE_id].pusch_bler[CC_id] * bler_filter + bler * (1.0-bler_filter); + UE_info->UE_sched_ctrl[UE_id].pusch_rx_num_old[CC_id] = UE_info->UE_sched_ctrl[UE_id].pusch_rx_num[CC_id]; + UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num_old[CC_id] = UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num[CC_id]; + + if(bler < 0.5) { + if(UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id] !=0) { + UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]--; + } + } + if(bler >= 2) { + UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]++; + if(UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id] >= 20) { + UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]=20; + } + } + } + + if ( UE_info->UE_sched_ctrl[UE_id].phr_received == 1 ) { + snr = (5 * UE_info->UE_sched_ctrl[UE_id].pusch_snr_amc[CC_id] - 640) / 10; + mcs = snr - snr2mcs_offset; + if(mcs > 20) { + mcs = 20; + } + + if(mcs - UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id] < 6) { + mcs = 6; + } + else { + mcs = mcs - UE_list->UE_sched_ctrl[UE_id].mcs_offset[CC_id]; } } else { mcs = 10; @@ -2689,19 +2736,13 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ul_total_buffer > 0 ) { rb_table_index = 2; tbs = get_TBS_UL(mcs,rb_table[rb_table_index]); - tx_power= estimate_ue_tx_power(tbs*8,rb_table[rb_table_index],0,frame_parms->Ncp,0); - - while ( (((UE_template->phr_info - tx_power) < 0 ) || (tbs > bytes_to_schedule)) && (mcs > 3) ) { - mcs--; - tbs = get_TBS_UL(mcs,rb_table[rb_table_index]); - tx_power= estimate_ue_tx_power(tbs*8,rb_table[rb_table_index],0,frame_parms->Ncp,0); - } + tx_power = (int8_t)(hundred_times_log10_NPRB[rb_table[rb_table_index] - 1] / 100); while ( (tbs < bytes_to_schedule) && (rb_table[rb_table_index]<(frame_parms->N_RB_UL-num_pucch_rb-first_rb[CC_id])) && ((UE_template->phr_info - tx_power) > 0) && (rb_table_index < 32 )) { rb_table_index++; tbs = get_TBS_UL(mcs,rb_table[rb_table_index]); - tx_power= estimate_ue_tx_power(tbs*8,rb_table[rb_table_index],0,frame_parms->Ncp,0); + tx_power = (int8_t)(hundred_times_log10_NPRB[rb_table[rb_table_index] - 1] / 100); } if ( rb_table[rb_table_index]<3 ) { @@ -2731,6 +2772,11 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, UE_info->UE_template[CC_id][UE_id].pre_allocated_rb_table_index_ul = rb_table_index; UE_info->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = mcs; } + + LOG_D(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d snr %d mcs %d mcs_offset %d bler %lf total_bler %lf ( %d %d ) rb_num %d phr_info %d tx_power %d bsr %d\n", + module_idP,frameP,subframeP,UE_id,UE_RNTI(CC_id,UE_id),CC_id, snr, mcs, UE_list->UE_sched_ctrl[UE_id].mcs_offset[CC_id], UE_list->UE_sched_ctrl[UE_id].pusch_bler[CC_id], + total_bler, UE_list->UE_sched_ctrl[UE_id].pusch_rx_num[CC_id], UE_list->UE_sched_ctrl[UE_id].pusch_rx_error_num[CC_id], rb_table[rb_table_index-1], UE_template->phr_info, tx_power, bytes_to_schedule); + } else { if (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED) { // assigne RBS( 6 RBs) @@ -3207,8 +3253,8 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, nfapi_hi_dci0_request_t *nfapi_hi_dci0_req = &eNB->HI_DCI0_req[CC_id][subframeP]; nfapi_hi_dci0_req->sfn_sf = frameP<<4|subframeP; // sfnsf_add_subframe(sched_frame, sched_subframeP, 0); // sunday! nfapi_hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; - LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d mcs %d first_rb %d num_rb %d round %d\n", - harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,UE_template->mcs_UL[harq_pid],first_rb[CC_id],rb_table[rb_table_index],0); + LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d mcs %d first_rb %d num_rb %d round %d mcs %d sinr %d bler %lf\n", + harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,UE_template->mcs_UL[harq_pid],first_rb[CC_id],rb_table[rb_table_index],0,UE_template->mcs_UL[harq_pid],(5 * UE_sched_ctrl->pusch_snr_amc[CC_id] - 640) / 10,UE_sched_ctrl->pusch_bler[CC_id]); ul_req_index = 0; dlsch_flag = 0; @@ -3358,8 +3404,9 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, hi_dci0_pdu->dci_pdu.dci_pdu_rel8.harq_pid = harq_pid; hi_dci0_req->number_of_dci++; // Add UL_config PDUs - LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d mcs %d first_rb %d num_rb %d round %d\n", - harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,mcs_rv,ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb,ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb,UE_sched_ctrl->round_UL[CC_id][harq_pid]); + LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d mcs %d first_rb %d num_rb %d round %d mcs %d sinr %d bler %lf\n", + harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,mcs_rv,ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb,ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb,UE_sched_ctrl->round_UL[CC_id][harq_pid],UE_template->mcs_UL[harq_pid],(5 * UE_sched_ctrl->pusch_snr_amc[CC_id] - 640) / 10,UE_sched_ctrl->pusch_bler[CC_id]); + ul_req_index = 0; dlsch_flag = 0; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 95a5b48598..82b640e7d0 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -2219,6 +2219,13 @@ add_new_ue(module_id_t mod_idP, UE_info->UE_sched_ctrl[UE_id].pusch_snr[cc_idP] = 0; UE_info->UE_sched_ctrl[UE_id].pusch_snr_avg[cc_idP] = 0; UE_info->UE_sched_ctrl[UE_id].pusch_snr_amc[cc_idP] = 0; + UE_info->UE_sched_ctrl[UE_id].pusch_rx_num[cc_idP] = 0; + UE_info->UE_sched_ctrl[UE_id].pusch_rx_num_old[cc_idP] = 0; + UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num[cc_idP] = 0; + UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num_old[cc_idP] = 0; + UE_info->UE_sched_ctrl[UE_id].pusch_bler[cc_idP] = 0; + UE_info->UE_sched_ctrl[UE_id].mcs_offset[cc_idP] = 0; + for (j = 0; j < 8; j++) { UE_info->UE_template[cc_idP][UE_id].oldNDI[j] = 0; UE_info->UE_template[cc_idP][UE_id].oldNDI_UL[j] = 0; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index d8a8983ac1..73e3465817 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -160,6 +160,8 @@ rx_sdu(const module_id_t enb_mod_idP, UE_scheduling_control->ul_inactivity_timer = 0; UE_scheduling_control->ul_failure_timer = 0; UE_scheduling_control->ul_scheduled &= (~(1 << harq_pid)); + UE_scheduling_control->pusch_rx_num[CC_idP]++; + /* Update with smoothing: 3/4 of old value and 1/4 of new. * This is the logic that was done in the function * lte_est_timing_advance_pusch, maybe it's not necessary? @@ -199,6 +201,7 @@ rx_sdu(const module_id_t enb_mod_idP, UE_template_ptr->scheduled_ul_bytes = 0; } } else { // sduP == NULL => error + UE_scheduling_control->pusch_rx_error_num[CC_idP]++; LOG_W(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d, UE_id %d, RNTI %x (len %d)\n", enb_mod_idP, harq_pid, diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index 3c15bd5ac9..09edd00a80 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -906,6 +906,11 @@ typedef struct { uint32_t pucch_tpc_tx_frame; uint32_t pucch_tpc_tx_subframe; + /// stores the frame where the last bler was calculated + uint32_t pusch_bler_calc_frame; + uint32_t pusch_bler_calc_subframe; + + uint8_t rach_resource_type; uint16_t mpdcch_repetition_cnt; frame_t Msg2_frame; @@ -963,6 +968,12 @@ typedef struct { uint8_t pusch_snr[NFAPI_CC_MAX]; uint8_t pusch_snr_avg[NFAPI_CC_MAX]; uint8_t pusch_snr_amc[NFAPI_CC_MAX]; + uint64_t pusch_rx_num[NFAPI_CC_MAX]; + uint64_t pusch_rx_num_old[NFAPI_CC_MAX]; + uint64_t pusch_rx_error_num[NFAPI_CC_MAX]; + uint64_t pusch_rx_error_num_old[NFAPI_CC_MAX]; + double pusch_bler[NFAPI_CC_MAX]; + uint8_t mcs_offset[NFAPI_CC_MAX]; uint16_t feedback_cnt[NFAPI_CC_MAX]; uint16_t timing_advance; uint16_t timing_advance_r9; From 2d5ad4d0b1983887ee47029376e4f0370858e887 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 26 Nov 2020 16:05:07 +0000 Subject: [PATCH 042/160] Minor updates in the SIB1 content --- openair2/COMMON/rrc_messages_types.h | 2 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 19 +++++++++++++------ ...=> gnb.sa.band78.fr1.106PRB.usrpb210.conf} | 0 3 files changed, 14 insertions(+), 7 deletions(-) rename targets/PROJECTS/GENERIC-NR-5GC/CONF/{gnb.sa.band78.tm1.fr1.106PRB.usrpb210.conf => gnb.sa.band78.fr1.106PRB.usrpb210.conf} (100%) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index ef76e6a7b4..02f878ee2e 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -399,7 +399,7 @@ typedef struct NbIoTRrcConfigurationReq_s { // gNB: GNB_APP -> RRC messages typedef struct NRRrcConfigurationReq_s { - long cell_identity; + uint64_t cell_identity; uint32_t tac; uint16_t mcc[PLMN_LIST_MAX_SIZE]; uint16_t mnc[PLMN_LIST_MAX_SIZE]; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 3c47074c22..3a4e28f880 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -368,7 +368,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, // TODO: add connEstFailureControl //si-SchedulingInfo - sib1->si_SchedulingInfo = CALLOC(1,sizeof(struct NR_SI_SchedulingInfo)); + /*sib1->si_SchedulingInfo = CALLOC(1,sizeof(struct NR_SI_SchedulingInfo)); asn_set_empty(&sib1->si_SchedulingInfo->schedulingInfoList.list); sib1->si_SchedulingInfo->si_WindowLength = NR_SI_SchedulingInfo__si_WindowLength_s20; struct NR_SchedulingInfo *schedulingInfo = CALLOC(1,sizeof(struct NR_SchedulingInfo)); @@ -378,7 +378,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, e_NR_SIB_TypeInfo__type *sib_type = CALLOC(1,sizeof(e_NR_SIB_TypeInfo__type)); *sib_type = NR_SIB_TypeInfo__type_sibType3; ASN_SEQUENCE_ADD(&schedulingInfo->sib_MappingInfo.list,sib_type); - ASN_SEQUENCE_ADD(&sib1->si_SchedulingInfo->schedulingInfoList.list,schedulingInfo); + ASN_SEQUENCE_ADD(&sib1->si_SchedulingInfo->schedulingInfoList.list,schedulingInfo);*/ // servingCellConfigCommon sib1->servingCellConfigCommon = CALLOC(1,sizeof(struct NR_ServingCellConfigCommonSIB)); @@ -393,27 +393,34 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, nrMultiBandInfo->freqBandIndicatorNR = configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i]; ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list,nrMultiBandInfo); } + sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.count; i++) { ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list,configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]); } sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon; sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon; - sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = 0; sib1->servingCellConfigCommon->downlinkConfigCommon.bcch_Config.modificationPeriodCoeff = NR_BCCH_Config__modificationPeriodCoeff_n2; sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.defaultPagingCycle = 0; sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.present = NR_PCCH_Config__nAndPagingFrameOffset_PR_oneT; sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.ns = NR_PCCH_Config__ns_four; sib1->servingCellConfigCommon->uplinkConfigCommon = CALLOC(1,sizeof(struct NR_UplinkConfigCommonSIB)); - sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon; asn_set_empty(&sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list); for(int i = 0; i< configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.count; i++) { ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list,configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]); } + sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters = configuration->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon; + sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon; + sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon; sib1->servingCellConfigCommon->n_TimingAdvanceOffset = configuration->scc->n_TimingAdvanceOffset; sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.shortBitmap; sib1->servingCellConfigCommon->ssb_PeriodicityServingCell = *configuration->scc->ssb_periodicityServingCell; + sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon = CALLOC(1,sizeof(struct NR_TDD_UL_DL_ConfigCommon)); + sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing = configuration->scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing; + sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon->pattern1 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern1; + sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon->pattern2 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern2; sib1->servingCellConfigCommon->ss_PBCH_BlockPower = configuration->scc->ss_PBCH_BlockPower; // ims-EmergencySupport @@ -426,7 +433,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, // TODO: add ue-TimersAndConstants // uac-BarringInfo - sib1->uac_BarringInfo = CALLOC(1, sizeof(struct NR_SIB1__uac_BarringInfo)); + /*sib1->uac_BarringInfo = CALLOC(1, sizeof(struct NR_SIB1__uac_BarringInfo)); NR_UAC_BarringInfoSet_t *nr_uac_BarringInfoSet = CALLOC(1, sizeof(NR_UAC_BarringInfoSet_t)); asn_set_empty(&sib1->uac_BarringInfo->uac_BarringInfoSetList); nr_uac_BarringInfoSet->uac_BarringFactor = NR_UAC_BarringInfoSet__uac_BarringFactor_p95; @@ -434,7 +441,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, nr_uac_BarringInfoSet->uac_BarringForAccessIdentity.buf = CALLOC(1, 1); nr_uac_BarringInfoSet->uac_BarringForAccessIdentity.size = 1; nr_uac_BarringInfoSet->uac_BarringForAccessIdentity.bits_unused = 1; - ASN_SEQUENCE_ADD(&sib1->uac_BarringInfo->uac_BarringInfoSetList, nr_uac_BarringInfoSet); + ASN_SEQUENCE_ADD(&sib1->uac_BarringInfo->uac_BarringInfoSetList, nr_uac_BarringInfoSet);*/ // useFullResumeID // TODO: add useFullResumeID diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.tm1.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf similarity index 100% rename from targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.tm1.fr1.106PRB.usrpb210.conf rename to targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf From 39ac342cfa753b4adcdb044a5a5119e4b4c364c3 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 26 Nov 2020 16:44:26 +0000 Subject: [PATCH 043/160] Flag --sa added in the softmodem-common to indicate the standalone mode --- executables/softmodem-common.h | 4 ++++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index feb020154b..7c027bda23 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -56,6 +56,7 @@ extern "C" #define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n" #define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n" #define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n" +#define CONFIG_HLP_SA "run gNB in standalone mode\n" #define CONFIG_HLP_EXTS "tells hardware to use an external timing reference\n" #define CONFIG_HLP_DMRSSYNC "tells RU to insert DMRS in subframe 1 slot 0" #define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)\n" @@ -100,6 +101,7 @@ extern "C" #define TP_CONFIG softmodem_params.threadPoolConfig #define PHY_TEST softmodem_params.phy_test #define DO_RA softmodem_params.do_ra +#define SA softmodem_params.sa #define WAIT_FOR_SYNC softmodem_params.wait_for_sync #define SINGLE_THREAD_FLAG softmodem_params.single_thread_flag #define CHAIN_OFFSET softmodem_params.chain_offset @@ -118,6 +120,7 @@ extern "C" {"thread-pool", CONFIG_HLP_TPOOL, 0, strptr:(char **)&TP_CONFIG, defstrval:"n", TYPE_STRING, sizeof(TP_CONFIG)}, \ {"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \ {"do-ra", CONFIG_HLP_DORA, PARAMFLAG_BOOL, iptr:&DO_RA, defintval:0, TYPE_INT, 0}, \ + {"sa", CONFIG_HLP_SA, PARAMFLAG_BOOL, iptr:&SA, defintval:0, TYPE_INT, 0}, \ {"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&USIM_TEST, defintval:0, TYPE_UINT8, 0}, \ {"clock-source", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \ {"time-source", CONFIG_HLP_TME, 0, uptr:&TIMING_SOURCE, defintval:0, TYPE_UINT, 0}, \ @@ -211,6 +214,7 @@ typedef struct { char threadPoolConfig[1024]; int phy_test; int do_ra; + int sa; uint8_t usim_test; int emulate_rf; int wait_for_sync; //eNodeB only diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 58782918b7..c149fa5d39 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -492,8 +492,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, schedule_nr_mib(module_idP, frame, slot, slots_per_frame[*scc->ssbSubcarrierSpacing]); // This schedules SIB1 - if (get_softmodem_params()->phy_test == 0) + if ( (get_softmodem_params()->phy_test == 0) & (get_softmodem_params()->sa == 1) ) schedule_nr_sib1(module_idP, frame, slot); + else if ( (get_softmodem_params()->phy_test == 1) & (get_softmodem_params()->sa == 1) ) + LOG_W(MAC,"Remove --phy-test to transmit SIB1 in standalone mode\n"); // This schedule PRACH if we are not in phy_test mode if (get_softmodem_params()->phy_test == 0) From 05eb88f0685f5ef54996aecba45d21722b313958 Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Fri, 14 Feb 2020 13:18:48 +0900 Subject: [PATCH 044/160] Fix scheduled_ul_bytes size remain when no crc report has come from L1. (cherry picked from commit ce10221c2761fb3058ccb77b73ba87f97d5e2cd2) --- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 11 +++++++++++ openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 774fac80eb..78f837884f 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -3192,6 +3192,17 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, UE_template->mcs_UL[harq_pid]=10;//cmin (10, openair_daq_vars.target_ue_ul_mcs); rb_table_index=5; // for PHR } + if( (UE_sched_ctrl->ul_scheduled | (1<0 ){ + UE_template->scheduled_ul_bytes -= UE_template->TBS_UL[harq_pid]; + + if (UE_template->scheduled_ul_bytes < 0) { + UE_template->scheduled_ul_bytes = 0; + } + UE_template->estimated_ul_buffer -= UE_template->TBS_UL[harq_pid]; + if (UE_template->estimated_ul_buffer < 0) { + UE_template->estimated_ul_buffer = 0; + } + } UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2=UE_template->mcs_UL[harq_pid]; UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid],rb_table[rb_table_index]); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 73e3465817..ee9e002803 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -200,6 +200,10 @@ rx_sdu(const module_id_t enb_mod_idP, if (UE_template_ptr->scheduled_ul_bytes < 0) { UE_template_ptr->scheduled_ul_bytes = 0; } + UE_template_ptr->estimated_ul_buffer -= UE_template_ptr->TBS_UL[harq_pid]; + if (UE_template_ptr->estimated_ul_buffer < 0) { + UE_template_ptr->estimated_ul_buffer = 0; + } } else { // sduP == NULL => error UE_scheduling_control->pusch_rx_error_num[CC_idP]++; LOG_W(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d, UE_id %d, RNTI %x (len %d)\n", @@ -233,6 +237,10 @@ rx_sdu(const module_id_t enb_mod_idP, if (UE_template_ptr->scheduled_ul_bytes < 0) { UE_template_ptr->scheduled_ul_bytes = 0; } + UE_template_ptr->estimated_ul_buffer -= UE_template_ptr->TBS_UL[harq_pid]; + if (UE_template_ptr->estimated_ul_buffer < 0) { + UE_template_ptr->estimated_ul_buffer = 0; + } if (find_RA_id(enb_mod_idP, CC_idP, current_rnti) != -1) { cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); From b573fd4dbd420208ab986ef3e96873a0cdda56c4 Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Sat, 22 Feb 2020 15:01:54 +0900 Subject: [PATCH 045/160] Fix: The remaining UL buffer size is incorrectly calculated and UL scheduling does not occur. (scheduled_ul_bytes is not subtracted correctly when receiving NACK rarely.) (cherry picked from commit 2fb4823b57320c4c4e4d800ae9bb0570f18ad353) --- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 78f837884f..c5e8577873 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -3379,7 +3379,6 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, mcs_rv = 31; } - UE_template->TBS_UL[harq_pid] = get_TBS_UL(UE_template->mcs_UL[harq_pid],ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb); UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_TBS=UE_template->TBS_UL[harq_pid]; if (mac_eNB_get_rrc_status(module_idP,rnti) < RRC_CONNECTED) From 52dfba49cd4a0c466d51d6dfead2457db588af66 Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Thu, 20 Feb 2020 19:59:02 +0900 Subject: [PATCH 046/160] Fix: smooth ULSCH AMC and TPC control. (cherry picked from commit 56720c68864f6b04409deb00676e59a41c8f050b) --- openair1/SCHED/phy_procedures_lte_eNb.c | 4 ++ openair2/LAYER2/MAC/defs.h | 2 +- openair2/LAYER2/MAC/eNB_scheduler.c | 4 +- openair2/LAYER2/MAC/eNB_scheduler_dlsch.c | 4 +- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 38 +++++++------------ openair2/LAYER2/MAC/eNB_scheduler_phytest.c | 3 +- .../LAYER2/MAC/eNB_scheduler_primitives.c | 6 +-- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 26 +++++-------- openair2/LAYER2/MAC/mac.h | 2 +- 9 files changed, 39 insertions(+), 50 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index f2a246fbc3..ac31326d9c 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1606,6 +1606,10 @@ void fill_rx_indication(PHY_VARS_eNB *eNB, pdu->rx_indication_rel8.timing_advance = timing_advance_update; // estimate UL_CQI for MAC (from antenna port 0 only) int SNRtimes10 = dB_fixed_times10(eNB->pusch_vars[UE_id]->ulsch_power[0]) - dB_fixed_times10(eNB->pusch_vars[UE_id]->ulsch_interference_power[0]); + + if(dB_fixed_times10(eNB->pusch_vars[UE_id]->ulsch_power[0]) > 500) { + SNRtimes10 = 300; + } if (SNRtimes10 < -640) pdu->rx_indication_rel8.ul_cqi = 0; diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index a16b145039..58f50a84ea 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -834,9 +834,9 @@ typedef struct { uint8_t pucch2_snr[NFAPI_CC_MAX]; uint8_t pucch3_cqi_update[NFAPI_CC_MAX]; uint8_t pucch3_snr[NFAPI_CC_MAX]; + uint8_t pusch_cqi[NFAPI_CC_MAX]; uint8_t pusch_snr[NFAPI_CC_MAX]; uint8_t pusch_snr_avg[NFAPI_CC_MAX]; - uint8_t pusch_snr_amc[NFAPI_CC_MAX]; uint64_t pusch_rx_num[NFAPI_CC_MAX]; uint64_t pusch_rx_num_old[NFAPI_CC_MAX]; uint64_t pusch_rx_error_num[NFAPI_CC_MAX]; diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index b2bd428e89..dd68cb8097 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -601,8 +601,8 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, UE_scheduling_control->ul_out_of_sync == 0 ? "in synch" : "out of sync", UE_info->UE_template[CC_id][UE_id].phr_info, UE_scheduling_control->dl_cqi[CC_id], - (5 * UE_scheduling_control->pusch_snr_avg[CC_id] - 640) / 10, - (5 * UE_scheduling_control->pucch1_snr[CC_id] - 640) / 10); + UE_scheduling_control->pusch_snr_avg[CC_id], + UE_scheduling_control->pucch1_snr[CC_id]); } RC.eNB[module_idP][CC_id]->pusch_stats_bsr[UE_id][(frameP * 10) + subframeP] = -63; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c index 1f99f50ece..455b8142d3 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c @@ -1050,7 +1050,7 @@ schedule_ue_spec(module_id_t module_idP, // this is the snr // unit is not dBm, it's special from nfapi // converting to dBm - int snr = (5 * ue_sched_ctrl->pucch1_snr[CC_id] - 640) / 10; + int snr = ue_sched_ctrl->pucch1_snr[CC_id]; int target_snr = eNB->puCch10xSnr / 10; // this assumes accumulated tpc // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out @@ -1684,7 +1684,7 @@ schedule_ue_spec_br(module_id_t module_idP, /* Do PUCCH power control */ /* This is the snr */ /* unit is not dBm, it's special from nfapi, convert to dBm */ - snr = (5 * ue_sched_ctl->pucch1_snr[CC_id] - 640) / 10; + snr = ue_sched_ctl->pucch1_snr[CC_id]; target_snr = mac->puCch10xSnr / 10; /* This assumes accumulated tpc */ /* Make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out */ diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index c5e8577873..8dc7c36b8c 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -1998,8 +1998,8 @@ schedule_ue_spec_fairRR(module_id_t module_idP, // this is the snr eNB_UE_stats = &UE_info->eNB_UE_stats[CC_id][UE_id]; /* Unit is not dBm, it's special from nfapi */ - snr = (5 * ue_sched_ctl->pucch1_snr[CC_id] - 640) / 10; - target_snr = eNB->puCch10xSnr / 10; + snr = ue_sched_ctl->pucch1_snr[CC_id]; + target_snr = eNB->puCch10xSnr/10; // this assumes accumulated tpc // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out int32_t framex10psubframe = UE_info->UE_template[CC_id][UE_id].pucch_tpc_tx_frame*10+UE_info->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe; @@ -2669,7 +2669,7 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, UE_template = &UE_info->UE_template[CC_id][UE_id]; int32_t framex10psubframe = UE_template->pusch_bler_calc_frame*10+UE_template->pusch_bler_calc_subframe; - int pusch_bler_interval=100; + int pusch_bler_interval=50; double total_bler; if(UE_info->UE_sched_ctrl[UE_id].pusch_rx_num[CC_id] == 0 && UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num[CC_id] == 0) { @@ -2711,21 +2711,11 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, } } - if ( UE_info->UE_sched_ctrl[UE_id].phr_received == 1 ) { - snr = (5 * UE_info->UE_sched_ctrl[UE_id].pusch_snr_amc[CC_id] - 640) / 10; - mcs = snr - snr2mcs_offset; - if(mcs > 20) { - mcs = 20; - } - - if(mcs - UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id] < 6) { - mcs = 6; - } - else { - mcs = mcs - UE_list->UE_sched_ctrl[UE_id].mcs_offset[CC_id]; - } - } else { - mcs = 10; + snr = UE_info->UE_sched_ctrl[UE_id].pusch_snr_avg[CC_id]; + + mcs = 20 - UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]; + if(mcs < 6) { + mcs = 6; } if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_FIRST ) { @@ -2773,9 +2763,9 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, UE_info->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = mcs; } - LOG_D(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d snr %d mcs %d mcs_offset %d bler %lf total_bler %lf ( %d %d ) rb_num %d phr_info %d tx_power %d bsr %d\n", - module_idP,frameP,subframeP,UE_id,UE_RNTI(CC_id,UE_id),CC_id, snr, mcs, UE_list->UE_sched_ctrl[UE_id].mcs_offset[CC_id], UE_list->UE_sched_ctrl[UE_id].pusch_bler[CC_id], - total_bler, UE_list->UE_sched_ctrl[UE_id].pusch_rx_num[CC_id], UE_list->UE_sched_ctrl[UE_id].pusch_rx_error_num[CC_id], rb_table[rb_table_index-1], UE_template->phr_info, tx_power, bytes_to_schedule); + LOG_D(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d snr %d snr_inst %d mcs %d mcs_offset %d bler %lf total_bler %lf ( %d %d ) rb_num %d phr_info %d tx_power %d bsr %d estimated_ul_buffer %d scheduled_ul_bytes %d\n", + module_idP,frameP,subframeP,UE_id,UE_RNTI(CC_id,UE_id),CC_id, snr, UE_list->UE_sched_ctrl[UE_id].pusch_snr[CC_id], mcs, UE_list->UE_sched_ctrl[UE_id].mcs_offset[CC_id], UE_list->UE_sched_ctrl[UE_id].pusch_bler[CC_id], + total_bler, UE_list->UE_sched_ctrl[UE_id].pusch_rx_num[CC_id], UE_list->UE_sched_ctrl[UE_id].pusch_rx_error_num[CC_id], rb_table[rb_table_index-1], UE_template->phr_info, tx_power, bytes_to_schedule, UE_template->estimated_ul_buffer, UE_template->scheduled_ul_bytes); } else { if (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED) { @@ -3140,7 +3130,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, //power control //compute the expected ULSCH RX power (for the stats) // this is the normalized RX power and this should be constant (regardless of mcs - snr = (5 * UE_sched_ctrl->pusch_snr_avg[CC_id] - 640) / 10; + snr = UE_sched_ctrl->pusch_snr_avg[CC_id]; target_snr = eNB->puSch10xSnr / 10; // this assumes accumulated tpc // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out @@ -3265,7 +3255,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, nfapi_hi_dci0_req->sfn_sf = frameP<<4|subframeP; // sfnsf_add_subframe(sched_frame, sched_subframeP, 0); // sunday! nfapi_hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d mcs %d first_rb %d num_rb %d round %d mcs %d sinr %d bler %lf\n", - harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,UE_template->mcs_UL[harq_pid],first_rb[CC_id],rb_table[rb_table_index],0,UE_template->mcs_UL[harq_pid],(5 * UE_sched_ctrl->pusch_snr_amc[CC_id] - 640) / 10,UE_sched_ctrl->pusch_bler[CC_id]); + harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,UE_template->mcs_UL[harq_pid],first_rb[CC_id],rb_table[rb_table_index],0,UE_template->mcs_UL[harq_pid],UE_sched_ctrl->pusch_snr_avg[CC_id],UE_sched_ctrl->pusch_bler[CC_id]); ul_req_index = 0; dlsch_flag = 0; @@ -3415,7 +3405,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, hi_dci0_req->number_of_dci++; // Add UL_config PDUs LOG_D(MAC,"[PUSCH %d] Frame %d, Subframe %d: Adding UL CONFIG.Request for UE %d/%x, ulsch_frame %d, ulsch_subframe %d mcs %d first_rb %d num_rb %d round %d mcs %d sinr %d bler %lf\n", - harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,mcs_rv,ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb,ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb,UE_sched_ctrl->round_UL[CC_id][harq_pid],UE_template->mcs_UL[harq_pid],(5 * UE_sched_ctrl->pusch_snr_amc[CC_id] - 640) / 10,UE_sched_ctrl->pusch_bler[CC_id]); + harq_pid,frameP,subframeP,UE_id,rnti,sched_frame,sched_subframeP,mcs_rv,ulsch_ue_select[CC_id].list[ulsch_ue_num].start_rb,ulsch_ue_select[CC_id].list[ulsch_ue_num].nb_rb,UE_sched_ctrl->round_UL[CC_id][harq_pid],UE_template->mcs_UL[harq_pid],UE_sched_ctrl->pusch_snr_avg[CC_id],UE_sched_ctrl->pusch_bler[CC_id]); ul_req_index = 0; dlsch_flag = 0; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c index 689db8e208..8bd3ebdd9b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c @@ -238,7 +238,8 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s //power control //compute the expected ULSCH RX power (for the stats) // this is the snr and this should be constant (regardless of mcs) - snr = (5 * UE_sched_ctrl->pusch_snr[CC_id] - 640) / 10; + snr = UE_sched_ctrl->pusch_snr[CC_id]; + // new transmission ndi = 1-UE_template->oldNDI_UL[harq_pid]; UE_template->oldNDI_UL[harq_pid]=ndi; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 82b640e7d0..f7bdc634cc 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -2217,8 +2217,8 @@ add_new_ue(module_id_t mod_idP, UE_info->UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0; UE_info->UE_sched_ctrl[UE_id].ta_update = 31; UE_info->UE_sched_ctrl[UE_id].pusch_snr[cc_idP] = 0; - UE_info->UE_sched_ctrl[UE_id].pusch_snr_avg[cc_idP] = 0; - UE_info->UE_sched_ctrl[UE_id].pusch_snr_amc[cc_idP] = 0; + UE_info->UE_sched_ctrl[UE_id].pusch_cqi[cc_idP] = (eNB->puSch10xSnr+640)/5; + UE_info->UE_sched_ctrl[UE_id].pusch_snr_avg[cc_idP] = eNB->puSch10xSnr/10; UE_info->UE_sched_ctrl[UE_id].pusch_rx_num[cc_idP] = 0; UE_info->UE_sched_ctrl[UE_id].pusch_rx_num_old[cc_idP] = 0; UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num[cc_idP] = 0; @@ -5173,7 +5173,7 @@ harq_indication(module_id_t mod_idP, /* don't care about cqi reporting if NACK/DTX is there */ if (channel == 0 && !nack_or_dtx_reported(cc, harq_pdu)) { - sched_ctl->pucch1_snr[CC_idP] = ul_cqi; + sched_ctl->pucch1_snr[CC_idP] = (5 * ul_cqi - 640) / 10; sched_ctl->pucch1_cqi_update[CC_idP] = 1; } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index ee9e002803..403680e1b0 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -168,22 +168,16 @@ rx_sdu(const module_id_t enb_mod_idP, * maybe it's even not correct at all? */ UE_scheduling_control->ta_update = (UE_scheduling_control->ta_update * 3 + timing_advance) / 4; - UE_scheduling_control->pusch_snr[CC_idP] = ul_cqi; + UE_scheduling_control->pusch_snr[CC_idP] = (5 * ul_cqi - 640) / 10; - double snr_filter_tpc=0.75; - if(UE_scheduling_control->pusch_snr_avg[CC_idP] == 0) { - UE_scheduling_control->pusch_snr_avg[CC_idP] = ul_cqi; - } - else { - UE_scheduling_control->pusch_snr_avg[CC_idP] = (int)((double)UE_scheduling_control->pusch_snr_avg[CC_idP] * snr_filter_tpc + (double)ul_cqi * (1-snr_filter_tpc)); - } - - double snr_filter_amc=0.5; - if(UE_scheduling_control->pusch_snr_amc[CC_idP] == 0) { - UE_scheduling_control->pusch_snr_amc[CC_idP] = ul_cqi; - } - else { - UE_scheduling_control->pusch_snr_amc[CC_idP] = (int)((double)UE_scheduling_control->pusch_snr_amc[CC_idP] * snr_filter_amc + (double)ul_cqi * (1-snr_filter_amc)); + if(UE_scheduling_control->pusch_snr[CC_idP] > 0 || UE_scheduling_control->pusch_snr[CC_idP] < 63) { + double snr_filter_tpc=0.9; + int snr_thres_tpc=30; + int diff = UE_scheduling_control->pusch_snr_avg[CC_idP] - UE_scheduling_control->pusch_snr[CC_idP]; + if(abs(diff) < snr_thres_tpc) { + UE_scheduling_control->pusch_cqi[CC_idP] = (int)((double)UE_scheduling_control->pusch_cqi[CC_idP] * snr_filter_tpc + (double)ul_cqi * (1-snr_filter_tpc)); + UE_scheduling_control->pusch_snr_avg[CC_idP] = (5 * UE_scheduling_control->pusch_cqi[CC_idP] - 640) / 10; + } } UE_scheduling_control->ul_consecutive_errors = 0; @@ -2013,7 +2007,7 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP, cqi_req = 0; /* Power control: compute the expected ULSCH RX snr (for the stats) */ /* This is the normalized snr and this should be constant (regardless of mcs) */ - snr = (5 * UE_sched_ctrl->pusch_snr_avg[CC_id] - 640) / 10; + snr = UE_sched_ctrl->pusch_snr_avg[CC_id]; target_snr = eNB->puSch10xSnr / 10; /* TODO: target_rx_power was 178, what to put? */ /* This assumes accumulated tpc */ /* Make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out */ diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index 09edd00a80..3ba4506fe7 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -965,9 +965,9 @@ typedef struct { uint8_t pucch2_snr[NFAPI_CC_MAX]; uint8_t pucch3_cqi_update[NFAPI_CC_MAX]; uint8_t pucch3_snr[NFAPI_CC_MAX]; + uint8_t pusch_cqi[NFAPI_CC_MAX]; uint8_t pusch_snr[NFAPI_CC_MAX]; uint8_t pusch_snr_avg[NFAPI_CC_MAX]; - uint8_t pusch_snr_amc[NFAPI_CC_MAX]; uint64_t pusch_rx_num[NFAPI_CC_MAX]; uint64_t pusch_rx_num_old[NFAPI_CC_MAX]; uint64_t pusch_rx_error_num[NFAPI_CC_MAX]; From 179775b72cf00c332526e643e35cd8e7c6dd5789 Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Wed, 4 Mar 2020 19:30:34 +0900 Subject: [PATCH 047/160] Temporary: change tpc filter. (cherry picked from commit d82fc4805ef9032c9bfd9705fef702a6e130f7b2) # Conflicts: # openair2/LAYER2/MAC/eNB_scheduler_fairRR.c --- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 2 +- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 8dc7c36b8c..4d37495a43 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -3135,7 +3135,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, // this assumes accumulated tpc // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out int32_t framex10psubframe = UE_template->pusch_tpc_tx_frame*10+UE_template->pusch_tpc_tx_subframe; - int pusch_tpc_interval=10; + int pusch_tpc_interval=500; if (((framex10psubframe+pusch_tpc_interval)<=(frameP*10+subframeP)) || //normal case ((framex10psubframe>(frameP*10+subframeP)) && (((10240-framex10psubframe+frameP*10+subframeP)>=pusch_tpc_interval)))) { //frame wrap-around diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 403680e1b0..b4d7d7bbef 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -171,7 +171,7 @@ rx_sdu(const module_id_t enb_mod_idP, UE_scheduling_control->pusch_snr[CC_idP] = (5 * ul_cqi - 640) / 10; if(UE_scheduling_control->pusch_snr[CC_idP] > 0 || UE_scheduling_control->pusch_snr[CC_idP] < 63) { - double snr_filter_tpc=0.9; + double snr_filter_tpc=0.7; int snr_thres_tpc=30; int diff = UE_scheduling_control->pusch_snr_avg[CC_idP] - UE_scheduling_control->pusch_snr[CC_idP]; if(abs(diff) < snr_thres_tpc) { From 4cce76382af810575cc2d22aec2b905974db871f Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Mon, 23 Mar 2020 13:45:57 +0900 Subject: [PATCH 048/160] Fix assertion in ulsch dem (cherry picked from commit dcd188e961422194c9c85636ea7c74ca0cc5101d) --- openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c index 62fabc87af..468cb77ec9 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c @@ -1064,11 +1064,12 @@ void rx_ulsch(PHY_VARS_eNB *eNB, if (deltaMCS==1) { // Note we're using TBS instead of sumKr, since didn't run segmentation yet! MPR_times_100Ks = 500*ulsch[UE_id]->harq_processes[harq_pid]->TBS/(ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12*4*ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch); - AssertFatal(MPR_times_100Ks < 750 && MPR_times_100Ks >= 0,"Impossible value for MPR_times_100Ks %d (TBS %d,Nre %d)\n", - MPR_times_100Ks,ulsch[UE_id]->harq_processes[harq_pid]->TBS, - (ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12*4*ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch)); - if (MPR_times_100Ks > 0) correction_factor = ulsch_power_LUT[MPR_times_100Ks]; + if ((MPR_times_100Ks > 0)&&(MPR_times_100Ks < 750)){ + correction_factor = ulsch_power_LUT[MPR_times_100Ks]; + }else{ + correction_factor = 1; + } } for (i=0; inb_antennas_rx; i++) { From 934cc715f8568578b64d39977b58993c344edb95 Mon Sep 17 00:00:00 2001 From: Kuroiwa Kenichi Date: Tue, 17 Mar 2020 21:00:48 +0900 Subject: [PATCH 049/160] Initialize scheduled_ul_bytes (cherry picked from commit b0d6c5150db520bd7840d1604c3f82a0b59bc218) --- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 5 ++++- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 4d37495a43..00bcaf6032 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -2458,7 +2458,10 @@ void ulsch_scheduler_pre_ue_select_fairRR( UE_sched_ctl = &UE_info->UE_sched_ctrl[UE_id]; int bytes_to_schedule = UE_info->UE_template[CC_id][UE_id].estimated_ul_buffer - UE_info->UE_template[CC_id][UE_id].scheduled_ul_bytes; - if (bytes_to_schedule < 0) bytes_to_schedule = 0; + if (bytes_to_schedule < 0) { + bytes_to_schedule = 0; + UE_list->UE_template[CC_id][UE_id].scheduled_ul_bytes = 0; + } rrc_status = mac_eNB_get_rrc_status(module_idP, rnti); if ( (bytes_to_schedule > 0) || (UE_info->UE_template[CC_id][UE_id].ul_SR > 0) || diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index b4d7d7bbef..9116608037 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -553,6 +553,8 @@ rx_sdu(const module_id_t enb_mod_idP, UE_template_ptr->ul_buffer_info[LCGID1] + UE_template_ptr->ul_buffer_info[LCGID2] + UE_template_ptr->ul_buffer_info[LCGID3]; + UE_template_ptr->scheduled_ul_bytes = 0; + RC.eNB[enb_mod_idP][CC_idP]->pusch_stats_bsr[UE_id][(frameP * 10) + subframeP] = (payload_ptr[0] & 0x3f); if (UE_id == UE_info->list.head) { @@ -598,6 +600,8 @@ rx_sdu(const module_id_t enb_mod_idP, UE_template_ptr->ul_buffer_info[LCGID1] + UE_template_ptr->ul_buffer_info[LCGID2] + UE_template_ptr->ul_buffer_info[LCGID3]; + UE_template_ptr->scheduled_ul_bytes = 0; + LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d: Received long BSR. Size is LCGID0 = %u LCGID1 = %u LCGID2 = %u LCGID3 = %u\n", enb_mod_idP, CC_idP, @@ -794,6 +798,9 @@ rx_sdu(const module_id_t enb_mod_idP, UE_template_ptr->ul_buffer_info[1] + UE_template_ptr->ul_buffer_info[2] + UE_template_ptr->ul_buffer_info[3]; + if (UE_template_ptr->estimated_ul_buffer == 0) { + UE_template_ptr->scheduled_ul_bytes = 0; + } //UE_template_ptr->estimated_ul_buffer += UE_template_ptr->estimated_ul_buffer / 4; } @@ -859,6 +866,9 @@ rx_sdu(const module_id_t enb_mod_idP, UE_template_ptr->ul_buffer_info[1] + UE_template_ptr->ul_buffer_info[2] + UE_template_ptr->ul_buffer_info[3]; + if (UE_template_ptr->estimated_ul_buffer == 0) { + UE_template_ptr->scheduled_ul_bytes = 0; + } } if ((rx_lengths[i] < SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0)) { // MAX SIZE OF transport block From 7a89100a9f10f7361dfdb9d74a64a07ebaa21a1b Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Thu, 5 Mar 2020 13:02:26 +0900 Subject: [PATCH 050/160] fix compilation. --- openair2/LAYER2/MAC/eNB_scheduler_primitives.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index f7bdc634cc..c8904ef9a3 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -2217,8 +2217,8 @@ add_new_ue(module_id_t mod_idP, UE_info->UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0; UE_info->UE_sched_ctrl[UE_id].ta_update = 31; UE_info->UE_sched_ctrl[UE_id].pusch_snr[cc_idP] = 0; - UE_info->UE_sched_ctrl[UE_id].pusch_cqi[cc_idP] = (eNB->puSch10xSnr+640)/5; - UE_info->UE_sched_ctrl[UE_id].pusch_snr_avg[cc_idP] = eNB->puSch10xSnr/10; + UE_info->UE_sched_ctrl[UE_id].pusch_cqi[cc_idP] = (RC.mac[mod_idP]->puSch10xSnr+640)/5; + UE_info->UE_sched_ctrl[UE_id].pusch_snr_avg[cc_idP] = RC.mac[mod_idP]->puSch10xSnr/10; UE_info->UE_sched_ctrl[UE_id].pusch_rx_num[cc_idP] = 0; UE_info->UE_sched_ctrl[UE_id].pusch_rx_num_old[cc_idP] = 0; UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num[cc_idP] = 0; From 80f83843f04b390825d3c298970f956e51924bfc Mon Sep 17 00:00:00 2001 From: Kuroiwa Kenichi Date: Thu, 19 Mar 2020 18:47:35 +0900 Subject: [PATCH 051/160] Initialize scheduled_ul_bytes (cherry picked from commit 4a18e26f8c1dfb80a5af2fac4104b06b648a598c) --- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 00bcaf6032..5072f9df06 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -2332,7 +2332,10 @@ void ulsch_scheduler_pre_ue_select_fairRR( // int bytes_to_schedule = UE_info->UE_template[CC_id][UE_id].estimated_ul_buffer - UE_info->UE_template[CC_id][UE_id].scheduled_ul_bytes; - if (bytes_to_schedule < 0) bytes_to_schedule = 0; + if (bytes_to_schedule < 0) { + bytes_to_schedule = 0; + UE_list->UE_template[CC_id][UE_id].scheduled_ul_bytes = 0; + } if ( UE_id > last_ulsch_ue_id[CC_id] && ((ulsch_ue_select[CC_id].ue_num+ue_first_num[CC_id]) < ulsch_ue_max_num[CC_id]) ) { if ( bytes_to_schedule > 0 ) { @@ -2724,7 +2727,10 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_FIRST ) { int bytes_to_schedule = UE_template->estimated_ul_buffer - UE_template->scheduled_ul_bytes; - if (bytes_to_schedule < 0) bytes_to_schedule = 0; + if (bytes_to_schedule < 0) { + bytes_to_schedule = 0; + UE_template->scheduled_ul_bytes = 0; + } if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ul_total_buffer > 0 ) { rb_table_index = 2; @@ -3088,7 +3094,10 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, module_idP,frameP,subframeP,harq_pid,UE_id,rnti,CC_id, aggregation,N_RB_UL); int bytes_to_schedule = UE_template->estimated_ul_buffer - UE_template->scheduled_ul_bytes; - if (bytes_to_schedule < 0) bytes_to_schedule = 0; + if (bytes_to_schedule < 0) { + bytes_to_schedule = 0; + UE_template->scheduled_ul_bytes = 0; + } RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP] = bytes_to_schedule; VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BO,RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP]); From 76998f7d755521d30e16a81fd06fabea9ed279a0 Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Wed, 18 Mar 2020 13:24:28 +0900 Subject: [PATCH 052/160] Fix: signal_power and interference_power issue from DRS. SHA-1: 9bb7664a234535b01518977440b3c4f3d14a8ee3 SHA-1: c299d006d833e8ffc6c01039feaeda2e7b1598cc --- openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c index 468cb77ec9..87651251c8 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c @@ -1073,10 +1073,17 @@ void rx_ulsch(PHY_VARS_eNB *eNB, } for (i=0; inb_antennas_rx; i++) { + //symbol 3 + int symbol_offset = frame_parms->N_RB_UL*12*(3 - frame_parms->Ncp); + pusch_vars->ulsch_interference_power[i] = interference_power(&pusch_vars->drs_ch_estimates[i][symbol_offset],ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12); + pusch_vars->ulsch_power[i] = signal_power(&pusch_vars->drs_ch_estimates[i][symbol_offset],ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12); + //symbol 3+7 + symbol_offset = frame_parms->N_RB_UL*12*((3 - frame_parms->Ncp)+(7-frame_parms->Ncp)); + pusch_vars->ulsch_interference_power[i] += interference_power(&pusch_vars->drs_ch_estimates[i][symbol_offset],ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12); + pusch_vars->ulsch_power[i] += signal_power(&pusch_vars->drs_ch_estimates[i][symbol_offset],ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12); - - pusch_vars->ulsch_interference_power[i] = interference_power(pusch_vars->drs_ch_estimates[i],ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)/correction_factor; - pusch_vars->ulsch_power[i] = signal_power(pusch_vars->drs_ch_estimates[i],ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)/correction_factor; + pusch_vars->ulsch_interference_power[i] = pusch_vars->ulsch_interference_power[i]/correction_factor; + pusch_vars->ulsch_power[i] = pusch_vars->ulsch_power[i]/correction_factor; if(pusch_vars->ulsch_power[i]>0x20000000){ pusch_vars->ulsch_power[i] = 0x20000000; From 6103d9ec551a57f34a6e5ba71359d77d5a90c263 Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Fri, 27 Mar 2020 21:17:12 +0900 Subject: [PATCH 053/160] Fix: calculate signal_power and interference_power per symbol from DMRS. --- openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c index 87651251c8..7a600c536e 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c @@ -1081,7 +1081,10 @@ void rx_ulsch(PHY_VARS_eNB *eNB, symbol_offset = frame_parms->N_RB_UL*12*((3 - frame_parms->Ncp)+(7-frame_parms->Ncp)); pusch_vars->ulsch_interference_power[i] += interference_power(&pusch_vars->drs_ch_estimates[i][symbol_offset],ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12); pusch_vars->ulsch_power[i] += signal_power(&pusch_vars->drs_ch_estimates[i][symbol_offset],ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12); - + //ave + pusch_vars->ulsch_interference_power[i] >>= 1; + pusch_vars->ulsch_power[i] >>= 1; + pusch_vars->ulsch_interference_power[i] = pusch_vars->ulsch_interference_power[i]/correction_factor; pusch_vars->ulsch_power[i] = pusch_vars->ulsch_power[i]/correction_factor; From d00297aeb96f55c82b252b71f3cccd71293b87c6 Mon Sep 17 00:00:00 2001 From: zhenghuangkun Date: Mon, 20 Apr 2020 12:34:24 +0900 Subject: [PATCH 054/160] Modify UL timer and CQI timer to 64 subframe --- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 5072f9df06..c891fa83d3 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -2355,9 +2355,9 @@ void ulsch_scheduler_pre_ue_select_fairRR( UE_sched_ctl = &UE_info->UE_sched_ctrl[UE_id]; rrc_status = mac_eNB_get_rrc_status(module_idP, rnti); - if ( ((UE_sched_ctl->ul_inactivity_timer>20)&&(UE_sched_ctl->ul_scheduled==0)) || + if ( ((UE_sched_ctl->ul_inactivity_timer>64)&&(UE_sched_ctl->ul_scheduled==0)) || ((UE_sched_ctl->ul_inactivity_timer>10)&&(UE_sched_ctl->ul_scheduled==0)&&(rrc_status < RRC_CONNECTED)) || - ((UE_sched_ctl->cqi_req_timer>300)&&((rrc_status >= RRC_CONNECTED))) ) { + ((UE_sched_ctl->cqi_req_timer>64)&&((rrc_status >= RRC_CONNECTED))) ) { first_ue_id[CC_id][ue_first_num[CC_id]]= UE_id; first_ue_total[CC_id] [ue_first_num[CC_id]] = 0; ue_first_num[CC_id]++; @@ -2468,9 +2468,9 @@ void ulsch_scheduler_pre_ue_select_fairRR( rrc_status = mac_eNB_get_rrc_status(module_idP, rnti); if ( (bytes_to_schedule > 0) || (UE_info->UE_template[CC_id][UE_id].ul_SR > 0) || - ((UE_sched_ctl->ul_inactivity_timer>20)&&(UE_sched_ctl->ul_scheduled==0)) || + ((UE_sched_ctl->ul_inactivity_timer>64)&&(UE_sched_ctl->ul_scheduled==0)) || ((UE_sched_ctl->ul_inactivity_timer>10)&&(UE_sched_ctl->ul_scheduled==0)&&(rrc_status < RRC_CONNECTED)) || - ((UE_sched_ctl->cqi_req_timer>300)&&((rrc_status >= RRC_CONNECTED))) ) { + ((UE_sched_ctl->cqi_req_timer>64)&&((rrc_status >= RRC_CONNECTED))) ) { hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi]; format_flag = 2; aggregation=get_aggregation(get_bw_index(module_idP,CC_id),UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0); From df5e22efeeac9d7721efac562e2ca35ba1b75e4c Mon Sep 17 00:00:00 2001 From: zhenghuangkun Date: Mon, 20 Apr 2020 16:33:54 +0900 Subject: [PATCH 055/160] Modify CQI timer to 64 subframe --- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index c891fa83d3..e6ea56d629 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -3111,7 +3111,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, UE_sched_ctrl->cqi_received = 0; UE_sched_ctrl->cqi_req_timer = 0; cqi_req = 0; - }else if (UE_sched_ctrl->cqi_req_timer>30) { + }else if (UE_sched_ctrl->cqi_req_timer>64) { cqi_req = 1; // To be safe , do not ask CQI in special SFs:36.213/7.2.3 CQI definition From 548eaae610a32fb6d5a7c1c91f88339dc5623082 Mon Sep 17 00:00:00 2001 From: Ding Yumei Date: Wed, 13 May 2020 12:34:23 +0900 Subject: [PATCH 056/160] fix Msg3 PHICH issue and C-RNTI DRB active issue --- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 10 +++++----- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 17 +++++++++++++++++ openair2/RRC/LTE/rrc_eNB.c | 6 ++++++ 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index d1365b9ac3..35082260f8 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -212,12 +212,12 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t *ra, frame_t frameP, hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP, subframeP, sf_ahead_dl); hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; - if (NFAPI_MODE != NFAPI_MONOLITHIC) { - oai_nfapi_hi_dci0_req(hi_dci0_req); - hi_dci0_req_body->number_of_hi=0; - } + //if (NFAPI_MODE != NFAPI_MONOLITHIC) { + // oai_nfapi_hi_dci0_req(hi_dci0_req); + // hi_dci0_req_body->number_of_hi=0; + //} - LOG_D(MAC, "MSG3: HI_DCI0 SFN/SF:%d number_of_dci:%d number_of_hi:%d\n", NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req_body->number_of_dci, hi_dci0_req_body->number_of_hi); + //LOG_D(MAC, "MSG3: HI_DCI0 SFN/SF:%d number_of_dci:%d number_of_hi:%d\n", NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req_body->number_of_dci, hi_dci0_req_body->number_of_hi); // save UL scheduling information for preprocessor for (j = 0; j < ra->msg3_nb_rb; j++) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 9116608037..da2843161a 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -312,6 +312,23 @@ rx_sdu(const module_id_t enb_mod_idP, if (ra->msg3_round >= mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx - 1) { cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); + nfapi_hi_dci0_request_t *hi_dci0_req = NULL; + uint8_t sf_ahead_dl = ul_subframe2_k_phich(&mac->common_channels[CC_idP], subframeP); + hi_dci0_req = &mac->HI_DCI0_req[CC_idP][(subframeP + sf_ahead_dl) % 10]; + nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body; + nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi]; + memset((void *) hi_dci0_pdu, 0, sizeof(nfapi_hi_dci0_request_pdu_t)); + hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_HI_PDU_TYPE; + hi_dci0_pdu->pdu_size = 2 + sizeof(nfapi_hi_dci0_hi_pdu); + hi_dci0_pdu->hi_pdu.hi_pdu_rel8.tl.tag = NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG; + hi_dci0_pdu->hi_pdu.hi_pdu_rel8.resource_block_start = first_rb; + hi_dci0_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms = 0; + hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value = 0; + hi_dci0_req_body->number_of_hi++; + hi_dci0_req_body->sfnsf = sfnsf_add_subframe(frameP, subframeP, 0); + hi_dci0_req_body->tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG; + hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP, subframeP, sf_ahead_dl); + hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; } else { if (ra->rach_resource_type > 0) { cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); // TODO: Currently we don't support retransmission of Msg3 ( If in error Cancel RA procedure and reattach) diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 18b7173a08..937f3c8f46 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -6711,6 +6711,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( ); } } else { // remove LCHAN from MAC/PHY +#if 0 if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { // DRB has just been removed so remove RLC + PDCP for DRB /* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE, @@ -6727,6 +6728,11 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( } ue_context_pP->ue_context.DRB_active[drb_id] = 0; +#endif + if (DRB_configList->list.array[i]->logicalChannelIdentity) { + DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity; + } + LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); From fbd0156a8f743e2ebb8775d6f59c0ccb8d4d9134 Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Wed, 20 May 2020 15:36:15 +0900 Subject: [PATCH 057/160] Add pusch signal threshold to config file. (cherry picked from commit 6f3d14e74663e75f2eaf3cd1c1348d5d028e3379) --- openair1/PHY/defs_eNB.h | 1 + openair1/SCHED/phy_procedures_lte_eNb.c | 2 +- openair2/ENB_APP/L1_paramdef.h | 5 ++++- openair2/ENB_APP/enb_config.c | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h index b3f7e1ef70..3505733ecb 100644 --- a/openair1/PHY/defs_eNB.h +++ b/openair1/PHY/defs_eNB.h @@ -667,6 +667,7 @@ typedef struct PHY_VARS_eNB_s { int32_t pusch_stats_bsr[NUMBER_OF_UE_MAX][10240]; int32_t pusch_stats_BO[NUMBER_OF_UE_MAX][10240]; uint8_t *FS6bufferZone; + int32_t pusch_signal_threshold; } PHY_VARS_eNB; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index ac31326d9c..4cc5ebc143 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1607,7 +1607,7 @@ void fill_rx_indication(PHY_VARS_eNB *eNB, // estimate UL_CQI for MAC (from antenna port 0 only) int SNRtimes10 = dB_fixed_times10(eNB->pusch_vars[UE_id]->ulsch_power[0]) - dB_fixed_times10(eNB->pusch_vars[UE_id]->ulsch_interference_power[0]); - if(dB_fixed_times10(eNB->pusch_vars[UE_id]->ulsch_power[0]) > 500) { + if(dB_fixed_times10(eNB->pusch_vars[UE_id]->ulsch_power[0]) > eNB->pusch_signal_threshold) { SNRtimes10 = 300; } diff --git a/openair2/ENB_APP/L1_paramdef.h b/openair2/ENB_APP/L1_paramdef.h index 72e77c3800..6c303ae29f 100644 --- a/openair2/ENB_APP/L1_paramdef.h +++ b/openair2/ENB_APP/L1_paramdef.h @@ -61,6 +61,7 @@ #define CONFIG_STRING_L1_PRACH_DTX_EMTC3_THRESHOLD "prach_dtx_emtc3_threshold" #define CONFIG_STRING_L1_PUCCH1_DTX_EMTC3_THRESHOLD "pucch1_dtx_emtc3_threshold" #define CONFIG_STRING_L1_PUCCH1AB_DTX_EMTC3_THRESHOLD "pucch1ab_dtx_emtc3_threshold" +#define CONFIG_STRING_L1_PUSCH_SIGNAL_THRESHOLD "pusch_signal_threshold" /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /* L1 configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -89,7 +90,8 @@ {CONFIG_STRING_L1_PUCCH1AB_DTX_EMTC2_THRESHOLD, NULL, 0, iptr:NULL, defintval:4, TYPE_INT, 0}, \ {CONFIG_STRING_L1_PRACH_DTX_EMTC3_THRESHOLD, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \ {CONFIG_STRING_L1_PUCCH1_DTX_EMTC3_THRESHOLD, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ - {CONFIG_STRING_L1_PUCCH1AB_DTX_EMTC3_THRESHOLD, NULL, 0, iptr:NULL, defintval:4, TYPE_INT, 0} \ +{CONFIG_STRING_L1_PUCCH1AB_DTX_EMTC3_THRESHOLD, NULL, 0, iptr:NULL, defintval:4, TYPE_INT, 0}, \ +{CONFIG_STRING_L1_PUSCH_SIGNAL_THRESHOLD, NULL, 0, iptr:NULL, defintval:330, TYPE_INT, 0} \ } #define L1_CC_IDX 0 #define L1_TRANSPORT_N_PREFERENCE_IDX 1 @@ -115,6 +117,7 @@ #define L1_PRACH_DTX_EMTC3_THRESHOLD_IDX 21 #define L1_PUCCH1_DTX_EMTC3_THRESHOLD_IDX 22 #define L1_PUCCH1AB_DTX_EMTC3_THRESHOLD_IDX 23 +#define L1_PUSCH_SIGNAL_THRESHOLD_IDX 28 /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ #endif diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index de77d783c7..978c2b9f23 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -170,6 +170,10 @@ void RCconfig_L1(void) { RC.eNB[j][0]->pucch1_DTX_threshold_emtc[ce_level] = *(L1_ParamList.paramarray[j][L1_PUCCH1_DTX_EMTC0_THRESHOLD_IDX+ce_level].iptr); RC.eNB[j][0]->pucch1ab_DTX_threshold_emtc[ce_level] = *(L1_ParamList.paramarray[j][L1_PUCCH1AB_DTX_EMTC0_THRESHOLD_IDX+ce_level].iptr); } + + + RC.eNB[j][0]->pusch_signal_threshold = *(L1_ParamList.paramarray[j][L1_PUSCH_SIGNAL_THRESHOLD_IDX].iptr); + LOG_I(ENB_APP,"PUSCH singal threshold = %d \n",RC.eNB[j][0]->pusch_signal_threshold); }// j=0..num_inst LOG_I(ENB_APP,"Initializing northbound interface for L1\n"); From 9ad810bab4292d4c92679a6d607f612b67be51be Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Wed, 20 May 2020 15:42:11 +0900 Subject: [PATCH 058/160] Fix ul_cqi and tpc filtering. (cherry picked from commit 120ea0950e1f52c1c5dd1d0dd4f7080e66d7ee93) --- openair2/LAYER2/MAC/defs.h | 2 ++ openair2/LAYER2/MAC/eNB_scheduler_dlsch.c | 2 ++ openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 1 + openair2/LAYER2/MAC/eNB_scheduler_primitives.c | 6 ++++-- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 6 ++++-- openair2/LAYER2/MAC/mac.h | 2 ++ 6 files changed, 15 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index 58f50a84ea..654fb4b228 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -815,6 +815,7 @@ typedef struct { uint16_t pre_nb_available_rbs[MAX_NUM_CCs]; unsigned char rballoc_sub_UE[MAX_NUM_CCs][N_RBG_MAX]; uint16_t ta_timer; + double ta_update_f; int16_t ta_update; uint16_t ul_consecutive_errors; int32_t context_active_timer; @@ -834,6 +835,7 @@ typedef struct { uint8_t pucch2_snr[NFAPI_CC_MAX]; uint8_t pucch3_cqi_update[NFAPI_CC_MAX]; uint8_t pucch3_snr[NFAPI_CC_MAX]; + double pusch_cqi_f[NFAPI_CC_MAX]; uint8_t pusch_cqi[NFAPI_CC_MAX]; uint8_t pusch_snr[NFAPI_CC_MAX]; uint8_t pusch_snr_avg[NFAPI_CC_MAX]; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c index 455b8142d3..b516b04e03 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c @@ -821,6 +821,7 @@ schedule_ue_spec(module_id_t module_idP, /* reset ta_update */ ue_sched_ctrl->ta_update = 31; + ue_sched_ctrl->ta_update_f = 31.0; } int ta_len = (ta_update != 31) ? 2 : 0; @@ -1366,6 +1367,7 @@ schedule_ue_spec_br(module_id_t module_idP, /* Reset ta_update */ ue_sched_ctl->ta_update = 31; + ue_sched_ctl->ta_update_f = 31.0; } else { ta_update = 31; } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index e6ea56d629..ba4d27a159 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -1567,6 +1567,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP, /* reset ta_update */ ue_sched_ctl->ta_update = 31; + ue_sched_ctl->ta_update_f = 31.0; } else { ta_update = 31; } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index c8904ef9a3..0107daf3e0 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -2215,10 +2215,12 @@ add_new_ue(module_id_t mod_idP, 0, sizeof(eNB_UE_STATS)); UE_info->UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0; + UE_info->UE_sched_ctrl[UE_id].ta_update_f = 31.0; UE_info->UE_sched_ctrl[UE_id].ta_update = 31; UE_info->UE_sched_ctrl[UE_id].pusch_snr[cc_idP] = 0; - UE_info->UE_sched_ctrl[UE_id].pusch_cqi[cc_idP] = (RC.mac[mod_idP]->puSch10xSnr+640)/5; - UE_info->UE_sched_ctrl[UE_id].pusch_snr_avg[cc_idP] = RC.mac[mod_idP]->puSch10xSnr/10; + UE_info->UE_sched_ctrl[UE_id].pusch_cqi_f[cc_idP] = (eNB->puSch10xSnr+640)/5; + UE_info->UE_sched_ctrl[UE_id].pusch_cqi[cc_idP] = (eNB->puSch10xSnr+640)/5; + UE_info->UE_sched_ctrl[UE_id].pusch_snr_avg[cc_idP] = eNB->puSch10xSnr/10; UE_info->UE_sched_ctrl[UE_id].pusch_rx_num[cc_idP] = 0; UE_info->UE_sched_ctrl[UE_id].pusch_rx_num_old[cc_idP] = 0; UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num[cc_idP] = 0; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index da2843161a..eb762bbdab 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -167,7 +167,8 @@ rx_sdu(const module_id_t enb_mod_idP, * lte_est_timing_advance_pusch, maybe it's not necessary? * maybe it's even not correct at all? */ - UE_scheduling_control->ta_update = (UE_scheduling_control->ta_update * 3 + timing_advance) / 4; + UE_scheduling_control->ta_update_f = ((double)UE_scheduling_control->ta_update_f * 3 + (double)timing_advance) / 4; + UE_scheduling_control->ta_update = (int)UE_scheduling_control->ta_update_f; UE_scheduling_control->pusch_snr[CC_idP] = (5 * ul_cqi - 640) / 10; if(UE_scheduling_control->pusch_snr[CC_idP] > 0 || UE_scheduling_control->pusch_snr[CC_idP] < 63) { @@ -175,7 +176,8 @@ rx_sdu(const module_id_t enb_mod_idP, int snr_thres_tpc=30; int diff = UE_scheduling_control->pusch_snr_avg[CC_idP] - UE_scheduling_control->pusch_snr[CC_idP]; if(abs(diff) < snr_thres_tpc) { - UE_scheduling_control->pusch_cqi[CC_idP] = (int)((double)UE_scheduling_control->pusch_cqi[CC_idP] * snr_filter_tpc + (double)ul_cqi * (1-snr_filter_tpc)); + UE_scheduling_control->pusch_cqi_f[CC_idP] = ((double)UE_scheduling_control->pusch_cqi_f[CC_idP] * snr_filter_tpc + (double)ul_cqi * (1-snr_filter_tpc)); + UE_scheduling_control->pusch_cqi[CC_idP] = (int)UE_scheduling_control->pusch_cqi_f[CC_idP]; UE_scheduling_control->pusch_snr_avg[CC_idP] = (5 * UE_scheduling_control->pusch_cqi[CC_idP] - 640) / 10; } } diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index 3ba4506fe7..62346e7ef7 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -942,6 +942,7 @@ typedef struct { unsigned char rballoc_sub_UE[NFAPI_CC_MAX][N_RBG_MAX]; int pre_dci_dl_pdu_idx; uint16_t ta_timer; + double ta_update_f; int16_t ta_update; uint16_t ul_consecutive_errors; int32_t context_active_timer; @@ -965,6 +966,7 @@ typedef struct { uint8_t pucch2_snr[NFAPI_CC_MAX]; uint8_t pucch3_cqi_update[NFAPI_CC_MAX]; uint8_t pucch3_snr[NFAPI_CC_MAX]; + double pusch_cqi_f[NFAPI_CC_MAX]; uint8_t pusch_cqi[NFAPI_CC_MAX]; uint8_t pusch_snr[NFAPI_CC_MAX]; uint8_t pusch_snr_avg[NFAPI_CC_MAX]; From 029c08b9d59fdb45d91d1469789a9471b4a07676 Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Wed, 20 May 2020 18:55:14 +0900 Subject: [PATCH 059/160] Replace from dB_fixed_times10 function to dB_fixed_x10. (cherry picked from commit de93d8f0aa9e6d7380bd159901a41aa36f257298) --- openair1/PHY/LTE_TRANSPORT/prach.c | 2 +- .../PHY/LTE_TRANSPORT/ulsch_demodulation.c | 2 +- openair1/PHY/TOOLS/dB_routines.c | 315 ++++++++++++++++++ openair1/PHY/TOOLS/dB_routines.h | 1 + openair1/PHY/TOOLS/tools_defs.h | 1 + openair1/SCHED/phy_procedures_lte_common.c | 2 +- openair1/SCHED/phy_procedures_lte_eNb.c | 16 +- 7 files changed, 328 insertions(+), 11 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index d3ed2ed439..3a4dbdfa18 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -625,7 +625,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, for (i=0; i*max_preamble_energy) { *max_preamble_energy = levdB; diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c index 7a600c536e..f1279ddc2c 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c @@ -1097,7 +1097,7 @@ void rx_ulsch(PHY_VARS_eNB *eNB, if(pusch_vars->ulsch_interference_power[i]<1)pusch_vars->ulsch_interference_power[i] = 1; } - LOG_D(PHY,"%4.4d.%d power harq_pid %d rb %2.2d TBS %2.2d (MPR_times_Ks %d correction %d) power %d dBtimes10\n", proc->frame_rx, proc->subframe_rx, harq_pid, ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, ulsch[UE_id]->harq_processes[harq_pid]->TBS,MPR_times_100Ks,correction_factor,dB_fixed_times10(pusch_vars->ulsch_power[i])); + LOG_D(PHY,"%4.4d.%d power harq_pid %d rb %2.2d TBS %2.2d (MPR_times_Ks %d correction %d) power %d dBtimes10\n", proc->frame_rx, proc->subframe_rx, harq_pid, ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, ulsch[UE_id]->harq_processes[harq_pid]->TBS,MPR_times_100Ks,correction_factor,dB_fixed_x10(pusch_vars->ulsch_power[i])); } diff --git a/openair1/PHY/TOOLS/dB_routines.c b/openair1/PHY/TOOLS/dB_routines.c index ed5c96a8c3..1b743695f6 100644 --- a/openair1/PHY/TOOLS/dB_routines.c +++ b/openair1/PHY/TOOLS/dB_routines.c @@ -540,6 +540,289 @@ int16_t dB_table_times10[256] = { 240, 240 }; + + +uint32_t bit_seach_mask[32] = { + 0x80000000, 0x40000000, 0x20000000, 0x10000000, + 0x08000000, 0x04000000, 0x02000000, 0x01000000, + 0x00800000, 0x00400000, 0x00200000, 0x00100000, + 0x00080000, 0x00040000, 0x00020000, 0x00010000, + 0x00008000, 0x00004000, 0x00002000, 0x00001000, + 0x00000800, 0x00000400, 0x00000200, 0x00000100, + 0x00000080, 0x00000040, 0x00000020, 0x00000010, + 0x00000008, 0x00000004, 0x00000002, 0x00000001 +}; +uint32_t bit_seach_res[32] = { + 31, 30, 29, 28, + 27, 26, 25, 24, + 23, 22, 21, 20, + 19, 18, 17, 16, + 15, 14, 13, 12, + 11, 10, 9, 8, + 7, 6, 5, 4, + 3, 2, 1, 0 +}; +uint32_t dB_fix_x10_tbl[128] = { +0 , +0 , +1 , +1 , +1 , +2 , +2 , +2 , +3 , +3 , +3 , +4 , +4 , +4 , +5 , +5 , +5 , +5 , +6 , +6 , +6 , +7 , +7 , +7 , +7 , +8 , +8 , +8 , +9 , +9 , +9 , +9 , +10 , +10 , +10 , +10 , +11 , +11 , +11 , +12 , +12 , +12 , +12 , +13 , +13 , +13 , +13 , +14 , +14 , +14 , +14 , +15 , +15 , +15 , +15 , +16 , +16 , +16 , +16 , +16 , +17 , +17 , +17 , +17 , +18 , +18 , +18 , +18 , +19 , +19 , +19 , +19 , +19 , +20 , +20 , +20 , +20 , +20 , +21 , +21 , +21 , +21 , +22 , +22 , +22 , +22 , +22 , +23 , +23 , +23 , +23 , +23 , +24 , +24 , +24 , +24 , +24 , +24 , +25 , +25 , +25 , +25 , +25 , +26 , +26 , +26 , +26 , +26 , +27 , +27 , +27 , +27 , +27 , +27 , +28 , +28 , +28 , +28 , +28 , +29 , +29 , +29 , +29 , +29 , +29 , +30 , +30 , +30 +}; +uint32_t dB_fix_x10_tbl_low[128] = { +0 , +0 , +30 , +48 , +60 , +70 , +78 , +85 , +90 , +95 , +100 , +104 , +108 , +111 , +115 , +118 , +120 , +123 , +126 , +128 , +130 , +132 , +134 , +136 , +138 , +140 , +141 , +143 , +145 , +146 , +148 , +149 , +151 , +152 , +153 , +154 , +156 , +157 , +158 , +159 , +160 , +161 , +162 , +163 , +164 , +165 , +166 , +167 , +168 , +169 , +170 , +171 , +172 , +172 , +173 , +174 , +175 , +176 , +176 , +177 , +178 , +179 , +179 , +180 , +181 , +181 , +182 , +183 , +183 , +184 , +185 , +185 , +186 , +186 , +187 , +188 , +188 , +189 , +189 , +190 , +190 , +191 , +191 , +192 , +192 , +193 , +193 , +194 , +194 , +195 , +195 , +196 , +196 , +197 , +197 , +198 , +198 , +199 , +199 , +200 , +200 , +200 , +201 , +201 , +202 , +202 , +203 , +203 , +203 , +204 , +204 , +205 , +205 , +205 , +206 , +206 , +206 , +207 , +207 , +208 , +208 , +208 , +209 , +209 , +209 , +210 , +210 , +210 +}; + /* int8_t dB_fixed(int x) { @@ -571,6 +854,38 @@ int8_t dB_fixed(int x) { } */ +int16_t dB_fixed_x10(uint32_t x) { + int16_t dB_power = 0; + + //for new algorithm + uint32_t cnt; + uint32_t Exponent; + uint32_t Mantissa; + uint32_t shift_right; + uint32_t tbl_resolution = 7; + uint32_t tbl_addr_mask; + + if (x < 128){ //OAI alogrithm + dB_power = dB_fix_x10_tbl_low[x]; + } + else { //new algorithm + tbl_addr_mask = 0x0000007Fu; // (1 << tbl_resolution) - 1;//i.e. 0x0000007F + Mantissa = 0; + Exponent = 0; + for (cnt = 0; cnt < 32; cnt++) { + if ((bit_seach_mask[cnt] & x) != 0) { + Exponent = bit_seach_res[cnt]; + Mantissa = x & (~bit_seach_mask[cnt]); + break; + } + } + shift_right = Exponent - tbl_resolution; + Mantissa = (Mantissa >> shift_right) & tbl_addr_mask; + dB_power = dB_fix_x10_tbl[Mantissa] + Exponent * 30u; + } + return dB_power; +} + int16_t dB_fixed_times10(uint32_t x) { int16_t dB_power=0; diff --git a/openair1/PHY/TOOLS/dB_routines.h b/openair1/PHY/TOOLS/dB_routines.h index c28184259f..185913cf5b 100644 --- a/openair1/PHY/TOOLS/dB_routines.h +++ b/openair1/PHY/TOOLS/dB_routines.h @@ -30,5 +30,6 @@ #define DB_ROUTINES_H_ int16_t dB_fixed_times10(uint32_t x); +int16_t dB_fixed_x10(uint32_t x); #endif /* DB_ROUTINES_H_ */ diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index 9f0a089903..12467e1fdc 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -472,6 +472,7 @@ uint8_t dB_fixed64(uint64_t x); int8_t dB_fixed2(uint32_t x,uint32_t y); int16_t dB_fixed_times10(uint32_t x); +int16_t dB_fixed_x10(uint32_t x); int32_t phy_phase_compensation_top(uint32_t pilot_type, uint32_t initial_pilot, diff --git a/openair1/SCHED/phy_procedures_lte_common.c b/openair1/SCHED/phy_procedures_lte_common.c index d162a413c1..0b592b9c55 100644 --- a/openair1/SCHED/phy_procedures_lte_common.c +++ b/openair1/SCHED/phy_procedures_lte_common.c @@ -1146,7 +1146,7 @@ int16_t estimate_ue_tx_power(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, //(beta_offset_pusch_x8=ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? ue->ulsch[eNB_id]->beta_offset_cqi_times8:8; // if deltamcs_enabledm - delta_mcs = ((hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch_x8)>>3))/100.0); + delta_mcs = ((hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_x10((beta_offset_pusch_x8)>>3))/100.0); bw_factor = (hundred_times_log10_NPRB[nb_rb-1]/100.0); #ifdef DEBUG_SEGMENTATION printf("estimated ue tx power %d (num_re %d, sumKr %d, mpr_x100 %d, delta_mcs %f, bw_factor %f)\n", diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 4cc5ebc143..fde784acfb 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -87,9 +87,9 @@ int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint16_t UE_id,uint8_t // This is the formula from Section 5.1.1.1 in 36.213 10*log10(deltaIF_PUSCH = (2^(MPR*Ks)-1)*beta_offset_pusch) if (bw_factor == 1) { uint8_t nb_rb = eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb; - return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3)) + hundred_times_log10_NPRB[nb_rb-1]; + return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_x10((beta_offset_pusch)>>3)) + hundred_times_log10_NPRB[nb_rb-1]; } else - return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch)>>3)); + return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_x10((beta_offset_pusch)>>3)); } else { return(0); } @@ -757,7 +757,7 @@ void fill_sr_indication(int UEid, PHY_VARS_eNB *eNB,uint16_t rnti,int frame,int // pdu->rx_ue_information.handle = handle; pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG; pdu->rx_ue_information.rnti = rnti; - int SNRtimes10 = dB_fixed_times10(stat) - 10 * eNB->measurements.n0_subband_power_dB[0][0]; + int SNRtimes10 = dB_fixed_x10(stat) - 10 * eNB->measurements.n0_subband_power_dB[0][0]; LOG_D(PHY,"stat %d subbandpower %d, SNRtimes10 %d\n", stat, eNB->measurements.n0_subband_power_dB[0][0], SNRtimes10); pdu->ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG; @@ -1605,9 +1605,9 @@ void fill_rx_indication(PHY_VARS_eNB *eNB, pdu->rx_indication_rel8.timing_advance = timing_advance_update; // estimate UL_CQI for MAC (from antenna port 0 only) - int SNRtimes10 = dB_fixed_times10(eNB->pusch_vars[UE_id]->ulsch_power[0]) - dB_fixed_times10(eNB->pusch_vars[UE_id]->ulsch_interference_power[0]); + int SNRtimes10 = dB_fixed_x10(eNB->pusch_vars[UE_id]->ulsch_power[0]) - dB_fixed_x10(eNB->pusch_vars[UE_id]->ulsch_interference_power[0]); - if(dB_fixed_times10(eNB->pusch_vars[UE_id]->ulsch_power[0]) > eNB->pusch_signal_threshold) { + if(dB_fixed_x10(eNB->pusch_vars[UE_id]->ulsch_power[0]) > eNB->pusch_signal_threshold) { SNRtimes10 = 300; } @@ -1618,8 +1618,8 @@ void fill_rx_indication(PHY_VARS_eNB *eNB, else pdu->rx_indication_rel8.ul_cqi = (640 + SNRtimes10) / 5; - LOG_D(PHY,"[PUSCH %d] Frame %d Subframe %d Filling RX_indication with SNR %d (%d), timing_advance %d (update %d)\n", - harq_pid,frame,subframe,SNRtimes10,pdu->rx_indication_rel8.ul_cqi,pdu->rx_indication_rel8.timing_advance, + LOG_D(PHY,"[PUSCH %d] Frame %d Subframe %d Filling RX_indication with SNR %d (%d) signal %d noise %d, timing_advance %d (update %d)\n", + harq_pid,frame,subframe,SNRtimes10,pdu->rx_indication_rel8.ul_cqi,dB_fixed_x10(eNB->pusch_vars[UE_id]->ulsch_power[0]),dB_fixed_x10(eNB->pusch_vars[UE_id]->ulsch_interference_power[0]),pdu->rx_indication_rel8.timing_advance, timing_advance_update); eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus++; eNB->UL_INFO.rx_ind.sfn_sf = frame<<4 | subframe; @@ -1923,7 +1923,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in pdu->rx_ue_information.rnti = uci->rnti; // estimate UL_CQI for MAC (from antenna port 0 only) pdu->ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG; - int SNRtimes10 = dB_fixed_times10(uci->stat) - 10 * eNB->measurements.n0_subband_power_dB[0][0]; + int SNRtimes10 = dB_fixed_x10(uci->stat) - 10 * eNB->measurements.n0_subband_power_dB[0][0]; if (SNRtimes10 < -100) LOG_I (PHY, "uci->stat %d \n", uci->stat); From 174069e26e8f37cab6f5552694c706d1f771f812 Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Thu, 28 May 2020 10:39:28 +0900 Subject: [PATCH 060/160] Fix calculation of pucch interference power. (cherry picked from commit 0622f7d40523e39334708ce4b9b0ee68e8fb2bf1) --- openair1/PHY/LTE_TRANSPORT/pucch.c | 137 ++++++++++++++++++- openair1/PHY/LTE_TRANSPORT/transport_proto.h | 6 +- openair1/PHY/defs_eNB.h | 2 + openair1/SCHED/phy_procedures_lte_eNb.c | 2 + 4 files changed, 145 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c index 8637e80137..1a3abb706e 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch.c @@ -721,6 +721,140 @@ int16_t pucchfmt3_Decode( int16_t b[48], } } + +uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, + int frame, + uint8_t subframe, + uint8_t shortened_format +) +//----------------------------------------------------------------------------- +{ + LTE_eNB_COMMON *common_vars = &eNB->common_vars; + LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; + + uint32_t u,v,n,aa; + uint32_t z[12*14]; + int16_t *zptr; + int16_t rxcomp[NB_ANTENNAS_RX][2*12*14]; + uint8_t ns,N_UL_symb,nsymb; + uint8_t c = (frame_parms->Ncp==0) ? 3 : 2; + uint16_t i,j,re_offset; + uint8_t m,l; + uint8_t n_cs,alpha_ind; + int16_t tmp_re,tmp_im,W_re=0,W_im=0; + int16_t W4_nouse[4]={1,1,-1,-1}; + int32_t interference_power; + int16_t *rxptr; + uint32_t symbol_offset; + + uint8_t deltaPUCCH_Shift = frame_parms->pucch_config_common.deltaPUCCH_Shift; + uint8_t Ncs1_div_deltaPUCCH_Shift = frame_parms->pucch_config_common.nCS_AN; + + uint32_t u0 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30; + uint32_t u1 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30; + uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1]; + uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)]; + int calc_cnt; + + if ((deltaPUCCH_Shift==0) || (deltaPUCCH_Shift>3)) { + LOG_E(PHY,"[eNB] rx_pucch: Illegal deltaPUCCH_shift %d (should be 1,2,3)\n",deltaPUCCH_Shift); + return(-1); + } + + if (Ncs1_div_deltaPUCCH_Shift > 7) { + LOG_E(PHY,"[eNB] rx_pucch: Illegal Ncs1_div_deltaPUCCH_Shift %d (should be 0...7)\n",Ncs1_div_deltaPUCCH_Shift); + return(-1); + } + + zptr = (int16_t *)z; + N_UL_symb = (frame_parms->Ncp==NORMAL) ? 7 : 6; + + interference_power=0; + calc_cnt=0; + // loop over 2 slots + for (n_cs=0; n_cs<12; n_cs++) { + for (ns=(subframe<<1),u=u0,v=v0; ns<(2+(subframe<<1)); ns++,u=u1,v=v1) { + + //loop over symbols in slot + for (l=0; l1)&&(l=N_UL_symb-2)) { // data + W_re=W4_nouse[l-N_UL_symb+4]; + W_im=0; + } + + alpha_ind=0; + // compute output sequence + + for (n=0; n<12; n++) { + + // this is r_uv^alpha(n) + tmp_re = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][n<<1] - (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)])>>15); + tmp_im = (int16_t)(((int32_t)alpha_re[alpha_ind] * ul_ref_sigs[u][v][0][1+(n<<1)] + (int32_t)alpha_im[alpha_ind] * ul_ref_sigs[u][v][0][n<<1])>>15); + + // this is S(ns)*w_noc(m)*r_uv^alpha(n) + zptr[n<<1] = (tmp_re*W_re - tmp_im*W_im)>>15; + zptr[1+(n<<1)] = -(tmp_re*W_im + tmp_im*W_re)>>15; + + alpha_ind = (alpha_ind + n_cs)%12; + } // n + + zptr+=24; + } // l + } // ns + + m = 0; + + nsymb = N_UL_symb<<1; + + zptr = (int16_t*)z; + + // Do detection + for (aa=0; aanb_antennas_rx; aa++) { + for (j=0,l=0; l1)&&((l%N_UL_symb)=N_UL_symb) && (shortened_format==1)) ){ + continue; + } + if ((l<(nsymb>>1)) && ((m&1) == 0)) + re_offset = (m*6) + frame_parms->first_carrier_offset; + else if ((l<(nsymb>>1)) && ((m&1) == 1)) + re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12; + else if ((m&1) == 0) + re_offset = frame_parms->first_carrier_offset + (frame_parms->N_RB_DL - (m>>1) - 1)*12; + else + re_offset = ((m-1)*6) + frame_parms->first_carrier_offset; + + if (re_offset > frame_parms->ofdm_symbol_size) + re_offset -= (frame_parms->ofdm_symbol_size); + + symbol_offset = (unsigned int)frame_parms->ofdm_symbol_size*l; + rxptr = (int16_t *)&common_vars->rxdataF[aa][symbol_offset]; + + for (i=0; i<12; i++,j+=2,re_offset++) { + if (re_offset==frame_parms->ofdm_symbol_size) + re_offset = 0; + + rxcomp[aa][j] = (int16_t)((rxptr[re_offset<<1]*(int32_t)zptr[j])>>15) - ((rxptr[1+(re_offset<<1)]*(int32_t)zptr[1+j])>>15); + rxcomp[aa][1+j] = (int16_t)((rxptr[re_offset<<1]*(int32_t)zptr[1+j])>>15) + ((rxptr[1+(re_offset<<1)]*(int32_t)zptr[j])>>15); + interference_power+= ((int32_t)rxcomp[aa][j]*(int32_t)rxcomp[aa][j]+(int32_t)rxcomp[aa][1+j]*(int32_t)rxcomp[aa][1+j]); + calc_cnt++; + } //re + } // symbol + } // antenna + } + calc_cnt/=12; + //printf("pucch noise %d %d %d\n",interference_power,calc_cnt,eNB->measurements.n0_subband_power_tot_dB[0]); + eNB->measurements.n0_pucch_dB = dB_fixed_x10(interference_power/calc_cnt)/10; + return 0; +} + + /* PUCCH format3 << */ uint32_t rx_pucch(PHY_VARS_eNB *eNB, @@ -740,7 +874,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, static int first_call = 1; LTE_eNB_COMMON *common_vars = &eNB->common_vars; LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; - int8_t sigma2_dB = max(eNB->measurements.n0_subband_power_tot_dB[0], eNB->measurements.n0_subband_power_tot_dB[eNB->frame_parms.N_RB_UL-1]); + int8_t sigma2_dB = eNB->measurements.n0_pucch_dB; + uint32_t u,v,n,aa; uint32_t z[12*14]; int16_t *zptr; diff --git a/openair1/PHY/LTE_TRANSPORT/transport_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_proto.h index 4ce113f78e..9e37821b05 100644 --- a/openair1/PHY/LTE_TRANSPORT/transport_proto.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_proto.h @@ -621,7 +621,11 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, uint16_t frame, uint8_t Ns); - +uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, + int frame, + uint8_t subframe, + uint8_t shortened_format +); uint32_t rx_pucch(PHY_VARS_eNB *phy_vars_eNB, PUCCH_FMT_t fmt, diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h index 3505733ecb..a79c114aa4 100644 --- a/openair1/PHY/defs_eNB.h +++ b/openair1/PHY/defs_eNB.h @@ -419,6 +419,8 @@ typedef struct { int subband_cqi_tot_dB[NUMBER_OF_UE_MAX][100]; /// PRACH background noise level int prach_I0; + /// PUCCH background noise level + int n0_pucch_dB; } PHY_MEASUREMENTS_eNB; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index fde784acfb..6ea0f84b4a 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -791,6 +791,8 @@ uci_procedures(PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci = NULL; LTE_DL_FRAME_PARMS *fp = &(eNB->frame_parms); + calc_pucch_1x_interference(eNB, frame, subframe, 0); + for (int i = 0; i < NUMBER_OF_UCI_VARS_MAX; i++) { uci = &(eNB->uci_vars[i]); From ad4a22fa0f3b708a639c2fa89965906bb6bd529f Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Mon, 1 Jun 2020 20:04:21 +0900 Subject: [PATCH 061/160] Fix PUCCH noise estimation. (cherry picked from commit 51634853671e07ef3013bc44ec79fc38c0646147) --- openair1/PHY/LTE_TRANSPORT/pucch.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c index 1a3abb706e..ef6a25e030 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch.c @@ -743,7 +743,8 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, uint8_t n_cs,alpha_ind; int16_t tmp_re,tmp_im,W_re=0,W_im=0; int16_t W4_nouse[4]={1,1,-1,-1}; - int32_t interference_power; + int32_t n0_IQ[2]; + double interference_power; int16_t *rxptr; uint32_t symbol_offset; @@ -769,7 +770,7 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, zptr = (int16_t *)z; N_UL_symb = (frame_parms->Ncp==NORMAL) ? 7 : 6; - interference_power=0; + interference_power=0.0; calc_cnt=0; // loop over 2 slots for (n_cs=0; n_cs<12; n_cs++) { @@ -778,6 +779,7 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, //loop over symbols in slot for (l=0; l1)&&(lnb_antennas_rx; aa++) { + n0_IQ[0]=0; + n0_IQ[1]=0; for (j=0,l=0; l1)&&((l%N_UL_symb)=N_UL_symb) && (shortened_format==1)) ){ + j+=24; continue; } if ((l<(nsymb>>1)) && ((m&1) == 0)) @@ -842,15 +847,17 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, rxcomp[aa][j] = (int16_t)((rxptr[re_offset<<1]*(int32_t)zptr[j])>>15) - ((rxptr[1+(re_offset<<1)]*(int32_t)zptr[1+j])>>15); rxcomp[aa][1+j] = (int16_t)((rxptr[re_offset<<1]*(int32_t)zptr[1+j])>>15) + ((rxptr[1+(re_offset<<1)]*(int32_t)zptr[j])>>15); - interference_power+= ((int32_t)rxcomp[aa][j]*(int32_t)rxcomp[aa][j]+(int32_t)rxcomp[aa][1+j]*(int32_t)rxcomp[aa][1+j]); + n0_IQ[0]+=rxcomp[aa][j]; + n0_IQ[1]+=rxcomp[aa][1+j]; calc_cnt++; } //re } // symbol + interference_power+= (int32_t)(n0_IQ[0]*n0_IQ[0]+n0_IQ[1]*n0_IQ[1]); } // antenna } - calc_cnt/=12; - //printf("pucch noise %d %d %d\n",interference_power,calc_cnt,eNB->measurements.n0_subband_power_tot_dB[0]); - eNB->measurements.n0_pucch_dB = dB_fixed_x10(interference_power/calc_cnt)/10; + interference_power /= calc_cnt; + eNB->measurements.n0_pucch_dB = dB_fixed_x10((int)(interference_power/calc_cnt))/10; + LOG_D(PHY,"estimate pucch noise %d %d %d\n",interference_power,calc_cnt,eNB->measurements.n0_pucch_dB); return 0; } From 1f54b131b5fbb428e2474aa39ccc2aa0374c8fcd Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Wed, 3 Jun 2020 14:19:48 +0900 Subject: [PATCH 062/160] Fix pucch functions. (cherry picked from commit 3bed7dc69db8dc43b28b62553f12834efbca349b) --- openair1/PHY/LTE_TRANSPORT/pucch.c | 32 +++++++++---------------- openair1/SCHED/phy_procedures_lte_eNb.c | 4 ++-- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c index ef6a25e030..cb90045da3 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch.c @@ -736,7 +736,7 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, uint32_t z[12*14]; int16_t *zptr; int16_t rxcomp[NB_ANTENNAS_RX][2*12*14]; - uint8_t ns,N_UL_symb,nsymb; + uint8_t ns,N_UL_symb,nsymb,n_cs_base; uint8_t c = (frame_parms->Ncp==0) ? 3 : 2; uint16_t i,j,re_offset; uint8_t m,l; @@ -748,36 +748,25 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, int16_t *rxptr; uint32_t symbol_offset; - uint8_t deltaPUCCH_Shift = frame_parms->pucch_config_common.deltaPUCCH_Shift; - uint8_t Ncs1_div_deltaPUCCH_Shift = frame_parms->pucch_config_common.nCS_AN; - - uint32_t u0 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30; - uint32_t u1 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30; + uint32_t u0 = (frame_parms->pucch_config_common.grouphop[subframe<<1]) % 30; + uint32_t u1 = (frame_parms->pucch_config_common.grouphop[1+(subframe<<1)]) % 30; uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1]; uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)]; int calc_cnt; - if ((deltaPUCCH_Shift==0) || (deltaPUCCH_Shift>3)) { - LOG_E(PHY,"[eNB] rx_pucch: Illegal deltaPUCCH_shift %d (should be 1,2,3)\n",deltaPUCCH_Shift); - return(-1); - } - - if (Ncs1_div_deltaPUCCH_Shift > 7) { - LOG_E(PHY,"[eNB] rx_pucch: Illegal Ncs1_div_deltaPUCCH_Shift %d (should be 0...7)\n",Ncs1_div_deltaPUCCH_Shift); - return(-1); - } - zptr = (int16_t *)z; N_UL_symb = (frame_parms->Ncp==NORMAL) ? 7 : 6; interference_power=0.0; calc_cnt=0; // loop over 2 slots - for (n_cs=0; n_cs<12; n_cs++) { + for (n_cs_base=0; n_cs_base<12; n_cs_base++) { + zptr = (int16_t *)z; for (ns=(subframe<<1),u=u0,v=v0; ns<(2+(subframe<<1)); ns++,u=u1,v=v1) { //loop over symbols in slot for (l=0; lncs_cell[ns][l]+n_cs_base; if(((l>1)&&(lpucch_config_common.deltaPUCCH_Shift; uint8_t NRB2 = frame_parms->pucch_config_common.nRB_CQI; uint8_t Ncs1_div_deltaPUCCH_Shift = frame_parms->pucch_config_common.nCS_AN; - uint32_t u0 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]) % 30; - uint32_t u1 = (frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]) % 30; + + uint32_t u0 = (frame_parms->pucch_config_common.grouphop[subframe<<1]) % 30; + uint32_t u1 = (frame_parms->pucch_config_common.grouphop[1+(subframe<<1)]) % 30; uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1]; uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)]; int chL; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 6ea0f84b4a..d2adcb8823 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -757,7 +757,7 @@ void fill_sr_indication(int UEid, PHY_VARS_eNB *eNB,uint16_t rnti,int frame,int // pdu->rx_ue_information.handle = handle; pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG; pdu->rx_ue_information.rnti = rnti; - int SNRtimes10 = dB_fixed_x10(stat) - 10 * eNB->measurements.n0_subband_power_dB[0][0]; + int SNRtimes10 = dB_fixed_x10(stat) - 10 * eNB->measurements.n0_pucch_dB; LOG_D(PHY,"stat %d subbandpower %d, SNRtimes10 %d\n", stat, eNB->measurements.n0_subband_power_dB[0][0], SNRtimes10); pdu->ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG; @@ -1925,7 +1925,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in pdu->rx_ue_information.rnti = uci->rnti; // estimate UL_CQI for MAC (from antenna port 0 only) pdu->ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG; - int SNRtimes10 = dB_fixed_x10(uci->stat) - 10 * eNB->measurements.n0_subband_power_dB[0][0]; + int SNRtimes10 = dB_fixed_x10(uci->stat) - 10 * eNB->measurements.n0_pucch_dB; if (SNRtimes10 < -100) LOG_I (PHY, "uci->stat %d \n", uci->stat); From 7eea98082798f48d50e3775377f26a5071e3e545 Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Thu, 4 Jun 2020 22:31:09 +0900 Subject: [PATCH 063/160] Fix sr detection. (cherry picked from commit 5482843b9a9dfd25abe74afb04a40c117da3bac4) --- openair1/PHY/LTE_TRANSPORT/pucch.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c index cb90045da3..edbf6c9c6e 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch.c @@ -838,9 +838,11 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, rxcomp[aa][1+j] = (int16_t)((rxptr[re_offset<<1]*(int32_t)zptr[1+j])>>15) + ((rxptr[1+(re_offset<<1)]*(int32_t)zptr[j])>>15); n0_IQ[0]+=rxcomp[aa][j]; n0_IQ[1]+=rxcomp[aa][1+j]; - calc_cnt++; } //re + calc_cnt++; } // symbol + n0_IQ[0]/=12; + n0_IQ[1]/=12; interference_power+= (double)(n0_IQ[0]*n0_IQ[0]+n0_IQ[1]*n0_IQ[1]); } // antenna } @@ -1187,7 +1189,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, #endif } - stat += ((stat_re*stat_re) + (stat_im*stat_im)); + stat += (stat_re*stat_re); } //re } // aa From 6c99c9a2557b91d796748e7395ee7b6aedcae717 Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Fri, 5 Jun 2020 14:41:10 +0900 Subject: [PATCH 064/160] Fix receive pucch 1a and power adjustment of pucch. (cherry picked from commit 6d5a40bd826de160ddf55599f61d1359cfba3fa4) --- openair1/PHY/LTE_TRANSPORT/pucch.c | 18 ++++++++++++++---- openair1/SCHED/phy_procedures_lte_eNb.c | 4 ++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c index edbf6c9c6e..9c5f28bec3 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch.c @@ -1275,8 +1275,13 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, } // this is total energy received, summed over data and reference - stat += ((((stat_re*stat_re)) + ((stat_im*stat_im)) + - ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb); + if (fmt==pucch_format1a){ + stat += ((((stat_re*stat_re)) + ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb); + }else{ + stat += ((((stat_re*stat_re)) + ((stat_im*stat_im)) + + ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb); + } + // now second slot stat_re=0; stat_im=0; @@ -1304,8 +1309,13 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, #ifdef DEBUG_PUCCH_RX printf("aa%d re %d : phase %d : stat %d\n",aa,re,phase,stat); #endif - stat += ((((stat_re*stat_re)) + ((stat_im*stat_im)) + - ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb); + if (fmt==pucch_format1a){ + stat += ((((stat_re*stat_re)) + ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb); + }else{ + stat += ((((stat_re*stat_re)) + ((stat_im*stat_im)) + + ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb); + } + } //re } // aa diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index d2adcb8823..e783afafa7 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -757,7 +757,7 @@ void fill_sr_indication(int UEid, PHY_VARS_eNB *eNB,uint16_t rnti,int frame,int // pdu->rx_ue_information.handle = handle; pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG; pdu->rx_ue_information.rnti = rnti; - int SNRtimes10 = dB_fixed_x10(stat) - 10 * eNB->measurements.n0_pucch_dB; + int SNRtimes10 = dB_fixed_x10(stat) - 10 * eNB->measurements.n0_pucch_dB - 10 * eNB->pucch1_DTX_threshold; LOG_D(PHY,"stat %d subbandpower %d, SNRtimes10 %d\n", stat, eNB->measurements.n0_subband_power_dB[0][0], SNRtimes10); pdu->ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG; @@ -1925,7 +1925,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in pdu->rx_ue_information.rnti = uci->rnti; // estimate UL_CQI for MAC (from antenna port 0 only) pdu->ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG; - int SNRtimes10 = dB_fixed_x10(uci->stat) - 10 * eNB->measurements.n0_pucch_dB; + int SNRtimes10 = dB_fixed_x10(uci->stat) - 10 * eNB->measurements.n0_pucch_dB - 10 * eNB->pucch1ab_DTX_threshold; if (SNRtimes10 < -100) LOG_I (PHY, "uci->stat %d \n", uci->stat); From deeded689de8f64d99e7711c8e8cdfe842340b80 Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Tue, 16 Jun 2020 15:39:18 +0900 Subject: [PATCH 065/160] Fix: guard multiple UL scheduling for same UE. (cherry picked from commit 57caca9ba87fda3f73aa30d86f4af01a6062224c) --- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index ba4d27a159..3ee27ae04b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -2393,6 +2393,18 @@ void ulsch_scheduler_pre_ue_select_fairRR( break; } + for(i = 0; ihi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi]; format_flag = 2; rnti = UE_RNTI(module_idP,first_ue_id[CC_id][temp]); From 7243b6d67ae19269d7446996383e860d5a072f28 Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Wed, 17 Jun 2020 16:24:50 +0900 Subject: [PATCH 066/160] Avoid Segfault with abnormal MAC header. (cherry picked from commit 04c5431468c9102dd625a73d9e5219b40b638fe3) (cherry picked from commit 17880778c848406e562f98c20f7b7a6428502279) (cherry picked from commit a26f44c197e854dd4261267a3695932392f09265) --- common/utils/asn1_conversions.h | 24 ++++++++++-- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 47 ++++++++++++++++++++--- 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/common/utils/asn1_conversions.h b/common/utils/asn1_conversions.h index 82dca54c08..7fd32af030 100644 --- a/common/utils/asn1_conversions.h +++ b/common/utils/asn1_conversions.h @@ -33,7 +33,11 @@ *\return the extracted value. */ static inline uint8_t BIT_STRING_to_uint8(BIT_STRING_t *asn) { - DevCheck ((asn->size == 1), asn->size, 0, 0); + //DevCheck ((asn->size == 1), asn->size, 0, 0); + if(!(asn->size == 1)) { + printf("BIT_STRING_to_uint8 size %ld\n", asn->size); + return 0; + } return asn->buf[0] >> asn->bits_unused; } @@ -47,7 +51,11 @@ static inline uint16_t BIT_STRING_to_uint16(BIT_STRING_t *asn) { uint16_t result = 0; int index = 0; - DevCheck ((asn->size > 0) && (asn->size <= 2), asn->size, 0, 0); + //DevCheck ((asn->size > 0) && (asn->size <= 2), asn->size, 0, 0); + if(!((asn->size > 0) && (asn->size <= 2))) { + printf("BIT_STRING_to_uint16 size %ld\n", asn->size); + return 0; + } switch (asn->size) { case 2: @@ -74,7 +82,11 @@ static inline uint32_t BIT_STRING_to_uint32(BIT_STRING_t *asn) { int index; int shift; - DevCheck ((asn->size > 0) && (asn->size <= 4), asn->size, 0, 0); + //DevCheck ((asn->size > 0) && (asn->size <= 4), asn->size, 0, 0); + if(!((asn->size > 0) && (asn->size <= 4))) { + printf("BIT_STRING_to_uint32 size %ld\n", asn->size); + return 0; + } shift = ((asn->size - 1) * 8) - asn->bits_unused; for (index = 0; index < (asn->size - 1); index++) { @@ -97,7 +109,11 @@ static inline uint64_t BIT_STRING_to_uint64(BIT_STRING_t *asn) { int index; int shift; - DevCheck ((asn->size > 0) && (asn->size <= 8), asn->size, 0, 0); + //DevCheck ((asn->size > 0) && (asn->size <= 8), asn->size, 0, 0); + if(!((asn->size > 0) && (asn->size <= 8))) { + printf("BIT_STRING_to_uint64 size %ld\n", asn->size); + return 0; + } shift = ((asn->size - 1) * 8) - asn->bits_unused; for (index = 0; index < (asn->size - 1); index++) { diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index eb762bbdab..fb258b1ea3 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -683,7 +683,7 @@ rx_sdu(const module_id_t enb_mod_idP, switch (rx_lcids[i]) { case CCCH: - if (rx_lengths[i] > CCCH_PAYLOAD_SIZE_MAX) { + if ((rx_lengths[i] > CCCH_PAYLOAD_SIZE_MAX) || (rx_lengths[i] < 0) || (rx_lengths[i] > sdu_lenP)) { LOG_E(MAC, "[eNB %d/%d] frame %d received CCCH of size %d (too big, maximum allowed is %d, sdu_len %d), dropping packet\n", enb_mod_idP, CC_idP, @@ -804,6 +804,17 @@ rx_sdu(const module_id_t enb_mod_idP, LOG_T(MAC, "\n"); #endif + if ((rx_lengths[i] > DCH_PAYLOAD_SIZE_MAX) || (rx_lengths[i] < 0) || (rx_lengths[i] > sdu_lenP)) { + LOG_E(MAC, "[eNB %d/%d] frame %d received DCCH of size %d (too big, maximum allowed is %d, sdu_len %d), dropping packet\n", + enb_mod_idP, + CC_idP, + frameP, + rx_lengths[i], + DCH_PAYLOAD_SIZE_MAX, + sdu_lenP); + break; + } + if (UE_id != -1) { if (lcgid_updated[UE_template_ptr->lcgidmap[rx_lcids[i]]] == 0) { /* Adjust buffer occupancy of the correponding logical channel group */ @@ -853,6 +864,17 @@ rx_sdu(const module_id_t enb_mod_idP, #endif if (rx_lcids[i] < NB_RB_MAX) { + if ((rx_lengths[i] > SCH_PAYLOAD_SIZE_MAX) || (rx_lengths[i] < 0) || (rx_lengths[i] > sdu_lenP)) { + LOG_E(MAC, "[eNB %d/%d] frame %d received DTCH of size %d (too big, maximum allowed is %d, sdu_len %d), dropping packet\n", + enb_mod_idP, + CC_idP, + frameP, + rx_lengths[i], + DCH_PAYLOAD_SIZE_MAX, + sdu_lenP); + UE_list->eNB_UE_stats[CC_idP][UE_id].num_errors_rx += 1; + break; + } LOG_D(MAC, "[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d\n", enb_mod_idP, CC_idP, @@ -862,6 +884,25 @@ rx_sdu(const module_id_t enb_mod_idP, rx_lcids[i]); if (UE_id != -1) { + ue_contextP = rrc_eNB_get_ue_context(RC.rrc[enb_mod_idP], current_rnti); + if (ue_contextP != NULL) { + if (ue_contextP->ue_context.DRB_active[rx_lcids[i] - 2] == 0) { + LOG_E(MAC, "[eNB %d/%d] frame %d received non active DTCH of size %d ( sdu_len %d, lcid %d), dropping packet\n", + enb_mod_idP, + CC_idP, + frameP, + rx_lengths[i], + sdu_lenP,rx_lcids[i]); + UE_list->eNB_UE_stats[CC_idP][UE_id].num_errors_rx += 1; + break; + } + }else{ + LOG_E(MAC, "[eNB %d] CC_id %d Couldn't find the context associated to UE (RNTI %d) and reset RRC inactivity timer\n", + enb_mod_idP, + CC_idP, + current_rnti); + break; + } /* Adjust buffer occupancy of the correponding logical channel group */ LOG_D(MAC, "[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d, removing from LCGID %ld, %d\n", enb_mod_idP, @@ -890,16 +931,12 @@ rx_sdu(const module_id_t enb_mod_idP, } } - if ((rx_lengths[i] < SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0)) { // MAX SIZE OF transport block mac_rlc_data_ind(enb_mod_idP, current_rnti, enb_mod_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, rx_lcids[i], (char *) payload_ptr, rx_lengths[i], 1, NULL); UE_info->eNB_UE_stats[CC_idP][UE_id].num_pdu_rx[rx_lcids[i]] += 1; UE_info->eNB_UE_stats[CC_idP][UE_id].num_bytes_rx[rx_lcids[i]] += rx_lengths[i]; /* Clear uplane_inactivity_timer */ UE_scheduling_control->uplane_inactivity_timer = 0; /* Reset RRC inactivity timer after uplane activity */ - ue_contextP = rrc_eNB_get_ue_context(RC.rrc[enb_mod_idP], current_rnti); - - if (ue_contextP != NULL) { ue_contextP->ue_context.ue_rrc_inactivity_timer = 1; } else { LOG_E(MAC, "[eNB %d] CC_id %d Couldn't find the context associated to UE (RNTI %d) and reset RRC inactivity timer\n", From cb927c7f9ae7caf6319cc2f0569a4449163c0795 Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Fri, 10 Jul 2020 21:22:53 +0900 Subject: [PATCH 067/160] Add statistics logs. (cherry picked from commit cf8f14edf4a261e1df72579423786d39ba6d97f9) --- nfapi/oai_integration/nfapi_vnf.c | 25 ++++++++++++++- openair2/LAYER2/MAC/defs.h | 18 +++++------ openair2/LAYER2/MAC/eNB_scheduler.c | 32 +++++++++++++++++-- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 12 ++++++- .../LAYER2/MAC/eNB_scheduler_primitives.c | 3 +- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 2 +- openair2/LAYER2/MAC/mac.h | 20 ++++++------ 7 files changed, 88 insertions(+), 24 deletions(-) diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 6a33fba5c0..b93cb9c342 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -358,8 +358,31 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) { proc->frame_rx, proc->subframe_rx); } + // wake up TX for subframe n+sf_ahead + // lock the TX mutex and make sure the thread is ready + if (pthread_mutex_timedlock(&L1_proc->mutex,&wait) != 0) { + LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)\n", L1_proc->subframe_rx&1,L1_proc->instance_cnt ); + //exit_fun( "error locking mutex_rxtx" ); + return(-1); + } + static int busy_log_cnt=0; + if(L1_proc->instance_cnt < 0){ + ++L1_proc->instance_cnt; + if(busy_log_cnt!=0){ + LOG_E(MAC,"RCC singal to rxtx frame %d subframe %d busy end %d (frame %d subframe %d)\n",L1_proc->frame_rx,L1_proc->subframe_rx,busy_log_cnt,proc->frame_rx,proc->subframe_rx); + } + busy_log_cnt=0; + }else{ + if(busy_log_cnt==0){ + LOG_E(MAC,"RCC singal to rxtx frame %d subframe %d busy %d (frame %d subframe %d)\n",L1_proc->frame_rx,L1_proc->subframe_rx,L1_proc->instance_cnt,proc->frame_rx,proc->subframe_rx); + } + pthread_mutex_unlock( &L1_proc->mutex ); + busy_log_cnt++; + return(0); + } + + pthread_mutex_unlock( &L1_proc->mutex ); - ++L1_proc->instance_cnt; //LOG_D( PHY,"[VNF-subframe_ind] sfn/sf:%d:%d proc[frame_rx:%d subframe_rx:%d] L1_proc->instance_cnt_rxtx:%d \n", sfn, sf, proc->frame_rx, proc->subframe_rx, L1_proc->instance_cnt_rxtx); // We have just received and processed the common part of a subframe, say n. // TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index 654fb4b228..2a807c1af5 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -829,16 +829,16 @@ typedef struct { uint8_t periodic_ri_received[NFAPI_CC_MAX]; uint8_t aperiodic_ri_received[NFAPI_CC_MAX]; uint32_t pucch_tpc_accumulated[NFAPI_CC_MAX]; - uint8_t pucch1_cqi_update[NFAPI_CC_MAX]; - uint8_t pucch1_snr[NFAPI_CC_MAX]; - uint8_t pucch2_cqi_update[NFAPI_CC_MAX]; - uint8_t pucch2_snr[NFAPI_CC_MAX]; - uint8_t pucch3_cqi_update[NFAPI_CC_MAX]; - uint8_t pucch3_snr[NFAPI_CC_MAX]; + int16_t pucch1_cqi_update[NFAPI_CC_MAX]; + int16_t pucch1_snr[NFAPI_CC_MAX]; + int16_t pucch2_cqi_update[NFAPI_CC_MAX]; + int16_t pucch2_snr[NFAPI_CC_MAX]; + int16_t pucch3_cqi_update[NFAPI_CC_MAX]; + int16_t pucch3_snr[NFAPI_CC_MAX]; double pusch_cqi_f[NFAPI_CC_MAX]; - uint8_t pusch_cqi[NFAPI_CC_MAX]; - uint8_t pusch_snr[NFAPI_CC_MAX]; - uint8_t pusch_snr_avg[NFAPI_CC_MAX]; + int16_t pusch_cqi[NFAPI_CC_MAX]; + int16_t pusch_snr[NFAPI_CC_MAX]; + int16_t pusch_snr_avg[NFAPI_CC_MAX]; uint64_t pusch_rx_num[NFAPI_CC_MAX]; uint64_t pusch_rx_num_old[NFAPI_CC_MAX]; uint64_t pusch_rx_error_num[NFAPI_CC_MAX]; diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index dd68cb8097..f76ee72c9b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -596,13 +596,41 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, UE_scheduling_control = &(UE_info->UE_sched_ctrl[UE_id]); 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", + double total_bler; + if(UE_scheduling_control->pusch_rx_num[CC_id] == 0 && UE_scheduling_control->pusch_rx_error_num[CC_id] == 0) { + total_bler = 0; + } + else { + total_bler = (double)UE_scheduling_control->pusch_rx_error_num[CC_id] / (double)(UE_scheduling_control->pusch_rx_error_num[CC_id] + UE_scheduling_control->pusch_rx_num[CC_id]) * 100; + } + LOG_I(MAC,"UE %x : %s, PHR %d DLCQI %d PUSCH %d PUCCH %d RLC disc %d UL-stat rcv %lu err %lu bler %lf mcsoff %d bsr %u sched %u tbs %lu cnt %u , DL-stat tbs %lu cnt %u rb %u buf %u 1st %u ret %u ri %d\n", rnti, UE_scheduling_control->ul_out_of_sync == 0 ? "in synch" : "out of sync", UE_info->UE_template[CC_id][UE_id].phr_info, UE_scheduling_control->dl_cqi[CC_id], UE_scheduling_control->pusch_snr_avg[CC_id], - UE_scheduling_control->pucch1_snr[CC_id]); + UE_scheduling_control->pucch1_snr[CC_id], + UE_scheduling_control->rlc_out_of_resources_cnt, + UE_scheduling_control->pusch_rx_num[CC_id], + UE_scheduling_control->pusch_rx_error_num[CC_id], + total_bler, + UE_scheduling_control->mcs_offset[CC_id], + UE_info->UE_template[CC_id][UE_id].estimated_ul_buffer, + UE_info->UE_template[CC_id][UE_id].scheduled_ul_bytes, + UE_info->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes_rx, + UE_info->eNB_UE_stats[CC_id][UE_id].total_num_pdus_rx, + UE_info->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes, + UE_info->eNB_UE_stats[CC_id][UE_id].total_num_pdus, + UE_info->eNB_UE_stats[CC_id][UE_id].total_rbs_used, +#if defined(PRE_SCD_THREAD) + dl_buffer_total[CC_id][UE_id], +#else + 0, +#endif + UE_scheduling_control->first_cnt[CC_id], + UE_scheduling_control->ret_cnt[CC_id], + UE_scheduling_control->aperiodic_ri_received[CC_id] + ); } RC.eNB[module_idP][CC_id]->pusch_stats_bsr[UE_id][(frameP * 10) + subframeP] = -63; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 3ee27ae04b..5e4810e57a 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -1001,7 +1001,17 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id, rnti = dlsch_ue_select[CC_id].list[i].rnti; ue_sched_ctl = &UE_info->UE_sched_ctrl[UE_id]; harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP,subframeP); - Round = ue_sched_ctl->round[CC_id][harq_pid]; + + unsigned char round1, round2; + round1 = ue_sched_ctl->round[CC_id][harq_pid][TB1]; + round2 = ue_sched_ctl->round[CC_id][harq_pid][TB2]; + if ((round1 != 8) || (round2 != 8)){ + Round = cmin(round1,round2); + ue_sched_ctl->ret_cnt[CC_id]++; + } else{ + Round = 8; + ue_sched_ctl->first_cnt[CC_id]++; + } //if (mac_eNB_get_rrc_status(Mod_id, rnti) < RRC_RECONFIGURED || round > 0) { if (mac_eNB_get_rrc_status(Mod_id, rnti) < RRC_RECONFIGURED || Round != 8) { // FIXME diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 0107daf3e0..c8d4862144 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -2226,7 +2226,8 @@ add_new_ue(module_id_t mod_idP, UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num[cc_idP] = 0; UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num_old[cc_idP] = 0; UE_info->UE_sched_ctrl[UE_id].pusch_bler[cc_idP] = 0; - UE_info->UE_sched_ctrl[UE_id].mcs_offset[cc_idP] = 0; + UE_info->UE_sched_ctrl[UE_id].ret_cnt[cc_idP] = 0; + UE_info->UE_sched_ctrl[UE_id].first_cnt[cc_idP] = 0; for (j = 0; j < 8; j++) { UE_info->UE_template[cc_idP][UE_id].oldNDI[j] = 0; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index fb258b1ea3..2f41e015e9 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -202,7 +202,7 @@ rx_sdu(const module_id_t enb_mod_idP, } } else { // sduP == NULL => error UE_scheduling_control->pusch_rx_error_num[CC_idP]++; - LOG_W(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d, UE_id %d, RNTI %x (len %d)\n", + LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d, UE_id %d, RNTI %x (len %d)\n", enb_mod_idP, harq_pid, CC_idP, diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index 62346e7ef7..d10f8e5be2 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -933,6 +933,8 @@ typedef struct { /// Current DL harq round per harq_pid on each CC uint8_t round[NFAPI_CC_MAX][10]; + uint32_t ret_cnt[NFAPI_CC_MAX]; + uint32_t first_cnt[NFAPI_CC_MAX]; /// Current Active TBs per harq_pid on each CC uint8_t tbcnt[NFAPI_CC_MAX][10]; /// Current UL harq round per harq_pid on each CC @@ -960,16 +962,16 @@ typedef struct { int32_t phr_received; uint8_t periodic_ri_received[NFAPI_CC_MAX]; uint8_t aperiodic_ri_received[NFAPI_CC_MAX]; - uint8_t pucch1_cqi_update[NFAPI_CC_MAX]; - uint8_t pucch1_snr[NFAPI_CC_MAX]; - uint8_t pucch2_cqi_update[NFAPI_CC_MAX]; - uint8_t pucch2_snr[NFAPI_CC_MAX]; - uint8_t pucch3_cqi_update[NFAPI_CC_MAX]; - uint8_t pucch3_snr[NFAPI_CC_MAX]; + int16_t pucch1_cqi_update[NFAPI_CC_MAX]; + int16_t pucch1_snr[NFAPI_CC_MAX]; + int16_t pucch2_cqi_update[NFAPI_CC_MAX]; + int16_t pucch2_snr[NFAPI_CC_MAX]; + int16_t pucch3_cqi_update[NFAPI_CC_MAX]; + int16_t pucch3_snr[NFAPI_CC_MAX]; double pusch_cqi_f[NFAPI_CC_MAX]; - uint8_t pusch_cqi[NFAPI_CC_MAX]; - uint8_t pusch_snr[NFAPI_CC_MAX]; - uint8_t pusch_snr_avg[NFAPI_CC_MAX]; + int16_t pusch_cqi[NFAPI_CC_MAX]; + int16_t pusch_snr[NFAPI_CC_MAX]; + int16_t pusch_snr_avg[NFAPI_CC_MAX]; uint64_t pusch_rx_num[NFAPI_CC_MAX]; uint64_t pusch_rx_num_old[NFAPI_CC_MAX]; uint64_t pusch_rx_error_num[NFAPI_CC_MAX]; From 39b9ffd69bc8b3258f9ebe69816a5b33832b6400 Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Mon, 20 Jul 2020 15:10:00 +0900 Subject: [PATCH 068/160] Add DC removing to signal power measurement. --- openair1/PHY/TOOLS/signal_energy.c | 231 ++++++++++++++++++----------- 1 file changed, 146 insertions(+), 85 deletions(-) diff --git a/openair1/PHY/TOOLS/signal_energy.c b/openair1/PHY/TOOLS/signal_energy.c index 687d38bda7..d2c2817b0e 100644 --- a/openair1/PHY/TOOLS/signal_energy.c +++ b/openair1/PHY/TOOLS/signal_energy.c @@ -29,6 +29,7 @@ #define shift 4 //#define shift_DC 0 +#define SHRT_MIN -32768 #if defined(__x86_64__) || defined(__i386__) #ifdef LOCALIZATION @@ -67,52 +68,86 @@ int32_t subcarrier_energy(int32_t *input,uint32_t length, int32_t *subcarrier_en } #endif +//int32_t signal_energy(int32_t *input,uint32_t length) +//{ +// +// int32_t i; +// int32_t temp,temp2; +// register __m64 mm0,mm1,mm2,mm3; +// __m64 *in = (__m64 *)input; +// +// +// mm0 = _mm_setzero_si64();//pxor(mm0,mm0); +// mm3 = _mm_setzero_si64();//pxor(mm3,mm3); +// +// for (i=0; i>1; i++) { +// +// mm1 = in[i]; +// mm2 = mm1; +// mm1 = _m_pmaddwd(mm1,mm1); +// mm1 = _m_psradi(mm1,shift);// shift any 32 bits blocs of the word by the value shift +// mm0 = _m_paddd(mm0,mm1);// add the two 64 bits words 4 bytes by 4 bytes +// // mm2 = _m_psrawi(mm2,shift_DC); +// mm3 = _m_paddw(mm3,mm2);// add the two 64 bits words 2 bytes by 2 bytes +// } +// +// mm1 = mm0; +// mm0 = _m_psrlqi(mm0,32); +// mm0 = _m_paddd(mm0,mm1); +// temp = _m_to_int(mm0); +// temp/=length; +// temp<<=shift; // this is the average of x^2 +// +// // now remove the DC component +// +// +// mm2 = _m_psrlqi(mm3,32); +// mm2 = _m_paddw(mm2,mm3); +// mm2 = _m_pmaddwd(mm2,mm2); +// temp2 = _m_to_int(mm2); +// temp2/=(length*length); +// // temp2<<=(2*shift_DC); +// temp -= temp2; +// +// _mm_empty(); +// _m_empty(); +// +// return((temp>0)?temp:1); + +//----------------------------------------------------------------- +// Average Power calculation with DC removing +//----------------------------------------------------------------- int32_t signal_energy(int32_t *input,uint32_t length) { + uint32_t i; + int32_t temp; + __m128i in, in_clp, i16_min, coe1; + __m128 num0, num1, num2, num3, recp1; - int32_t i; - int32_t temp,temp2; - register __m64 mm0,mm1,mm2,mm3; - __m64 *in = (__m64 *)input; + //init + num0 = _mm_setzero_ps(); + num1 = _mm_setzero_ps(); + i16_min = _mm_set1_epi16(SHRT_MIN); + coe1 = _mm_set1_epi16(1); + recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length))); - - mm0 = _mm_setzero_si64();//pxor(mm0,mm0); - mm3 = _mm_setzero_si64();//pxor(mm3,mm3); - - for (i=0; i>1; i++) { - - mm1 = in[i]; - mm2 = mm1; - mm1 = _m_pmaddwd(mm1,mm1); - mm1 = _m_psradi(mm1,shift);// shift any 32 bits blocs of the word by the value shift - mm0 = _m_paddd(mm0,mm1);// add the two 64 bits words 4 bytes by 4 bytes - // mm2 = _m_psrawi(mm2,shift_DC); - mm3 = _m_paddw(mm3,mm2);// add the two 64 bits words 2 bytes by 2 bytes + //Acc + for (i = 0; i < (length >> 2); i++) { + in = _mm_loadu_si128((__m128i *)input); + in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min));//if in=SHRT_MIN in+1, else in + num0 = _mm_add_ps(num0, _mm_cvtepi32_ps(_mm_madd_epi16(in_clp, in_clp))); + num1 = _mm_add_ps(num1, _mm_cvtepi32_ps(_mm_madd_epi16(in, coe1)));//DC + input += 4; } + //Ave + num2 = _mm_dp_ps(num0, recp1, 0xFF);//AC power + num3 = _mm_dp_ps(num1, recp1, 0xFF);//DC + num3 = _mm_mul_ps(num3, num3); //DC power + //remove DC + temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(_mm_sub_ps(num2, num3))); - mm1 = mm0; - mm0 = _m_psrlqi(mm0,32); - mm0 = _m_paddd(mm0,mm1); - temp = _m_to_int(mm0); - temp/=length; - temp<<=shift; // this is the average of x^2 + return temp; - - // now remove the DC component - - - mm2 = _m_psrlqi(mm3,32); - mm2 = _m_paddw(mm2,mm3); - mm2 = _m_pmaddwd(mm2,mm2); - temp2 = _m_to_int(mm2); - temp2/=(length*length); - // temp2<<=(2*shift_DC); - temp -= temp2; - - _mm_empty(); - _m_empty(); - - return((temp>0)?temp:1); } int32_t signal_energy_amp_shift(int32_t *input,uint32_t length) @@ -164,60 +199,86 @@ int32_t signal_energy_amp_shift(int32_t *input,uint32_t length) int32_t signal_energy_nodc(int32_t *input,uint32_t length) { +// int32_t i; +// int32_t temp; +// register __m64 mm0,mm1;//,mm2,mm3; +// __m64 *in = (__m64 *)input; +// +//#ifdef MAIN +// int16_t *printb; +//#endif +// +// mm0 = _mm_setzero_si64();//_pxor(mm0,mm0); +// // mm3 = _mm_setzero_si64();//pxor(mm3,mm3); +// +// for (i=0; i>1; i++) { +// +// mm1 = in[i]; +// mm1 = _m_pmaddwd(mm1,mm1);// SIMD complex multiplication +// mm1 = _m_psradi(mm1,shift); +// mm0 = _m_paddd(mm0,mm1); +// // temp2 = mm0; +// // printf("%d %d\n",((int *)&in[i])[0],((int *)&in[i])[1]); +// +// +// // printb = (int16_t *)&mm2; +// // printf("mm2 %d : %d %d %d %d\n",i,printb[0],printb[1],printb[2],printb[3]); +// +// +// } +// +// /* +// #ifdef MAIN +// printb = (int16_t *)&mm3; +// printf("%d %d %d %d\n",printb[0],printb[1],printb[2],printb[3]); +// #endif +// */ +// mm1 = mm0; +// +// mm0 = _m_psrlqi(mm0,32); +// +// mm0 = _m_paddd(mm0,mm1); +// +// temp = _m_to_int(mm0); +// +// temp/=length; +// temp<<=shift; // this is the average of x^2 +// +//#ifdef MAIN +// printf("E x^2 = %d\n",temp); +//#endif +// _mm_empty(); +// _m_empty(); +// +// +// +// return((temp>0)?temp:1); + + + int32_t i; int32_t temp; - register __m64 mm0,mm1;//,mm2,mm3; - __m64 *in = (__m64 *)input; - -#ifdef MAIN - int16_t *printb; -#endif - - mm0 = _mm_setzero_si64();//_pxor(mm0,mm0); - // mm3 = _mm_setzero_si64();//pxor(mm3,mm3); - - for (i=0; i>1; i++) { - - mm1 = in[i]; - mm1 = _m_pmaddwd(mm1,mm1);// SIMD complex multiplication - mm1 = _m_psradi(mm1,shift); - mm0 = _m_paddd(mm0,mm1); - // temp2 = mm0; - // printf("%d %d\n",((int *)&in[i])[0],((int *)&in[i])[1]); - - - // printb = (int16_t *)&mm2; - // printf("mm2 %d : %d %d %d %d\n",i,printb[0],printb[1],printb[2],printb[3]); + __m128i in; + __m128 mm0; +//init + mm0 = _mm_setzero_ps(); +//Acc + for (i=0; i<(length>>2); i++) { + in = _mm_loadu_si128((__m128i *)input); + mm0 = _mm_add_ps(mm0,_mm_cvtepi32_ps(_mm_madd_epi16(in,in))); + input += 4; } + //Ave + temp = (int)((((float*)&mm0)[0] + + ((float*)&mm0)[1] + + ((float*)&mm0)[2] + + ((float*)&mm0)[3])/(float)length); - /* - #ifdef MAIN - printb = (int16_t *)&mm3; - printf("%d %d %d %d\n",printb[0],printb[1],printb[2],printb[3]); - #endif - */ - mm1 = mm0; - - mm0 = _m_psrlqi(mm0,32); - - mm0 = _m_paddd(mm0,mm1); - - temp = _m_to_int(mm0); - - temp/=length; - temp<<=shift; // this is the average of x^2 - -#ifdef MAIN - printf("E x^2 = %d\n",temp); -#endif - _mm_empty(); - _m_empty(); + return temp; - - return((temp>0)?temp:1); } #elif defined(__arm__) From 53b197fd162a42985e3a8eb681e671e5c3940dea Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 26 Nov 2020 18:14:12 +0100 Subject: [PATCH 069/160] Fix: when adding an MME through FlexRAN, set port --- openair2/ENB_APP/flexran_agent_ran_api.c | 2 ++ openair3/S1AP/s1ap_eNB.c | 1 + openair3/S1AP/s1ap_eNB_defs.h | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index d126012737..6d69ccc4ee 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -3491,6 +3491,7 @@ int flexran_add_s1ap_mme(mid_t mod_id, size_t n_mme, char **mme_ipv4) { S1AP_REGISTER_ENB_REQ(m).broadcast_plmn_num[n] = mme->broadcast_plmn_num; for (int i = 0; i < mme->broadcast_plmn_num; ++i) S1AP_REGISTER_ENB_REQ(m).broadcast_plmn_index[n][i] = mme->broadcast_plmn_index[i]; + S1AP_REGISTER_ENB_REQ(m).mme_port[n] = mme->mme_port; S1AP_REGISTER_ENB_REQ(m).nb_mme += 1; } @@ -3505,6 +3506,7 @@ int flexran_add_s1ap_mme(mid_t mod_id, size_t n_mme, char **mme_ipv4) { S1AP_REGISTER_ENB_REQ(m).broadcast_plmn_num[n] = S1AP_REGISTER_ENB_REQ(m).num_plmn; for (int i = 0; i < S1AP_REGISTER_ENB_REQ(m).num_plmn; ++i) S1AP_REGISTER_ENB_REQ(m).broadcast_plmn_index[n][i] = i; + S1AP_REGISTER_ENB_REQ(m).mme_port[n] = S1AP_PORT_NUMBER; S1AP_REGISTER_ENB_REQ(m).nb_mme += 1; } diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index 2a153acaa2..bb8633ba17 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -127,6 +127,7 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, memcpy(&s1ap_mme_data_p->mme_s1_ip, mme_ip_address, sizeof(*mme_ip_address)); + s1ap_mme_data_p->mme_port = mme_port; for (int i = 0; i < broadcast_plmn_num; ++i) s1ap_mme_data_p->broadcast_plmn_index[i] = broadcast_plmn_index[i]; diff --git a/openair3/S1AP/s1ap_eNB_defs.h b/openair3/S1AP/s1ap_eNB_defs.h index d4bc6cfc0f..d8a8da8001 100644 --- a/openair3/S1AP/s1ap_eNB_defs.h +++ b/openair3/S1AP/s1ap_eNB_defs.h @@ -124,8 +124,9 @@ typedef struct s1ap_eNB_mme_data_s { /* This is the optional name provided by the MME */ char *mme_name; - /* MME S1AP IP address */ + /* MME S1AP IP address and port */ net_ip_address_t mme_s1_ip; + uint16_t mme_port; /* List of served GUMMEI per MME. There is one GUMMEI per RAT with a max * number of 8 RATs but in our case only one is used. The LTE related pool From ed0c12ba19e421162cbd3e4952eb221763491019 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 26 Nov 2020 18:47:57 +0100 Subject: [PATCH 070/160] Avoid useless loop --- openair2/ENB_APP/flexran_agent_ran_api.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index 6d69ccc4ee..5377b03ae9 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -3498,17 +3498,15 @@ int flexran_add_s1ap_mme(mid_t mod_id, size_t n_mme, char **mme_ipv4) { if (S1AP_REGISTER_ENB_REQ(m).nb_mme + n_mme > S1AP_MAX_NB_MME_IP_ADDRESS) return -1; - for (int i = 0; i < n_mme; ++i) { - const int n = S1AP_REGISTER_ENB_REQ(m).nb_mme; - strcpy(S1AP_REGISTER_ENB_REQ(m).mme_ip_address[n].ipv4_address, mme_ipv4[0]); - S1AP_REGISTER_ENB_REQ(m).mme_ip_address[n].ipv4 = 1; - S1AP_REGISTER_ENB_REQ(m).mme_ip_address[n].ipv6 = 0; - S1AP_REGISTER_ENB_REQ(m).broadcast_plmn_num[n] = S1AP_REGISTER_ENB_REQ(m).num_plmn; - for (int i = 0; i < S1AP_REGISTER_ENB_REQ(m).num_plmn; ++i) - S1AP_REGISTER_ENB_REQ(m).broadcast_plmn_index[n][i] = i; - S1AP_REGISTER_ENB_REQ(m).mme_port[n] = S1AP_PORT_NUMBER; - S1AP_REGISTER_ENB_REQ(m).nb_mme += 1; - } + const int n = S1AP_REGISTER_ENB_REQ(m).nb_mme; + strcpy(S1AP_REGISTER_ENB_REQ(m).mme_ip_address[n].ipv4_address, mme_ipv4[0]); + S1AP_REGISTER_ENB_REQ(m).mme_ip_address[n].ipv4 = 1; + S1AP_REGISTER_ENB_REQ(m).mme_ip_address[n].ipv6 = 0; + S1AP_REGISTER_ENB_REQ(m).broadcast_plmn_num[n] = S1AP_REGISTER_ENB_REQ(m).num_plmn; + for (int i = 0; i < S1AP_REGISTER_ENB_REQ(m).num_plmn; ++i) + S1AP_REGISTER_ENB_REQ(m).broadcast_plmn_index[n][i] = i; + S1AP_REGISTER_ENB_REQ(m).mme_port[n] = S1AP_PORT_NUMBER; + S1AP_REGISTER_ENB_REQ(m).nb_mme += 1; itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(mod_id), m); From 0dcf4ef8f8ddd72213a782fda78597f417d3c073 Mon Sep 17 00:00:00 2001 From: frtabu Date: Thu, 26 Nov 2020 23:12:23 +0100 Subject: [PATCH 071/160] remove L2L1 task, parallelisation as config option --- executables/nr-softmodem.c | 84 ------------------ executables/nr-ue.c | 10 +-- executables/nr-uesoftmodem.c | 75 ++++++---------- executables/nr-uesoftmodem.h | 38 +++++--- openair1/PHY/INIT/nr_init.c | 1 - .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 26 ++---- openair1/PHY/TOOLS/nr_phy_scope.c | 1 - openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 86 ++++++++++--------- targets/COMMON/create_nr_tasks.h | 2 - targets/COMMON/create_tasks.h | 3 - 10 files changed, 111 insertions(+), 215 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index fb757a9f47..fe1fc64207 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -300,87 +300,11 @@ void exit_function(const char *file, const char *function, const int line, const } -void *l2l1_task(void *arg) { - MessageDef *message_p = NULL; - int result; - itti_set_task_real_time(TASK_L2L1); - itti_mark_task_ready(TASK_L2L1); - /* Wait for the initialize message */ - printf("Wait for the ITTI initialize message\n"); - - do { - if (message_p != NULL) { - result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - } - - itti_receive_msg (TASK_L2L1, &message_p); - - switch (ITTI_MSG_ID(message_p)) { - case INITIALIZE_MESSAGE: - /* Start gNB thread */ - LOG_D(EMU, "L2L1 TASK received %s\n", ITTI_MSG_NAME(message_p)); - start_gNB = 1; - break; - - case TERMINATE_MESSAGE: - printf("received terminate message\n"); - oai_exit=1; - start_gNB = 0; - itti_exit_task (); - break; - - default: - LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p)); - break; - } - } while (ITTI_MSG_ID(message_p) != INITIALIZE_MESSAGE); - - result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - /* ???? no else but seems to be UE only ??? - do { - // Wait for a message - itti_receive_msg (TASK_L2L1, &message_p); - - switch (ITTI_MSG_ID(message_p)) { - case TERMINATE_MESSAGE: - oai_exit=1; - itti_exit_task (); - break; - - case ACTIVATE_MESSAGE: - start_UE = 1; - break; - - case DEACTIVATE_MESSAGE: - start_UE = 0; - break; - - case MESSAGE_TEST: - LOG_I(EMU, "Received %s\n", ITTI_MSG_NAME(message_p)); - break; - - default: - LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p)); - break; - } - - result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - } while(!oai_exit); - */ - return NULL; -} int create_gNB_tasks(uint32_t gnb_nb) { LOG_D(GNB_APP, "%s(gnb_nb:%d)\n", __FUNCTION__, gnb_nb); itti_wait_ready(1); - if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) { - LOG_E(PDCP, "Create task for L2L1 failed\n"); - return -1; - } if (gnb_nb > 0) { /* Last task to create, others task must be ready before its start */ @@ -717,7 +641,6 @@ int stop_L1L2(module_id_t gnb_id) { /* these tasks need to pick up new configuration */ terminate_task(TASK_RRC_ENB, gnb_id); - terminate_task(TASK_L2L1, gnb_id); LOG_I(GNB_APP, "calling kill_gNB_proc() for instance %d\n", gnb_id); kill_gNB_proc(gnb_id); LOG_I(GNB_APP, "calling kill_NR_RU_proc() for instance %d\n", gnb_id); @@ -753,13 +676,6 @@ int restart_L1L2(module_id_t gnb_id) { rrc_enb_init(); itti_mark_task_ready(TASK_RRC_ENB); - if (itti_create_task (TASK_L2L1, l2l1_task, NULL) < 0) { - LOG_E(PDCP, "Create task for L2L1 failed\n"); - return -1; - } else { - LOG_I(PDCP, "Re-created task for L2L1 successfully\n"); - } - /* pass a reconfiguration request which will configure everything down to * RC.eNB[i][j]->frame_parms, too */ msg_p = itti_alloc_new_message(TASK_ENB_APP, RRC_CONFIGURATION_REQ); diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 5191551ea3..15947ba881 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -860,11 +860,11 @@ void init_NR_UE_threads(int nb_inst) { LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]); threadCreate(&threads[inst], UE_thread, (void *)UE, "UEthread", -1, OAI_PRIORITY_RT_MAX); -#ifdef UE_DLSCH_PARALLELISATION - pthread_t dlsch0_threads; - threadCreate(&dlsch0_threads, dlsch_thread, (void *)UE, "DLthread", -1, OAI_PRIORITY_RT_MAX-1); -#endif - + if( IS_DLSCH_PARALLEL) + { + pthread_t dlsch0_threads; + threadCreate(&dlsch0_threads, dlsch_thread, (void *)UE, "DLthread", -1, OAI_PRIORITY_RT_MAX-1); + } } } diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 08834ed740..d96bc16d35 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -81,6 +81,7 @@ unsigned short config_frames[4] = {2,9,11,13}; // current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0) #include "PHY/TOOLS/phy_scope_interface.h" #include "PHY/TOOLS/nr_phy_scope.h" +#define NRUE_MAIN #include #include "executables/softmodem-common.h" #include "executables/thread-common.h" @@ -106,7 +107,6 @@ volatile int start_eNB = 0; volatile int start_UE = 0; volatile int oai_exit = 0; -// Command line options extern int16_t nr_dlsch_demod_shift; static int tx_max_power[MAX_NUM_CCs] = {0}; @@ -208,57 +208,23 @@ void exit_function(const char *file, const char *function, const int line, const exit(1); } -void *l2l1_task(void *arg) { - MessageDef *message_p = NULL; - int result; - itti_set_task_real_time(TASK_L2L1); - itti_mark_task_ready(TASK_L2L1); - do { - // Wait for a message - itti_receive_msg (TASK_L2L1, &message_p); - - switch (ITTI_MSG_ID(message_p)) { - case TERMINATE_MESSAGE: - oai_exit=1; - itti_exit_task (); - break; - - case ACTIVATE_MESSAGE: - start_UE = 1; - break; - - case DEACTIVATE_MESSAGE: - start_UE = 0; - break; - - case MESSAGE_TEST: - LOG_I(EMU, "Received %s\n", ITTI_MSG_NAME(message_p)); - break; - - default: - LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p)); - break; - } - - result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - } while(!oai_exit); - - return NULL; +nrUE_params_t *get_nrUE_params(void) { + return &nrUE_params; } static void get_options(void) { char *loopfile=NULL; - + int32_t nr_dlsch_parallel=0; paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC_UE ; config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL); paramdef_t cmdline_uemodeparams[] = CMDLINE_UEMODEPARAMS_DESC; paramdef_t cmdline_ueparams[] = CMDLINE_NRUEPARAMS_DESC; config_process_cmdline( cmdline_uemodeparams,sizeof(cmdline_uemodeparams)/sizeof(paramdef_t),NULL); config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL); - + for (int card=1; carddmrsConfigType; + uint8_t dmrs_Type = harq_process->dmrsConfigType; //nfapi_nr_config_request_t *cfg = &phy_vars_ue->nrUE_config; //uint8_t dmrs_type = cfg->pdsch_config.dmrs_type.value; @@ -815,7 +812,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, else nb_re_dmrs = 4*harq_process->n_dmrs_cdm_groups; - uint16_t length_dmrs = get_num_dmrs(dl_config_pdu->dlDmrsSymbPos); + uint16_t length_dmrs = get_num_dmrs(harq_process->dlDmrsSymbPos); uint32_t i,j; // int nbDlProcessing =0; @@ -1344,15 +1341,14 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, return(ret); } -#endif -#ifdef UE_DLSCH_PARALLELISATION + + void nr_dlsch_decoding_process(void *arg) { nr_rxtx_thread_data_t *rxtxD= (nr_rxtx_thread_data_t *)arg; UE_nr_rxtx_proc_t *proc = &rxtxD->proc; PHY_VARS_NR_UE *phy_vars_ue = rxtxD->UE; - NR_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms; int llr8_flag1; int32_t no_iteration_ldpc,length_dec; t_nrLDPC_dec_params decParams; @@ -1366,7 +1362,7 @@ void nr_dlsch_decoding_process(void *arg) //__m128i l; //int16_t inv_d [68*384]; //int16_t *p_invd =&inv_d; - uint8_t kb, kc; + uint8_t kc; uint8_t Ilbrm = 1; uint32_t Tbslbrm = 950984; uint16_t nb_rb = 30; //to update @@ -1376,8 +1372,6 @@ void nr_dlsch_decoding_process(void *arg) uint16_t length_dmrs = 1; uint32_t i,j; - uint32_t k; - __m128i *pv = (__m128i*)&z; __m128i *pl = (__m128i*)&l; @@ -1394,7 +1388,7 @@ void nr_dlsch_decoding_process(void *arg) #endif uint32_t A,E; uint32_t G; - uint32_t ret,offset; + uint32_t ret; uint32_t r,r_offset=0,Kr,Kr_bytes,err_flag=0,K_bytes_F; uint8_t crc_type; uint8_t C,Cprime; @@ -1765,7 +1759,6 @@ void nr_dlsch_decoding_process(void *arg) void *dlsch_thread(void *arg) { //this thread should be over the processing thread to keep in real time - PHY_VARS_NR_UE *UE = (PHY_VARS_NR_UE *) arg; notifiedFIFO_t nf; initNotifiedFIFO(&nf); notifiedFIFO_elt_t *res_dl; @@ -1781,7 +1774,6 @@ void *dlsch_thread(void *arg) { while (nbDlProcessing >= RX_NB_TH_DL) { if ( (res=tryPullTpool(&nf, Tpool_dl)) != NULL ) { - nr_rxtx_thread_data_t *tmp=(nr_rxtx_thread_data_t *)res->msgData; //nbDlProcessing--; pushNotifiedFIFO_nothreadSafe(&freeBlocks_dl,res); } @@ -1802,4 +1794,4 @@ void *dlsch_thread(void *arg) { return NULL; } -#endif + diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index 78e34036a3..ba53e0b98f 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -25,7 +25,6 @@ #include #include "nr_phy_scope.h" -#include "executables/nr-softmodem-common.h" #include "executables/softmodem-common.h" #include diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index bbe592b914..4009dae6eb 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -50,6 +50,7 @@ #include "SCHED/phy_procedures_emos.h" #endif #include "executables/softmodem-common.h" +#include "executables/nr-uesoftmodem.h" #include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" //#define DEBUG_PHY_PROC @@ -1048,8 +1049,9 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, start_meas(&ue->dlsch_decoding_stats[proc->thread_id]); #endif -#ifdef UE_DLSCH_PARALLELISATION - ret = nr_dlsch_decoding_mthread(ue, + if( IS_DLSCH_PARALLEL) + { + ret = nr_dlsch_decoding_mthread(ue, proc, eNB_id, pdsch_vars->llr[0], @@ -1062,9 +1064,11 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, harq_pid, pdsch==PDSCH?1:0, dlsch0->harq_processes[harq_pid]->TBS>256?1:0); - LOG_T(PHY,"UE_DLSCH_PARALLELISATION is defined, ret = %d\n", ret); -#else - ret = nr_dlsch_decoding(ue, + LOG_T(PHY,"dlsch decoding is parallelized, ret = %d\n", ret); + } + else + { + ret = nr_dlsch_decoding(ue, proc, eNB_id, pdsch_vars->llr[0], @@ -1077,9 +1081,9 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, harq_pid, pdsch==PDSCH?1:0, dlsch0->harq_processes[harq_pid]->TBS>256?1:0); - LOG_T(PHY,"UE_DLSCH_PARALLELISATION is NOT defined, ret = %d\n", ret); - //printf("start cW0 dlsch decoding\n"); -#endif + LOG_T(PHY,"Sequential dlsch decoding , ret = %d\n", ret); + } + #if UE_TIMING_TRACE stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]); @@ -1131,38 +1135,40 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, start_meas(&ue->dlsch_decoding_stats[proc->thread_id]); #endif -#ifdef UE_DLSCH_PARALLELISATION - ret1 = nr_dlsch_decoding_mthread(ue, - proc, - eNB_id, - pdsch_vars->llr[1], - &ue->frame_parms, - dlsch1, - dlsch1->harq_processes[harq_pid], - frame_rx, - nb_symb_sch, - nr_slot_rx, - harq_pid, - pdsch==PDSCH?1:0, - dlsch1->harq_processes[harq_pid]->TBS>256?1:0); - LOG_T(PHY,"UE_DLSCH_PARALLELISATION is defined, ret1 = %d\n", ret1); -#else - ret1 = nr_dlsch_decoding(ue, - proc, - eNB_id, - pdsch_vars->llr[1], - &ue->frame_parms, - dlsch1, - dlsch1->harq_processes[harq_pid], - frame_rx, - nb_symb_sch, - nr_slot_rx, - harq_pid, - pdsch==PDSCH?1:0,//proc->decoder_switch, - dlsch1->harq_processes[harq_pid]->TBS>256?1:0); - LOG_T(PHY,"UE_DLSCH_PARALLELISATION is NOT defined, ret1 = %d\n", ret1); - printf("start cw1 dlsch decoding\n"); -#endif + if( IS_DLSCH_PARALLEL) + { + ret1 = nr_dlsch_decoding_mthread(ue, + proc, + eNB_id, + pdsch_vars->llr[1], + &ue->frame_parms, + dlsch1, + dlsch1->harq_processes[harq_pid], + frame_rx, + nb_symb_sch, + nr_tti_rx, + harq_pid, + pdsch==PDSCH?1:0, + dlsch1->harq_processes[harq_pid]->TBS>256?1:0); + LOG_T(PHY,"CW dlsch decoding is parallelized, ret1 = %d\n", ret1); + } + else + { + ret1 = nr_dlsch_decoding(ue, + proc, + eNB_id, + pdsch_vars->llr[1], + &ue->frame_parms, + dlsch1, + dlsch1->harq_processes[harq_pid], + frame_rx, + nb_symb_sch, + nr_tti_rx, + harq_pid, + pdsch==PDSCH?1:0,//proc->decoder_switch, + dlsch1->harq_processes[harq_pid]->TBS>256?1:0); + LOG_T(PHY,"CWW sequential dlsch decoding, ret1 = %d\n", ret1); + } #if UE_TIMING_TRACE stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]); diff --git a/targets/COMMON/create_nr_tasks.h b/targets/COMMON/create_nr_tasks.h index ca259a2b34..23dd23e7db 100644 --- a/targets/COMMON/create_nr_tasks.h +++ b/targets/COMMON/create_nr_tasks.h @@ -22,8 +22,6 @@ #ifndef CREATE_NR_TASKS_H_ #define CREATE_NR_TASKS_H_ -/* External declaration of L2L1 task that depend on the target */ -extern void *l2l1_task(void *arg); int create_gNB_tasks(uint32_t gnb_nb); diff --git a/targets/COMMON/create_tasks.h b/targets/COMMON/create_tasks.h index 843897cefb..e3f871964a 100644 --- a/targets/COMMON/create_tasks.h +++ b/targets/COMMON/create_tasks.h @@ -22,9 +22,6 @@ #ifndef CREATE_TASKS_H_ #define CREATE_TASKS_H_ -/* External declaration of L2L1 task that depend on the target */ -extern void *l2l1_task(void *arg); - int create_tasks(uint32_t enb_nb); int create_tasks_ue(uint32_t ue_nb); int create_tasks_mbms(uint32_t enb_nb); From 9ef0107a6ef0347b28d90f04957caabec20427ea Mon Sep 17 00:00:00 2001 From: Hongzhi Wang Date: Fri, 27 Nov 2020 11:00:53 +0100 Subject: [PATCH 072/160] bug fix ue parallelization --- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 01eb7ca07d..9a15bed1fd 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -802,20 +802,17 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, uint32_t Tbslbrm = 950984; uint16_t nb_rb = 30; double Coderate = 0.0; - uint8_t dmrs_Type = harq_process->dmrsConfigType; - //nfapi_nr_config_request_t *cfg = &phy_vars_ue->nrUE_config; - //uint8_t dmrs_type = cfg->pdsch_config.dmrs_type.value; + uint8_t dmrs_type = harq_process->dmrsConfigType; uint8_t nb_re_dmrs; - if (dmrs_Type == NFAPI_NR_DMRS_TYPE1) + if (dmrs_type == NFAPI_NR_DMRS_TYPE1) nb_re_dmrs = 6*harq_process->n_dmrs_cdm_groups; else nb_re_dmrs = 4*harq_process->n_dmrs_cdm_groups; - uint16_t length_dmrs = get_num_dmrs(harq_process->dlDmrsSymbPos); - + uint16_t length_dmrs = get_num_dmrs(dl_config_pdu->dlDmrsSymbPos); + uint32_t i,j; -// int nbDlProcessing =0; __m128i *pv = (__m128i*)&z; __m128i *pl = (__m128i*)&l; @@ -1187,11 +1184,11 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, } if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) { - printf("Segment %u CRC OK\n",r); + LOG_D(PHY,"Segment %u CRC OK\n",r); ret = 2; } else { - printf("CRC NOK\n"); + LOG_D(PHY,"CRC NOK\n"); ret = 1+dlsch->max_ldpc_iterations; } @@ -1501,7 +1498,7 @@ void nr_dlsch_decoding_process(void *arg) // } - //printf("round %d Z %d K %d BG %d\n", harq_process->round, p_decParams->Z, harq_process->K, p_decParams->BG); + LOG_D(PHY,"round %d Z %d K %d BG %d\n", harq_process->round, p_decParams->Z, harq_process->K, p_decParams->BG); p_decParams->numMaxIter = dlsch->max_ldpc_iterations; @@ -1545,9 +1542,7 @@ void nr_dlsch_decoding_process(void *arg) r_offset = Nl*Qm*(G/(Nl*Qm*Cprime)); else r_offset = Nl*Qm*((G/(Nl*Qm*Cprime))+1); - - // printf("thread0 r_offset %d\n",r_offset); - + //for (r=(harq_process->C/2); rC; r++) { // r=1; //(harq_process->C/2); @@ -1657,18 +1652,18 @@ void nr_dlsch_decoding_process(void *arg) if (err_flag == 0) { /* - LOG_D(PHY, "turbo algo Kr=%d cb_cnt=%d C=%d nbRB=%d crc_type %d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d maxIter %d\n", + LOG_D(PHY, "LDPC algo Kr=%d cb_cnt=%d C=%d nbRB=%d crc_type %d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d maxIter %d\n", Kr,r,harq_process->C,harq_process->nb_rb,crc_type,A,harq_process->TBS, harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round,dlsch->max_ldpc_iterations); */ if (llr8_flag1) { - AssertFatal (Kr >= 256, "turbo algo issue Kr=%d cb_cnt=%d C=%d nbRB=%d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d\n", + AssertFatal (Kr >= 256, "LDPC algo issue Kr=%d cb_cnt=%d C=%d nbRB=%d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d\n", Kr,r,harq_process->C,harq_process->nb_rb,A,harq_process->TBS,harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round); } #if UE_TIMING_TRACE start_meas(dlsch_turbo_decoding_stats); #endif -// LOG_D(PHY,"AbsSubframe %d.%d Start turbo segment %d/%d \n",frame%1024,subframe,r,harq_process->C-1); +// LOG_D(PHY,"AbsSubframe %d.%d Start LDPC segment %d/%d \n",frame%1024,subframe,r,harq_process->C-1); /* for (int cnt =0; cnt < (kc-2)*p_decParams->Z; cnt++){ inv_d[cnt] = (1)*harq_process->d[r][cnt]; From a365bde8da0ce3cbc1c4900467f5175faa980a59 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Sat, 28 Nov 2020 01:32:31 +0000 Subject: [PATCH 073/160] Minor correction: y cannot be zero --- .../PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 7 +++++-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 9 +++------ .../CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf | 16 ++++++++-------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 3cc49b3186..8c694edcf4 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -422,7 +422,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, } len = (pilots==1)? ((config_type==pdsch_dmrs_type1)?nb_rb*(12-6*dlsch0_harq->n_dmrs_cdm_groups): nb_rb*(12-4*dlsch0_harq->n_dmrs_cdm_groups)):(nb_rb*12); - + #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); #if DISABLE_LOG_X @@ -1591,13 +1591,16 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext, short rb; unsigned char aatx,aarx; __m128i *dl_ch128, avg128D; - +Mi //nb_rb*nre = y * 2^x int16_t x = factor2(len); //x = (x>4) ? 4 : x; int16_t y = (len)>>x; //printf("len = %d = %d * 2^(%d)\n",len,y,x); + // FIXME: y cannot be zero + if(y == 0) y = 1; + for (aatx=0; aatxnb_antenna_ports_gNB; aatx++) for (aarx=0; aarxnb_antennas_rx; aarx++) { //clear average level diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index a34520a154..e319430c66 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -298,6 +298,8 @@ void schedule_control_sib1(module_id_t module_id, gNB_mac->sched_ctrlCommon->rbSize = rbSize; gNB_mac->sched_ctrlCommon->rbStart = 0; + LOG_I(MAC,"rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); + // Mark the corresponding RBs as used for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) { vrb_map[rb + rbStart] = 1; @@ -440,7 +442,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) // static values const int CC_id = 0; - int time_domain_allocation = 2; // FIXME: For OAI-UE (2), For 3rd party implementation and 3GPP compliant (4) + int time_domain_allocation = 0; // FIXME: For OAI-UE (0-3), For 3rd party implementation and 3GPP compliant (4) uint8_t mcsTableIdx = 0; uint8_t mcs = 8; uint8_t numDmrsCdmGrpsNoData = 2; @@ -474,11 +476,6 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS,0 ,0 ,1 ) >> 3; - - printf("===================================================\n"); - printf("gNB_mac->sched_ctrlCommon->rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); - printf("===================================================\n"); - nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, TBS, startSymbolIndex, nrOfSymbols); diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 3558122f24..770f0b92b3 100755 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -62,25 +62,25 @@ gNBs = #pdschTimeDomainAllocationList (up to 16 entries) initialDLBWPk0_0 = 0; #initialULBWPmappingType - #0=typeA,1=typeB + #0=typeA,1=typeB initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_0 = 53; initialDLBWPk0_1 = 0; initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + #this is SS=2,L=10 + initialDLBWPstartSymbolAndLength_1 = 81; initialDLBWPk0_2 = 0; initialDLBWPmappingType_2 = 0; #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; + initialDLBWPstartSymbolAndLength_2 = 95; initialDLBWPk0_3 = 0; initialDLBWPmappingType_3 = 0; - #this is SS=1,L=5 - initialDLBWPstartSymbolAndLength_3 = 57; + #this is SS=2,L=7 + initialDLBWPstartSymbolAndLength_3 = 86; initialDLBWPk0_4 = 0; initialDLBWPmappingType_4 = 0; From 548015929ec6cb4339ed3dd896f810adda3f1827 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Sat, 28 Nov 2020 01:49:00 +0000 Subject: [PATCH 074/160] Minor correction --- openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 8c694edcf4..c769c53c5d 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -1591,7 +1591,7 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext, short rb; unsigned char aatx,aarx; __m128i *dl_ch128, avg128D; -Mi + //nb_rb*nre = y * 2^x int16_t x = factor2(len); //x = (x>4) ? 4 : x; From b54c32b70d85e8f96a80c178c6311ceffb33812e Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Tue, 21 Jul 2020 18:41:42 +0900 Subject: [PATCH 075/160] Change UL DCI aggregation level by DL cqi. (cherry picked from commit 175c59ae3aedf612777cd1c8c88b6d6f254b9334) --- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 39 ++++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 5e4810e57a..7e68349e47 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -2312,6 +2312,18 @@ void ulsch_scheduler_pre_ue_select_fairRR( } } + if (mac_eNB_get_rrc_status(module_idP, rnti) == RRC_HO_EXECUTION) { + aggregation = 4; + + if(get_aggregation(get_bw_index(module_idP, CC_id),UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0)>4) + aggregation = get_aggregation(get_bw_index(module_idP, CC_id),UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0); + }else{ + //aggregation = 2; + aggregation = get_aggregation(get_bw_index(module_idP, CC_id), + UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id], + format0); + } + cc = &eNB->common_channels[CC_id]; //harq_pid harq_pid = subframe2harqpid(cc,(frameP+(sched_subframePhi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi]; - format_flag = 2; rnti = UE_RNTI(module_idP,first_ue_id[CC_id][temp]); + format_flag = 2; aggregation=get_aggregation(get_bw_index(module_idP,CC_id),UE_info->UE_sched_ctrl[first_ue_id[CC_id][temp]].dl_cqi[CC_id],format0); - + if (mac_eNB_get_rrc_status(module_idP, rnti) == RRC_HO_EXECUTION) { + aggregation = 4; + + if(get_aggregation(get_bw_index(module_idP, CC_id),UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0)>4) + aggregation = get_aggregation(get_bw_index(module_idP, CC_id),UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0); + }else { + aggregation = get_aggregation(get_bw_index(module_idP, CC_id), + UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id], + format0); + } if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) { cc_id_flag[CC_id] = 1; break; @@ -2498,6 +2519,9 @@ void ulsch_scheduler_pre_ue_select_fairRR( format_flag = 2; aggregation=get_aggregation(get_bw_index(module_idP,CC_id),UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0); + aggregation = get_aggregation(get_bw_index(module_idP, CC_id), + UE_list->UE_sched_ctrl[UE_id].dl_cqi[CC_id], + format0); if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) { cc_id_flag[CC_id] = 1; continue; @@ -3112,7 +3136,16 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, UE_sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; harq_pid = subframe2harqpid(cc,sched_frame,sched_subframeP); rnti = UE_RNTI(CC_id,UE_id); - aggregation=get_aggregation(get_bw_index(module_idP,CC_id),UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0); + if (mac_eNB_get_rrc_status(module_idP, rnti) == RRC_HO_EXECUTION) { + aggregation = 4; + if(get_aggregation(get_bw_index(module_idP, CC_id),UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0)>4) + aggregation = get_aggregation(get_bw_index(module_idP, CC_id),UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0); + }else{ + //aggregation = 2; + aggregation = get_aggregation(get_bw_index(module_idP, CC_id), + UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id], + format0); + } LOG_D(MAC,"[eNB %d] frame %d subframe %d,Checking PUSCH %d for UE %d/%x CC %d : aggregation level %d, N_RB_UL %d\n", module_idP,frameP,subframeP,harq_pid,UE_id,rnti,CC_id, aggregation,N_RB_UL); int bytes_to_schedule = UE_template->estimated_ul_buffer - UE_template->scheduled_ul_bytes; From de568b2d8841f32753f0586d78c0e13a4a66184f Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Tue, 8 Sep 2020 16:00:36 +0900 Subject: [PATCH 076/160] Change default value of pusch signal power threshold. --- openair2/ENB_APP/L1_paramdef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/L1_paramdef.h b/openair2/ENB_APP/L1_paramdef.h index 6c303ae29f..813cca419c 100644 --- a/openair2/ENB_APP/L1_paramdef.h +++ b/openair2/ENB_APP/L1_paramdef.h @@ -91,7 +91,7 @@ {CONFIG_STRING_L1_PRACH_DTX_EMTC3_THRESHOLD, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \ {CONFIG_STRING_L1_PUCCH1_DTX_EMTC3_THRESHOLD, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {CONFIG_STRING_L1_PUCCH1AB_DTX_EMTC3_THRESHOLD, NULL, 0, iptr:NULL, defintval:4, TYPE_INT, 0}, \ -{CONFIG_STRING_L1_PUSCH_SIGNAL_THRESHOLD, NULL, 0, iptr:NULL, defintval:330, TYPE_INT, 0} \ +{CONFIG_STRING_L1_PUSCH_SIGNAL_THRESHOLD, NULL, 0, iptr:NULL, defintval:635, TYPE_INT, 0} \ } #define L1_CC_IDX 0 #define L1_TRANSPORT_N_PREFERENCE_IDX 1 From 1a320bc6d4d74df5c695f4d46a5d77cef4005d6f Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Mon, 14 Sep 2020 15:47:52 +0900 Subject: [PATCH 077/160] Fix: SNR feedback to PUSCH TPC and PUCCH TPC of default scheduler. --- openair2/LAYER2/MAC/eNB_scheduler_phytest.c | 1 - openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c index 8bd3ebdd9b..1e595f11b5 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c @@ -239,7 +239,6 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s //compute the expected ULSCH RX power (for the stats) // this is the snr and this should be constant (regardless of mcs) snr = UE_sched_ctrl->pusch_snr[CC_id]; - // new transmission ndi = 1-UE_template->oldNDI_UL[harq_pid]; UE_template->oldNDI_UL[harq_pid]=ndi; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 2f41e015e9..d3a13591b4 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -1492,7 +1492,7 @@ schedule_ulsch_rnti(module_id_t module_idP, * This is the normalized RX snr and this should be constant (regardless * of mcs) Is not in dBm, unit from nfapi, converting to dBm */ - const int32_t snr = (5 * UE_sched_ctrl_ptr->pusch_snr[CC_id] - 640) / 10; + const int32_t snr = UE_sched_ctrl_ptr->pusch_snr[CC_id]; const int32_t target_snr = mac->puSch10xSnr / 10; /* @@ -2073,7 +2073,7 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP, cqi_req = 0; /* Power control: compute the expected ULSCH RX snr (for the stats) */ /* This is the normalized snr and this should be constant (regardless of mcs) */ - snr = UE_sched_ctrl->pusch_snr_avg[CC_id]; + snr = UE_sched_ctrl->pusch_snr[CC_id]; target_snr = eNB->puSch10xSnr / 10; /* TODO: target_rx_power was 178, what to put? */ /* This assumes accumulated tpc */ /* Make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out */ From fc595236b33056e91293c66cb4436f984708cf3a Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Tue, 15 Sep 2020 11:38:41 +0900 Subject: [PATCH 078/160] add logs. --- openair2/LAYER2/MAC/eNB_scheduler_primitives.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index c8d4862144..32c01593b1 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -4946,6 +4946,7 @@ cqi_indication(module_id_t mod_idP, { int UE_id = find_UE_id(mod_idP, rntiP); UE_info_t *UE_info = &RC.mac[mod_idP]->UE_info; + uint64_t pdu_val = *(uint64_t *) pdu; if (UE_id == -1) { LOG_W(MAC, "cqi_indication: UE %x not found\n", rntiP); @@ -4985,10 +4986,10 @@ cqi_indication(module_id_t mod_idP, subframeP, pdu, rel9->length); - LOG_D(MAC,"Frame %d Subframe %d update CQI:%d\n", + LOG_D(MAC,"Frame %d Subframe %d update CQI:%d pdu 0x%016"PRIx64"\n", frameP, subframeP, - sched_ctl->dl_cqi[CC_idP]); + sched_ctl->dl_cqi[CC_idP],pdu_val); sched_ctl->cqi_req_flag &= (~(1 << subframeP)); sched_ctl->cqi_received = 1; } From 18becc60fc70073313fc67747b107964bc82a126 Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Fri, 25 Sep 2020 12:46:03 +0900 Subject: [PATCH 079/160] Fix: rfsim abnormal CCCH reception. --- openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c | 3 --- openair1/SCHED/ru_procedures.c | 1 - 2 files changed, 4 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c index f1279ddc2c..b4b273aa8e 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c @@ -1081,9 +1081,6 @@ void rx_ulsch(PHY_VARS_eNB *eNB, symbol_offset = frame_parms->N_RB_UL*12*((3 - frame_parms->Ncp)+(7-frame_parms->Ncp)); pusch_vars->ulsch_interference_power[i] += interference_power(&pusch_vars->drs_ch_estimates[i][symbol_offset],ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12); pusch_vars->ulsch_power[i] += signal_power(&pusch_vars->drs_ch_estimates[i][symbol_offset],ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12); - //ave - pusch_vars->ulsch_interference_power[i] >>= 1; - pusch_vars->ulsch_power[i] >>= 1; pusch_vars->ulsch_interference_power[i] = pusch_vars->ulsch_interference_power[i]/correction_factor; pusch_vars->ulsch_power[i] = pusch_vars->ulsch_power[i]/correction_factor; diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c index e472d64db4..70399f0a23 100644 --- a/openair1/SCHED/ru_procedures.c +++ b/openair1/SCHED/ru_procedures.c @@ -775,7 +775,6 @@ void fep_full(RU_t *ru, if ((fp->frame_type == TDD) && (subframe_select(fp,subframe) != SF_UL)) return; - start_meas(&ru->ofdm_demod_stats); if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+ru->idx, 1 ); From 5db6e75bb101bdfe2deb3af9dbb8187da2882dce Mon Sep 17 00:00:00 2001 From: Haruki NAOI Date: Fri, 25 Sep 2020 15:18:45 +0900 Subject: [PATCH 080/160] fix warning. --- openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c index b4b273aa8e..978e38afca 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c @@ -1031,6 +1031,7 @@ void rx_ulsch(PHY_VARS_eNB *eNB, AssertFatal(ulsch[UE_id]->harq_processes[harq_pid]->nb_rb > 0, "PUSCH (%d/%x) nb_rb=0!\n", harq_pid,ulsch[UE_id]->rnti); + for (l=0; l<(frame_parms->symbols_per_tti-ulsch[UE_id]->harq_processes[harq_pid]->srs_active); l++) { if(LOG_DEBUGFLAG(DEBUG_ULSCH)) { LOG_I(PHY,"rx_ulsch : symbol %d (first_rb %d,nb_rb %d), rxdataF %p, rxdataF_ext %p\n",l, From 6d0ef37c8ecee25bce691be23c2ec4fe5c315ebf Mon Sep 17 00:00:00 2001 From: zhenghuangkun Date: Fri, 25 Sep 2020 16:33:24 +0900 Subject: [PATCH 081/160] Modify DRB_active array size to NB_RB_MAX -2 --- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 7 +++++++ openair2/RRC/LTE/rrc_defs.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index d3a13591b4..1991c81397 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -961,6 +961,13 @@ rx_sdu(const module_id_t enb_mod_idP, rx_lcids[i], UE_id); } + }else { + LOG_E(MAC, "[eNB %d/%d] frame %d received a invalid LCID of size %d ( sdu_len %d, lcid %d), dropping packet\n", + enb_mod_idP, + CC_idP, + frameP, + rx_lengths[i], + sdu_lenP,rx_lcids[i]); } break; diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index 7829360939..7602e9ca64 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -554,7 +554,7 @@ typedef struct eNB_RRC_UE_s { LTE_DRB_ToAddModList_t *DRB_configList; LTE_DRB_ToAddModList_t *DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; LTE_DRB_ToReleaseList_t *DRB_Release_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; - uint8_t DRB_active[8]; + uint8_t DRB_active[NB_RB_MAX -2]; struct LTE_PhysicalConfigDedicated *physicalConfigDedicated; struct LTE_SPS_Config *sps_Config; LTE_MeasObjectToAddMod_t *MeasObj[MAX_MEAS_OBJ]; From e64593246bee967300f3bf61a9088dbdbf2bc798 Mon Sep 17 00:00:00 2001 From: zhenghuangkun Date: Fri, 25 Sep 2020 18:31:52 +0900 Subject: [PATCH 082/160] Fix: rfsim abnormal CCCH reception. --- openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c index 978e38afca..eeab616097 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c @@ -755,6 +755,7 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext, __m128i *ul_ch128,*ul_ch_mag128,*ul_ch_mag128b,*rxdataF128,*rxdataF_comp128; uint8_t aarx;//,symbol_mod; __m128i mmtmpU0,mmtmpU1,mmtmpU2,mmtmpU3; + #elif defined(__arm__) int16x4_t *ul_ch128,*rxdataF128; int16x8_t *ul_ch_mag128,*ul_ch_mag128b,*rxdataF_comp128; @@ -762,6 +763,7 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext, int32x4_t mmtmpU0,mmtmpU1,mmtmpU0b,mmtmpU1b; int16_t conj[4]__attribute__((aligned(16))) = {1,-1,1,-1}; int32x4_t output_shift128 = vmovq_n_s32(-(int32_t)output_shift); + #endif for (aarx=0; aarxnb_antennas_rx; aarx++) { @@ -872,6 +874,7 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext, rxdataF_comp128[0] = _mm_add_epi16(rxdataF_comp128[0],(*(__m128i *)&jitter[0])); rxdataF_comp128[1] = _mm_add_epi16(rxdataF_comp128[1],(*(__m128i *)&jitter[0])); rxdataF_comp128[2] = _mm_add_epi16(rxdataF_comp128[2],(*(__m128i *)&jitter[0])); + ul_ch128+=3; ul_ch_mag128+=3; ul_ch_mag128b+=3; @@ -918,9 +921,10 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext, mmtmpU1 = vqshlq_s32(mmtmpU1,-output_shift128); rxdataF_comp128[2] = vcombine_s16(vmovn_s32(mmtmpU0),vmovn_s32(mmtmpU1)); // Add a jitter to compensate for the saturation in "packs" resulting in a bias on the DC after IDFT - rxdataF_comp128[0] = vqaddq_s16(rxdataF_comp128[0],(*(int16x8_t *)&jitter[0])); - rxdataF_comp128[1] = vqaddq_s16(rxdataF_comp128[1],(*(int16x8_t *)&jitter[0])); - rxdataF_comp128[2] = vqaddq_s16(rxdataF_comp128[2],(*(int16x8_t *)&jitter[0])); + rxdataF_comp128[0] = vqaddq_s16(rxdataF_comp128[0],(*(int16x8_t*)&jitter[0])); + rxdataF_comp128[1] = vqaddq_s16(rxdataF_comp128[1],(*(int16x8_t*)&jitter[0])); + rxdataF_comp128[2] = vqaddq_s16(rxdataF_comp128[2],(*(int16x8_t*)&jitter[0])); + ul_ch128+=6; ul_ch_mag128+=3; ul_ch_mag128b+=3; From 15680553108dd0be3b15c0eb1efcc21c97680a28 Mon Sep 17 00:00:00 2001 From: Ding Yumei Date: Thu, 15 Oct 2020 14:48:19 +0900 Subject: [PATCH 083/160] fix segmentation fault(ul dtch length error) --- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 1991c81397..8f40e8a6a4 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -972,8 +972,13 @@ rx_sdu(const module_id_t enb_mod_idP, break; } - - payload_ptr += rx_lengths[i]; + if((sdu_lenP - (payload_ptr - sduP)) >= rx_lengths[i]){ + payload_ptr += rx_lengths[i]; + }else{ + LOG_E(MAC,"[eNB %d/%d] frame %d subframe %d rnti %x sdu_len %d remain_len %d rx_lengths %d\n", + enb_mod_idP,CC_idP,frameP,subframeP,rntiP,sdu_lenP,(uint16_t)(payload_ptr - sduP), rx_lengths[i]); + return; + } } /* CDRX UL HARQ timers */ From 0dd16fb6f5fac6d0353d105336c4934bebde124c Mon Sep 17 00:00:00 2001 From: Ding Yumei Date: Tue, 20 Oct 2020 12:02:07 +0900 Subject: [PATCH 084/160] fix segmentation fault(ul error) --- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 8f40e8a6a4..1ee739eaf6 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -862,9 +862,8 @@ rx_sdu(const module_id_t enb_mod_idP, LOG_T(MAC, "\n"); #endif - if (rx_lcids[i] < NB_RB_MAX) { - if ((rx_lengths[i] > SCH_PAYLOAD_SIZE_MAX) || (rx_lengths[i] < 0) || (rx_lengths[i] > sdu_lenP)) { + if ((rx_lengths[i] > SCH_PAYLOAD_SIZE_MAX) || (rx_lengths[i] < 0) || (rx_lengths[i] > (sdu_lenP - (payload_ptr - sduP)))) { LOG_E(MAC, "[eNB %d/%d] frame %d received DTCH of size %d (too big, maximum allowed is %d, sdu_len %d), dropping packet\n", enb_mod_idP, CC_idP, @@ -976,7 +975,7 @@ rx_sdu(const module_id_t enb_mod_idP, payload_ptr += rx_lengths[i]; }else{ LOG_E(MAC,"[eNB %d/%d] frame %d subframe %d rnti %x sdu_len %d remain_len %d rx_lengths %d\n", - enb_mod_idP,CC_idP,frameP,subframeP,rntiP,sdu_lenP,(uint16_t)(payload_ptr - sduP), rx_lengths[i]); + enb_mod_idP,CC_idP,frameP,subframeP,rntiP,sdu_lenP,(uint16_t)(sdu_lenP - (payload_ptr - sduP)), rx_lengths[i]); return; } } From 67da5c7cf35d52f94caf80822d1f2553a4f406f8 Mon Sep 17 00:00:00 2001 From: Ding Yumei Date: Tue, 20 Oct 2020 12:12:57 +0900 Subject: [PATCH 085/160] fix segmentation fault(ccch/dcch length eror) --- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 1ee739eaf6..4e63863df4 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -683,7 +683,7 @@ rx_sdu(const module_id_t enb_mod_idP, switch (rx_lcids[i]) { case CCCH: - if ((rx_lengths[i] > CCCH_PAYLOAD_SIZE_MAX) || (rx_lengths[i] < 0) || (rx_lengths[i] > sdu_lenP)) { + if ((rx_lengths[i] > CCCH_PAYLOAD_SIZE_MAX) || (rx_lengths[i] < 0) || (rx_lengths[i] > (sdu_lenP - (payload_ptr - sduP)))) { LOG_E(MAC, "[eNB %d/%d] frame %d received CCCH of size %d (too big, maximum allowed is %d, sdu_len %d), dropping packet\n", enb_mod_idP, CC_idP, @@ -804,7 +804,7 @@ rx_sdu(const module_id_t enb_mod_idP, LOG_T(MAC, "\n"); #endif - if ((rx_lengths[i] > DCH_PAYLOAD_SIZE_MAX) || (rx_lengths[i] < 0) || (rx_lengths[i] > sdu_lenP)) { + if ((rx_lengths[i] > DCH_PAYLOAD_SIZE_MAX) || (rx_lengths[i] < 0) || (rx_lengths[i] > (sdu_lenP - (payload_ptr - sduP)))) { LOG_E(MAC, "[eNB %d/%d] frame %d received DCCH of size %d (too big, maximum allowed is %d, sdu_len %d), dropping packet\n", enb_mod_idP, CC_idP, From a332423d97548d26b742f3a145e036910c999207 Mon Sep 17 00:00:00 2001 From: Ding Yumei Date: Tue, 20 Oct 2020 18:54:25 +0900 Subject: [PATCH 086/160] fix segmentation fault(mac head error) --- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 4e63863df4..6639e10075 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -1130,6 +1130,10 @@ parse_ulsch_header(unsigned char *mac_header, tb_length, length, mac_header_ptr - mac_header); + if(num_sdus >= NB_RB_MAX){ + LOG_E(MAC,"parse_ulsch_header: num_sdus(%d) reach max\n",num_sdus); + return NULL; + } rx_lcids[num_sdus] = lcid; rx_lengths[num_sdus] = length; num_sdus++; @@ -1137,6 +1141,10 @@ parse_ulsch_header(unsigned char *mac_header, if (lcid == SHORT_PADDING) { mac_header_ptr++; } else { + if(num_ces >= MAX_NUM_CE){ + LOG_E(MAC,"parse_ulsch_header: num_ces(%d) reach max\n",num_ces); + return NULL; + } rx_ces[num_ces] = lcid; num_ces++; mac_header_ptr++; From 20f1d347ac630cbbd2e59d90b185b342a9a1bb4e Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Thu, 5 Nov 2020 23:07:49 +0900 Subject: [PATCH 087/160] Fix DCI0 aggregation and call ulsch scheduling. --- openair1/SCHED/fapi_l1.c | 22 ++++++++++++++++++++++ openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 5 +++++ 2 files changed, 27 insertions(+) diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index 96a073fbb8..e444dff41f 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -992,11 +992,33 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) { if (NFAPI_MODE!=NFAPI_MONOLITHIC) { if (number_ul_pdu>0) { + uint8_t ulsch_pdu_num = 0; + for (i=0; iul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE) || + (UL_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE) || + (UL_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE) || + (UL_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE)){ + ulsch_pdu_num++; + } + } + if (RC.mac[Mod_id]->scheduler_mode == SCHED_MODE_DEFAULT) { + //LOG_D(PHY, "UL_CONFIG to send to PNF\n"); + UL_req->sfn_sf = frame << 4 | subframe; + oai_nfapi_ul_config_req(UL_req); + UL_req->ul_config_request_body.number_of_pdus=0; + number_ul_pdu=0; + }else if (RC.mac[Mod_id]->scheduler_mode == SCHED_MODE_FAIR_RR) { + if(ulsch_pdu_num <= RC.rrc[Mod_id]->configuration.radioresourceconfig[CC_id].ue_multiple_max){ //LOG_D(PHY, "UL_CONFIG to send to PNF\n"); UL_req->sfn_sf = frame << 4 | subframe; oai_nfapi_ul_config_req(UL_req); UL_req->ul_config_request_body.number_of_pdus=0; number_ul_pdu=0; + }else{ + LOG_E(MAC,"NFAPI: frame %d subframe %d ul_req num %d ul pdu %d\n", + frame,subframe,number_ul_pdu,ulsch_pdu_num); + } + } } } else { for (i=0; icommon_channels; UE_info_t *UE_info = &mac->UE_info; + //uint8_t aggregation = 2; int sched_frame = frameP; @@ -1669,8 +1670,12 @@ schedule_ulsch_rnti(module_id_t module_idP, UE_template_ptr->cshift[harq_pid] = cshift; /* Setting DCI0 NFAPI struct */ hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[dci_ul_pdu_idx]; + //memset((void *) hi_dci0_pdu, 0,sizeof(nfapi_hi_dci0_request_pdu_t)); + hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; hi_dci0_pdu->pdu_size = 2 + sizeof(nfapi_hi_dci0_dci_pdu); hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format = NFAPI_UL_DCI_FORMAT_0; + //hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; hi_dci0_pdu->dci_pdu.dci_pdu_rel8.transmission_power = 6000; hi_dci0_pdu->dci_pdu.dci_pdu_rel8.resource_block_start = UE_template_ptr->pre_first_nb_rb_ul; hi_dci0_pdu->dci_pdu.dci_pdu_rel8.number_of_resource_block = From 88699deb81e312e2c3695bd02d3c3157a65536fb Mon Sep 17 00:00:00 2001 From: zhenghuangkun Date: Mon, 30 Nov 2020 18:56:26 +0900 Subject: [PATCH 088/160] Merge branch fujitsu_lte_contribution into lte_uplink_improvement --- openair1/PHY/LTE_TRANSPORT/pucch.c | 3 +- openair2/ENB_APP/L1_paramdef.h | 2 +- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 65 ++++++------------- .../LAYER2/MAC/eNB_scheduler_primitives.c | 1 + openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 20 +----- openair2/LAYER2/MAC/mac.h | 2 + 6 files changed, 28 insertions(+), 65 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c index 9c5f28bec3..fa4d883d64 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch.c @@ -737,7 +737,6 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, int16_t *zptr; int16_t rxcomp[NB_ANTENNAS_RX][2*12*14]; uint8_t ns,N_UL_symb,nsymb,n_cs_base; - uint8_t c = (frame_parms->Ncp==0) ? 3 : 2; uint16_t i,j,re_offset; uint8_t m,l; uint8_t n_cs,alpha_ind; @@ -848,7 +847,7 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, } interference_power /= calc_cnt; eNB->measurements.n0_pucch_dB = dB_fixed_x10((int)(interference_power/calc_cnt))/10; - LOG_D(PHY,"estimate pucch noise %d %d %d\n",interference_power,calc_cnt,eNB->measurements.n0_pucch_dB); + LOG_D(PHY,"estimate pucch noise %lf %d %d\n",interference_power,calc_cnt,eNB->measurements.n0_pucch_dB); return 0; } diff --git a/openair2/ENB_APP/L1_paramdef.h b/openair2/ENB_APP/L1_paramdef.h index 813cca419c..c4e6670ea3 100644 --- a/openair2/ENB_APP/L1_paramdef.h +++ b/openair2/ENB_APP/L1_paramdef.h @@ -117,7 +117,7 @@ #define L1_PRACH_DTX_EMTC3_THRESHOLD_IDX 21 #define L1_PUCCH1_DTX_EMTC3_THRESHOLD_IDX 22 #define L1_PUCCH1AB_DTX_EMTC3_THRESHOLD_IDX 23 -#define L1_PUSCH_SIGNAL_THRESHOLD_IDX 28 +#define L1_PUSCH_SIGNAL_THRESHOLD_IDX 24 /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ #endif diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 7e68349e47..23137b7887 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -61,7 +61,9 @@ extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset); /* internal vars */ DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs]; int last_dlsch_ue_id[MAX_NUM_CCs] = {-1}; +int last_dlsch_ue_id_volte[MAX_NUM_CCs] = {-1}; int last_ulsch_ue_id[MAX_NUM_CCs] = {-1}; +int last_ulsch_ue_id_volte[MAX_NUM_CCs] = {-1}; #if defined(PRE_SCD_THREAD) uint16_t pre_nb_rbs_required[2][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; @@ -1001,17 +1003,7 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id, rnti = dlsch_ue_select[CC_id].list[i].rnti; ue_sched_ctl = &UE_info->UE_sched_ctrl[UE_id]; harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frameP,subframeP); - - unsigned char round1, round2; - round1 = ue_sched_ctl->round[CC_id][harq_pid][TB1]; - round2 = ue_sched_ctl->round[CC_id][harq_pid][TB2]; - if ((round1 != 8) || (round2 != 8)){ - Round = cmin(round1,round2); - ue_sched_ctl->ret_cnt[CC_id]++; - } else{ - Round = 8; - ue_sched_ctl->first_cnt[CC_id]++; - } + Round = ue_sched_ctl->round[CC_id][harq_pid]; //if (mac_eNB_get_rrc_status(Mod_id, rnti) < RRC_RECONFIGURED || round > 0) { if (mac_eNB_get_rrc_status(Mod_id, rnti) < RRC_RECONFIGURED || Round != 8) { // FIXME @@ -2357,7 +2349,7 @@ void ulsch_scheduler_pre_ue_select_fairRR( if (bytes_to_schedule < 0) { bytes_to_schedule = 0; - UE_list->UE_template[CC_id][UE_id].scheduled_ul_bytes = 0; + UE_info->UE_template[CC_id][UE_id].scheduled_ul_bytes = 0; } if ( UE_id > last_ulsch_ue_id[CC_id] && ((ulsch_ue_select[CC_id].ue_num+ue_first_num[CC_id]) < ulsch_ue_max_num[CC_id]) ) { @@ -2415,32 +2407,11 @@ void ulsch_scheduler_pre_ue_select_fairRR( break; } - for(i = 0; ihi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi]; - rnti = UE_RNTI(module_idP,first_ue_id[CC_id][temp]); format_flag = 2; + rnti = UE_RNTI(module_idP,first_ue_id[CC_id][temp]); aggregation=get_aggregation(get_bw_index(module_idP,CC_id),UE_info->UE_sched_ctrl[first_ue_id[CC_id][temp]].dl_cqi[CC_id],format0); - if (mac_eNB_get_rrc_status(module_idP, rnti) == RRC_HO_EXECUTION) { - aggregation = 4; - - if(get_aggregation(get_bw_index(module_idP, CC_id),UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0)>4) - aggregation = get_aggregation(get_bw_index(module_idP, CC_id),UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0); - }else { - aggregation = get_aggregation(get_bw_index(module_idP, CC_id), - UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id], - format0); - } + if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) { cc_id_flag[CC_id] = 1; break; @@ -2507,7 +2478,7 @@ void ulsch_scheduler_pre_ue_select_fairRR( if (bytes_to_schedule < 0) { bytes_to_schedule = 0; - UE_list->UE_template[CC_id][UE_id].scheduled_ul_bytes = 0; + UE_info->UE_template[CC_id][UE_id].scheduled_ul_bytes = 0; } rrc_status = mac_eNB_get_rrc_status(module_idP, rnti); @@ -2517,11 +2488,17 @@ void ulsch_scheduler_pre_ue_select_fairRR( ((UE_sched_ctl->cqi_req_timer>64)&&((rrc_status >= RRC_CONNECTED))) ) { hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi]; format_flag = 2; - aggregation=get_aggregation(get_bw_index(module_idP,CC_id),UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0); - - aggregation = get_aggregation(get_bw_index(module_idP, CC_id), - UE_list->UE_sched_ctrl[UE_id].dl_cqi[CC_id], + if (mac_eNB_get_rrc_status(module_idP, rnti) == RRC_HO_EXECUTION) { + aggregation = 4; + + if(get_aggregation(get_bw_index(module_idP, CC_id),UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0)>4) + aggregation = get_aggregation(get_bw_index(module_idP, CC_id),UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id],format0); + }else { + aggregation = get_aggregation(get_bw_index(module_idP, CC_id), + UE_info->UE_sched_ctrl[UE_id].dl_cqi[CC_id], format0); + } + if (CCE_allocation_infeasible(module_idP,CC_id,format_flag,subframeP,aggregation,rnti) == 1) { cc_id_flag[CC_id] = 1; continue; @@ -2625,7 +2602,6 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, uint16_t first_rb[MAX_NUM_CCs]; int8_t mcs; uint8_t snr; - uint8_t snr2mcs_offset = 3; double bler_filter=0.9; double bler; uint8_t rb_table_index; @@ -2818,10 +2794,9 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, UE_info->UE_template[CC_id][UE_id].pre_allocated_rb_table_index_ul = rb_table_index; UE_info->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = mcs; } - - LOG_D(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d snr %d snr_inst %d mcs %d mcs_offset %d bler %lf total_bler %lf ( %d %d ) rb_num %d phr_info %d tx_power %d bsr %d estimated_ul_buffer %d scheduled_ul_bytes %d\n", - module_idP,frameP,subframeP,UE_id,UE_RNTI(CC_id,UE_id),CC_id, snr, UE_list->UE_sched_ctrl[UE_id].pusch_snr[CC_id], mcs, UE_list->UE_sched_ctrl[UE_id].mcs_offset[CC_id], UE_list->UE_sched_ctrl[UE_id].pusch_bler[CC_id], - total_bler, UE_list->UE_sched_ctrl[UE_id].pusch_rx_num[CC_id], UE_list->UE_sched_ctrl[UE_id].pusch_rx_error_num[CC_id], rb_table[rb_table_index-1], UE_template->phr_info, tx_power, bytes_to_schedule, UE_template->estimated_ul_buffer, UE_template->scheduled_ul_bytes); + LOG_D(MAC,"[eNB %hu] frame %u subframe %u, UE %d/%x CC %d snr %hhu snr_inst %hhu mcs %hhd mcs_offset %hhu bler %lf total_bler %lf ( %lu %lu ) rb_num %hhu phr_info %hhd tx_power %hd bsr %d estimated_ul_buffer %d scheduled_ul_bytes %d\n", + module_idP,frameP,subframeP,UE_id,UE_RNTI(CC_id,UE_id),CC_id, snr, UE_info->UE_sched_ctrl[UE_id].pusch_snr[CC_id], mcs, UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id], UE_info->UE_sched_ctrl[UE_id].pusch_bler[CC_id], + total_bler, UE_info->UE_sched_ctrl[UE_id].pusch_rx_num[CC_id], UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num[CC_id], rb_table[rb_table_index-1], UE_template->phr_info, tx_power, bytes_to_schedule, UE_template->estimated_ul_buffer, UE_template->scheduled_ul_bytes); } else { if (mac_eNB_get_rrc_status(module_idP,UE_RNTI(module_idP, UE_id)) < RRC_CONNECTED) { diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 32c01593b1..bd3c428828 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -2173,6 +2173,7 @@ add_new_ue(module_id_t mod_idP, ) //------------------------------------------------------------------------------ { + eNB_MAC_INST *eNB = RC.mac[mod_idP]; int UE_id; int i, j; UE_info_t *UE_info = &RC.mac[mod_idP]->UE_info; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 3858cb99b7..5b8f6a9d5c 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -871,7 +871,7 @@ rx_sdu(const module_id_t enb_mod_idP, rx_lengths[i], DCH_PAYLOAD_SIZE_MAX, sdu_lenP); - UE_list->eNB_UE_stats[CC_idP][UE_id].num_errors_rx += 1; + UE_info->eNB_UE_stats[CC_idP][UE_id].num_errors_rx += 1; break; } LOG_D(MAC, "[eNB %d] CC_id %d Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d\n", @@ -892,7 +892,7 @@ rx_sdu(const module_id_t enb_mod_idP, frameP, rx_lengths[i], sdu_lenP,rx_lcids[i]); - UE_list->eNB_UE_stats[CC_idP][UE_id].num_errors_rx += 1; + UE_info->eNB_UE_stats[CC_idP][UE_id].num_errors_rx += 1; break; } }else{ @@ -937,21 +937,7 @@ rx_sdu(const module_id_t enb_mod_idP, UE_scheduling_control->uplane_inactivity_timer = 0; /* Reset RRC inactivity timer after uplane activity */ ue_contextP->ue_context.ue_rrc_inactivity_timer = 1; - } else { - LOG_E(MAC, "[eNB %d] CC_id %d Couldn't find the context associated to UE (RNTI %d) and reset RRC inactivity timer\n", - enb_mod_idP, - CC_idP, - current_rnti); - } - } else { /* rx_length[i] Max size */ - UE_info->eNB_UE_stats[CC_idP][UE_id].num_errors_rx += 1; - LOG_E(MAC, "[eNB %d] CC_id %d Frame %d : Max size of transport block reached LCID %d from UE %d ", - enb_mod_idP, - CC_idP, - frameP, - rx_lcids[i], - UE_id); - } + } else { // end if (UE_id != -1) LOG_E(MAC,"[eNB %d] CC_id %d Frame %d : received unsupported or unknown LCID %d from UE %d ", enb_mod_idP, diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index d10f8e5be2..1bae590a59 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -469,6 +469,7 @@ typedef struct { #define BSR_TRIGGER_PADDING (4) /* For Padding BSR Trigger */ + /*! \brief Downlink SCH PDU Structure */ typedef struct { uint8_t payload[8][SCH_PAYLOAD_SIZE_MAX]; @@ -1056,6 +1057,7 @@ typedef struct { /// DRX UL retransmission timer, one per UL HARQ process /* Not implemented yet */ /* End of C-DRX related timers */ + uint32_t rlc_out_of_resources_cnt; } UE_sched_ctrl_t; /*! \brief eNB template for the Random access information */ From 1acf4a68f22abcbdb401d3d979232e7176df9353 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Mon, 30 Nov 2020 12:56:10 +0100 Subject: [PATCH 089/160] mib ssb in mac structure, prach scheduled accordingly --- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 2 ++ openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 6d9904c94b..aa5fcf13dc 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -250,6 +250,8 @@ typedef struct { uint8_t RA_BI_found; /// Flag for the Msg1 generation: enabled at every occurrence of nr prach slot uint8_t generate_nr_prach; + /// SSB index from MIB decoding + uint8_t mib_ssb; //// FAPI-like interface message fapi_nr_ul_config_request_t *ul_config_request; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 2cc5f38a39..2d0f1fc002 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -994,7 +994,10 @@ int8_t nr_ue_decode_mib(module_id_t module_id, LOG_D(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred); LOG_D(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection); LOG_D(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit); - LOG_D(MAC,"ssb index(extra bits): %d\n", (int)ssb_index); + LOG_I(MAC,"ssb index(extra bits): %d\n", (int)ssb_index); + + //storing ssb index in the mac structure + mac->mib_ssb = ssb_index; subcarrier_spacing_t scs_ssb = scs_30kHz; // default for //const uint32_t scs_index = 0; @@ -1793,9 +1796,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s if (is_nr_UL_slot(scc, slotP)) { - // WIP Need to get the proper selected ssb_idx - // Initial beam selection functionality is not available yet - uint8_t selected_gnb_ssb_idx = 0; + uint8_t selected_gnb_ssb_idx = mac->mib_ssb; // Get any valid PRACH occasion in the current slot for the selected SSB index is_nr_prach_slot = get_nr_prach_info_from_ssb_index(selected_gnb_ssb_idx, From 46de16b6e16f6f8dfe9db4ac491589fc50b96e7d Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 30 Nov 2020 12:26:12 +0000 Subject: [PATCH 090/160] Minor updates in LOGs --- executables/softmodem-common.h | 2 +- openair1/PHY/NR_TRANSPORT/nr_dci.c | 7 +---- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 1 - openair1/PHY/NR_UE_TRANSPORT/dci_nr.c | 12 ++------ .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 7 ++--- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 11 ++------ openair2/GNB_APP/gnb_config.c | 5 ---- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 1 - openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 28 +++++++++---------- .../NR_MAC_UE/nr_ue_dci_configuration.c | 6 +--- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 11 ++------ .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 12 ++++---- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 1 - openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 1 + openair2/RRC/NR/L2_nr_interface.c | 3 -- openair2/RRC/NR/MESSAGES/asn1_msg.c | 2 +- openair2/RRC/NR_UE/rrc_UE.c | 11 +------- 17 files changed, 38 insertions(+), 83 deletions(-) diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 7c027bda23..a416f80504 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -120,7 +120,7 @@ extern "C" {"thread-pool", CONFIG_HLP_TPOOL, 0, strptr:(char **)&TP_CONFIG, defstrval:"n", TYPE_STRING, sizeof(TP_CONFIG)}, \ {"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \ {"do-ra", CONFIG_HLP_DORA, PARAMFLAG_BOOL, iptr:&DO_RA, defintval:0, TYPE_INT, 0}, \ - {"sa", CONFIG_HLP_SA, PARAMFLAG_BOOL, iptr:&SA, defintval:0, TYPE_INT, 0}, \ + {"sa", CONFIG_HLP_SA, PARAMFLAG_BOOL, iptr:&SA, defintval:0, TYPE_INT, 0}, \ {"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&USIM_TEST, defintval:0, TYPE_UINT8, 0}, \ {"clock-source", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \ {"time-source", CONFIG_HLP_TME, 0, uptr:&TIMING_SOURCE, defintval:0, TYPE_UINT, 0}, \ diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index f09f9ca890..ae93810965 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -31,7 +31,6 @@ */ #include -#include #include "nr_dci.h" #include "nr_dlsch.h" #include "nr_sch_dmrs.h" @@ -103,10 +102,6 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, LOG_D(PHY, "Coreset rb_offset %d, nb_rb %d\n",rb_offset,n_rb); LOG_D(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb); // DMRS length is per OFDM symbol - - //AssertFatal(pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED, - //"Interleaved CCE REG MAPPING not supported\n"); - uint32_t dmrs_length = (pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED)? (n_rb*6) : (pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]*36/cset_nsymb); //2(QPSK)*3(per RB)*6(REG per CCE) uint32_t encoded_length = pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]*108; //2(QPSK)*9(per RB)*6(REG per CCE) @@ -226,7 +221,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, } // m } // reg_idx - LOG_I(PHY, ">> DCI: payloadSize = %d | payload = %llx\n", + LOG_I(PHY, "DCI: payloadSize = %d | payload = %llx\n", *pdcch_pdu_rel15->dci_pdu.PayloadSizeBits,*(unsigned long long*)pdcch_pdu_rel15->dci_pdu.Payload); } // for (int d=0;dnumDlDci;d++) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index a707bc3b6b..e3627b9344 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -290,7 +290,6 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, // Non interleaved VRB to PRB mapping uint16_t start_sc = frame_parms->first_carrier_offset + (rel15->rbStart+rel15->BWPStart)*NR_NB_SC_PER_RB; - if (start_sc >= frame_parms->ofdm_symbol_size) start_sc -= frame_parms->ofdm_symbol_size; diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 1c6cce8070..fbf1779009 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -884,7 +884,8 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, n_rnti = rel15->rnti; if (crc == n_rnti) { - LOG_D(PHY,"Decoded crc %x matches rnti %x for DCI format %d\n", crc, n_rnti, rel15->dci_format_options[k]); + LOG_I(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n", + proc->frame_rx, proc->nr_slot_rx,n_rnti,rel15->dci_format_options[k],CCEind,dci_length,*(unsigned long long*)dci_estimation); dci_ind->SFN = proc->frame_rx; dci_ind->slot = proc->nr_slot_rx; dci_ind->dci_list[dci_ind->number_of_dcis].rnti = n_rnti; @@ -893,20 +894,13 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, dci_ind->dci_list[dci_ind->number_of_dcis].payloadSize = dci_length; memcpy((void*)dci_ind->dci_list[dci_ind->number_of_dcis].payloadBits,(void*)dci_estimation,8); dci_ind->number_of_dcis++; - - LOG_I(PHY, "\n>> Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n\n", - n_rnti,rel15->dci_format_options[k],CCEind,dci_length,*(unsigned long long*)dci_estimation); - break; // If DCI is found, no need to check for remaining DCI lengths } else { - LOG_I(PHY,"Decoded crc %x does not match rnti %x for DCI format %d\n", crc, n_rnti, rel15->dci_format_options[k]); + LOG_D(PHY,"(%i.%i) Decoded crc %x does not match rnti %x for DCI format %d\n", proc->frame_rx, proc->nr_slot_rx, crc, n_rnti, rel15->dci_format_options[k]); } } } } - - LOG_I(PHY,"nr_dci_decoding_procedure: frame = %i, slot = %i\n", proc->frame_rx, proc->nr_slot_rx); - return(dci_ind->number_of_dcis); } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index d561c62e32..699cc2ecbf 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -592,11 +592,9 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, // Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) { - LOG_I(PHY,"Segment %u CRC OK\n\033[0m",r); - if (r==0) { - for (int i=0;i<10;i++) LOG_I(PHY,"byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]); + for (int i=0;i<10;i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]); } //Temporary hack @@ -604,10 +602,11 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ret = no_iteration_ldpc; } else { - LOG_I(PHY,"CRC NOT OK\n\033[0m"); + LOG_D(PHY,"CRC NOT OK\n\033[0m"); ret = 1 + dlsch->max_ldpc_iterations; } + nb_total_decod++; if (no_iteration_ldpc > dlsch->max_ldpc_iterations){ nb_error_decod++; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 8abfd69185..152d16090d 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -32,7 +32,7 @@ #define _GNU_SOURCE -#include +#include "nr/nr_common.h" #include "assertions.h" #include "defs.h" #include "PHY/defs_nr_UE.h" @@ -812,7 +812,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ dlsch0->current_harq_pid) < 0) return -1; } - else AssertFatal(1==0,"not RA_PDSCH, SI_PDSCH or PDSCH\n"); + else AssertFatal(1==0,"Not RA_PDSCH, SI_PDSCH or PDSCH\n"); } if (pdsch == PDSCH) LOG_D(PHY,"Done processing symbol %d : llr_offset %d\n",m,ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]); #if UE_TIMING_TRACE @@ -1828,13 +1828,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, #if UE_TIMING_TRACE stop_meas(&ue->ofdm_demod_stats); #endif - - //printf("phy procedure pdcch start measurement l =%d\n",l); - //nr_ue_measurement_procedures(l,ue,proc,gNB_id,(nr_slot_rx),mode); - - - dci_cnt = dci_cnt + nr_ue_pdcch_procedures(gNB_id, ue, proc); + dci_cnt = dci_cnt + nr_ue_pdcch_procedures(gNB_id, ue, proc); } } diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index dd1692c365..228d624e03 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -584,11 +584,6 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { config_get(pdcch_ConfigSIB1,sizeof(pdcch_ConfigSIB1)/sizeof(paramdef_t),aprefix); } - AssertFatal(rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero == 10 - || rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero == 11 - || rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero == 12, - "controlResourceSetZero %li not suported yet\n", rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero); - sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); config_getlist(&SCCsParamList, NULL, 0, aprefix); diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 4a24efcb36..3383d90bb7 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -117,7 +117,6 @@ const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f const int32_t table_38213_10_1_1_c2[5] = { 0, 0, 4, 2, 1 }; -const char *prachfmt03[]={"0","1","2","3"}; const char *prachfmt[]={"0","1","2","3", "A1","A2","A3","B1","B4","C0","C2","A1/B1","A2/B2","A3/B3"}; const char *duplex_mode[]={"FDD","TDD"}; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index d90db2940e..e28fb1a231 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -118,29 +118,29 @@ typedef enum subcarrier_spacing_e { } subcarrier_spacing_t; typedef enum channel_bandwidth_e { - bw_5MHz = 0x1, - bw_10MHz = 0x2, - bw_20MHz = 0x4, - bw_40MHz = 0x8, - bw_80MHz = 0x16, - bw_100MHz = 0x32 + bw_5MHz = 0x1, + bw_10MHz = 0x2, + bw_20MHz = 0x4, + bw_40MHz = 0x8, + bw_80MHz = 0x16, + bw_100MHz = 0x32 } channel_bandwidth_t; typedef enum frequency_range_e { - FR1 = 0, - FR2 + FR1 = 0, + FR2 } frequency_range_t; typedef enum nr_ssb_and_cset_mux_pattern_type_e { - NR_SSB_AND_CSET_MUX_PATTERN_TYPE1=1, - NR_SSB_AND_CSET_MUX_PATTERN_TYPE2, - NR_SSB_AND_CSET_MUX_PATTERN_TYPE3 + NR_SSB_AND_CSET_MUX_PATTERN_TYPE1=1, + NR_SSB_AND_CSET_MUX_PATTERN_TYPE2, + NR_SSB_AND_CSET_MUX_PATTERN_TYPE3 } nr_ssb_and_cset_mux_pattern_type_t; typedef enum { - SFN_C_MOD_2_EQ_0, - SFN_C_MOD_2_EQ_1, - SFN_C_IMPOSSIBLE + SFN_C_MOD_2_EQ_0, + SFN_C_MOD_2_EQ_1, + SFN_C_IMPOSSIBLE } SFN_C_TYPE; typedef struct Type0_PDCCH_CSS_config_s { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 3c3b0bb45a..caba8c9902 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -162,14 +162,13 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t case NR_RNTI_SP_CSI: break; case NR_RNTI_SI: - // we use DL BWP dedicated sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12; // for SPS=14 8 MSBs in positions 13 down to 6 monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); - rel15->rnti = 0xFFFF; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values + rel15->rnti = SI_RNTI; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values rel15->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; rel15->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; @@ -177,9 +176,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t for (int i = 0; i < rel15->num_dci_options; i++) { rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0); } - break; - case NR_RNTI_SFI: break; case NR_RNTI_INT: @@ -245,7 +242,6 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl } *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = 0; LOG_D(MAC, "[DCI_CONFIG] Configure SearchSpace#0 of the initial BWP\n"); - LOG_W(MAC, "[DCI_CONFIG] This should not be available yet..."); } if (ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0){ // check available SS IDs diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 8238ff6d3f..e0bfda7007 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2748,9 +2748,9 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, dlsch_config_pdu->start_symbol=S; dlsch_config_pdu->number_symbols=L; - LOG_I(MAC,"SLIV = %i\n", startSymbolAndLength); - LOG_I(MAC,"start_symbol = %i\n", dlsch_config_pdu->start_symbol); - LOG_I(MAC,"number_symbols = %i\n", dlsch_config_pdu->number_symbols); + LOG_D(MAC,"SLIV = %i\n", startSymbolAndLength); + LOG_D(MAC,"start_symbol = %i\n", dlsch_config_pdu->start_symbol); + LOG_D(MAC,"number_symbols = %i\n", dlsch_config_pdu->number_symbols); } else {// Default configuration from tables @@ -3398,15 +3398,11 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr mac->scc->dmrs_TypeA_Position, dlsch_config_pdu_1_0->number_symbols); dlsch_config_pdu_1_0->dmrsConfigType = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; - - LOG_D(MAC,"dlDmrsSymbPos = 0x%x\n", dlsch_config_pdu_1_0->dlDmrsSymbPos); - /* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */ if (dlsch_config_pdu_1_0->number_symbols == 2) dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1; else dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 2; - /* VRB_TO_PRB_MAPPING */ dlsch_config_pdu_1_0->vrb_to_prb_mapping = (dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved:vrb_to_prb_mapping_interleaved; /* MCS */ @@ -3808,7 +3804,6 @@ int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){ case NR_RNTI_RA: case NR_RNTI_TC: case NR_RNTI_P: - //case NR_RNTI_SI: if (mac->DLbwp[0]->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero) { uint8_t bwp_id = 1; uint8_t coreset_id = 0; // assuming controlResourceSetId is 0 for controlResourceSetZero diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index e319430c66..2cd3693a38 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -283,9 +283,9 @@ void schedule_control_sib1(module_id_t module_id, int startSymbolIndex, nrOfSymbols; SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); - LOG_I(MAC,"SLIV = %i\n", startSymbolAndLength); - LOG_I(MAC,"startSymbolIndex = %i\n", startSymbolIndex); - LOG_I(MAC,"nrOfSymbols = %i\n", nrOfSymbols); + LOG_D(MAC,"SLIV = %i\n", startSymbolAndLength); + LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex); + LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols); int rbSize = 0; uint32_t TBS = 0; @@ -298,7 +298,7 @@ void schedule_control_sib1(module_id_t module_id, gNB_mac->sched_ctrlCommon->rbSize = rbSize; gNB_mac->sched_ctrlCommon->rbStart = 0; - LOG_I(MAC,"rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); + LOG_D(MAC,"rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); // Mark the corresponding RBs as used for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) { @@ -457,8 +457,8 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) uint8_t sib1_payload[100]; uint8_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, 1, sib1_payload); LOG_D(MAC,"sib1_sdu_length = %i\n", sib1_sdu_length); - LOG_I(MAC,"SIB1: \n"); - for (int i=0;ipdcch_ConfigSIB1, // *carrier->servingcellconfigcommon->ssbSubcarrierSpacing, diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 3a4e28f880..9ed9039cf1 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -39,7 +39,6 @@ #include #include /* for _ASN_DEFAULT_STACK_MAX */ #include -#include #include "asn1_msg.h" #include "../nr_rrc_proto.h" @@ -69,6 +68,7 @@ #include "NR_SDAP-Config.h" #include "NR_RRCReconfigurationComplete.h" #include "NR_RRCReconfigurationComplete-IEs.h" +#include "PHY/defs_nr_common.h" #if defined(NR_Rel16) #include "NR_SCS-SpecificCarrier.h" #include "NR_TDD-UL-DL-ConfigCommon.h" diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index ccbd3b3bf2..cd20a53117 100755 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1489,26 +1489,17 @@ int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index buffer_len); if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) { - - printf("NR_BCCH_DL_SCH decode error\n"); - for (int i=0; imessage.choice.c1->choice.systemInformationBlockType1; xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)sib1); - } return 0; From c8dfaf8eb920d867c1e3bcb22aa35b84729a8b61 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 30 Nov 2020 19:11:01 +0000 Subject: [PATCH 091/160] Improvements to decode SIB1 in 3rd party implementations and OAI UE with the same gNB configurations --- .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 6 ++-- openair1/PHY/defs_nr_common.h | 3 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 6 ++-- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 32 ++++++++++--------- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 1 - openair2/RRC/NR/MESSAGES/asn1_msg.c | 4 +-- .../gnb.sa.band78.fr1.106PRB.usrpb210.conf | 4 +-- 8 files changed, 30 insertions(+), 28 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index c769c53c5d..49e7956cc6 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -1598,8 +1598,10 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext, int16_t y = (len)>>x; //printf("len = %d = %d * 2^(%d)\n",len,y,x); - // FIXME: y cannot be zero - if(y == 0) y = 1; + if(y == 0) { + LOG_W(PHY,"Cannot divide by zero: in function %s of file %s \n", __func__, __FILE__); + return; + } for (aatx=0; aatxnb_antenna_ports_gNB; aatx++) for (aarx=0; aarxnb_antennas_rx; aarx++) { diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index bcc0a5133c..8bf585ad93 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -104,12 +104,11 @@ #define NR_MAX_PDSCH_ENCODED_LENGTH NR_MAX_NB_RB*NR_SYMBOLS_PER_SLOT*NR_NB_SC_PER_RB*8*NR_MAX_NB_LAYERS // 8 is the maximum modulation order (it was 950984 before !!) #define NR_MAX_PUSCH_ENCODED_LENGTH NR_MAX_PDSCH_ENCODED_LENGTH #define NR_MAX_PDSCH_TBS 3824 +#define NR_MAX_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1 - The physical layer imposes a limit to the maximum size a SIB can take. The maximum SIB1 or SI message size is 2976 bits. #define MAX_NUM_NR_DLSCH_SEGMENTS 34 #define MAX_NR_DLSCH_PAYLOAD_BYTES (MAX_NUM_NR_DLSCH_SEGMENTS*1056) -#define MAX_NR_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1 - The physical layer imposes a limit to the maximum size a SIB can take. The maximum SIB1 or SI message size is 2976 bits. - #define MAX_NUM_NR_ULSCH_SEGMENTS MAX_NUM_NR_DLSCH_SEGMENTS #define MAX_NR_ULSCH_PAYLOAD_BYTES (MAX_NUM_NR_ULSCH_SEGMENTS*1056) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 3383d90bb7..61976f166f 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -3101,9 +3101,6 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC type0_PDCCH_CSS_config->num_symbols = table_38213_13_4_c3[index_4msb]; type0_PDCCH_CSS_config->rb_offset = table_38213_13_4_c4[index_4msb]; - LOG_I(MAC,"<<<<<<<<num_rbs,type0_PDCCH_CSS_config->num_symbols,type0_PDCCH_CSS_config->rb_offset ); - }else if(min_channel_bw & bw_40MHz){ AssertFatal(index_4msb < 10, "38.213 Table 13-6 4 MSB out of range\n"); type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; @@ -3176,6 +3173,9 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC break; } + LOG_D(MAC,"Coreset0: index_4msb=%d, num_rbs=%d, num_symb=%d, rb_offset=%d\n", + index_4msb,type0_PDCCH_CSS_config->num_rbs,type0_PDCCH_CSS_config->num_symbols,type0_PDCCH_CSS_config->rb_offset ); + AssertFatal(type0_PDCCH_CSS_config->num_rbs != -1, "Type0 PDCCH coreset num_rbs undefined"); AssertFatal(type0_PDCCH_CSS_config->num_symbols != -1, "Type0 PDCCH coreset num_symbols undefined"); AssertFatal(type0_PDCCH_CSS_config->rb_offset != -1, "Type0 PDCCH coreset rb_offset undefined"); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index e0bfda7007..2a96b2b438 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3396,7 +3396,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr /* dmrs symbol positions*/ dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config, mac->scc->dmrs_TypeA_Position, - dlsch_config_pdu_1_0->number_symbols); + dlsch_config_pdu_1_0->start_symbol+dlsch_config_pdu_1_0->number_symbols); dlsch_config_pdu_1_0->dmrsConfigType = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; /* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */ if (dlsch_config_pdu_1_0->number_symbols == 2) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 2cd3693a38..262c34cf7d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -230,7 +230,6 @@ void schedule_control_sib1(module_id_t module_id, int time_domain_allocation, uint8_t mcsTableIdx, uint8_t mcs, - uint8_t numDmrsCdmGrpsNoData, int num_total_bytes) { gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; @@ -252,7 +251,6 @@ void schedule_control_sib1(module_id_t module_id, gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation; gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx; gNB_mac->sched_ctrlCommon->mcs = mcs; - gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = numDmrsCdmGrpsNoData; gNB_mac->sched_ctrlCommon->num_total_bytes = num_total_bytes; uint8_t nr_of_candidates; @@ -274,18 +272,20 @@ void schedule_control_sib1(module_id_t module_id, const uint16_t bwpSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs; int rbStart = gNB_mac->type0_PDCCH_CSS_config.cset_start_rb; - // Calculate number of PRB_DMRS - uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; - // Calculate number of symbols struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; int startSymbolIndex, nrOfSymbols; SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); - LOG_D(MAC,"SLIV = %i\n", startSymbolAndLength); - LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex); - LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols); + if (nrOfSymbols == 2) { + gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = 1; + } else { + gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = 2; + } + + // Calculate number of PRB_DMRS + uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; int rbSize = 0; uint32_t TBS = 0; @@ -298,6 +298,9 @@ void schedule_control_sib1(module_id_t module_id, gNB_mac->sched_ctrlCommon->rbSize = rbSize; gNB_mac->sched_ctrlCommon->rbStart = 0; + LOG_D(MAC,"SLIV = %i\n", startSymbolAndLength); + LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex); + LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols); LOG_D(MAC,"rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); // Mark the corresponding RBs as used @@ -372,7 +375,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; - pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, pdsch_pdu_rel15->NrOfSymbols); + pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, pdsch_pdu_rel15->StartSymbolIndex+pdsch_pdu_rel15->NrOfSymbols); LOG_D(MAC,"dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos); @@ -440,12 +443,11 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) LOG_D(MAC,"Schedule_nr_sib1: frameP = %i, slotP = %i\n", frameP, slotP); - // static values + // TODO: Get these values from RRC const int CC_id = 0; - int time_domain_allocation = 0; // FIXME: For OAI-UE (0-3), For 3rd party implementation and 3GPP compliant (4) + int time_domain_allocation = 4; // For OAI-UE (0-4), For 3rd party implementation and 3GPP compliant (4) uint8_t mcsTableIdx = 0; - uint8_t mcs = 8; - uint8_t numDmrsCdmGrpsNoData = 2; + uint8_t mcs = 6; gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; @@ -454,14 +456,14 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) LOG_D(MAC,"> SIB1 transmission\n"); // Get SIB1 - uint8_t sib1_payload[100]; + uint8_t sib1_payload[NR_MAX_SIB_LENGTH/8]; uint8_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, 1, sib1_payload); LOG_D(MAC,"sib1_sdu_length = %i\n", sib1_sdu_length); LOG_D(MAC,"SIB1: \n"); for (int i=0;imessage.choice.c1->choice.systemInformationBlockType1); - if(carrier->SIB1 == NULL) carrier->SIB1=(uint8_t *) malloc16(MAX_NR_SIB_LENGTH/8); + if(carrier->SIB1 == NULL) carrier->SIB1=(uint8_t *) malloc16(NR_MAX_SIB_LENGTH/8); enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_DL_SCH_Message, NULL, (void *)sib1_message, carrier->SIB1, - MAX_NR_SIB_LENGTH/8); + NR_MAX_SIB_LENGTH/8); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 770f0b92b3..f1339c24d2 100755 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -24,7 +24,7 @@ gNBs = pdcch_ConfigSIB1 = ( { - controlResourceSetZero = 10; + controlResourceSetZero = 12; searchSpaceZero = 0; } ); @@ -84,7 +84,7 @@ gNBs = initialDLBWPk0_4 = 0; initialDLBWPmappingType_4 = 0; - #this is SS=1,L=5 + #this is SS=2,L=5 initialDLBWPstartSymbolAndLength_4 = 58; #uplinkConfigCommon From ecdd7a7f629b1f9794c1f27336cbaa8df7de1e2b Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Tue, 1 Dec 2020 16:19:59 +0100 Subject: [PATCH 092/160] taking aggregation level and nr of candidates from config at ue --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 27 +++++++++++++++++++ openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 4 +++ .../NR_MAC_UE/nr_ue_dci_configuration.c | 19 +++++++------ .../NR_MAC_gNB/gNB_scheduler_primitives.c | 26 ------------------ openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 4 --- 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 876fef9dbc..778ecdf634 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -974,6 +974,33 @@ int64_t *get_prach_config_info(uint32_t pointa, return prach_config_info_p; } +void find_aggregation_candidates(uint8_t *aggregation_level, + uint8_t *nr_of_candidates, + NR_SearchSpace_t *ss) { + + if (ss->nrofCandidates->aggregationLevel1 != NR_SearchSpace__nrofCandidates__aggregationLevel1_n0) { + *aggregation_level = 1; + *nr_of_candidates = ss->nrofCandidates->aggregationLevel1; + } + if (ss->nrofCandidates->aggregationLevel2 != NR_SearchSpace__nrofCandidates__aggregationLevel2_n0) { + *aggregation_level = 2; + *nr_of_candidates = ss->nrofCandidates->aggregationLevel2; + } + if (ss->nrofCandidates->aggregationLevel4 != NR_SearchSpace__nrofCandidates__aggregationLevel4_n0) { + *aggregation_level = 4; + *nr_of_candidates = ss->nrofCandidates->aggregationLevel4; + } + if (ss->nrofCandidates->aggregationLevel8 != NR_SearchSpace__nrofCandidates__aggregationLevel8_n0) { + *aggregation_level = 8; + *nr_of_candidates = ss->nrofCandidates->aggregationLevel8; + } + if (ss->nrofCandidates->aggregationLevel16 != NR_SearchSpace__nrofCandidates__aggregationLevel16_n0) { + *aggregation_level = 16; + *nr_of_candidates = ss->nrofCandidates->aggregationLevel16; + } +} + + void find_monitoring_periodicity_offset_common(NR_SearchSpace_t *ss, uint16_t *slot_period, uint16_t *offset) { diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 2be97ba8f6..e6a0dd81db 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -123,6 +123,10 @@ uint16_t nr_dci_size(NR_ServingCellConfigCommon_t *scc, uint16_t N_RB, int bwp_id); +void find_aggregation_candidates(uint8_t *aggregation_level, + uint8_t *nr_of_candidates, + NR_SearchSpace_t *ss); + void find_monitoring_periodicity_offset_common(NR_SearchSpace_t *ss, uint16_t *slot_period, uint16_t *offset); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 36a4c5fceb..631096ab28 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -53,17 +53,16 @@ dci_pdu_rel15_t *def_dci_pdu_rel15; void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) { LOG_D(MAC,"Filling search candidates for DCI\n"); - - rel15->number_of_candidates=4; - rel15->CCE[0]=0; - rel15->L[0]=4; - rel15->CCE[1]=4; - rel15->L[1]=4; - rel15->CCE[2]=8; - rel15->L[2]=4; - rel15->CCE[3]=12; - rel15->L[3]=4; + uint8_t aggregation; + find_aggregation_candidates(&aggregation, + &rel15->number_of_candidates, + ss); + + for (int i=0; inumber_of_candidates; i++) { + rel15->CCE[i] = i*aggregation; + rel15->L[i] = aggregation; + } } void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, fapi_nr_dl_config_request_t *dl_config, int rnti_type, int ss_id){ diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index ae389cd23b..d34dc2d433 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1857,32 +1857,6 @@ void get_pdsch_to_harq_feedback(int Mod_idP, } -void find_aggregation_candidates(uint8_t *aggregation_level, - uint8_t *nr_of_candidates, - NR_SearchSpace_t *ss) { - - if (ss->nrofCandidates->aggregationLevel1 != NR_SearchSpace__nrofCandidates__aggregationLevel1_n0) { - *aggregation_level = 1; - *nr_of_candidates = ss->nrofCandidates->aggregationLevel1; - } - if (ss->nrofCandidates->aggregationLevel2 != NR_SearchSpace__nrofCandidates__aggregationLevel2_n0) { - *aggregation_level = 2; - *nr_of_candidates = ss->nrofCandidates->aggregationLevel2; - } - if (ss->nrofCandidates->aggregationLevel4 != NR_SearchSpace__nrofCandidates__aggregationLevel4_n0) { - *aggregation_level = 4; - *nr_of_candidates = ss->nrofCandidates->aggregationLevel4; - } - if (ss->nrofCandidates->aggregationLevel8 != NR_SearchSpace__nrofCandidates__aggregationLevel8_n0) { - *aggregation_level = 8; - *nr_of_candidates = ss->nrofCandidates->aggregationLevel8; - } - if (ss->nrofCandidates->aggregationLevel16 != NR_SearchSpace__nrofCandidates__aggregationLevel16_n0) { - *aggregation_level = 16; - *nr_of_candidates = ss->nrofCandidates->aggregationLevel16; - } -} - /*void fill_nfapi_coresets_and_searchspaces(NR_CellGroupConfig_t *cg, nfapi_nr_coreset_t *coreset, diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 7bb08e4f04..71cf1fbe72 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -275,10 +275,6 @@ NR_SearchSpace_t *get_searchspace( NR_BWP_Downlink_t *bwp, NR_SearchSpace__searchSpaceType_PR target_ss); -void find_aggregation_candidates(uint8_t *aggregation_level, - uint8_t *nr_of_candidates, - NR_SearchSpace_t *ss); - uint8_t nr_get_tpc(int target, uint8_t cqi, int incr); int get_spf(nfapi_nr_config_request_scf_t *cfg); From d9b7d43ec6bcdfc15c8f0237a80d4a84237acda8 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Tue, 1 Dec 2020 18:26:07 +0100 Subject: [PATCH 093/160] rebase and fix non paralellized errors --- common/utils/threadPool/thread-pool.h | 2 -- executables/nr-uesoftmodem.c | 18 ++++++++++++++---- openair1/PHY/INIT/nr_init.c | 1 + .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 3 +-- openair1/PHY/TOOLS/nr_phy_scope.c | 1 + openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 4 ++-- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h index 0ed8715811..4ec0f5768c 100644 --- a/common/utils/threadPool/thread-pool.h +++ b/common/utils/threadPool/thread-pool.h @@ -236,7 +236,6 @@ static inline void pushTpool(tpool_t *t, notifiedFIFO_elt_t *msg) { static inline notifiedFIFO_elt_t *pullTpool(notifiedFIFO_t *responseFifo, tpool_t *t) { notifiedFIFO_elt_t *msg= pullNotifiedFIFO(responseFifo); - AssertFatal(t->traceFd, "Thread pool used while not initialized"); if (t->measurePerf) msg->returnTime=rdtsc(); @@ -248,7 +247,6 @@ static inline notifiedFIFO_elt_t *pullTpool(notifiedFIFO_t *responseFifo, tpool_ static inline notifiedFIFO_elt_t *tryPullTpool(notifiedFIFO_t *responseFifo, tpool_t *t) { notifiedFIFO_elt_t *msg= pollNotifiedFIFO(responseFifo); - AssertFatal(t->traceFd, "Thread pool used while not initialized"); if (msg == NULL) return NULL; diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index d96bc16d35..55bf0a9114 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -98,9 +98,7 @@ pthread_mutex_t sync_mutex; int sync_var=-1; //!< protected by mutex \ref sync_mutex. int config_sync_var=-1; tpool_t *Tpool; -#ifdef UE_DLSCH_PARALLELISATION - tpool_t *Tpool_dl; -#endif +tpool_t *Tpool_dl; RAN_CONTEXT_t RC; volatile int start_eNB = 0; @@ -208,6 +206,14 @@ void exit_function(const char *file, const char *function, const int line, const exit(1); } +uint64_t get_nrUE_optmask(void) { + return nrUE_params.optmask; +} + +uint64_t set_nrUE_optmask(uint64_t bitmask) { + nrUE_params.optmask = nrUE_params.optmask | bitmask; + return nrUE_params.optmask; +} nrUE_params_t *get_nrUE_params(void) { return &nrUE_params; @@ -243,6 +249,8 @@ static void get_options(void) { if ((cmdline_uemodeparams[CMDLINE_DUMPMEMORY_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_dump_frame; + if (nr_dlsch_parallel) + set_nrUE_optmask(NRUE_DLSCH_PARALLEL_BIT); if (vcdflag > 0) ouput_vcd = 1; @@ -475,6 +483,7 @@ int main( int argc, char **argv ) { get_options (); //Command-line options specific for NRUE get_common_options(SOFTMODEM_5GUE_BIT ); + CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); #if T_TRACER T_Config_Init(); #endif @@ -553,8 +562,9 @@ int main( int argc, char **argv ) { PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+chain_offset; PHY_vars_UE_g[0][CC_id]->timing_advance = timing_advance; } - + init_NR_UE_threads(1); + config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS); printf("UE threads created by %ld\n", gettid()); // wait for end of program diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 9db741fae9..49ec60c94b 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -19,6 +19,7 @@ * contact@openairinterface.org */ +#include "executables/nr-softmodem-common.h" #include "PHY/defs_gNB.h" #include "PHY/phy_extern.h" #include "PHY/NR_REFSIG/nr_refsig.h" diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 9a15bed1fd..9c87cf26d5 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -810,7 +810,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, else nb_re_dmrs = 4*harq_process->n_dmrs_cdm_groups; - uint16_t length_dmrs = get_num_dmrs(dl_config_pdu->dlDmrsSymbPos); + uint16_t length_dmrs = get_num_dmrs(harq_process->dlDmrsSymbPos); uint32_t i,j; @@ -1397,7 +1397,6 @@ void nr_dlsch_decoding_process(void *arg) int harq_pid = proc->harq_pid; llr8_flag1 = proc->llr8_flag; int frame = proc->frame_rx; - int slot = proc->nr_slot_rx; r = proc->num_seg; NR_UE_DLSCH_t *dlsch = phy_vars_ue->dlsch[proc->thread_id][eNB_id][0]; diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index ba53e0b98f..b11c163ae8 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -26,6 +26,7 @@ #include #include "nr_phy_scope.h" #include "executables/softmodem-common.h" +#include "executables/nr-softmodem-common.h" #include #define TPUT_WINDOW_LENGTH 100 diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 4009dae6eb..32e9bff5b4 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1146,7 +1146,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, dlsch1->harq_processes[harq_pid], frame_rx, nb_symb_sch, - nr_tti_rx, + nr_slot_rx, harq_pid, pdsch==PDSCH?1:0, dlsch1->harq_processes[harq_pid]->TBS>256?1:0); @@ -1163,7 +1163,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, dlsch1->harq_processes[harq_pid], frame_rx, nb_symb_sch, - nr_tti_rx, + nr_slot_rx, harq_pid, pdsch==PDSCH?1:0,//proc->decoder_switch, dlsch1->harq_processes[harq_pid]->TBS>256?1:0); From aa3317a009c0294167c6998b3d2e02c2c49935e6 Mon Sep 17 00:00:00 2001 From: Hongzhi Wang Date: Wed, 2 Dec 2020 11:36:57 +0100 Subject: [PATCH 094/160] set less dlsch thread by default --- executables/nr-uesoftmodem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 55bf0a9114..ebb92fef44 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -459,7 +459,7 @@ void init_tpools(void) { if( IS_DLSCH_PARALLEL) { tpool_t pool_dl; Tpool_dl = &pool_dl; - char params_dl[]="-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1"; + char params_dl[]="-1,-1,-1,-1"; initTpool(params_dl, Tpool_dl, false); } } From f4b20822d459ea61e06d7c5ce8e3409b14f5b9de Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 2 Dec 2020 16:27:20 +0000 Subject: [PATCH 095/160] Fix build warnings --- executables/softmodem-common.h | 2 +- openair1/SIMULATION/NR_PHY/dlsim.c | 4 ++++ openair1/SIMULATION/NR_PHY/prachsim.c | 4 ++++ openair1/SIMULATION/NR_PHY/ulsim.c | 4 ++++ openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 17 ++++++++--------- .../CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf | 11 ++++++++++- 6 files changed, 31 insertions(+), 11 deletions(-) mode change 100755 => 100644 targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index a416f80504..9cb53ad35a 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -56,7 +56,7 @@ extern "C" #define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n" #define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n" #define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n" -#define CONFIG_HLP_SA "run gNB in standalone mode\n" +#define CONFIG_HLP_SA "run gNB in standalone mode\n" #define CONFIG_HLP_EXTS "tells hardware to use an external timing reference\n" #define CONFIG_HLP_DMRSSYNC "tells RU to insert DMRS in subframe 1 slot 0" #define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)\n" diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 2bd70021f7..9b8f05364f 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -146,6 +146,10 @@ int is_x2ap_enabled(void) return 0; } +int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) { + return 0; +} + // needed for some functions openair0_config_t openair0_cfg[MAX_CARDS]; void update_ptrs_config(NR_CellGroupConfig_t *secondaryCellGroup, uint16_t *rbSize, uint8_t *mcsIndex,int8_t *ptrs_arg); diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 1f4db3138a..f679a14d13 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -107,6 +107,10 @@ int is_x2ap_enabled(void) return 0; } +int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) { + return 0; +} + int main(int argc, char **argv){ char c; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 821ac75a64..bc29419afb 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -126,6 +126,10 @@ int is_x2ap_enabled(void) return 0; } +int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) { + return 0; +} + // needed for some functions uint16_t n_rnti = 0x1234; openair0_config_t openair0_cfg[MAX_CARDS]; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 61976f166f..96f70d46af 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -3208,14 +3208,13 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC // type0-pdcch search space - float big_o; - float big_m; - uint32_t temp; - type0_PDCCH_CSS_config->sfn_c=SFN_C_IMPOSSIBLE; // only valid for mux=1 - type0_PDCCH_CSS_config->n_c=UINT_MAX; - type0_PDCCH_CSS_config->number_of_search_space_per_slot=UINT_MAX; - type0_PDCCH_CSS_config->first_symbol_index=UINT_MAX; - type0_PDCCH_CSS_config->search_space_duration=0; // element of search space + float big_o = 0.0f; + float big_m = 0.0f; + type0_PDCCH_CSS_config->sfn_c = SFN_C_IMPOSSIBLE; // only valid for mux=1 + type0_PDCCH_CSS_config->n_c = UINT_MAX; + type0_PDCCH_CSS_config->number_of_search_space_per_slot = UINT_MAX; + type0_PDCCH_CSS_config->first_symbol_index = UINT_MAX; + type0_PDCCH_CSS_config->search_space_duration = 0; // element of search space // 38.213 table 10.1-1 /// MUX PATTERN 1 @@ -3224,7 +3223,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC type0_PDCCH_CSS_config->number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; big_m = table_38213_13_11_c3[index_4lsb]; - temp = (uint32_t)(big_o*pow(2, scs_pdcch)) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m); + uint32_t temp = (uint32_t)(big_o*pow(2, scs_pdcch)) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m); type0_PDCCH_CSS_config->n_c = temp / num_slot_per_frame; if((temp/num_slot_per_frame) & 0x1){ type0_PDCCH_CSS_config->sfn_c = SFN_C_MOD_2_EQ_1; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf old mode 100755 new mode 100644 index f1339c24d2..ce0505a4c0 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -282,12 +282,21 @@ RUs = ( THREAD_STRUCT = ( { #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" - parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + parallel_config = "PARALLEL_SINGLE_THREAD"; #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" worker_config = "WORKER_ENABLE"; } ); +rfsimulator : +{ + serveraddr = "server"; + serverport = "4043"; + options = (); #("saviq"); or/and "chanmod" + modelname = "AWGN"; + IQfile = "/tmp/rfsimulator.iqs"; +}; + log_config : { global_log_level ="info"; From 61a0e4f7b214cb1ee20f1aa28e24423c05fb4472 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 2 Dec 2020 17:28:02 +0000 Subject: [PATCH 096/160] Fix creation of rbconfig.raw and reconfig.raw files in standalone mode --- executables/nr-softmodem.c | 5 ++++- executables/nr-uesoftmodem.c | 3 +++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 5 ++--- openair2/RRC/NR/rrc_gNB.c | 2 +- openair2/RRC/NR/rrc_gNB_internode.c | 4 ++-- openair2/RRC/NR/rrc_gNB_nsa.c | 2 +- openair2/RRC/NR_UE/rrc_UE.c | 2 +- openair2/SIMULATION/NR_RRC/itti_sim.c | 2 +- 8 files changed, 15 insertions(+), 10 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index fb757a9f47..1ed2f7fc8e 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -419,7 +419,7 @@ int create_gNB_tasks(uint32_t gnb_nb) { } - if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0)) { + if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0 && get_softmodem_params()->sa==0)) { if (gnb_nb > 0) { /* if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) { @@ -851,6 +851,9 @@ int main( int argc, char **argv ) if (get_softmodem_params()->do_ra) AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n"); + if (get_softmodem_params()->sa) + AssertFatal(get_softmodem_params()->phy_test == 0,"Standalone mode and phy_test are mutually exclusive\n"); + #if T_TRACER T_Config_Init(); #endif diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 08834ed740..a288d82e70 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -536,6 +536,9 @@ int main( int argc, char **argv ) { if (get_softmodem_params()->do_ra) AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n"); + if (get_softmodem_params()->sa) + AssertFatal(get_softmodem_params()->phy_test == 0,"Standalone mode and phy_test are mutually exclusive\n"); + for (int CC_id=0; CC_idssbSubcarrierSpacing]); // This schedules SIB1 - if ( (get_softmodem_params()->phy_test == 0) & (get_softmodem_params()->sa == 1) ) + if ( get_softmodem_params()->sa == 1 ) schedule_nr_sib1(module_idP, frame, slot); - else if ( (get_softmodem_params()->phy_test == 1) & (get_softmodem_params()->sa == 1) ) - LOG_W(MAC,"Remove --phy-test to transmit SIB1 in standalone mode\n"); + // This schedule PRACH if we are not in phy_test mode if (get_softmodem_params()->phy_test == 0) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 71e0bd13ad..0a77d429c5 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -225,7 +225,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration (NR_CellGroupConfig_t *)NULL ); - if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0) { + if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0 || get_softmodem_params()->sa > 0) { // This is for phytest only, emulate first X2 message if uecap.raw file is present FILE *fd; fd = fopen("uecap.raw","r"); diff --git a/openair2/RRC/NR/rrc_gNB_internode.c b/openair2/RRC/NR/rrc_gNB_internode.c index 3c8d75edfa..0b5d40f6ac 100644 --- a/openair2/RRC/NR/rrc_gNB_internode.c +++ b/openair2/RRC/NR/rrc_gNB_internode.c @@ -98,7 +98,7 @@ int generate_CG_Config(gNB_RRC_INST *rrc, total_size = (enc_rval.encoded+7)>>3; FILE *fd; // file to be generated for nr-ue - if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0) { + if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0 || get_softmodem_params()->sa == 1) { // This is for phytest only, emulate first X2 message if uecap.raw file is present LOG_I(RRC,"Dumping NR_RRCReconfiguration message (%jd bytes)\n",(enc_rval.encoded+7)>>3); for (int i=0; i<(enc_rval.encoded+7)>>3; i++) { @@ -123,7 +123,7 @@ int generate_CG_Config(gNB_RRC_INST *rrc, - if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0) { + if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra > 0 || get_softmodem_params()->sa == 1) { LOG_I(RRC,"Dumping scg_RB_Config message (%jd bytes)\n",(enc_rval.encoded+7)>>3); for (int i=0; i<(enc_rval.encoded+7)>>3; i++) { diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 7b7647a746..addae64022 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -162,7 +162,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ NR_RRCReconfiguration_IEs_t *reconfig_ies=calloc(1,sizeof(NR_RRCReconfiguration_IEs_t)); ue_context_p->ue_context.reconfig->criticalExtensions.choice.rrcReconfiguration = reconfig_ies; carrier->initial_csi_index[rrc->Nb_ue] = 0; - if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1){ + if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1 || get_softmodem_params()->sa == 1){ ue_context_p->ue_context.rb_config = calloc(1,sizeof(NR_RRCReconfiguration_t)); fill_default_rbconfig(ue_context_p->ue_context.rb_config); } diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index cd20a53117..66d600db46 100755 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -458,7 +458,7 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* rrc_config_path){ RRC_LIST_INIT(NR_UE_rrc_inst[nr_ue].CSI_ReportConfig_list, NR_maxNrofCSI_ReportConfigurations); } - if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra==1) { + if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra==1 || get_softmodem_params()->sa == 1) { // read in files for RRCReconfiguration and RBconfig FILE *fd; char filename[1024]; diff --git a/openair2/SIMULATION/NR_RRC/itti_sim.c b/openair2/SIMULATION/NR_RRC/itti_sim.c index d9352f2d0a..6a264a9977 100644 --- a/openair2/SIMULATION/NR_RRC/itti_sim.c +++ b/openair2/SIMULATION/NR_RRC/itti_sim.c @@ -284,7 +284,7 @@ int create_gNB_tasks(uint32_t gnb_nb) { } } - if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0)) { + if (AMF_MODE_ENABLED && (get_softmodem_params()->phy_test==0 && get_softmodem_params()->do_ra==0 && get_softmodem_params()->sa==0)) { if (gnb_nb > 0) { if (itti_create_task (TASK_NGAP, ngap_gNB_task, NULL) < 0) { LOG_E(S1AP, "Create task for NGAP failed\n"); From d262d152ecfc884e07e0e588ba419c763b57ccaf Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Fri, 13 Nov 2020 14:34:01 +0100 Subject: [PATCH 097/160] rlc v2: implement SOstart/SOend in NACK reporting The necessity of SOstart/SOend was understood after email exchanges with David Breaux . See openair2/LAYER2/rlc_v2/tests/test46.h for some details. Basically if we NACK without SOstart/SOend then the other end of the RLC channel will consider all the bytes as NACKed and will have to resend them all. If another status is then reported before all the bytes are sent, and because we don't use SOstart/SOend this status will NACK all the bytes again, then all the bytes are to be sent again. And the cycle repeats. It will end with a max retx reached (which triggers RLF, Radio Link Failure). The function put_bit in openair2/LAYER2/rlc_v2/rlc_pdu.c has been changed too, maybe introducing some performance issues. --- openair2/LAYER2/rlc_v2/TODO | 3 - openair2/LAYER2/rlc_v2/rlc_entity_am.c | 156 +++++++++++++++++---- openair2/LAYER2/rlc_v2/rlc_pdu.c | 5 +- openair2/LAYER2/rlc_v2/tests/run_tests.sh | 2 +- openair2/LAYER2/rlc_v2/tests/test11.txt.gz | Bin 430 -> 427 bytes openair2/LAYER2/rlc_v2/tests/test12.txt.gz | Bin 415 -> 411 bytes openair2/LAYER2/rlc_v2/tests/test46.h | 49 +++++++ openair2/LAYER2/rlc_v2/tests/test46.txt.gz | Bin 0 -> 2063 bytes openair2/LAYER2/rlc_v2/tests/test47.h | 27 ++++ openair2/LAYER2/rlc_v2/tests/test47.txt.gz | Bin 0 -> 416 bytes openair2/LAYER2/rlc_v2/tests/test48.h | 29 ++++ openair2/LAYER2/rlc_v2/tests/test48.txt.gz | Bin 0 -> 427 bytes openair2/LAYER2/rlc_v2/tests/test49.h | 27 ++++ openair2/LAYER2/rlc_v2/tests/test49.txt.gz | Bin 0 -> 895 bytes openair2/LAYER2/rlc_v2/tests/test6.h | 3 - openair2/LAYER2/rlc_v2/tests/test6.txt.gz | Bin 777 -> 773 bytes openair2/LAYER2/rlc_v2/tests/test7.h | 3 - openair2/LAYER2/rlc_v2/tests/test7.txt.gz | Bin 796 -> 779 bytes openair2/LAYER2/rlc_v2/tests/test9.h | 3 - openair2/LAYER2/rlc_v2/tests/test9.txt.gz | Bin 327 -> 324 bytes 20 files changed, 261 insertions(+), 46 deletions(-) create mode 100644 openair2/LAYER2/rlc_v2/tests/test46.h create mode 100644 openair2/LAYER2/rlc_v2/tests/test46.txt.gz create mode 100644 openair2/LAYER2/rlc_v2/tests/test47.h create mode 100644 openair2/LAYER2/rlc_v2/tests/test47.txt.gz create mode 100644 openair2/LAYER2/rlc_v2/tests/test48.h create mode 100644 openair2/LAYER2/rlc_v2/tests/test48.txt.gz create mode 100644 openair2/LAYER2/rlc_v2/tests/test49.h create mode 100644 openair2/LAYER2/rlc_v2/tests/test49.txt.gz diff --git a/openair2/LAYER2/rlc_v2/TODO b/openair2/LAYER2/rlc_v2/TODO index 0778d4320b..e93ad7e8b9 100644 --- a/openair2/LAYER2/rlc_v2/TODO +++ b/openair2/LAYER2/rlc_v2/TODO @@ -13,6 +13,3 @@ RLC AM - 36.322 5.1.3.2.3 Actions when a RLC data PDU is placed in the reception buffer [...] and in-sequence byte segments of the AMD PDU with SN = VR(R) [...] - -- use SOstart/SOend in NACK reporting, do not NACK full PDU if - parts of it have been received diff --git a/openair2/LAYER2/rlc_v2/rlc_entity_am.c b/openair2/LAYER2/rlc_v2/rlc_entity_am.c index b4f3d2f47c..710f22855e 100644 --- a/openair2/LAYER2/rlc_v2/rlc_entity_am.c +++ b/openair2/LAYER2/rlc_v2/rlc_entity_am.c @@ -898,6 +898,64 @@ static tx_pdu_size_t compute_new_pdu_size(rlc_entity_am_t *entity, int maxsize) return ret; } +/* return number of missing parts of a sn + * if everything is missing (nothing received), return 0 + */ +static int count_nack_missing_parts(rlc_entity_am_t *entity, int sn) +{ + rlc_rx_pdu_segment_t *l = entity->rx_list; + int last_byte; + int new_last_byte; + int count; + + while (l != NULL) { + if (l->sn == sn) + break; + l = l->next; + } + /* nothing received, everything is missing, return 0 */ + if (l == NULL) + return 0; + + last_byte = -1; + count = 0; + while (l != NULL && l->sn == sn) { + if (l->so > last_byte + 1) + /* missing part detected */ + count++; + if (l->is_last) + /* end of PDU reached - no more missing part to add */ + return count; + new_last_byte = l->so + l->size - l->data_offset - 1; + if (new_last_byte > last_byte) + last_byte = new_last_byte; + l = l->next; + } + /* at this point: end of PDU not received, one more missing part */ + count++; + + return count; +} + +/* return size of nack reporting for sn, in bits */ +static int segment_nack_size(rlc_entity_am_t *entity, int sn) +{ + /* nack + e1 + e2 = 12 bits + * SOstart + SOend = 30 bits + */ + int count; + + count = count_nack_missing_parts(entity, sn); + + /* count_nack_missing_parts returns 0 when everything is missing + * in which case we don't have SOstart/SOend, so only 12 bits + */ + if (count == 0) + return 12; + + return count * (12 + 30); +} + static int status_size(rlc_entity_am_t *entity, int maxsize) { /* let's count bits */ @@ -912,11 +970,16 @@ static int status_size(rlc_entity_am_t *entity, int maxsize) return 0; } - /* each NACK adds 12 bits */ + /* add size of NACKs */ sn = entity->vr_r; - while (bits + 12 <= maxsize && sn_compare_rx(entity, sn, entity->vr_ms) < 0) { - if (!(rlc_am_segment_full(entity, sn))) - bits += 12; + while (sn_compare_rx(entity, sn, entity->vr_ms) < 0) { + if (!(rlc_am_segment_full(entity, sn))) { + int nack_size = segment_nack_size(entity, sn); + /* stop there if not enough room */ + if (bits + nack_size > maxsize) + break; + bits += nack_size; + } sn = (sn + 1) % 1024; } @@ -929,7 +992,8 @@ static int generate_status(rlc_entity_am_t *entity, char *buffer, int size) int bits = 15; /* minimum size is 15 (header+ack_sn+e1) */ int sn; rlc_pdu_encoder_t encoder; - int has_nack = 0; + rlc_pdu_encoder_t encoder_ack; + rlc_pdu_encoder_t previous_e1; int ack; rlc_pdu_encoder_init(&encoder, buffer, size); @@ -947,24 +1011,68 @@ static int generate_status(rlc_entity_am_t *entity, char *buffer, int size) rlc_pdu_encoder_put_bits(&encoder, 0, 3); /* CPT */ /* reserve room for ACK (it will be set after putting the NACKs) */ + encoder_ack = encoder; rlc_pdu_encoder_put_bits(&encoder, 0, 10); + /* put 0 for e1, will be set to 1 later in the code if needed */ + previous_e1 = encoder; + rlc_pdu_encoder_put_bits(&encoder, 0, 1); /* at this point, ACK is VR(R) */ ack = entity->vr_r; - /* each NACK adds 12 bits */ sn = entity->vr_r; - while (bits + 12 <= size && sn_compare_rx(entity, sn, entity->vr_ms) < 0) { + while (sn_compare_rx(entity, sn, entity->vr_ms) < 0) { if (!(rlc_am_segment_full(entity, sn))) { - /* put previous e1 (is 1) */ - rlc_pdu_encoder_put_bits(&encoder, 1, 1); - /* if previous was NACK, put previous e2 (0, we don't do 'so' thing) */ - if (has_nack) - rlc_pdu_encoder_put_bits(&encoder, 0, 1); - /* put NACKed sn */ - rlc_pdu_encoder_put_bits(&encoder, sn, 10); - has_nack = 1; - bits += 12; + rlc_rx_pdu_segment_t *l; + int i; + int count = count_nack_missing_parts(entity, sn); + int nack_bits = count == 0 ? 12 : count * (12 + 30); + int last_byte; + int new_last_byte; + int so_start; + int so_end; + /* if not enough room, stop putting NACKs */ + if (bits + nack_bits > size) + break; + /* set previous e1 to 1 */ + rlc_pdu_encoder_put_bits(&previous_e1, 1, 1); + + if (count == 0) { + /* simply NACK, no SOstart/SOend */ + rlc_pdu_encoder_put_bits(&encoder, sn, 10); /* nack */ + previous_e1 = encoder; + rlc_pdu_encoder_put_bits(&encoder, 0, 2); /* e1, e2 */ + } else { + /* count is not 0, so we have 'count' NACK+e1+e2+SOstart+SOend */ + l = entity->rx_list; + last_byte = -1; + while (l->sn != sn) l = l->next; + for (i = 0; i < count; i++) { + rlc_pdu_encoder_put_bits(&encoder, sn, 10); /* nack */ + previous_e1 = encoder; + /* all NACKs but the last have a following NACK, set e1 for them */ + rlc_pdu_encoder_put_bits(&encoder, i != count - 1, 1); /* e1 */ + rlc_pdu_encoder_put_bits(&encoder, 1, 1); /* e2 */ + /* look for the next segment with missing data before it */ + while (l != NULL && l->sn == sn && !(l->so > last_byte + 1)) { + new_last_byte = l->so + l->size - l->data_offset - 1; + if (new_last_byte > last_byte) + last_byte = new_last_byte; + l = l->next; + } + so_start = last_byte + 1; + if (l == NULL) + so_end = 0x7fff; + else + so_end = l->so - 1; + rlc_pdu_encoder_put_bits(&encoder, so_start, 15); + rlc_pdu_encoder_put_bits(&encoder, so_end, 15); + if (l != NULL) + last_byte = l->so + l->size - l->data_offset - 1; + } + } + + bits += nack_bits; } else { /* this sn is full and we put all NACKs before it, use it for ACK */ ack = (sn + 1) % 1024; @@ -972,24 +1080,10 @@ static int generate_status(rlc_entity_am_t *entity, char *buffer, int size) sn = (sn + 1) % 1024; } - /* go to highest full sn+1 for ACK, VR(MS) is the limit */ - while (sn_compare_rx(entity, sn, entity->vr_ms) < 0 && - rlc_am_segment_full(entity, sn)) { - ack = (sn + 1) % 1024; - sn = (sn + 1) % 1024; - } - - /* at this point, if last put was NACK then put 2 bits else put 1 bit */ - if (has_nack) - rlc_pdu_encoder_put_bits(&encoder, 0, 2); - else - rlc_pdu_encoder_put_bits(&encoder, 0, 1); - rlc_pdu_encoder_align(&encoder); /* let's put the ACK */ - buffer[0] |= ack >> 6; - buffer[1] |= (ack & 0x3f) << 2; + rlc_pdu_encoder_put_bits(&encoder_ack, ack, 10); /* reset the trigger */ entity->status_triggered = 0; diff --git a/openair2/LAYER2/rlc_v2/rlc_pdu.c b/openair2/LAYER2/rlc_v2/rlc_pdu.c index c55e2d9c3c..dc8fc8b094 100644 --- a/openair2/LAYER2/rlc_v2/rlc_pdu.c +++ b/openair2/LAYER2/rlc_v2/rlc_pdu.c @@ -233,9 +233,10 @@ static void put_bit(rlc_pdu_encoder_t *encoder, int bit) exit(1); } - encoder->buffer[encoder->byte] <<= 1; if (bit) - encoder->buffer[encoder->byte] |= 1; + encoder->buffer[encoder->byte] |= 1 << (7 - encoder->bit); + else + encoder->buffer[encoder->byte] &= ~(1 << (7 - encoder->bit)); encoder->bit++; if (encoder->bit == 8) { diff --git a/openair2/LAYER2/rlc_v2/tests/run_tests.sh b/openair2/LAYER2/rlc_v2/tests/run_tests.sh index 72feff0036..f3776157a3 100755 --- a/openair2/LAYER2/rlc_v2/tests/run_tests.sh +++ b/openair2/LAYER2/rlc_v2/tests/run_tests.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_count=45 +test_count=49 for i in `seq $test_count` do diff --git a/openair2/LAYER2/rlc_v2/tests/test11.txt.gz b/openair2/LAYER2/rlc_v2/tests/test11.txt.gz index ea435a666025ab5d90ca2992b91dd94e1551a654..160916bb368ac40216ecf15155677fdbb54f5f84 100644 GIT binary patch literal 427 zcmV;c0aX4UiwFqxWUXHU19W9`bTKh5ba-?CwUo0))YGRXPHJSJCGD&=2K@3MX@!?fS*j}2wX7T6hIY@a zBM|C$d#aQ@bGVOil@xR~QqRVb&6`ASq;HV9urN8+^&~!r>xnqo_4a$^jjmswa5q`} zhhZ+@xf*#f-3q$?9Xq7x=VkVT!7dZdE~9;dLr+*e&+HzVddku)LH*(5hv#Sk_M;Pe zU|Ugpr%>zFMpc+i7IvnN9rA}5W9It-#;8g9%^2#2;J0Z;itr{ibd%>w>#|v|KWrwd VxOPVH(GlKY#1~D&mb-cf008H$$TI){ literal 430 zcmV;f0a5-RiwFp&wB}p_19W9`bTKh5ba-?CwUtY6f0M9nL&YNquZv5 zx@sCT4nt#NA7Q{getiL*rsx#WXhMJx?sx7z9A>8D$uz`bgF)Qb!J^`nnzuFX4I|o$Pw`y>w}dw--E& zX6G=>2fS2}XXA~a@85BY6#adfh3rh3^rnn<2_8M^^n$kPX2B6%$_3z)U1|klVdWPxy8Qk?sJIIXX81*=(WWEGP+_a_f4y%2p`JAmRcKYvvRfi Ya-Ep;)?2|xR|K6EKh2#HPZJ0L05dMoSpWb4 diff --git a/openair2/LAYER2/rlc_v2/tests/test12.txt.gz b/openair2/LAYER2/rlc_v2/tests/test12.txt.gz index 988d7ae644c008cef2f34adce448d00a3a7ce4e1..a416cfdd2edc22463ab562588847eb73d27a3848 100644 GIT binary patch literal 411 zcmV;M0c8FkiwFp;WvyQV19W9`bTKk6ba-?CwUkRwgFqC8_x_5r)Q!29;W4l@?bevI zT^Z9*7)+D;NT<~3uXmswQ|dsW+6@ab=iGC?fjb>frU}OPcL_MbT4me0&P!Y`bI?r! zz5G%L5pL!v|Y$eVE_t25lDjKPN8RoOtmrvEkGH_gi)ZvyazMb1B*^0 z(KKQo9DqY`1eV|!oPrnN44fYuJ*!u>PB&`)o|k(U5mhd!UqO(BK-Q%QDIH-sD%;&) zKrBCU=JIO5DyvhFO-K85!*exfO6N?jXXbXMX=0upbyRA)#!lB7aA7M{3|tuEpd->D z2HIh0WzcjD`xLFHQH7}|zBsxBzF7VRpJAVsdh_;zhtcex;JG|6^!R{zJ zJj}v(o|g8s#c!f43KWG2+S~^sxWqNG2+zC6T`42Z)oQs_YfMJ7{jP1@(I+&{_1vy8 z7t(VxpYZ6l{eC>UuH664wi-qFNHuhsWlHO!T&+HB5|!UN6+Bqs4OWOw#Wy=C0~C)3 F007+Szx)6I literal 415 zcmV;Q0bu?giwFpK`Quyy19W9`bTKk6ba-?CwUtXx!!Qtp@BE56!UgTxN%J_O_KJ|& zo)D^1$3>OOLv>RGzn(lA)D*`}3c2JEd1hxnt-Z6!bQWWBe;0#eY_-}iOq$_(oq}#+ znDv*2AL9{3AO;DL1bI(avvwgjg+6Em3P2$!atcK)WGa;jXbDoFJd6gd^8a843$Sz= z$)*u|U>`gJ2jCDKffMi&tib81(X)Ql+hnH~?`d{$kwM{-cm;%z;D=>XgoIA8oHXn1 zphqk(u;vmaV6Dm&RHvguy8gMEHA8DnE^DTB&AgNRE6CAO(>1cXmVj4v3k3rkhRAnB zI>ta1hE@hm*HM>73u;tg>WD82hQJqvf5DftSDD$pz2IRy|0j4h&!OgWKB)@Yu0s7r z(eYuHp7pd>pB7C`^#(}Sn5j!iu^eR1SPn91EH9k23VSY2^=7@-TTI9E!!~H$B4;$# z1=6m`8FkzpXFNK+&p#fnq4a*UElLqS5(ASdrHxr-o6TpPM5nh_1@~5n-U{hdd;_Eq JWzaDQ003|)yl4Ob diff --git a/openair2/LAYER2/rlc_v2/tests/test46.h b/openair2/LAYER2/rlc_v2/tests/test46.h new file mode 100644 index 0000000000..b58c9dce64 --- /dev/null +++ b/openair2/LAYER2/rlc_v2/tests/test46.h @@ -0,0 +1,49 @@ +/* + * rlc am test ack/nack reporting with segmented SDUs + * eNB sends SDU in big PDU, not received + * eNB retx with smaller PDUs, not received except a few + * after some time, RX works again, UE should NACK with SOstart/SOend + * + * this test was written because in the past we didn't generate NACKs with + * SOstart/SOend, potentially leading to infinite retransmissions, even with + * good radio conditions (well, there will be max ReTX reached at some point). + * The scenario is as follows: + * the eNB transmits many many PDUs segments and asks for status + * report at some point (but before sending all the segments). The UE then + * generates a (wrong) NACK without SOstart/SOend, and then the eNB has to + * resend everything from start (all bytes of the PDU have been NACKed because + * there is no SOstart/SOend). Then the eNB will again ask for status report + * before sending everything and the process repeats all over again. + */ +TIME, 1, + ENB_AM, 100000, 100000, 35, 0, 45, -1, -1, 4, + UE_AM, 100000, 100000, 35, 0, 45, -1, -1, 4, + UE_RECV_FAILS, 1, + ENB_RECV_FAILS, 1, + ENB_SDU, 0, 300, + ENB_PDU_SIZE, 500, + UE_PDU_SIZE, 1000, +TIME, 2, + ENB_PDU_SIZE, 7, +TIME, 50, + UE_RECV_FAILS, 0, +TIME, 51, + UE_RECV_FAILS, 1, +TIME, 60, + UE_RECV_FAILS, 0, +TIME, 61, + UE_RECV_FAILS, 1, +TIME, 70, + UE_RECV_FAILS, 0, +TIME, 71, + UE_RECV_FAILS, 1, +TIME, 80, + UE_RECV_FAILS, 0, +TIME, 81, + UE_RECV_FAILS, 1, +TIME, 140, + UE_RECV_FAILS, 0, + ENB_RECV_FAILS, 0, +TIME, 150, + ENB_PDU_SIZE, 200, +TIME, -1 diff --git a/openair2/LAYER2/rlc_v2/tests/test46.txt.gz b/openair2/LAYER2/rlc_v2/tests/test46.txt.gz new file mode 100644 index 0000000000000000000000000000000000000000..dd633ec0329973242005359584099d8e223de24c GIT binary patch literal 2063 zcmZ9Idpy(oAIH;9%q4C1V8k$TD`oB*A(zv140Y6uLzvu3ncT^>wUJA8(1XZwPQQL# zu=vU4=eFDuwK%RNv;8EOVZs=j`R&{9{2q_<`~CHKKi==>>-l+qK3ch8aBo0$z1Ffci8jd zM|xaWChZ3m5{Cj6uCb`o+=Pu--gY97B^IqHMy2m?6t7b~Ux~gA>~5>=2}qr(2~^>s zy=pLXibEqQdazIWW#p3NKg%_~)@xE|>_U(ZtenO-Nk>C66J0Z0`u6)E)sHxuU7~8- z-H$;k|G`GIGExNlv^a2qa@tMLRkbv#16y7s8^D=djzEI5uwXDW$dLfGB9reze$%9E1eH&R|toy4sdf`5wA{YSiSyQdms`znRT_N zA;@jQtN}5ZSsiFwdm-}RTcqr-SUFc{gro00tHVGpVo zDY;xKth<@*7kv#4W9G%YNn#tLJ(0y!{`(c)78omiu_iBXwUe>XKMJNR-0<_!;N)j=i>INX zN>4I*rCLGyLCLN=7&UhBnG(&aw1(3qlCw8WD<4&eYGdpmtU7U>SuHDV01pr8IEIzX zFV^g)A%Gxq%QlHzN?y=o@xDob_!fZ{PYjSDCfIP)B-_aF`tKaU32r&Y& z{nob5CU<8uAxRLnor1q^6F#lEq}BUsV-@=7PEw+1ncCR0Yvp1+1?rt+{@|BzyB(j0 zf{~`2caEBM;uvuW3*3QyVfyTU@-~XY$fX(Ff|2pZ(9r!gDHj5&PYX&j8s%B^ILRY2 zxZ*MICds5?>eXgGpnwUVqk)YYm$_xNQdj91k*)GmrrI+&2Gm3Gm*(_zPfC`o~rY?ENM8 zvJV&23StB6p2S5&;Q%ncsx9=P1g!R-T5?IZyOQ46+&1`dzHe|~bie0D=itKg0)ym` z`I*HsgXG}(2WsqsV7>;Il2hMdU}*M)qbdRPXJKd|S34=4_3Z1Rjq^~fxu8$pup zf$qW2Ksd(PNHg-VHsvj(|0dz6Ga5>4QsCgSk>+GCB;`GXc}vyC*-(wRt-y)QMp}@E zk(43`ld6h$GDH$1WGnNsXZ6TlI+PL!GeCYu(IigL8 zs?wZy*_Eo~pLOpCL;CXxzd9OXh(6MsrR+*I@~|!?4AOt+B=WH43JK)Vr7Zr8z{#q( zS%E_c#*^CRMAO)tq=KH+gHC5u+|b|7(L{ZMa8*>S)K=_O3!$1&4d%oh9(4d*w^&>73X=##F z2w8rtQKSeVKf>edS(_N)B{sI8vA5VcduDWJyWVUgtnY3jNQBa4$GFNHT<&wwRfKB) zZom}b9z-Ap2}pr7$OHMH02G2&4;R}3=+QixGO11coHsp1T1rA4Xbx+)?ohco?2o3z z=62WX%(XcY&d5mLksg>UX9VnwAOWSI3}mNcKt=1qY+C~>7c@BnUcl0hlnkXn3i%FZJ zFlAiTN!?VI-u>h5kpT7U=ZWlGzRnKdj9qZDvq7-mjM`k-$c8kG(^SaA`62H_)aatm z-xK|d&&+&xK6=b&!MgoZv^yVf)aUPr*;yXxs1GyiAN{uv@r*PN3S?=4T3Vnd3qAlU KzFe^s2LJ%53BYIo literal 0 HcmV?d00001 diff --git a/openair2/LAYER2/rlc_v2/tests/test48.h b/openair2/LAYER2/rlc_v2/tests/test48.h new file mode 100644 index 0000000000..46c2c8ad33 --- /dev/null +++ b/openair2/LAYER2/rlc_v2/tests/test48.h @@ -0,0 +1,29 @@ +/* + * am: test case "if (bits + nack_size > maxsize)" in functions status_size + * and generate_status. + * The eNB sends 5 PDUs, only first and last received by the UE. Then we + * ask for the UE's buffer status to trigger the case. UE PDU size is + * limited to 6 to trigger the case. + */ +TIME, 1, + ENB_AM, 100000, 100000, 35, 0, 45, -1, -1, 4, + UE_AM, 100000, 100000, 35, 0, 45, -1, -1, 4, + ENB_RECV_FAILS, 1, + ENB_PDU_SIZE, 100, + UE_PDU_SIZE, 6, +TIME, 2, + ENB_SDU, 0, 10, +TIME, 3, + UE_RECV_FAILS, 1, + ENB_SDU, 1, 10, +TIME, 4, + ENB_SDU, 2, 10, +TIME, 5, + ENB_SDU, 3, 10, +TIME, 6, + UE_RECV_FAILS, 0, + ENB_RECV_FAILS, 0, + ENB_SDU, 4, 10, +TIME, 42, + UE_BUFFER_STATUS, +TIME, -1 diff --git a/openair2/LAYER2/rlc_v2/tests/test48.txt.gz b/openair2/LAYER2/rlc_v2/tests/test48.txt.gz new file mode 100644 index 0000000000000000000000000000000000000000..c1797b73bb05906533b665989bdb1f242895c29d GIT binary patch literal 427 zcmV;c0aX4UiwFp4T&`aN19W9`bTl|Fba-?Ct&_V>!$1&4d%oh9(4d*wwd1%%q@_tx zA!PZnMv)?f{0NV)XV=6CFNtM~H1-yrvuCbnHmmg}#_HiNhQz2$en{$~#r3WL-NdMO zp9V}Z9zg_Rkbo3Og91BebUW>M;h@+&`fu^vws}5C|{qA5Y ztnatI&QzNt;e?Fz9qEC&@*-d_f)td2a*$2OfJ*1WY+C~>A2b>P&tPd!N`_Lb!2vh~ zFTfFa2~NQoI0qL#XjDpOumVp?c~bUJLI}bTfhdTE1dtH2@Ij+eY6dIxr1VfqBFGYw zLNZ7Wu~FJdD4__7ebA_sp2l+X7tWbK`>`8y!dqISZu8vKb=mIsAN>}X;`SF?TTIrL zrKys-Nt?E|^zNN>mjr0uzfWXy`8j)l6Lvvw7rJL|=aPnlG&bJR^zrT#)Y%oEz9AQy z?9NA@^O=P>p`(wfT7nHIqCYLT>v+Pi9~8*sf(vb0*I{rrr2iu(uhyB4`rYE;Zn>}B VMQTo9u0W3#d;x&&PX$2-002Em%`^Z2 literal 0 HcmV?d00001 diff --git a/openair2/LAYER2/rlc_v2/tests/test49.h b/openair2/LAYER2/rlc_v2/tests/test49.h new file mode 100644 index 0000000000..edeec27403 --- /dev/null +++ b/openair2/LAYER2/rlc_v2/tests/test49.h @@ -0,0 +1,27 @@ +/* + * rlc am test ack/nack reporting with segmented SDUs + * + * 5 SDUs put into 6 PDUs, all PDUs received expect the 3rd. Then + * retransmission happens with smaller PDU size. + */ +TIME, 1, + ENB_AM, 100000, 100000, 35, 0, 45, -1, -1, 4, + UE_AM, 100000, 100000, 35, 0, 45, -1, -1, 4, + ENB_SDU, 0, 60, + ENB_SDU, 1, 160, + ENB_SDU, 2, 130, + ENB_SDU, 3, 120, + ENB_SDU, 4, 100, + ENB_PDU_SIZE, 100, + UE_PDU_SIZE, 1000, +TIME, 3, + UE_RECV_FAILS, 1, +TIME, 4, + UE_RECV_FAILS, 0, +TIME, 7, + ENB_PDU_SIZE, 40, +TIME, 42, + UE_RECV_FAILS, 1, +TIME, 80, + UE_RECV_FAILS, 0, +TIME, -1 diff --git a/openair2/LAYER2/rlc_v2/tests/test49.txt.gz b/openair2/LAYER2/rlc_v2/tests/test49.txt.gz new file mode 100644 index 0000000000000000000000000000000000000000..752a1aedd51defe7b9225848e6ff5bf45c7d1a7f GIT binary patch literal 895 zcmV-_1AzP=iwFo60m)wi19W9`bTm0Gba-?C?U>7MTtyIu_dLb7gbnJhzRwcHTQ+f4 z2t|EGmMj!`a1cB_=Nx-1jy*m}5R8*B574cuud4pKTwc7s+;Q>a4?FaZn_l0)-M3r5 zy=tiMcI>bI?0B`~CzL{Il%NdCq8!Sj0xF^sDx(UjqNax(HP8yJ(SkN;i*{&_4(NzZ z=!`Dtif-tR9*9CTB8WjO;t-DnBq9mPNI@#nkd6$D!f1?O48~#{#$y5|ViG1}%Fo|i zKJT7BxTo*@GZoV?9W$^BtFeMLSc`R7j}6#}P1uYr*otk~jvY9K(>TEyoW(hu#|2!( zC0xc8T*Wn9$Bl_7UgHIC@D}gz9v|=#pYR!9@D<GxgZa@V3u5HmDXsT zHt343=|VSjOLufn5A;Y+^h_`GN^kT|9}LCN3}G0CWjKas1V&^eMrIU7Wi&=-j4!dS zPE#wJ5i<`FlOCC*VS`%^_c4~{nvhzf9r4Gwc9n+DZOUT z%pA+JbZoZS1JpMc3)9xGuip0?UcY*Cm}|a*u|~F%Wzw0+xw9&MgetC}noX#6Nf$la z^{r=+ZCLSp-m|~0weR=i_WJsdLznLD`@j8d)zQ!G{pXXHGc&c8o8x1Y zJuG-L;=>4aDkWbVC|d@`djqFPoiNST1|DyNcPsK(44edMQqcdTXUuUA;iv_16?d7l zYZi(z3*^d!5I=LoA-yExyKO_<2Bh(_ke1Q?83UhW!35%H7HIJ=oydy`PZkipY#`^u z|YD19W9`bT%$@cys{mnoExzH4ugO`4!(1HmLlz?-DUvHkqst ziu@>}kwys3WrE<>bDJ0kv)hpWz*LO~xZu|D;_3eq9Z@)g_PCV#*_x8LV z`QmONU!FMM{iZaL6W<|%IK(3XiAX{+Qjm%?q$2~F$YrJ?8z(r2^SFSExP;5Nf~&ZO z>$riNxP?>P#tYuzJwD(gKH)RI;48l2JAU9Ne&H3r2|{oLPY8raNQ6u%gi2_HP8ftq zSOg_(q7WU?69X|46EPDDu@W1x69;h;7g33uBqT@jq(F+KM9QQ>s-#Bhq(PdbMN-lx z3)zu9Iglecku$lFE4h(7d5|Z0k(InDLU9yN36w}lluRjc#}A>^AEEUEwTP9@tjny+_&5HIf8*cyH~x+P7ZF`!xtd+``yZ~C>Wh5z zSOv|&%)yL**KP&z}HpWjF+dntPbUjN+ zJXTosPaY1%ndnS(|6Z_vPh+;MZmKcWeAZe05b@IcyLbA)>u=tCxIS#Rht09fv5bG? z-}pEFjeq0c_ek6bJK($Ab9=hX9gKi=Q}`V@P0ef8>h5i_#HfCEZ)k|A6H$?2 z2>qxw2oQ$BHD%ae?_JRpBzVQlFbNef;Y?KLp1RY6xxRXPecF5n_A;WDn^Dz4!= zZr~3?3if{OiANYx1c*Spm5FEi10wEF-ArlIr5*ncs24NBw zK?$2EL`U?*K#ash%)~;h#76AIL7c=zRN^KH$&oxMkRmCOGO3U%sgXKqkS1x7l(fl0 zc4SWuOPH)=4hT4Xpxp^nO10()@YqJXp^>Rrx|a$&>h{=13l6c zJ<|)l(i^?g2Yu2PUFn-449D<{z=({*$c)0MjK=7U!I+H2P{w8o(=k0WFe5WDGqW%& zvoSk!Feh^{mAP5MaxBjZtjJ2N%qpzPYOKy0tjSs|Wo=YYhk7)i5lv`D3tG{Jc66W< zU8tg)Eo{g3?7)uf#Ln!(uI$F{?7^Pw#a8w<{*8a*-}pEFjeq0+|KgzFW$H5ijeq0c_&5HIf8+mIRM%K8cGvuH;Chs<;(S2FWw!bp6}lux9SP$bG|HM7BO2f&#fe% zBVWVC5XZ;J`wPKu@$xg)tF2d<^h|m$ivQ1L_%*RTDZ})X45!J^WN0!p8NMtTKA0_E zejAjJK3w&mfu18{sj<}jcSjQsG!{E;u+&&;Ui4|hImAnEZ$9W9Z{NK8^aF(b|6s;4 zV;TR(zwvMU8~?_?@&9}p>r}lsM-)bT|B6$_O}O(tv!$`xG?uFn z%zWH20uh2Xa)^JucjHJ{WL<{H@r7lpcdL7z=bl;Sy}o*Lec^k~c*tj^ZhS5-Ew2DTPugjnXNDGAWCqluZ??qk3wf zMrxvFYN1wYqju_`PU@m6b)UvYb2Lv2v`9;|Oe?fXYqU-qv`JgE(~LJ==#K8`fgb6J zp6P{N>5bm$gFfktuJp|ihGTd}U_?e@WJY0BMq_lwU`)nhC}T5)>6o4wn30*7nOT^X z*_fRVMh$b|n1+8d9J37#b zE>zLY7Pe!1c3?+#VrO(a|Hi-ZZ~Pno#=r6Z-}3*j`QR8=X~`RhRK^{2TwqzwvMU8~@KjU1PcEuKDvHuBYjXeDSdf zT7y}G8UMz=@&6t1|8!&4iyJdYJ#WnY*P=X8dX9{x#!_Qj<5_xdix*QI&3kR{TZ37H zeN+5DZMJl=*}TMav#t8~K+ln})L3f%Wm|69Y}ry{srhDY`R&zLL+l^!`=GK?im;WO-|6GlyW?OoD^Fi-;^ZM=M%MJE!gH@ST znelJ@8~?_?@o)Sa|Ig#-|Fy&T}ltM-YX3|B9!Kn=t#md&^+8X)ISE znEjXy0uh346cBs}nz`&RRuGl#?O_0{|916SXFcfcLE)A{M+aozLH z%|hNDINtoBG?4>8Ac8o=BLRs>LNZd2iZrAn1DVL_PenFPa1Q5j0T*!zmvIGGaShjT z12=ICr?`z5yu*8Zz(;(-XMDj|e8YGAz)$?bD}ED%;0T@&2$7HonNSFo&pE*;JuAs;35O zq$X;n7HXw7YNrnBq%Nvb_i1c2NAt8mi?l?`v_h-2M(eaeo3uqc&3My=?&zK#=#if2 znO^9X-sqh^=##$aO5Y4&IEH5gMr0&LW)wzcG)89(#$+spGB#6~j_H|!8JUThnT1)I zjoF!lIhl*8%*_&(V|i9!MOI>ER$*0EV|CVGP1a&5YomfX)T057XhJhu(26#+qXV7j zLKWR?VLP^G2Xj`QR8=YB~S(ou|{2TwqzwvMU8~-mNy2f%byXJ?&^)!8v&pw-= zIhZ+^@o)Sa|6dXR&o^ehxG{s&^TynNEy@$6XUUjqOf|MOUS#fV@uG^O^GE?mA2 z5g$+c=l?w1pa}lo^7ynoZh721(me8YhZYmZ*PBptW$J-`{qygK1W|ZLI40jfsNb% diff --git a/openair2/LAYER2/rlc_v2/tests/test9.h b/openair2/LAYER2/rlc_v2/tests/test9.h index 88e23d94e9..2da9732012 100644 --- a/openair2/LAYER2/rlc_v2/tests/test9.h +++ b/openair2/LAYER2/rlc_v2/tests/test9.h @@ -11,9 +11,6 @@ * In the current RLC implementation, this is impossible. If we send [12..21] * it means [1..21] has been split and so we won't sent it later on. * Maybe with HARQ retransmissions in PHY/MAC in bad radio conditions? - * - * this test will fail if NACK mechanism uses SOstart/SOend - * (not implemented for the moment) */ TIME, 1, ENB_AM, 100000, 100000, 35, 0, 45, -1, -1, 4, diff --git a/openair2/LAYER2/rlc_v2/tests/test9.txt.gz b/openair2/LAYER2/rlc_v2/tests/test9.txt.gz index cc6d934e708e1ddad7286e7c3eec33cd23c91f94..d3803062aa9de8a7e8fa319d58248e6b06c89e99 100644 GIT binary patch literal 324 zcmV-K0lWSmiwFomVXa>R19W9`bU7|`cys{0luJ*;Fc5_A{S|YB3!2S4Iilu@klLOQ zs?yj&k-|f9Qv|=BIFL#a7NR2b;?sKOo87h7`D&dZzq!sJ8CqQ)wnlZhs1 zJ~P~b1O@a!9}K_{jKCO7z!WUN9aw_>MGaOELImPLd`JKZArT~oB#;zRKz5K4qV5;# z3B-eb(rvNV+ZWZ11fC@*I6$0*BZ!?KUT8sdGJ^aSXX=?aJ;k@4)nJuy2=KcMY2em7 zIm1*nbgKqdRUK7#Cj?KUd4mi4jV(K~e}2U6ax(*=P#lW?wGEs6%h9!g<6GpU+ILSS z8LK^edbC7wg{tZsIt}R0H-k^0UQg+!KIj&!rV^C z91kEt0RvEhAsB%%n1CsmfhAah8r%ctL`w1+i%l@>iUpXX^D7)q1WvtCU@UpJm8Gzuwsy zhN_WYHEdPQQMEcFcovTvT)1znZrt|u8TZr02!ulMDE?O)7PD_hUjzHU$iZplf0eL5 z9Smm Date: Thu, 3 Dec 2020 23:22:07 +0100 Subject: [PATCH 098/160] Fix phy simulators compilation, number of threads for dlsch configurable --- cmake_targets/CMakeLists.txt | 5 + common/utils/LOG/log.h | 1 + executables/nr-ue.c | 14 +- executables/nr-uesoftmodem.c | 32 +- executables/nr-uesoftmodem.h | 14 +- openair1/PHY/NR_TRANSPORT/nr_dlsch.h | 2 +- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 370 ++++++------------ openair1/SCHED_NR_UE/defs.h | 12 +- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 25 +- openair1/SIMULATION/NR_PHY/dlsim.c | 13 +- 10 files changed, 192 insertions(+), 296 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 94d55d5fe5..d918ade255 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -3231,6 +3231,7 @@ add_executable(nr_dlschsim ${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${OPENAIR_DIR}/common/utils/utils.c + ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c ${UTIL_SRC} ${T_SOURCE} ${SHLIB_LOADER_SOURCES} @@ -3245,6 +3246,7 @@ add_executable(nr_pbchsim ${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${OPENAIR_DIR}/common/utils/utils.c + ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c ${UTIL_SRC} ${T_SOURCE} ${SHLIB_LOADER_SOURCES} @@ -3261,6 +3263,7 @@ add_executable(nr_pucchsim ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/utils.c + ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c ${UTIL_SRC} ${T_SOURCE} ${SHLIB_LOADER_SOURCES} @@ -3279,6 +3282,7 @@ add_executable(nr_dlsim ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${NFAPI_USER_DIR}/nfapi.c + ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c ${UTIL_SRC} ${T_SOURCE} ${SHLIB_LOADER_SOURCES} @@ -3298,6 +3302,7 @@ add_executable(nr_prachsim ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${NFAPI_USER_DIR}/nfapi.c + ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c ${UTIL_SRC} ${T_SOURCE} ${SHLIB_LOADER_SOURCES}) diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index 55dea68896..240e89a0e7 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -148,6 +148,7 @@ extern "C" { #define DEBUG_SECURITY (1<<11) #define DEBUG_NAS (1<<12) #define DEBUG_RLC (1<<13) +#define DEBUG_DLSCH_DECOD (1<<14) #define UE_TIMING (1<<20) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 15947ba881..6afbae91b0 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -411,7 +411,7 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL ); #else uint64_t a=rdtsc(); - phy_procedures_nrUE_RX( UE, proc, 0, UE->mode); + phy_procedures_nrUE_RX( UE, proc, 0, UE->mode,get_nrUE_params()->nr_dlsch_parallel); LOG_D(PHY,"phy_procedures_nrUE_RX: slot:%d, time %lu\n", proc->nr_slot_rx, (rdtsc()-a)/3500); //printf(">>> nr_ue_pdcch_procedures ended\n"); #endif @@ -624,7 +624,7 @@ void *UE_thread(void *arg) { while (!oai_exit) { if (syncRunning) { - notifiedFIFO_elt_t *res=tryPullTpool(&nf, Tpool); + notifiedFIFO_elt_t *res=tryPullTpool(&nf,&(get_nrUE_params()->Tpool)); if (res) { syncRunning=false; @@ -650,7 +650,7 @@ void *UE_thread(void *arg) { syncData_t *syncMsg=(syncData_t *)NotifiedFifoData(Msg); syncMsg->UE=UE; memset(&syncMsg->proc, 0, sizeof(syncMsg->proc)); - pushTpool(Tpool, Msg); + pushTpool(&(get_nrUE_params()->Tpool), Msg); trashed_frames=0; syncRunning=true; continue; @@ -765,7 +765,7 @@ void *UE_thread(void *arg) { notifiedFIFO_elt_t *res; while (nbSlotProcessing >= RX_NB_TH) { - res=pullTpool(&nf, Tpool); + res=pullTpool(&nf, &(get_nrUE_params()->Tpool)); nbSlotProcessing--; processingData_t *tmp=(processingData_t *)res->msgData; @@ -798,13 +798,13 @@ void *UE_thread(void *arg) { nbSlotProcessing++; msgToPush->key=slot_nr; - pushTpool(Tpool, msgToPush); + pushTpool(&(get_nrUE_params()->Tpool), msgToPush); if (IS_SOFTMODEM_RFSIM || IS_SOFTMODEM_NOS1) { //getenv("RFSIMULATOR") // FixMe: Wait previous thread is done, because race conditions seems too bad // in case of actual RF board, the overlap between threads mitigate the issue // We must receive one message, that proves the slot processing is done - res=pullTpool(&nf, Tpool); + res=pullTpool(&nf, &(get_nrUE_params()->Tpool)); nbSlotProcessing--; processingData_t *tmp=(processingData_t *)res->msgData; @@ -860,7 +860,7 @@ void init_NR_UE_threads(int nb_inst) { LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]); threadCreate(&threads[inst], UE_thread, (void *)UE, "UEthread", -1, OAI_PRIORITY_RT_MAX); - if( IS_DLSCH_PARALLEL) + if(get_nrUE_params()->nr_dlsch_parallel) { pthread_t dlsch0_threads; threadCreate(&dlsch0_threads, dlsch_thread, (void *)UE, "DLthread", -1, OAI_PRIORITY_RT_MAX-1); diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index ebb92fef44..af1b712a70 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -43,6 +43,7 @@ #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "SCHED/sched_common_vars.h" #include "PHY/MODULATION/modulation_vars.h" +#include "PHY/NR_TRANSPORT/nr_dlsch.h" //#include "../../SIMU/USER/init_lte.h" #include "LAYER2/MAC/mac_vars.h" @@ -97,8 +98,8 @@ pthread_cond_t sync_cond; pthread_mutex_t sync_mutex; int sync_var=-1; //!< protected by mutex \ref sync_mutex. int config_sync_var=-1; -tpool_t *Tpool; -tpool_t *Tpool_dl; + + RAN_CONTEXT_t RC; volatile int start_eNB = 0; @@ -218,11 +219,16 @@ uint64_t set_nrUE_optmask(uint64_t bitmask) { nrUE_params_t *get_nrUE_params(void) { return &nrUE_params; } - +/* initialie thread pools used for NRUE processing paralleliation */ +void init_tpools(uint8_t nun_dlsch_threads) { + + initTpool("-1,-1", &(nrUE_params.Tpool), false); + init_dlsch_tpool(nrUE_params.nr_dlsch_parallel); +} static void get_options(void) { char *loopfile=NULL; - int32_t nr_dlsch_parallel=0; + paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC_UE ; config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL); paramdef_t cmdline_uemodeparams[] = CMDLINE_UEMODEPARAMS_DESC; @@ -249,8 +255,6 @@ static void get_options(void) { if ((cmdline_uemodeparams[CMDLINE_DUMPMEMORY_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_dump_frame; - if (nr_dlsch_parallel) - set_nrUE_optmask(NRUE_DLSCH_PARALLEL_BIT); if (vcdflag > 0) ouput_vcd = 1; @@ -261,6 +265,7 @@ static void get_options(void) { printf("%s\n",uecap_xer); uecap_xer_in=1; } /* UE with config file */ + init_tpools(nrUE_params.nr_dlsch_parallel); } // set PHY vars from command line @@ -450,19 +455,6 @@ void *rrc_enb_process_msg(void *notUsed) { return NULL; } -/* initialie thread pools used for NRUE processing paralleliation */ -void init_tpools(void) { - tpool_t pool; - Tpool = &pool; - char params[]="-1,-1"; - initTpool(params, Tpool, false); - if( IS_DLSCH_PARALLEL) { - tpool_t pool_dl; - Tpool_dl = &pool_dl; - char params_dl[]="-1,-1,-1,-1"; - initTpool(params_dl, Tpool_dl, false); - } -} int main( int argc, char **argv ) { //uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2; @@ -489,7 +481,7 @@ int main( int argc, char **argv ) { #endif //randominit (0); set_taus_seed (0); - init_tpools(); + cpuf=get_cpu_freq_GHz(); itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h index 7e4e18d91c..ec6409cf80 100644 --- a/executables/nr-uesoftmodem.h +++ b/executables/nr-uesoftmodem.h @@ -53,17 +53,17 @@ } -#define CONFIG_HLP_DLSCH_PARA "enable dlsch processing parallelization" +#define CONFIG_HLP_DLSCH_PARA "number of threads for dlsch processing 0 for no parallelization" /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ /* command line parameters common to gNB and UE */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*----------------------------------------------------------------------------------------------------------------------------------------------------*/ #define CMDLINE_PARAMS_DESC_UE { \ {"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \ - {"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, PARAMFLAG_BOOL, iptr:(int32_t *)&nr_dlsch_parallel, defintval:0, TYPE_INT, 0}, \ + {"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, iptr:(int32_t *)&nrUE_params.nr_dlsch_parallel, defintval:0, TYPE_UINT8, 0}, \ {"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \ {"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \ - {"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&(openair0_cfg[0].threequarter_fs), defintval:0, TYPE_INT8, 0}, \ + {"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&(openair0_cfg[0].threequarter_fs), defintval:0, TYPE_INT8, 0}, \ {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \ {"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 0}, \ {"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&UE_no_timing_correction, defintval:0, TYPE_INT, 0}, \ @@ -72,12 +72,11 @@ -#define NRUE_DLSCH_PARALLEL_BIT (1<<0) - -#define IS_DLSCH_PARALLEL ( get_nrUE_optmask() & NRUE_DLSCH_PARALLEL_BIT) typedef struct { uint64_t optmask; //mask to store boolean config options + uint8_t nr_dlsch_parallel; // number of threads for dlsch decoding, 0 means no parallelization + tpool_t Tpool; // thread pool } nrUE_params_t; extern uint64_t get_nrUE_optmask(void); extern uint64_t set_nrUE_optmask(uint64_t bitmask); @@ -96,6 +95,5 @@ extern void reset_opp_meas(void); extern void print_opp_meas(void); void *UE_thread(void *arg); void init_nr_ue_vars(PHY_VARS_NR_UE *ue, uint8_t UE_id, uint8_t abstraction_flag); -extern tpool_t *Tpool; -extern tpool_t *Tpool_dl; + #endif diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h index 23ec756531..6af8f28eac 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h @@ -95,7 +95,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, time_stats_t *dlsch_interleaving_stats, time_stats_t *dlsch_segmentation_stats); - +void init_dlsch_tpool(uint8_t nun_dlsch_threads); void nr_emulate_dlsch_payload(uint8_t* payload, uint16_t size); void dump_pdsch_stats(PHY_VARS_gNB *gNB); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 9c87cf26d5..8cd59f7d5e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -44,7 +44,7 @@ #include "executables/nr-uesoftmodem.h" #include "PHY/CODING/nrLDPC_extern.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h" -//#define DEBUG_DLSCH_DECODING + //#define ENABLE_PHY_PAYLOAD_DEBUG 1 //#define OAI_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX @@ -56,7 +56,22 @@ notifiedFIFO_t freeBlocks_dl; notifiedFIFO_elt_t *msgToPush_dl; int nbDlProcessing =0; + +static tpool_t pool_dl; + //extern double cpuf; +void init_dlsch_tpool(uint8_t nun_dlsch_threads) +{ + if( nun_dlsch_threads==0) + return; + + char *params=malloc(nun_dlsch_threads*3*sizeof(char)); + for (int i=0; imax_ldpc_iterations = max_ldpc_iterations; for (i=0; iharq_processes[i] = (NR_DL_UE_HARQ_t *)malloc16(sizeof(NR_DL_UE_HARQ_t)); if (dlsch->harq_processes[i]) { @@ -188,7 +202,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint return(dlsch); } - printf("new_ue_dlsch with size %zu: exit_flag = %u\n",sizeof(NR_DL_UE_HARQ_t), exit_flag); + LOG_I(PHY,"new_ue_dlsch with size %zu: exit_flag = %u\n",sizeof(NR_DL_UE_HARQ_t), exit_flag); free_nr_ue_dlsch(&dlsch,N_RB_DL); return(NULL); @@ -250,7 +264,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, t_nrLDPC_time_stats* p_procTime =&procTime ; if (!harq_process) { - printf("dlsch_decoding.c: NULL harq_process pointer\n"); + LOG_E(PHY,"dlsch_decoding.c: NULL harq_process pointer\n"); return(dlsch->max_ldpc_iterations + 1); } t_nrLDPC_procBuf** p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf; @@ -290,12 +304,12 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, //NR_DL_UE_HARQ_t *harq_process = dlsch->harq_processes[0]; if (!dlsch_llr) { - printf("dlsch_decoding.c: NULL dlsch_llr pointer\n"); + LOG_E(PHY,"dlsch_decoding.c: NULL dlsch_llr pointer\n"); return(dlsch->max_ldpc_iterations + 1); } if (!frame_parms) { - printf("dlsch_decoding.c: NULL frame_parms pointer\n"); + LOG_E(PHY,"dlsch_decoding.c: NULL frame_parms pointer\n"); return(dlsch->max_ldpc_iterations + 1); } @@ -395,12 +409,10 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, &harq_process->F, p_decParams->BG); -#ifdef DEBUG_DLSCH_DECODING - if (!frame%100) - printf("K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, p_decParams->Z, harq_process->Nl); -#endif + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD) && (!frame%100)) + LOG_I(PHY,"K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, p_decParams->Z, harq_process->Nl); } - + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_SEGMENTATION, VCD_FUNCTION_OUT); p_decParams->Z = harq_process->Z; @@ -426,9 +438,9 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, return((1+dlsch->max_ldpc_iterations)); } -#ifdef DEBUG_DLSCH_DECODING - printf("Segmentation: C %d, K %d\n",harq_process->C,harq_process->K); -#endif + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) + LOG_I(PHY,"Segmentation: C %d, K %d\n",harq_process->C,harq_process->K); + opp_enabled=1; @@ -456,8 +468,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_OUT); - //for (int i =0; i<16; i++) - // printf("rx output deinterleaving w[%d]= %d r_offset %d\n", i,harq_process->w[r][i], r_offset); #if UE_TIMING_TRACE stop_meas(dlsch_deinterleaving_stats); @@ -511,29 +521,20 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, #endif } - - //for (int i =0; i<16; i++) - // printf("rx output ratematching d[%d]= %d r_offset %d\n", i,harq_process->d[r][i], r_offset); - r_offset += E; -#ifdef DEBUG_DLSCH_DECODING - if (r==0) { - write_output("decoder_llr.m","decllr",dlsch_llr,G,1,0); - write_output("decoder_in.m","dec",&harq_process->d[0][0],E,1,0); - } - - printf("decoder input(segment %u) :",r); + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) + { + LOG_I(PHY,"decoder input(segment %u) :",r); int i; for (i=0;id[r][i]); - printf("\n"); -#endif + LOG_D(PHY,"%d : %d\n",i,harq_process->d[r][i]); + LOG_D(PHY,"\n"); + } - // printf("Clearing c, %p\n",harq_process->c[r]); memset(harq_process->c[r],0,Kr_bytes); - // printf("done\n"); + if (harq_process->C == 1){ if (A > 3824) crc_type = CRC24_A; @@ -554,9 +555,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, start_meas(dlsch_turbo_decoding_stats); #endif - //LOG_E(PHY,"AbsSubframe %d.%d Start LDPC segment %d/%d A %d ",frame%1024,nr_slot_rx,r,harq_process->C-1, A); - - //printf("harq process dr iteration %d\n", p_decParams->numMaxIter); memset(pv,0,2*harq_process->Z*sizeof(int16_t)); //memset(pl,0,2*p_decParams->Z*sizeof(int8_t)); @@ -601,7 +599,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ret = no_iteration_ldpc; } else { - LOG_D(PHY,"CRC NOK\n\033[0m"); + LOG_I(PHY,"CRC NOK\n\033[0m"); ret = 1 + dlsch->max_ldpc_iterations; } @@ -611,24 +609,17 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, nb_error_decod++; } - //if (!nb_total_decod%10000){ - //printf("Error number of iteration LPDC %d %ld/%ld \n", no_iteration_ldpc, nb_error_decod,nb_total_decod);fflush(stdout); - //} - //else - //printf("OK number of iteration LPDC %d\n", no_iteration_ldpc); - for (int m=0; m < Kr>>3; m ++) { harq_process->c[r][m]= (uint8_t) llrProcBuf[m]; } -#ifdef DEBUG_DLSCH_DECODING - //printf("output decoder %d %d %d %d %d \n", harq_process->c[r][0], harq_process->c[r][1], harq_process->c[r][2],harq_process->c[r][3], harq_process->c[r][4]); - for (int k=0;k>3;k++) - printf("output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]); - printf("no_iterations_ldpc %d (ret %u)\n",no_iteration_ldpc,ret); - //write_output("dec_output.m","dec0",harq_process->c[0],Kr_bytes,1,4); -#endif + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) + { + for (int k=0;k>3;k++) + LOG_D(PHY,"output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]); + LOG_D(PHY,"no_iterations_ldpc %d (ret %u)\n",no_iteration_ldpc,ret); + } #if UE_TIMING_TRACE @@ -636,33 +627,22 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, #endif } - - - /*printf("Segmentation: C %d r %d, dlsch_rate_unmatching_stats %5.3f dlsch_deinterleaving_stats %5.3f dlsch_turbo_decoding_stats %5.3f \n", - harq_process->C, - r, - dlsch_rate_unmatching_stats->p_time/(cpuf*1000.0), - dlsch_deinterleaving_stats->p_time/(cpuf*1000.0), - dlsch_turbo_decoding_stats->p_time/(cpuf*1000.0));*/ - if ((err_flag == 0) && (ret>=(1+dlsch->max_ldpc_iterations))) {// a Code segment is in error so break; - LOG_D(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,nr_slot_rx,r,harq_process->C-1); + LOG_I(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,nr_slot_rx,r,harq_process->C-1); err_flag = 1; } } if (err_flag == 1) { -//#if UE_DEBUG_TRACE - LOG_D(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n", + LOG_I(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n", phy_vars_ue->Mod_id, frame, nr_slot_rx, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round); -//#endif + harq_process->harq_ack.ack = 0; harq_process->harq_ack.harq_id = harq_pid; harq_process->harq_ack.send_harq_status = 1; harq_process->errors[harq_process->round]++; - // printf("Rate: [UE %d] DLSCH: Setting NACK for slot %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,nr_slot_rx,harq_pid,harq_process->round); if (harq_process->round >= dlsch->Mlimit) { harq_process->status = SCH_IDLE; harq_process->round = 0; @@ -671,16 +651,15 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, if(is_crnti) { - LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for nr_slot_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n", + LOG_I(PHY,"[UE %d] DLSCH: Setting NACK for nr_slot_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n", phy_vars_ue->Mod_id,nr_slot_rx,harq_pid,harq_process->status,harq_process->round,dlsch->Mdlharq,harq_process->TBS); } return((1 + dlsch->max_ldpc_iterations)); } else { -//#if UE_DEBUG_TRACE + LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for nr_slot_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n", phy_vars_ue->Mod_id,nr_slot_rx,harq_process->TBS,harq_process->mcs,harq_process->nb_rb, harq_process->round); -//#endif harq_process->status = SCH_IDLE; harq_process->round = 0; @@ -704,11 +683,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, Kr = harq_process->K; Kr_bytes = Kr>>3; - /* - printf("harq_pid %d\n",harq_pid); - printf("F %d, Fbytes %d\n",harq_process->F,harq_process->F>>3); - printf("C %d\n",harq_process->C); - */ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_COMBINE_SEG, VCD_FUNCTION_IN); @@ -719,30 +693,22 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, Kr_bytes- - (harq_process->F>>3) -((harq_process->C>1)?3:0)); offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0)); -#ifdef DEBUG_DLSCH_DECODING - printf("Segment %u : Kr= %u bytes\n",r,Kr_bytes); - printf("copied %d bytes to b sequence (harq_pid %d)\n", - (Kr_bytes - (harq_process->F>>3)-((harq_process->C>1)?3:0)),harq_pid); - printf("b[0] = %x,c[%d] = %x\n", - harq_process->b[offset], + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) + { + LOG_D(PHY,"Segment %u : Kr= %u bytes\n",r,Kr_bytes); + LOG_D(PHY,"copied %d bytes to b sequence (harq_pid %d)\n", + (Kr_bytes - (harq_process->F>>3)-((harq_process->C>1)?3:0)),harq_pid); + LOG_D(PHY,"b[0] = %p,c[%d] = %p\n", + (void *)(uint64_t)(harq_process->b[offset]), harq_process->F>>3, - harq_process->c[r]); - - /*printf ("Printing payload bytes:"); - for (int i = 0; i < Kr_bytes; i++){ - printf("%d : %d \n", i, harq_process->b[i]); - }*/ -#endif - -#if defined(ENABLE_PHY_PAYLOAD_DEBUG) - if (frame%100 == 0){ - LOG_I (PHY, "Printing 10 first payload bytes at frame: %d ", frame); - for (int i = 0; i <10 ; i++){ //Kr_bytes - LOG_I(PHY, "[%d] : %x ", i, harq_process->b[i]); - } + (void *)(uint64_t)(harq_process->c[r]) ); + if (frame%100 == 0){ + LOG_D (PHY, "Printing 10 first payload bytes at frame: %d ", frame); + for (int i = 0; i <10 ; i++){ //Kr_bytes + LOG_D(PHY, "[%d] : %x ", i, harq_process->b[i]); } -#endif - + } + } } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_COMBINE_SEG, VCD_FUNCTION_OUT); @@ -790,7 +756,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, t_nrLDPC_time_stats* p_procTime =&procTime ; int8_t llrProcBuf[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))); if (!harq_process) { - printf("dlsch_decoding.c: NULL harq_process pointer\n"); + LOG_E(PHY,"dlsch_decoding.c: NULL harq_process pointer\n"); return(dlsch->max_ldpc_iterations); } t_nrLDPC_procBuf* p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf[0]; @@ -822,14 +788,14 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_SEGMENTATION, VCD_FUNCTION_IN); if (!dlsch_llr) { - printf("dlsch_decoding.c: NULL dlsch_llr pointer\n"); + LOG_E(PHY,"dlsch_decoding.c: NULL dlsch_llr pointer\n"); return(dlsch->max_ldpc_iterations); } if (!frame_parms) { - printf("dlsch_decoding.c: NULL frame_parms pointer\n"); + LOG_E(PHY,"dlsch_decoding.c: NULL frame_parms pointer\n"); return(dlsch->max_ldpc_iterations); } @@ -872,14 +838,12 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, G = harq_process->G; - LOG_D(PHY,"DLSCH Decoding main, harq_pid %d TBS %d G %d, nb_re_dmrs %d, length_dmrs %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, nb_re_dmrs, length_dmrs, harq_process->mcs, harq_process->Nl, nb_symb_sch,nb_rb); + LOG_I(PHY,"DLSCH Decoding main, harq_pid %d TBS %d G %d, nb_re_dmrs %d, length_dmrs %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, nb_re_dmrs, length_dmrs, harq_process->mcs, harq_process->Nl, nb_symb_sch,nb_rb); proc->decoder_main_available = 1; proc->decoder_thread_available = 0; proc->decoder_thread_available1 = 0; - //get_G(frame_parms,nb_rb,dlsch->rb_alloc,mod_order,num_pdcch_symbols,phy_vars_ue->frame,subframe); - // printf("DLSCH Decoding, harq_pid %d Ndi %d\n",harq_pid,harq_process->Ndi); if ((harq_process->R)<1024) Coderate = (float) (harq_process->R) /(float) 1024; @@ -939,7 +903,6 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, p_decParams->Z = harq_process->Z; - //printf("coderate %f kc %d \n", Coderate, kc); p_decParams->numMaxIter = dlsch->max_ldpc_iterations; p_decParams->outMode= 0; @@ -957,15 +920,15 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, LOG_E(PHY,"Illegal harq_process->C %d > %d\n",harq_process->C,a_segments); return((1+dlsch->max_ldpc_iterations)); } -#ifdef DEBUG_DLSCH_DECODING - printf("Segmentation: C %d, K %d\n",harq_process->C,harq_process->K); -#endif + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) + LOG_I(PHY,"Segmentation: C %d, K %d\n",harq_process->C,harq_process->K); + notifiedFIFO_elt_t *res_dl; opp_enabled=1; if (harq_process->C>1) { for (int nb_seg =1 ; nb_segC; nb_seg++){ - if ( (res_dl=tryPullTpool(&nf, Tpool_dl)) != NULL ) { + if ( (res_dl=tryPullTpool(&nf, &pool_dl)) != NULL ) { pushNotifiedFIFO_nothreadSafe(&freeBlocks_dl,res_dl); } @@ -987,7 +950,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, curMsg->proc.llr8_flag = llr8_flag; msgToPush_dl->key= (nr_slot_rx%2) ? (nb_seg+30): nb_seg; - pushTpool(Tpool_dl, msgToPush_dl); + pushTpool(&pool_dl, msgToPush_dl); /*Qm= harq_process->Qm; Nl=harq_process->Nl; @@ -1031,10 +994,9 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, harq_process->w[r], dlsch_llr+r_offset); -#ifdef DEBUG_DLSCH_DECODING + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) for (int i =0; i<16; i++) - printf("rx output deinterleaving w[%d]= %d r_offset %u\n", i,harq_process->w[r][i], r_offset); -#endif + LOG_D(PHY,"rx output deinterleaving w[%d]= %d r_offset %u\n", i,harq_process->w[r][i], r_offset); #if UE_TIMING_TRACE stop_meas(dlsch_deinterleaving_stats); @@ -1044,8 +1006,8 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, start_meas(dlsch_rate_unmatching_stats); #endif -#ifdef DEBUG_DLSCH_DECODING - LOG_D(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n", + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) + LOG_I(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n", harq_pid,r, G, Kr*3, harq_process->TBS, @@ -1054,7 +1016,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, harq_process->Nl, harq_process->rvidx, harq_process->round); -#endif + // for tbslbrm calculation according to 5.4.2.1 of 38.212 if (harq_process->Nl < Nl) @@ -1086,35 +1048,28 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, #endif } - //for (int i =0; i<16; i++) - // printf("rx output ratematching d[%d]= %d r_offset %d\n", i,harq_process->d[r][i], r_offset); - - //r_offset += E; - //printf("main thread r_offset %d\n",r_offset); -#ifdef DEBUG_DLSCH_DECODING + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) for (int i =0; i<16; i++) - printf("rx output ratematching d[%d]= %d r_offset %u\n", i,harq_process->d[r][i], r_offset); -#endif + LOG_I(PHY,"rx output ratematching d[%d]= %d r_offset %u\n", i,harq_process->d[r][i], r_offset); -#ifdef DEBUG_DLSCH_DECODING + + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) + { if (r==0) { - write_output("decoder_llr.m","decllr",dlsch_llr,G,1,0); - write_output("decoder_in.m","dec",&harq_process->d[0][96],(3*8*Kr_bytes)+12,1,0); + LOG_M("decoder_llr.m","decllr",dlsch_llr,G,1,0); + LOG_M("decoder_in.m","dec",&harq_process->d[0][96],(3*8*Kr_bytes)+12,1,0); } - printf("decoder input(segment %u) :",r); + LOG_D(PHY,"decoder input(segment %u) :",r); for (int i=0;i<(3*8*Kr_bytes);i++) - printf("%d : %d\n",i,harq_process->d[r][i]); - printf("\n"); -#endif + LOG_D(PHY,"%d : %d\n",i,harq_process->d[r][i]); + LOG_D(PHY,"\n"); + } - - // printf("Clearing c, %p\n",harq_process->c[r]); memset(harq_process->c[r],0,Kr_bytes); - // printf("done\n"); if (harq_process->C == 1){ if (A > 3824) crc_type = CRC24_A; @@ -1140,7 +1095,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, #if UE_TIMING_TRACE start_meas(dlsch_turbo_decoding_stats); #endif - LOG_D(PHY,"mthread AbsSubframe %d.%d Start LDPC segment %d/%d \n",frame%1024,nr_slot_rx,r,harq_process->C-1); + LOG_I(PHY,"mthread AbsSubframe %d.%d Start LDPC segment %d/%d \n",frame%1024,nr_slot_rx,r,harq_process->C-1); /*for (int cnt =0; cnt < (kc-2)*p_decParams->Z; cnt++){ inv_d[cnt] = (1)*harq_process->d[r][cnt]; @@ -1188,7 +1143,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, ret = 2; } else { - LOG_D(PHY,"CRC NOK\n"); + LOG_I(PHY,"CRC NOK\n"); ret = 1+dlsch->max_ldpc_iterations; } @@ -1196,9 +1151,6 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, printf("Error number of iteration LPDC %d %ld/%ld \n", no_iteration_ldpc, nb_error_decod,nb_total_decod);fflush(stdout); } - //else - //printf("OK number of iteration LPDC %d\n", no_iteration_ldpc); - for (int m=0; m < Kr>>3; m ++) { harq_process->c[r][m]= (uint8_t) llrProcBuf[m]; @@ -1220,10 +1172,10 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, //printf("output channel decoder %d %d %d %d %d \n", harq_process->c[r][0], harq_process->c[r][1], harq_process->c[r][2],harq_process->c[r][3], harq_process->c[r][4]); //printf("output decoder %d %d %d %d %d \n", harq_process->c[r][0], harq_process->c[r][1], harq_process->c[r][2],harq_process->c[r][3], harq_process->c[r][4]); -#ifdef DEBUG_DLSCH_DECODING - for (int k=0;k<32;k++) - printf("output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]); -#endif + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) + for (int k=0;k<32;k++) + LOG_D(PHY,"output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]); + #if UE_TIMING_TRACE stop_meas(dlsch_turbo_decoding_stats); @@ -1232,40 +1184,36 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, if ((err_flag == 0) && (ret>=(1+dlsch->max_ldpc_iterations))) {// a Code segment is in error so break; - LOG_D(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,nr_slot_rx,r,harq_process->C-1); + LOG_I(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,nr_slot_rx,r,harq_process->C-1); err_flag = 1; } //} //loop r if (err_flag == 1) { -#if UE_DEBUG_TRACE - LOG_D(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n", + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) + LOG_I(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n", phy_vars_ue->Mod_id, frame, nr_slot_rx, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round); -#endif harq_process->harq_ack.ack = 0; harq_process->harq_ack.harq_id = harq_pid; harq_process->harq_ack.send_harq_status = 1; harq_process->errors[harq_process->round]++; harq_process->round++; - - // printf("Rate: [UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round); if (harq_process->round >= dlsch->Mlimit) { harq_process->status = SCH_IDLE; harq_process->round = 0; } if(is_crnti) { - LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for nr_slot_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n", + LOG_I(PHY,"[UE %d] DLSCH: Setting NACK for nr_slot_rx %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n", phy_vars_ue->Mod_id,nr_slot_rx,harq_pid,harq_process->status,harq_process->round,dlsch->Mlimit,harq_process->TBS); } return((1+dlsch->max_ldpc_iterations)); } else { -#if UE_DEBUG_TRACE - LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for nr_slot_rx %d TBS %d mcs %d nb_rb %d\n", + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) + LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for nr_slot_rx %d TBS %d mcs %d nb_rb %d\n", phy_vars_ue->Mod_id,nr_slot_rx,harq_process->TBS,harq_process->mcs,harq_process->nb_rb); -#endif harq_process->status = SCH_IDLE; harq_process->round = 0; @@ -1319,15 +1267,16 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, Kr_bytes- - (harq_process->F>>3) -((harq_process->C>1)?3:0)); offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0)); -#ifdef DEBUG_DLSCH_DECODING - printf("Segment %u : Kr= %u bytes\n",r,Kr_bytes); - printf("copied %d bytes to b sequence (harq_pid %d)\n", - (Kr_bytes - (harq_process->F>>3)-((harq_process->C>1)?3:0)),harq_pid); - printf("b[0] = %x,c[%d] = %x\n", - harq_process->b[offset], - harq_process->F>>3, - harq_process->c[r]); -#endif + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) + { + LOG_I(PHY,"Segment %u : Kr= %u bytes\n",r,Kr_bytes); + LOG_I(PHY,"copied %d bytes to b sequence (harq_pid %d)\n", + (Kr_bytes - (harq_process->F>>3)-((harq_process->C>1)?3:0)),harq_pid); + LOG_I(PHY,"b[0] = %p,c[%d] = %p\n", + (void *)(uint64_t)(harq_process->b[offset]), + harq_process->F>>3, + (void *)(uint64_t)(harq_process->c[r])); + } } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_SEGMENTATION, VCD_FUNCTION_OUT); @@ -1402,25 +1351,12 @@ void nr_dlsch_decoding_process(void *arg) NR_UE_DLSCH_t *dlsch = phy_vars_ue->dlsch[proc->thread_id][eNB_id][0]; NR_DL_UE_HARQ_t *harq_process = dlsch->harq_processes[harq_pid]; short *dlsch_llr = phy_vars_ue->pdsch_vars[proc->thread_id][eNB_id]->llr[0]; - //printf("2thread0 llr flag %d tdp flag %d\n",llr8_flag1, tdp->llr8_flag); + p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf[r]; nb_symb_sch = harq_process->nb_symbols; - printf("dlsch decoding process frame %d slot %d segment %d r %u nb symb %d \n", frame, proc->nr_slot_rx, proc->num_seg, r, harq_process->nb_symbols); + LOG_I(PHY,"dlsch decoding process frame %d slot %d segment %d r %u nb symb %d \n", frame, proc->nr_slot_rx, proc->num_seg, r, harq_process->nb_symbols); - /* - if (nb_rb > frame_parms->N_RB_DL) { - printf("dlsch_decoding.c: Illegal nb_rb %d\n",nb_rb); - return(max_ldpc_iterations); - }*/ - - /*harq_pid = dlsch->current_harq_pid[proc->thread_id]; - if (harq_pid >= 8) { - printf("dlsch_decoding.c: Illegal harq_pid %d\n",harq_pid); - return(max_ldpc_iterations); - } - */ - nb_rb = harq_process->nb_rb; harq_process->trials[harq_process->round]++; @@ -1437,7 +1373,7 @@ void nr_dlsch_decoding_process(void *arg) harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, harq_process->Qm,harq_process->Nl); G = harq_process->G; - LOG_D(PHY,"DLSCH Decoding process, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, harq_process->mcs, harq_process->Nl, nb_symb_sch,nb_rb); + LOG_I(PHY,"DLSCH Decoding process, harq_pid %d TBS %d G %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,G, harq_process->mcs, harq_process->Nl, nb_symb_sch,nb_rb); if ((harq_process->R)<1024) Coderate = (float) (harq_process->R) /(float) 1024; @@ -1503,30 +1439,7 @@ void nr_dlsch_decoding_process(void *arg) p_decParams->numMaxIter = dlsch->max_ldpc_iterations; p_decParams->outMode= 0; - /* - else { - printf("dlsch_decoding.c: Ndi>0 not checked yet!!\n"); - return(max_ldpc_iterations); - } - */ err_flag = 0; - //r_offset = 0; - - /* - uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated - - if (nb_rb != 273) { - a_segments = a_segments*nb_rb; - a_segments = a_segments/273 +1; - } - - if (harq_process->C > a_segments) { - LOG_E(PHY,"Illegal harq_process->C %d > %d\n",harq_process->C,a_segments); - return((1+dlsch->max_ldpc_iterations)); - }*/ -#ifdef DEBUG_DLSCH_DECODING - printf("Segmentation: C %d, Cminus %d, Kminus %d, Kplus %d\n",harq_process->C,harq_process->Cminus,harq_process->Kminus,harq_process->Kplus); -#endif opp_enabled=1; @@ -1561,10 +1474,10 @@ void nr_dlsch_decoding_process(void *arg) harq_process->w[r], dlsch_llr+r_offset); -#ifdef DEBUG_DLSCH_DECODING + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) for (int i =0; i<16; i++) - printf("rx output thread 0 deinterleaving w[%d]= %d r_offset %u\n", i,harq_process->w[r][i], r_offset); -#endif + LOG_D(PHY,"rx output thread 0 deinterleaving w[%d]= %d r_offset %u\n", i,harq_process->w[r][i], r_offset); + #if UE_TIMING_TRACE stop_meas(dlsch_deinterleaving_stats); @@ -1574,8 +1487,8 @@ void nr_dlsch_decoding_process(void *arg) start_meas(dlsch_rate_unmatching_stats); #endif -#ifdef DEBUG_DLSCH_DECODING - LOG_D(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n", + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) + LOG_I(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n", harq_pid,r, G, Kr*3, harq_process->TBS, @@ -1584,7 +1497,7 @@ void nr_dlsch_decoding_process(void *arg) harq_process->Nl, harq_process->rvidx, harq_process->round); -#endif + if (Nl<4) Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,Nl); @@ -1615,25 +1528,14 @@ void nr_dlsch_decoding_process(void *arg) #endif } - //for (int i =0; i<16; i++) - // printf("rx output ratematching d[%d]= %d r_offset %d\n", i,harq_process->d[r][i], r_offset); - - //r_offset += E; - -#ifdef DEBUG_DLSCH_DECODING - if (r==0) { - write_output("decoder_llr.m","decllr",dlsch_llr,G,1,0); - write_output("decoder_in.m","dec",&harq_process->d[0][0],(3*8*Kr_bytes)+12,1,0); + if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) { + LOG_D(PHY,"decoder input(segment %u) :",r); + for (int i=0;i<(3*8*Kr_bytes)+12;i++) + LOG_D(PHY,"%d : %d\n",i,harq_process->d[r][i]); + LOG_D(PHY,"\n"); } - printf("decoder input(segment %u) :",r); - int i; for (i=0;i<(3*8*Kr_bytes)+12;i++) - printf("%d : %d\n",i,harq_process->d[r][i]); - printf("\n"); -#endif - - // printf("Clearing c, %p\n",harq_process->c[r]); memset(harq_process->c[r],0,Kr_bytes); if (harq_process->C == 1){ @@ -1702,39 +1604,23 @@ void nr_dlsch_decoding_process(void *arg) ret = 2; } else { - LOG_D(PHY,"Segment %u CRC NOK\n",r); + LOG_I(PHY,"Segment %u CRC NOK\n",r); ret = 1+dlsch->max_ldpc_iterations; } if (no_iteration_ldpc > 10) - LOG_D(PHY,"Error number of iteration LPDC %d\n", no_iteration_ldpc); - //else - //printf("OK number of iteration LPDC %d\n", no_iteration_ldpc); + LOG_I(PHY,"Error number of iteration LPDC %d\n", no_iteration_ldpc); + for (int m=0; m < Kr>>3; m ++) { harq_process->c[r][m]= (uint8_t) llrProcBuf[m]; } - /*for (int u=0; u < Kr>>3; u ++) - { - ullrProcBuf[u]= (uint8_t) llrProcBuf[u]; - } + if ( LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) + for (int k=0;k<2;k++) + LOG_D(PHY,"segment 1 output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]); - - printf("output unsigned ullrProcBuf \n"); - - for (int j=0; j < Kr>>3; j ++) - { - - printf(" %d \n", ullrProcBuf[j]); - - } - printf(" \n");*/ -#ifdef DEBUG_DLSCH_DECODING - for (int k=0;k<2;k++) - printf("segment 1 output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]); -#endif #if UE_TIMING_TRACE stop_meas(dlsch_turbo_decoding_stats); @@ -1767,7 +1653,7 @@ void *dlsch_thread(void *arg) { notifiedFIFO_elt_t *res; while (nbDlProcessing >= RX_NB_TH_DL) { - if ( (res=tryPullTpool(&nf, Tpool_dl)) != NULL ) { + if ( (res=tryPullTpool(&nf, &pool_dl)) != NULL ) { //nbDlProcessing--; pushNotifiedFIFO_nothreadSafe(&freeBlocks_dl,res); } @@ -1775,7 +1661,7 @@ void *dlsch_thread(void *arg) { usleep(200); } - res_dl=pullTpool(&nf, Tpool_dl); + res_dl=pullTpool(&nf, &pool_dl); nbDlProcessing--; pushNotifiedFIFO_nothreadSafe(&freeBlocks_dl,res_dl); diff --git a/openair1/SCHED_NR_UE/defs.h b/openair1/SCHED_NR_UE/defs.h index b74494a404..07bb7a4b3e 100644 --- a/openair1/SCHED_NR_UE/defs.h +++ b/openair1/SCHED_NR_UE/defs.h @@ -110,15 +110,17 @@ int phy_procedures_RN_UE_RX(unsigned char last_slot, unsigned char next_slot, re void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t eNB_id); /*! \brief Scheduling for UE RX procedures in normal subframes. - @param ue Pointer to UE variables on which to act - @param proc Pointer to proc information - @param gNB_id Local id of eNB on which to act - @param mode calibration/debug mode + @param ue Pointer to UE variables on which to act + @param proc Pointer to proc information + @param gNB_id Local id of eNB on which to act + @param mode calibration/debug mode + @param dlsch_parallel use multithreaded dlsch processing */ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, - runmode_t mode); + runmode_t mode, + uint8_t dlsch_parallel); int phy_procedures_slot_parallelization_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode,relaying_type_t r_type); diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 32e9bff5b4..42ffd348e9 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -918,7 +918,8 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1, int *dlsch_errors, - runmode_t mode) { + runmode_t mode, + uint8_t dlsch_parallel) { if (dlsch0==NULL) AssertFatal(0,"dlsch0 should be defined at this level \n"); @@ -1049,7 +1050,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, start_meas(&ue->dlsch_decoding_stats[proc->thread_id]); #endif - if( IS_DLSCH_PARALLEL) + if( dlsch_parallel) { ret = nr_dlsch_decoding_mthread(ue, proc, @@ -1135,7 +1136,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, start_meas(&ue->dlsch_decoding_stats[proc->thread_id]); #endif - if( IS_DLSCH_PARALLEL) + if(dlsch_parallel) { ret1 = nr_dlsch_decoding_mthread(ue, proc, @@ -1711,8 +1712,10 @@ int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, - runmode_t mode) -{ + runmode_t mode, + uint8_t dlsch_parallel + ) +{ int frame_rx = proc->frame_rx; int nr_slot_rx = proc->nr_slot_rx; int slot_pbch; @@ -1920,7 +1923,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ue->dlsch_SI[gNB_id], NULL, &ue->dlsch_SI_errors[gNB_id], - mode); + mode, + dlsch_parallel); // deactivate dlsch once dlsch proc is done ue->dlsch_SI[gNB_id]->active = 0; @@ -1945,7 +1949,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ue->dlsch_p[gNB_id], NULL, &ue->dlsch_p_errors[gNB_id], - mode); + mode, + dlsch_parallel); // deactivate dlsch once dlsch proc is done ue->dlsch_p[gNB_id]->active = 0; @@ -1970,7 +1975,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ue->dlsch_ra[gNB_id], NULL, &ue->dlsch_ra_errors[gNB_id], - mode); + mode, + dlsch_parallel); // deactivate dlsch once dlsch proc is done ue->dlsch_ra[gNB_id]->active = 0; @@ -1996,7 +2002,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ue->dlsch[proc->thread_id][gNB_id][0], ue->dlsch[proc->thread_id][gNB_id][1], &ue->dlsch_errors[gNB_id], - mode); + mode, + dlsch_parallel); #if UE_TIMING_TRACE diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 2bd70021f7..cce2ab41e6 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -269,7 +269,7 @@ int main(int argc, char **argv) uint16_t ptrsSymbPerSlot = 0; uint16_t rbSize = 106; uint8_t mcsIndex = 9; - + uint8_t dlsch_threads = 0; if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) { exit_fun("[NR_DLSIM] Error, configuration module init failed\n"); } @@ -280,7 +280,7 @@ int main(int argc, char **argv) FILE *scg_fd=NULL; - while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:e:m:w:T:U:")) != -1) { + while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:d:e:m:w:T:U:")) != -1) { switch (c) { case 'f': scg_fd = fopen(optarg,"r"); @@ -447,7 +447,9 @@ int main(int argc, char **argv) case 'b': g_rbSize = atoi(optarg); break; - + case 'd': + dlsch_threads = atoi(optarg); + break; case 'e': g_mcsIndex = atoi(optarg); break; @@ -512,6 +514,7 @@ int main(int argc, char **argv) printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:2}, e.g. -U 2 0 2 \n"); printf("-P Print DLSCH performances\n"); printf("-w Write txdata to binary file (one frame)\n"); + printf("-d number of dlsch threads, 0: no dlsch parallelization\n"); exit (-1); break; } @@ -527,6 +530,7 @@ int main(int argc, char **argv) if (snr1set==0) snr1 = snr0+10; + init_dlsch_tpool(dlsch_threads); RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *)); @@ -981,7 +985,8 @@ int main(int argc, char **argv) phy_procedures_nrUE_RX(UE, &UE_proc, 0, - normal_txrx); + normal_txrx, + dlsch_threads); //printf("dlsim round %d ends\n",round); round++; From 756c20c009a5b3d8eaecab6829532ff4d49d2372 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 4 Dec 2020 16:21:45 +0100 Subject: [PATCH 099/160] tentative fix for delayed RA procedure at UE --- openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c | 12 ++++++------ openair1/PHY/defs_nr_common.h | 2 +- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 5 ++--- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 1 + 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c index fa2f07726f..4b36180b58 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c @@ -33,12 +33,12 @@ // last channel estimate of the receiver void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, - PHY_VARS_NR_UE *ue, - module_id_t gNB_id, - uint8_t frame, - uint8_t subframe, - unsigned char clear, - short coef) + PHY_VARS_NR_UE *ue, + module_id_t gNB_id, + uint8_t frame, + uint8_t subframe, + unsigned char clear, + short coef) { static int max_pos_fil = 0; diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index e5678f894d..89c6a2d9c8 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -228,7 +228,7 @@ typedef struct { /// Pointer to Msg3 payload for UL-grant uint8_t *Msg3; /// Frame of last completed synch - uint8_t sync_frame; + uint16_t sync_frame; /// Flag to indicate that prach is ready to start: it is enabled with an initial delay after the sync uint8_t init_msg1; } NR_PRACH_RESOURCES_t; diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 96db1cf654..bce6d68893 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -311,7 +311,6 @@ void nr_ue_pbch_procedures(uint8_t gNB_id, { // int i; //int pbch_tx_ant=0; - //uint8_t pbch_phase; int ret = 0; //static uint8_t first_run = 1; //uint8_t pbch_trials = 0; @@ -323,7 +322,7 @@ void nr_ue_pbch_procedures(uint8_t gNB_id, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_IN); - //LOG_I(PHY,"[UE %d] Frame %d, Trying PBCH %d (NidCell %d, gNB_id %d)\n",ue->Mod_id,frame_rx,pbch_phase,ue->frame_parms.Nid_cell,gNB_id); + LOG_D(PHY,"[UE %d] Frame %d, Trying PBCH (NidCell %d, gNB_id %d)\n",ue->Mod_id,frame_rx,ue->frame_parms.Nid_cell,gNB_id); ret = nr_rx_pbch(ue, proc, ue->pbch_vars[gNB_id], @@ -2166,7 +2165,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_IN); - if (!prach_resources->init_msg1 && (frame_tx == (ue->prach_resources[gNB_id]->sync_frame + 150) % MAX_FRAME_NUMBER)){ + if (!prach_resources->init_msg1 && ((MAX_FRAME_NUMBER+frame_tx-ue->prach_resources[gNB_id]->sync_frame)% MAX_FRAME_NUMBER)>150){ ue->prach_cnt = 0; prach_resources->init_msg1 = 1; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 746dd8ee48..bb32b78509 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -147,7 +147,7 @@ void compute_csi_bitlen (NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_info_t UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen =0; } - LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d", + LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d\n", UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen, UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].rsrp_bitlen, UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].diff_rsrp_bitlen); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 76c9dedf30..95f1e864a2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -415,6 +415,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, "reset RA state information for RA-RNTI %04x/index %d\n", ra->rnti, i); + return; } } From e97edafd3f5ab09f0cd18096d1c9a9cd64e35767 Mon Sep 17 00:00:00 2001 From: frtabu Date: Mon, 7 Dec 2020 01:02:23 +0100 Subject: [PATCH 100/160] remove threadoffset option, doesn't seem to be defined in the develop code?? --- ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml b/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml index 9e5e0a2bac..54b957473d 100644 --- a/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml +++ b/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml @@ -52,7 +52,7 @@ Initialize_OAI_UE Initialize NR UE USRP - --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --threadoffset 16 --rrc_config_path . + --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path . NR From 50b629c6c236fb6e4084a7f404f01a0cc9d21057 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Mon, 7 Dec 2020 10:27:12 +0100 Subject: [PATCH 101/160] fix for nb of slots in ue gold --- openair1/PHY/INIT/nr_init.c | 1 + openair1/PHY/NR_REFSIG/nr_gold_ue.c | 56 ++++++++++++++--------------- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 49ec60c94b..63c80a136b 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -134,6 +134,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, nr_generate_modulation_table(); nr_init_pdcch_dmrs(gNB, cfg->cell_config.phy_cell_id.value); nr_init_pbch_interleaver(gNB->nr_pbch_interleaver); + //PDSCH DMRS init gNB->nr_gold_pdsch_dmrs = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***)); uint32_t ****pdsch_dmrs = gNB->nr_gold_pdsch_dmrs; diff --git a/openair1/PHY/NR_REFSIG/nr_gold_ue.c b/openair1/PHY/NR_REFSIG/nr_gold_ue.c index 414582a31d..da80bd88d6 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold_ue.c +++ b/openair1/PHY/NR_REFSIG/nr_gold_ue.c @@ -70,40 +70,39 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, unsigned int n,x1,x2,x2tmp0; unsigned int nid; - if (n_idDMRS) - nid = n_idDMRS; - else - nid = ue->frame_parms.Nid_cell; + if (n_idDMRS) + nid = n_idDMRS; + else + nid = ue->frame_parms.Nid_cell; - for (ns=0; ns<20; ns++) { + for (ns=0; nsframe_parms.slots_per_frame; ns++) { - for (l=0; l>1) ^ (x2>>2) ^ (x2>>3))<<31); + x1 = 1+ (1<<31); + x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); - // skip first 50 double words (1600 bits) - for (n=1; n<50; n++) { - x1 = (x1>>1) ^ (x1>>4); - x1 = x1 ^ (x1<<31) ^ (x1<<28); - x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); - x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); - //printf("x1 : %x, x2 : %x\n",x1,x2); - } - - for (n=0; n<52; n++) { - x1 = (x1>>1) ^ (x1>>4); - x1 = x1 ^ (x1<<31) ^ (x1<<28); - x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); - x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); - ue->nr_gold_pdcch[0][ns][l][n] = x1^x2; - // if (ns==1 && l==0) printf("n=%d : c %x\n",n,x1^x2); - } + // skip first 50 double words (1600 bits) + for (n=1; n<50; n++) { + x1 = (x1>>1) ^ (x1>>4); + x1 = x1 ^ (x1<<31) ^ (x1<<28); + x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); + x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); + //printf("x1 : %x, x2 : %x\n",x1,x2); + } + for (n=0; n<52; n++) { + x1 = (x1>>1) ^ (x1>>4); + x1 = x1 ^ (x1<<31) ^ (x1<<28); + x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); + x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); + ue->nr_gold_pdcch[0][ns][l][n] = x1^x2; + // if (ns==1 && l==0) printf("n=%d : c %x\n",n,x1^x2); } } + } } void nr_gold_pdsch(PHY_VARS_NR_UE* ue, @@ -125,7 +124,7 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue, //printf("gold pdsch nid %d lbar %d\n",nid,lbar); - for (ns=0; ns<20; ns++) { + for (ns=0; nsframe_parms.slots_per_frame; ns++) { for (l=0; l<14; l++) { @@ -155,7 +154,6 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue, // if ((ns==2)&&(l==0)) //printf("n=%d : c %x\n",n,x1^x2); } - } } } From 81da4ffce36daa65864898bbbf5febef59e801c9 Mon Sep 17 00:00:00 2001 From: frtabu Date: Mon, 7 Dec 2020 01:02:23 +0100 Subject: [PATCH 102/160] remove threadoffset option, doesn't seem to be defined in the develop code?? --- ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml | 2 +- ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml index a344cb6a7f..b15b5bfcbc 100644 --- a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml +++ b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml @@ -52,7 +52,7 @@ Initialize_OAI_UE Initialize NR UE USRP - --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --threadoffset 16 --rrc_config_path . + --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path . NR diff --git a/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml b/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml index 9e5e0a2bac..54b957473d 100644 --- a/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml +++ b/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml @@ -52,7 +52,7 @@ Initialize_OAI_UE Initialize NR UE USRP - --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --threadoffset 16 --rrc_config_path . + --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path . NR From b0f5a37fba81ef427c4fca084590918ed3466f58 Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Mon, 7 Dec 2020 20:08:03 +0900 Subject: [PATCH 103/160] Fix indentation, merge miss and remove unnecessary comment. --- common/utils/asn1_conversions.h | 24 +- openair1/PHY/TOOLS/dB_routines.c | 598 ++++----- openair1/PHY/TOOLS/signal_energy.c | 253 ++-- openair1/SCHED/fapi_l1.c | 19 +- openair2/LAYER2/MAC/defs.h | 1359 --------------------- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 7 - openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 4 +- openair2/RRC/LTE/rrc_eNB.c | 20 +- 8 files changed, 387 insertions(+), 1897 deletions(-) delete mode 100644 openair2/LAYER2/MAC/defs.h diff --git a/common/utils/asn1_conversions.h b/common/utils/asn1_conversions.h index 7fd32af030..82dca54c08 100644 --- a/common/utils/asn1_conversions.h +++ b/common/utils/asn1_conversions.h @@ -33,11 +33,7 @@ *\return the extracted value. */ static inline uint8_t BIT_STRING_to_uint8(BIT_STRING_t *asn) { - //DevCheck ((asn->size == 1), asn->size, 0, 0); - if(!(asn->size == 1)) { - printf("BIT_STRING_to_uint8 size %ld\n", asn->size); - return 0; - } + DevCheck ((asn->size == 1), asn->size, 0, 0); return asn->buf[0] >> asn->bits_unused; } @@ -51,11 +47,7 @@ static inline uint16_t BIT_STRING_to_uint16(BIT_STRING_t *asn) { uint16_t result = 0; int index = 0; - //DevCheck ((asn->size > 0) && (asn->size <= 2), asn->size, 0, 0); - if(!((asn->size > 0) && (asn->size <= 2))) { - printf("BIT_STRING_to_uint16 size %ld\n", asn->size); - return 0; - } + DevCheck ((asn->size > 0) && (asn->size <= 2), asn->size, 0, 0); switch (asn->size) { case 2: @@ -82,11 +74,7 @@ static inline uint32_t BIT_STRING_to_uint32(BIT_STRING_t *asn) { int index; int shift; - //DevCheck ((asn->size > 0) && (asn->size <= 4), asn->size, 0, 0); - if(!((asn->size > 0) && (asn->size <= 4))) { - printf("BIT_STRING_to_uint32 size %ld\n", asn->size); - return 0; - } + DevCheck ((asn->size > 0) && (asn->size <= 4), asn->size, 0, 0); shift = ((asn->size - 1) * 8) - asn->bits_unused; for (index = 0; index < (asn->size - 1); index++) { @@ -109,11 +97,7 @@ static inline uint64_t BIT_STRING_to_uint64(BIT_STRING_t *asn) { int index; int shift; - //DevCheck ((asn->size > 0) && (asn->size <= 8), asn->size, 0, 0); - if(!((asn->size > 0) && (asn->size <= 8))) { - printf("BIT_STRING_to_uint64 size %ld\n", asn->size); - return 0; - } + DevCheck ((asn->size > 0) && (asn->size <= 8), asn->size, 0, 0); shift = ((asn->size - 1) * 8) - asn->bits_unused; for (index = 0; index < (asn->size - 1); index++) { diff --git a/openair1/PHY/TOOLS/dB_routines.c b/openair1/PHY/TOOLS/dB_routines.c index 1b743695f6..7a71ac0195 100644 --- a/openair1/PHY/TOOLS/dB_routines.c +++ b/openair1/PHY/TOOLS/dB_routines.c @@ -543,284 +543,284 @@ int16_t dB_table_times10[256] = { uint32_t bit_seach_mask[32] = { - 0x80000000, 0x40000000, 0x20000000, 0x10000000, - 0x08000000, 0x04000000, 0x02000000, 0x01000000, - 0x00800000, 0x00400000, 0x00200000, 0x00100000, - 0x00080000, 0x00040000, 0x00020000, 0x00010000, - 0x00008000, 0x00004000, 0x00002000, 0x00001000, - 0x00000800, 0x00000400, 0x00000200, 0x00000100, - 0x00000080, 0x00000040, 0x00000020, 0x00000010, - 0x00000008, 0x00000004, 0x00000002, 0x00000001 + 0x80000000, 0x40000000, 0x20000000, 0x10000000, + 0x08000000, 0x04000000, 0x02000000, 0x01000000, + 0x00800000, 0x00400000, 0x00200000, 0x00100000, + 0x00080000, 0x00040000, 0x00020000, 0x00010000, + 0x00008000, 0x00004000, 0x00002000, 0x00001000, + 0x00000800, 0x00000400, 0x00000200, 0x00000100, + 0x00000080, 0x00000040, 0x00000020, 0x00000010, + 0x00000008, 0x00000004, 0x00000002, 0x00000001 }; uint32_t bit_seach_res[32] = { - 31, 30, 29, 28, - 27, 26, 25, 24, - 23, 22, 21, 20, - 19, 18, 17, 16, - 15, 14, 13, 12, - 11, 10, 9, 8, - 7, 6, 5, 4, - 3, 2, 1, 0 + 31, 30, 29, 28, + 27, 26, 25, 24, + 23, 22, 21, 20, + 19, 18, 17, 16, + 15, 14, 13, 12, + 11, 10, 9, 8, + 7, 6, 5, 4, + 3, 2, 1, 0 }; uint32_t dB_fix_x10_tbl[128] = { -0 , -0 , -1 , -1 , -1 , -2 , -2 , -2 , -3 , -3 , -3 , -4 , -4 , -4 , -5 , -5 , -5 , -5 , -6 , -6 , -6 , -7 , -7 , -7 , -7 , -8 , -8 , -8 , -9 , -9 , -9 , -9 , -10 , -10 , -10 , -10 , -11 , -11 , -11 , -12 , -12 , -12 , -12 , -13 , -13 , -13 , -13 , -14 , -14 , -14 , -14 , -15 , -15 , -15 , -15 , -16 , -16 , -16 , -16 , -16 , -17 , -17 , -17 , -17 , -18 , -18 , -18 , -18 , -19 , -19 , -19 , -19 , -19 , -20 , -20 , -20 , -20 , -20 , -21 , -21 , -21 , -21 , -22 , -22 , -22 , -22 , -22 , -23 , -23 , -23 , -23 , -23 , -24 , -24 , -24 , -24 , -24 , -24 , -25 , -25 , -25 , -25 , -25 , -26 , -26 , -26 , -26 , -26 , -27 , -27 , -27 , -27 , -27 , -27 , -28 , -28 , -28 , -28 , -28 , -29 , -29 , -29 , -29 , -29 , -29 , -30 , -30 , -30 +0 , +0 , +1 , +1 , +1 , +2 , +2 , +2 , +3 , +3 , +3 , +4 , +4 , +4 , +5 , +5 , +5 , +5 , +6 , +6 , +6 , +7 , +7 , +7 , +7 , +8 , +8 , +8 , +9 , +9 , +9 , +9 , +10 , +10 , +10 , +10 , +11 , +11 , +11 , +12 , +12 , +12 , +12 , +13 , +13 , +13 , +13 , +14 , +14 , +14 , +14 , +15 , +15 , +15 , +15 , +16 , +16 , +16 , +16 , +16 , +17 , +17 , +17 , +17 , +18 , +18 , +18 , +18 , +19 , +19 , +19 , +19 , +19 , +20 , +20 , +20 , +20 , +20 , +21 , +21 , +21 , +21 , +22 , +22 , +22 , +22 , +22 , +23 , +23 , +23 , +23 , +23 , +24 , +24 , +24 , +24 , +24 , +24 , +25 , +25 , +25 , +25 , +25 , +26 , +26 , +26 , +26 , +26 , +27 , +27 , +27 , +27 , +27 , +27 , +28 , +28 , +28 , +28 , +28 , +29 , +29 , +29 , +29 , +29 , +29 , +30 , +30 , +30 }; uint32_t dB_fix_x10_tbl_low[128] = { -0 , -0 , -30 , -48 , -60 , -70 , -78 , -85 , -90 , -95 , -100 , -104 , -108 , -111 , -115 , -118 , -120 , -123 , -126 , -128 , -130 , -132 , -134 , -136 , -138 , -140 , -141 , -143 , -145 , -146 , -148 , -149 , -151 , -152 , -153 , -154 , -156 , -157 , -158 , -159 , -160 , -161 , -162 , -163 , -164 , -165 , -166 , -167 , -168 , -169 , -170 , -171 , -172 , -172 , -173 , -174 , -175 , -176 , -176 , -177 , -178 , -179 , -179 , -180 , -181 , -181 , -182 , -183 , -183 , -184 , -185 , -185 , -186 , -186 , -187 , -188 , -188 , -189 , -189 , -190 , -190 , -191 , -191 , -192 , -192 , -193 , -193 , -194 , -194 , -195 , -195 , -196 , -196 , -197 , -197 , -198 , -198 , -199 , -199 , -200 , -200 , -200 , -201 , -201 , -202 , -202 , -203 , -203 , -203 , -204 , -204 , -205 , -205 , -205 , -206 , -206 , -206 , -207 , -207 , -208 , -208 , -208 , -209 , -209 , -209 , -210 , -210 , -210 +0 , +0 , +30 , +48 , +60 , +70 , +78 , +85 , +90 , +95 , +100 , +104 , +108 , +111 , +115 , +118 , +120 , +123 , +126 , +128 , +130 , +132 , +134 , +136 , +138 , +140 , +141 , +143 , +145 , +146 , +148 , +149 , +151 , +152 , +153 , +154 , +156 , +157 , +158 , +159 , +160 , +161 , +162 , +163 , +164 , +165 , +166 , +167 , +168 , +169 , +170 , +171 , +172 , +172 , +173 , +174 , +175 , +176 , +176 , +177 , +178 , +179 , +179 , +180 , +181 , +181 , +182 , +183 , +183 , +184 , +185 , +185 , +186 , +186 , +187 , +188 , +188 , +189 , +189 , +190 , +190 , +191 , +191 , +192 , +192 , +193 , +193 , +194 , +194 , +195 , +195 , +196 , +196 , +197 , +197 , +198 , +198 , +199 , +199 , +200 , +200 , +200 , +201 , +201 , +202 , +202 , +203 , +203 , +203 , +204 , +204 , +205 , +205 , +205 , +206 , +206 , +206 , +207 , +207 , +208 , +208 , +208 , +209 , +209 , +209 , +210 , +210 , +210 }; /* @@ -855,35 +855,35 @@ int8_t dB_fixed(int x) { */ int16_t dB_fixed_x10(uint32_t x) { - int16_t dB_power = 0; + int16_t dB_power = 0; - //for new algorithm - uint32_t cnt; - uint32_t Exponent; - uint32_t Mantissa; - uint32_t shift_right; - uint32_t tbl_resolution = 7; - uint32_t tbl_addr_mask; + //for new algorithm + uint32_t cnt; + uint32_t Exponent; + uint32_t Mantissa; + uint32_t shift_right; + uint32_t tbl_resolution = 7; + uint32_t tbl_addr_mask; - if (x < 128){ //OAI alogrithm - dB_power = dB_fix_x10_tbl_low[x]; - } - else { //new algorithm - tbl_addr_mask = 0x0000007Fu; // (1 << tbl_resolution) - 1;//i.e. 0x0000007F - Mantissa = 0; - Exponent = 0; - for (cnt = 0; cnt < 32; cnt++) { - if ((bit_seach_mask[cnt] & x) != 0) { - Exponent = bit_seach_res[cnt]; - Mantissa = x & (~bit_seach_mask[cnt]); - break; - } - } - shift_right = Exponent - tbl_resolution; - Mantissa = (Mantissa >> shift_right) & tbl_addr_mask; - dB_power = dB_fix_x10_tbl[Mantissa] + Exponent * 30u; - } - return dB_power; + if (x < 128){ //OAI alogrithm + dB_power = dB_fix_x10_tbl_low[x]; + } + else { //new algorithm + tbl_addr_mask = 0x0000007Fu; // (1 << tbl_resolution) - 1;//i.e. 0x0000007F + Mantissa = 0; + Exponent = 0; + for (cnt = 0; cnt < 32; cnt++) { + if ((bit_seach_mask[cnt] & x) != 0) { + Exponent = bit_seach_res[cnt]; + Mantissa = x & (~bit_seach_mask[cnt]); + break; + } + } + shift_right = Exponent - tbl_resolution; + Mantissa = (Mantissa >> shift_right) & tbl_addr_mask; + dB_power = dB_fix_x10_tbl[Mantissa] + Exponent * 30u; + } + return dB_power; } int16_t dB_fixed_times10(uint32_t x) diff --git a/openair1/PHY/TOOLS/signal_energy.c b/openair1/PHY/TOOLS/signal_energy.c index d2c2817b0e..f3dea58374 100644 --- a/openair1/PHY/TOOLS/signal_energy.c +++ b/openair1/PHY/TOOLS/signal_energy.c @@ -68,86 +68,39 @@ int32_t subcarrier_energy(int32_t *input,uint32_t length, int32_t *subcarrier_en } #endif -//int32_t signal_energy(int32_t *input,uint32_t length) -//{ -// -// int32_t i; -// int32_t temp,temp2; -// register __m64 mm0,mm1,mm2,mm3; -// __m64 *in = (__m64 *)input; -// -// -// mm0 = _mm_setzero_si64();//pxor(mm0,mm0); -// mm3 = _mm_setzero_si64();//pxor(mm3,mm3); -// -// for (i=0; i>1; i++) { -// -// mm1 = in[i]; -// mm2 = mm1; -// mm1 = _m_pmaddwd(mm1,mm1); -// mm1 = _m_psradi(mm1,shift);// shift any 32 bits blocs of the word by the value shift -// mm0 = _m_paddd(mm0,mm1);// add the two 64 bits words 4 bytes by 4 bytes -// // mm2 = _m_psrawi(mm2,shift_DC); -// mm3 = _m_paddw(mm3,mm2);// add the two 64 bits words 2 bytes by 2 bytes -// } -// -// mm1 = mm0; -// mm0 = _m_psrlqi(mm0,32); -// mm0 = _m_paddd(mm0,mm1); -// temp = _m_to_int(mm0); -// temp/=length; -// temp<<=shift; // this is the average of x^2 -// -// // now remove the DC component -// -// -// mm2 = _m_psrlqi(mm3,32); -// mm2 = _m_paddw(mm2,mm3); -// mm2 = _m_pmaddwd(mm2,mm2); -// temp2 = _m_to_int(mm2); -// temp2/=(length*length); -// // temp2<<=(2*shift_DC); -// temp -= temp2; -// -// _mm_empty(); -// _m_empty(); -// -// return((temp>0)?temp:1); - //----------------------------------------------------------------- // Average Power calculation with DC removing //----------------------------------------------------------------- int32_t signal_energy(int32_t *input,uint32_t length) { - uint32_t i; - int32_t temp; - __m128i in, in_clp, i16_min, coe1; - __m128 num0, num1, num2, num3, recp1; + uint32_t i; + int32_t temp; + __m128i in, in_clp, i16_min, coe1; + __m128 num0, num1, num2, num3, recp1; - //init - num0 = _mm_setzero_ps(); - num1 = _mm_setzero_ps(); - i16_min = _mm_set1_epi16(SHRT_MIN); - coe1 = _mm_set1_epi16(1); - recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length))); + //init + num0 = _mm_setzero_ps(); + num1 = _mm_setzero_ps(); + i16_min = _mm_set1_epi16(SHRT_MIN); + coe1 = _mm_set1_epi16(1); + recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length))); - //Acc - for (i = 0; i < (length >> 2); i++) { - in = _mm_loadu_si128((__m128i *)input); - in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min));//if in=SHRT_MIN in+1, else in - num0 = _mm_add_ps(num0, _mm_cvtepi32_ps(_mm_madd_epi16(in_clp, in_clp))); - num1 = _mm_add_ps(num1, _mm_cvtepi32_ps(_mm_madd_epi16(in, coe1)));//DC - input += 4; + //Acc + for (i = 0; i < (length >> 2); i++) { + in = _mm_loadu_si128((__m128i *)input); + in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min));//if in=SHRT_MIN in+1, else in + num0 = _mm_add_ps(num0, _mm_cvtepi32_ps(_mm_madd_epi16(in_clp, in_clp))); + num1 = _mm_add_ps(num1, _mm_cvtepi32_ps(_mm_madd_epi16(in, coe1)));//DC + input += 4; } - //Ave - num2 = _mm_dp_ps(num0, recp1, 0xFF);//AC power - num3 = _mm_dp_ps(num1, recp1, 0xFF);//DC - num3 = _mm_mul_ps(num3, num3); //DC power - //remove DC - temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(_mm_sub_ps(num2, num3))); - - return temp; + //Ave + num2 = _mm_dp_ps(num0, recp1, 0xFF);//AC power + num3 = _mm_dp_ps(num1, recp1, 0xFF);//DC + num3 = _mm_mul_ps(num3, num3); //DC power + //remove DC + temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(_mm_sub_ps(num2, num3))); + return temp; } int32_t signal_energy_amp_shift(int32_t *input,uint32_t length) @@ -198,64 +151,6 @@ int32_t signal_energy_amp_shift(int32_t *input,uint32_t length) int32_t signal_energy_nodc(int32_t *input,uint32_t length) { - -// int32_t i; -// int32_t temp; -// register __m64 mm0,mm1;//,mm2,mm3; -// __m64 *in = (__m64 *)input; -// -//#ifdef MAIN -// int16_t *printb; -//#endif -// -// mm0 = _mm_setzero_si64();//_pxor(mm0,mm0); -// // mm3 = _mm_setzero_si64();//pxor(mm3,mm3); -// -// for (i=0; i>1; i++) { -// -// mm1 = in[i]; -// mm1 = _m_pmaddwd(mm1,mm1);// SIMD complex multiplication -// mm1 = _m_psradi(mm1,shift); -// mm0 = _m_paddd(mm0,mm1); -// // temp2 = mm0; -// // printf("%d %d\n",((int *)&in[i])[0],((int *)&in[i])[1]); -// -// -// // printb = (int16_t *)&mm2; -// // printf("mm2 %d : %d %d %d %d\n",i,printb[0],printb[1],printb[2],printb[3]); -// -// -// } -// -// /* -// #ifdef MAIN -// printb = (int16_t *)&mm3; -// printf("%d %d %d %d\n",printb[0],printb[1],printb[2],printb[3]); -// #endif -// */ -// mm1 = mm0; -// -// mm0 = _m_psrlqi(mm0,32); -// -// mm0 = _m_paddd(mm0,mm1); -// -// temp = _m_to_int(mm0); -// -// temp/=length; -// temp<<=shift; // this is the average of x^2 -// -//#ifdef MAIN -// printf("E x^2 = %d\n",temp); -//#endif -// _mm_empty(); -// _m_empty(); -// -// -// -// return((temp>0)?temp:1); - - - int32_t i; int32_t temp; @@ -266,9 +161,9 @@ int32_t signal_energy_nodc(int32_t *input,uint32_t length) mm0 = _mm_setzero_ps(); //Acc for (i=0; i<(length>>2); i++) { - in = _mm_loadu_si128((__m128i *)input); - mm0 = _mm_add_ps(mm0,_mm_cvtepi32_ps(_mm_madd_epi16(in,in))); - input += 4; + in = _mm_loadu_si128((__m128i *)input); + mm0 = _mm_add_ps(mm0,_mm_cvtepi32_ps(_mm_madd_epi16(in,in))); + input += 4; } //Ave temp = (int)((((float*)&mm0)[0] + @@ -277,8 +172,6 @@ int32_t signal_energy_nodc(int32_t *input,uint32_t length) ((float*)&mm0)[3])/(float)length); return temp; - - } #elif defined(__arm__) @@ -429,62 +322,62 @@ main(int argc,char **argv) int32_t signal_power(int32_t *input, uint32_t length) { - uint32_t i; - int32_t temp; + uint32_t i; + int32_t temp; - __m128i in, in_clp, i16_min; - __m128 num0, num1; - __m128 recp1; + __m128i in, in_clp, i16_min; + __m128 num0, num1; + __m128 recp1; - //init - num0 = _mm_setzero_ps(); - i16_min = _mm_set1_epi16(SHRT_MIN); - recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length))); - //Acc - for (i = 0; i < (length >> 2); i++) { - in = _mm_loadu_si128((__m128i *)input); - in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min));//if in=SHRT_MIN in+1, else in - num0 = _mm_add_ps(num0, _mm_cvtepi32_ps(_mm_madd_epi16(in_clp, in_clp))); - input += 4; - } - //Ave - num1 = _mm_dp_ps(num0, recp1, 0xFF); - temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(num1)); + //init + num0 = _mm_setzero_ps(); + i16_min = _mm_set1_epi16(SHRT_MIN); + recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length))); + //Acc + for (i = 0; i < (length >> 2); i++) { + in = _mm_loadu_si128((__m128i *)input); + in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min));//if in=SHRT_MIN in+1, else in + num0 = _mm_add_ps(num0, _mm_cvtepi32_ps(_mm_madd_epi16(in_clp, in_clp))); + input += 4; + } + //Ave + num1 = _mm_dp_ps(num0, recp1, 0xFF); + temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(num1)); - return temp; + return temp; } int32_t interference_power(int32_t *input, uint32_t length) { - uint32_t i; - int32_t temp; + uint32_t i; + int32_t temp; - __m128i in, in_clp, i16_min; - __m128i num0, num1, num2, num3; - __m128 num4, num5, num6; - __m128 recp1; + __m128i in, in_clp, i16_min; + __m128i num0, num1, num2, num3; + __m128 num4, num5, num6; + __m128 recp1; - //init - i16_min = _mm_set1_epi16(SHRT_MIN); - num5 = _mm_setzero_ps(); - recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length>>2)));// 1/n, n= length/4 - //Acc - for (i = 0; i < (length >> 2); i++) { - in = _mm_loadu_si128((__m128i *)input); - in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min)); //if in=SHRT_MIN, in+1, else in - num0 = _mm_cvtepi16_epi32(in_clp); //lower 2 complex [0], [1] - num1 = _mm_cvtepi16_epi32(_mm_shuffle_epi32(in_clp, 0x4E)); //upper 2 complex [2], [3] - num2 = _mm_srai_epi32(_mm_add_epi32(num0, num1), 0x01); //average A=complex( [0] + [2] ) / 2, B=complex( [1] + [3] ) / 2 - num3 = _mm_sub_epi32(num2, _mm_shuffle_epi32(num2, 0x4E)); //complexA-complexB, B-A - num4 = _mm_dp_ps(_mm_cvtepi32_ps(num3), _mm_cvtepi32_ps(num3), 0x3F);//C = num3 lower complex power, C, C, C - num5 = _mm_add_ps(num5, num4); //Acc Cn, Cn, Cn, Cn, - input += 4; - } - //Interference ve - num6 = _mm_mul_ps(num5, recp1); //Cn / n - temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(num6)); + //init + i16_min = _mm_set1_epi16(SHRT_MIN); + num5 = _mm_setzero_ps(); + recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length>>2)));// 1/n, n= length/4 + //Acc + for (i = 0; i < (length >> 2); i++) { + in = _mm_loadu_si128((__m128i *)input); + in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min)); //if in=SHRT_MIN, in+1, else in + num0 = _mm_cvtepi16_epi32(in_clp); //lower 2 complex [0], [1] + num1 = _mm_cvtepi16_epi32(_mm_shuffle_epi32(in_clp, 0x4E)); //upper 2 complex [2], [3] + num2 = _mm_srai_epi32(_mm_add_epi32(num0, num1), 0x01); //average A=complex( [0] + [2] ) / 2, B=complex( [1] + [3] ) / 2 + num3 = _mm_sub_epi32(num2, _mm_shuffle_epi32(num2, 0x4E)); //complexA-complexB, B-A + num4 = _mm_dp_ps(_mm_cvtepi32_ps(num3), _mm_cvtepi32_ps(num3), 0x3F);//C = num3 lower complex power, C, C, C + num5 = _mm_add_ps(num5, num4); //Acc Cn, Cn, Cn, Cn, + input += 4; + } + //Interference ve + num6 = _mm_mul_ps(num5, recp1); //Cn / n + temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(num6)); - return temp; + return temp; } diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index e444dff41f..3f342802b4 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -1008,16 +1008,15 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) { UL_req->ul_config_request_body.number_of_pdus=0; number_ul_pdu=0; }else if (RC.mac[Mod_id]->scheduler_mode == SCHED_MODE_FAIR_RR) { - if(ulsch_pdu_num <= RC.rrc[Mod_id]->configuration.radioresourceconfig[CC_id].ue_multiple_max){ - //LOG_D(PHY, "UL_CONFIG to send to PNF\n"); - UL_req->sfn_sf = frame << 4 | subframe; - oai_nfapi_ul_config_req(UL_req); - UL_req->ul_config_request_body.number_of_pdus=0; - number_ul_pdu=0; - }else{ - LOG_E(MAC,"NFAPI: frame %d subframe %d ul_req num %d ul pdu %d\n", - frame,subframe,number_ul_pdu,ulsch_pdu_num); - } + if(ulsch_pdu_num <= RC.rrc[Mod_id]->configuration.radioresourceconfig[CC_id].ue_multiple_max){ + UL_req->sfn_sf = frame << 4 | subframe; + oai_nfapi_ul_config_req(UL_req); + UL_req->ul_config_request_body.number_of_pdus=0; + number_ul_pdu=0; + }else{ + LOG_E(MAC,"NFAPI: frame %d subframe %d ul_req num %d ul pdu %d\n", + frame,subframe,number_ul_pdu,ulsch_pdu_num); + } } } } else { diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h deleted file mode 100644 index 2a807c1af5..0000000000 --- a/openair2/LAYER2/MAC/defs.h +++ /dev/null @@ -1,1359 +0,0 @@ -/* - * 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 LAYER2/MAC/defs.h -* \brief MAC data structures, constant, and function prototype -* \author Navid Nikaein and Raymond Knopp -* \date 2011 -* \version 0.5 -* \email navid.nikaein@eurecom.fr - -*/ -/** @defgroup _oai2 openair2 Reference Implementation - * @ingroup _ref_implementation_ - * @{ - */ - -/*@}*/ - -#ifndef __LAYER2_MAC_DEFS_H__ -#define __LAYER2_MAC_DEFS_H__ - - - -#ifdef USER_MODE -#include -#include -#include -#endif - -//#include "COMMON/openair_defs.h" - - - -#include "PHY/defs.h" -#include "PHY/LTE_TRANSPORT/defs.h" -#include "COMMON/platform_constants.h" -#include "BCCH-BCH-Message.h" -#include "RadioResourceConfigCommon.h" -#include "RadioResourceConfigDedicated.h" -#include "MeasGapConfig.h" -#include "SchedulingInfoList.h" -#include "TDD-Config.h" -#include "RACH-ConfigCommon.h" -#include "MeasObjectToAddModList.h" -#include "MobilityControlInfo.h" -#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) -#include "MBSFN-AreaInfoList-r9.h" -#include "MBSFN-SubframeConfigList.h" -#include "PMCH-InfoList-r9.h" -#include "SCellToAddMod-r10.h" -#endif -#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) -#include "SystemInformationBlockType1-v1310-IEs.h" -#endif - -#include "nfapi_interface.h" -#include "PHY_INTERFACE/IF_Module.h" - -/** @defgroup _mac MAC - * @ingroup _oai2 - * @{ - */ - -#define BCCH_PAYLOAD_SIZE_MAX 128 -#define CCCH_PAYLOAD_SIZE_MAX 128 -#define PCCH_PAYLOAD_SIZE_MAX 128 -#define RAR_PAYLOAD_SIZE_MAX 128 - -#define SCH_PAYLOAD_SIZE_MAX 4096 -/// Logical channel ids from 36-311 (Note BCCH is not specified in 36-311, uses the same as first DRB) - -#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - -// Mask for identifying subframe for MBMS -#define MBSFN_TDD_SF3 0x80// for TDD -#define MBSFN_TDD_SF4 0x40 -#define MBSFN_TDD_SF7 0x20 -#define MBSFN_TDD_SF8 0x10 -#define MBSFN_TDD_SF9 0x08 -#define MBSFN_FDD_SF1 0x80// for FDD -#define MBSFN_FDD_SF2 0x40 -#define MBSFN_FDD_SF3 0x20 -#define MBSFN_FDD_SF6 0x10 -#define MBSFN_FDD_SF7 0x08 -#define MBSFN_FDD_SF8 0x04 - -#define MAX_MBSFN_AREA 8 -#define MAX_PMCH_perMBSFN 15 -/*!\brief MAX MCCH payload size */ -#define MCCH_PAYLOAD_SIZE_MAX 128 -//#define MCH_PAYLOAD_SIZE_MAX 16384// this value is using in case mcs and TBS index are high -#endif - -#ifdef USER_MODE -#define printk printf -#endif //USER_MODE - -/*!\brief Maximum number of logical channl group IDs */ -#define MAX_NUM_LCGID 4 -/*!\brief logical channl group ID 0 */ -#define LCGID0 0 -/*!\brief logical channl group ID 1 */ -#define LCGID1 1 -/*!\brief logical channl group ID 2 */ -#define LCGID2 2 -/*!\brief logical channl group ID 3 */ -#define LCGID3 3 -/*!\brief Maximum number of logical chanels */ -#define MAX_NUM_LCID 11 -/*!\brief Maximum number od control elemenets */ -#define MAX_NUM_CE 5 -/*!\brief Maximum number of random access process */ -#define NB_RA_PROC_MAX 4 -/*!\brief size of buffer status report table */ -#define BSR_TABLE_SIZE 64 -/*!\brief The power headroom reporting range is from -23 ...+40 dB and beyond, with step 1 */ -#define PHR_MAPPING_OFFSET 23 // if ( x>= -23 ) val = floor (x + 23) -/*!\brief maximum number of resource block groups */ -#define N_RBG_MAX 25 // for 20MHz channel BW -/*!\brief minimum value for channel quality indicator */ -#define MIN_CQI_VALUE 0 -/*!\brief maximum value for channel quality indicator */ -#define MAX_CQI_VALUE 15 -/*!\briefmaximum number of supported bandwidth (1.4, 5, 10, 20 MHz) */ -#define MAX_SUPPORTED_BW 4 -/*!\brief CQI values range from 1 to 15 (4 bits) */ -#define CQI_VALUE_RANGE 16 - -/*!\brief value for indicating BSR Timer is not running */ -#define MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF) - -#define LCID_EMPTY 0 -#define LCID_NOT_EMPTY 1 - -/*!\brief minimum RLC PDU size to be transmitted = min RLC Status PDU or RLC UM PDU SN 5 bits */ -#define MIN_RLC_PDU_SIZE (2) - -/*!\brief minimum MAC data needed for transmitting 1 min RLC PDU size + 1 byte MAC subHeader */ -#define MIN_MAC_HDR_RLC_SIZE (1 + MIN_RLC_PDU_SIZE) - -/*!\brief maximum number of slices / groups */ -#define MAX_NUM_SLICES 4 - -/* - * eNB part - */ - - -/* - * UE/ENB common part - */ -/*!\brief MAC header of Random Access Response for Random access preamble identifier (RAPID) */ -typedef struct { - uint8_t RAPID:6; - uint8_t T:1; - uint8_t E:1; -} __attribute__((__packed__))RA_HEADER_RAPID; - -/*!\brief MAC header of Random Access Response for backoff indicator (BI)*/ -typedef struct { - uint8_t BI:4; - uint8_t R:2; - uint8_t T:1; - uint8_t E:1; -} __attribute__((__packed__))RA_HEADER_BI; -/* -typedef struct { - uint64_t padding:16; - uint64_t t_crnti:16; - uint64_t hopping_flag:1; - uint64_t rb_alloc:10; - uint64_t mcs:4; - uint64_t TPC:3; - uint64_t UL_delay:1; - uint64_t cqi_req:1; - uint64_t Timing_Advance_Command:11; // first/2nd octet LSB - uint64_t R:1; // octet MSB - } __attribute__((__packed__))RAR_PDU; - -typedef struct { - uint64_t padding:16; - uint64_t R:1; // octet MSB - uint64_t Timing_Advance_Command:11; // first/2nd octet LSB - uint64_t cqi_req:1; - uint64_t UL_delay:1; - uint64_t TPC:3; - uint64_t mcs:4; - uint64_t rb_alloc:10; - uint64_t hopping_flag:1; - uint64_t t_crnti:16; - } __attribute__((__packed__))RAR_PDU; - -#define sizeof_RAR_PDU 6 -*/ -/*!\brief MAC subheader short with 7bit Length field */ -typedef struct { - uint8_t LCID:5; // octet 1 LSB - uint8_t E:1; - uint8_t R:2; // octet 1 MSB - uint8_t L:7; // octet 2 LSB - uint8_t F:1; // octet 2 MSB -} __attribute__((__packed__))SCH_SUBHEADER_SHORT; -/*!\brief MAC subheader long with 15bit Length field */ -typedef struct { - uint8_t LCID:5; // octet 1 LSB - uint8_t E:1; - uint8_t R:2; // octet 1 MSB - uint8_t L_MSB:7; - uint8_t F:1; // octet 2 MSB - uint8_t L_LSB:8; - uint8_t padding; -} __attribute__((__packed__))SCH_SUBHEADER_LONG; -/*!\brief MAC subheader short without length field */ -typedef struct { - uint8_t LCID:5; - uint8_t E:1; - uint8_t R:2; -} __attribute__((__packed__))SCH_SUBHEADER_FIXED; - -/*!\brief mac control element: short buffer status report for a specific logical channel group ID*/ -typedef struct { - uint8_t Buffer_size:6; // octet 1 LSB - uint8_t LCGID:2; // octet 1 MSB -} __attribute__((__packed__))BSR_SHORT; - -typedef BSR_SHORT BSR_TRUNCATED; -/*!\brief mac control element: long buffer status report for all logical channel group ID*/ -typedef struct { - uint8_t Buffer_size3:6; - uint8_t Buffer_size2:6; - uint8_t Buffer_size1:6; - uint8_t Buffer_size0:6; -} __attribute__((__packed__))BSR_LONG; - -#define BSR_LONG_SIZE (sizeof(BSR_LONG)) -/*!\brief mac control element: timing advance */ -typedef struct { - uint8_t TA:6; - uint8_t R:2; -} __attribute__((__packed__))TIMING_ADVANCE_CMD; -/*!\brief mac control element: power headroom report */ -typedef struct { - uint8_t PH:6; - uint8_t R:2; -} __attribute__((__packed__))POWER_HEADROOM_CMD; - -/*! \brief MIB payload */ -typedef struct { - uint8_t payload[3] ; -} __attribute__((__packed__))MIB_PDU; -/*! \brief CCCH payload */ -typedef struct { - uint8_t payload[CCCH_PAYLOAD_SIZE_MAX] ; -} __attribute__((__packed__))CCCH_PDU; -/*! \brief BCCH payload */ -typedef struct { - uint8_t payload[BCCH_PAYLOAD_SIZE_MAX] ; -} __attribute__((__packed__))BCCH_PDU; -/*! \brief RAR payload */ -typedef struct { - uint8_t payload[RAR_PAYLOAD_SIZE_MAX]; -} __attribute__ ((__packed__)) RAR_PDU; -/*! \brief BCCH payload */ -typedef struct { - uint8_t payload[PCCH_PAYLOAD_SIZE_MAX] ; -} __attribute__((__packed__))PCCH_PDU; - -#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) -/*! \brief MCCH payload */ -typedef struct { - uint8_t payload[MCCH_PAYLOAD_SIZE_MAX] ; -} __attribute__((__packed__))MCCH_PDU; -/*!< \brief MAC control element for activation and deactivation of component carriers */ -typedef struct { - uint8_t C7:1;/*!< \brief Component carrier 7 */ - uint8_t C6:1;/*!< \brief Component carrier 6 */ - uint8_t C5:1;/*!< \brief Component carrier 5 */ - uint8_t C4:1;/*!< \brief Component carrier 4 */ - uint8_t C3:1;/*!< \brief Component carrier 3 */ - uint8_t C2:1;/*!< \brief Component carrier 2 */ - uint8_t C1:1;/*!< \brief Component carrier 1 */ - uint8_t R:1;/*!< \brief Reserved */ -} __attribute__((__packed__))CC_ELEMENT; -/*! \brief MAC control element: MCH Scheduling Information */ -typedef struct { - uint8_t stop_sf_MSB:3; // octet 1 LSB - uint8_t lcid:5; // octet 2 MSB - uint8_t stop_sf_LSB:8; -} __attribute__((__packed__))MSI_ELEMENT; -#endif -/*! \brief Values of CCCH LCID for DLSCH */ -#define CCCH_LCHANID 0 -/*!\brief Values of BCCH logical channel (fake)*/ -#define BCCH 3 // SI -/*!\brief Values of PCCH logical channel (fake)*/ -#define PCCH 4 // Paging -/*!\brief Values of PCCH logical channel (fake) */ -#define MIBCH 5 // MIB -/*!\brief Values of BCCH SIB1_BR logical channel (fake) */ -#define BCCH_SIB1_BR 6 // SIB1_BR -/*!\brief Values of BCCH SIB_BR logical channel (fake) */ -#define BCCH_SI_BR 7 // SI-BR -/*!\brief Value of CCCH / SRB0 logical channel */ -#define CCCH 0 // srb0 -/*!\brief DCCH / SRB1 logical channel */ -#define DCCH 1 // srb1 -/*!\brief DCCH1 / SRB2 logical channel */ -#define DCCH1 2 // srb2 -/*!\brief DTCH DRB1 logical channel */ -#define DTCH 3 // LCID -/*!\brief MCCH logical channel */ -#define MCCH 4 -/*!\brief MTCH logical channel */ -#define MTCH 1 -// DLSCH LCHAN ID -/*!\brief LCID of UE contention resolution identity for DLSCH*/ -#define UE_CONT_RES 28 -/*!\brief LCID of timing advance for DLSCH */ -#define TIMING_ADV_CMD 29 -/*!\brief LCID of discontinous reception mode for DLSCH */ -#define DRX_CMD 30 -/*!\brief LCID of padding LCID for DLSCH */ -#define SHORT_PADDING 31 - -#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) -// MCH LCHAN IDs (table6.2.1-4 TS36.321) -/*!\brief LCID of MCCH for DL */ -#define MCCH_LCHANID 0 -/*!\brief LCID of MCH scheduling info for DL */ -#define MCH_SCHDL_INFO 3 -/*!\brief LCID of Carrier component activation/deactivation */ -#define CC_ACT_DEACT 27 -#endif - -// ULSCH LCHAN IDs -/*!\brief LCID of extended power headroom for ULSCH */ -#define EXTENDED_POWER_HEADROOM 25 -/*!\brief LCID of power headroom for ULSCH */ -#define POWER_HEADROOM 26 -/*!\brief LCID of CRNTI for ULSCH */ -#define CRNTI 27 -/*!\brief LCID of truncated BSR for ULSCH */ -#define TRUNCATED_BSR 28 -/*!\brief LCID of short BSR for ULSCH */ -#define SHORT_BSR 29 -/*!\brief LCID of long BSR for ULSCH */ -#define LONG_BSR 30 -/*!\bitmaps for BSR Triggers */ -#define BSR_TRIGGER_NONE (0) /* No BSR Trigger */ -#define BSR_TRIGGER_REGULAR (1) /* For Regular and ReTxBSR Expiry Triggers */ -#define BSR_TRIGGER_PERIODIC (2) /* For BSR Periodic Timer Expiry Trigger */ -#define BSR_TRIGGER_PADDING (4) /* For Padding BSR Trigger */ - - -/*! \brief Downlink SCH PDU Structure */ -typedef struct { - uint8_t payload[8][SCH_PAYLOAD_SIZE_MAX]; - uint16_t Pdu_size[8]; -} __attribute__ ((__packed__)) DLSCH_PDU; - - -/*! \brief MCH PDU Structure */ -typedef struct { - int8_t payload[SCH_PAYLOAD_SIZE_MAX]; - uint16_t Pdu_size; - uint8_t mcs; - uint8_t sync_area; - uint8_t msi_active; - uint8_t mcch_active; - uint8_t mtch_active; -} __attribute__ ((__packed__)) MCH_PDU; - -/*! \brief Uplink SCH PDU Structure */ -typedef struct { - int8_t payload[SCH_PAYLOAD_SIZE_MAX]; /*!< \brief SACH payload */ - uint16_t Pdu_size; -} __attribute__ ((__packed__)) ULSCH_PDU; - -#include "PHY/impl_defs_top.h" - -/*!\brief UE ULSCH scheduling states*/ -typedef enum { - S_UL_NONE =0, - S_UL_WAITING, - S_UL_SCHEDULED, - S_UL_BUFFERED, - S_UL_NUM_STATUS -} UE_ULSCH_STATUS; - -/*!\brief UE DLSCH scheduling states*/ -typedef enum { - S_DL_NONE =0, - S_DL_WAITING, - S_DL_SCHEDULED, - S_DL_BUFFERED, - S_DL_NUM_STATUS -} UE_DLSCH_STATUS; - -/*!\brief scheduling policy for the contention-based access */ -typedef enum { - CBA_ES=0, /// equal share of RB among groups w - CBA_ES_S, /// equal share of RB among groups with small allocation - CBA_PF, /// proportional fair (kind of) - CBA_PF_S, /// proportional fair (kind of) with small RB allocation - CBA_RS /// random allocation -} CBA_POLICY; - - -/*! \brief temporary struct for ULSCH sched */ -typedef struct { - rnti_t rnti; - uint16_t subframe; - uint16_t serving_num; - UE_ULSCH_STATUS status; -} eNB_ULSCH_INFO; -/*! \brief temp struct for DLSCH sched */ -typedef struct { - rnti_t rnti; - uint16_t weight; - uint16_t subframe; - uint16_t serving_num; - UE_DLSCH_STATUS status; -} eNB_DLSCH_INFO; -/*! \brief eNB overall statistics */ -typedef struct { - /// num BCCH PDU per CC - uint32_t total_num_bcch_pdu; - /// BCCH buffer size - uint32_t bcch_buffer; - /// total BCCH buffer size - uint32_t total_bcch_buffer; - /// BCCH MCS - uint32_t bcch_mcs; - - /// num CCCH PDU per CC - uint32_t total_num_ccch_pdu; - /// BCCH buffer size - uint32_t ccch_buffer; - /// total BCCH buffer size - uint32_t total_ccch_buffer; - /// BCCH MCS - uint32_t ccch_mcs; - -/// num active users - uint16_t num_dlactive_UEs; - /// available number of PRBs for a give SF - uint16_t available_prbs; - /// total number of PRB available for the user plane - uint32_t total_available_prbs; - /// aggregation - /// total avilable nccc : num control channel element - uint16_t available_ncces; - // only for a new transmission, should be extended for retransmission - // current dlsch bit rate for all transport channels - uint32_t dlsch_bitrate; - // - uint32_t dlsch_bytes_tx; - // - uint32_t dlsch_pdus_tx; - // - uint32_t total_dlsch_bitrate; - // - uint32_t total_dlsch_bytes_tx; - // - uint32_t total_dlsch_pdus_tx; - - // here for RX - // - uint32_t ulsch_bitrate; - // - uint32_t ulsch_bytes_rx; - // - uint64_t ulsch_pdus_rx; - - uint32_t total_ulsch_bitrate; - // - uint32_t total_ulsch_bytes_rx; - // - uint32_t total_ulsch_pdus_rx; - - - /// MAC agent-related stats - /// total number of scheduling decisions - int sched_decisions; - /// missed deadlines - int missed_deadlines; - -} eNB_STATS; -/*! \brief eNB statistics for the connected UEs*/ -typedef struct { - - /// CRNTI of UE - rnti_t crnti; ///user id (rnti) of connected UEs - // rrc status - uint8_t rrc_status; - /// harq pid - uint8_t harq_pid; - /// harq rounf - uint8_t harq_round; - /// total available number of PRBs for a new transmission - uint16_t rbs_used; - /// total available number of PRBs for a retransmission - uint16_t rbs_used_retx; - /// total nccc used for a new transmission: num control channel element - uint16_t ncce_used; - /// total avilable nccc for a retransmission: num control channel element - uint16_t ncce_used_retx; - - // mcs1 before the rate adaptaion - uint8_t dlsch_mcs1; - /// Target mcs2 after rate-adaptation - uint8_t dlsch_mcs2; - // current TBS with mcs2 - uint32_t TBS; - // total TBS with mcs2 - // uint32_t total_TBS; - // total rb used for a new transmission - uint32_t total_rbs_used; - // total rb used for retransmission - uint32_t total_rbs_used_retx; - - /// TX - /// Num pkt - uint32_t num_pdu_tx[NB_RB_MAX]; - /// num bytes - uint32_t num_bytes_tx[NB_RB_MAX]; - /// num retransmission / harq - uint32_t num_retransmission; - /// instantaneous tx throughput for each TTI - // uint32_t tti_throughput[NB_RB_MAX]; - - /// overall - // - uint32_t dlsch_bitrate; - //total - uint32_t total_dlsch_bitrate; - /// headers+ CE + padding bytes for a MAC PDU - uint64_t overhead_bytes; - /// headers+ CE + padding bytes for a MAC PDU - uint64_t total_overhead_bytes; - /// headers+ CE + padding bytes for a MAC PDU - uint64_t avg_overhead_bytes; - // MAC multiplexed payload - uint64_t total_sdu_bytes; - // total MAC pdu bytes - uint64_t total_pdu_bytes; - - // total num pdu - uint32_t total_num_pdus; - // - // uint32_t avg_pdu_size; - - /// RX - - /// PUCCH1a/b power (dBm) - int32_t Po_PUCCH_dBm; - /// Indicator that Po_PUCCH has been updated by PHY - int32_t Po_PUCCH_update; - /// Uplink measured RSSI - int32_t UL_rssi; - /// preassigned mcs after rate adaptation - uint8_t ulsch_mcs1; - /// adjusted mcs - uint8_t ulsch_mcs2; - - /// estimated average pdu inter-departure time - uint32_t avg_pdu_idt; - /// estimated average pdu size - uint32_t avg_pdu_ps; - /// - uint32_t aggregated_pdu_size; - uint32_t aggregated_pdu_arrival; - - /// uplink transport block size - uint32_t ulsch_TBS; - - /// total rb used for a new uplink transmission - uint32_t num_retransmission_rx; - /// total rb used for a new uplink transmission - uint32_t rbs_used_rx; - /// total rb used for a new uplink retransmission - uint32_t rbs_used_retx_rx; - /// total rb used for a new uplink transmission - uint32_t total_rbs_used_rx; - /// snr - int32_t snr; - /// target snr - int32_t target_snr; - - /// num rx pdu - uint32_t num_pdu_rx[NB_RB_MAX]; - /// num bytes rx - uint32_t num_bytes_rx[NB_RB_MAX]; - /// instantaneous rx throughput for each TTI - // uint32_t tti_goodput[NB_RB_MAX]; - /// errors - uint32_t num_errors_rx; - - uint64_t overhead_bytes_rx; - /// headers+ CE + padding bytes for a MAC PDU - uint64_t total_overhead_bytes_rx; - /// headers+ CE + padding bytes for a MAC PDU - uint64_t avg_overhead_bytes_rx; - // - uint32_t ulsch_bitrate; - //total - uint32_t total_ulsch_bitrate; - /// overall - /// MAC pdu bytes - uint64_t pdu_bytes_rx; - /// total MAC pdu bytes - uint64_t total_pdu_bytes_rx; - /// total num pdu - uint32_t total_num_pdus_rx; - /// num of error pdus - uint32_t total_num_errors_rx; - -} eNB_UE_STATS; -/*! \brief eNB template for UE context information */ -typedef struct { - /// C-RNTI of UE - rnti_t rnti; - /// NDI from last scheduling - uint8_t oldNDI[8]; - /// mcs1 from last scheduling - uint8_t oldmcs1[8]; - /// mcs2 from last scheduling - uint8_t oldmcs2[8]; - /// NDI from last UL scheduling - uint8_t oldNDI_UL[8]; - /// mcs from last UL scheduling - uint8_t mcs_UL[8]; - /// TBS from last UL scheduling - uint8_t TBS_UL[8]; - /// CQI_req from last scheduling - uint8_t oldCQI_UL[8]; - /// TPC from last scheduling - uint8_t oldTPC_UL[8]; - /// Flag to indicate UL has been scheduled at least once - boolean_t ul_active; - /// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received) - boolean_t configured; - - /// MCS from last scheduling - uint8_t mcs[8]; - - /// TPC from last scheduling - uint8_t oldTPC[8]; - - // PHY interface info - - /// Number of Allocated RBs for DL after scheduling (prior to frequency allocation) - uint16_t nb_rb[8]; // num_max_harq - - /// Number of Allocated RBs for UL after scheduling - uint16_t nb_rb_ul[8]; // num_max_harq - - /// Number of Allocated RBs for UL after scheduling - uint16_t first_rb_ul[8]; // num_max_harq - - /// Is CQI requested for UL after scheduling 1st transmission - uint8_t cqi_req[8]; // num_max_harq - - /// Cyclic shift for DMRS after scheduling - uint16_t cshift[8]; // num_max_harq - - /// Number of Allocated RBs by the ulsch preprocessor - uint8_t pre_allocated_nb_rb_ul; - - /// index of Allocated RBs by the ulsch preprocessor - int8_t pre_allocated_rb_table_index_ul; - - /// total allocated RBs - int8_t total_allocated_rbs; - - /// pre-assigned MCS by the ulsch preprocessor - uint8_t pre_assigned_mcs_ul; - - /// assigned MCS by the ulsch scheduler - uint8_t assigned_mcs_ul; - - /// DL DAI - uint8_t DAI; - - /// UL DAI - uint8_t DAI_ul[10]; - - /// UL Scheduling Request Received - uint8_t ul_SR; - - ///Resource Block indication for each sub-band in MU-MIMO - uint8_t rballoc_subband[8][50]; - - // Logical channel info for link with RLC - - /// Last received UE BSR info for each logical channel group id - uint8_t bsr_info[MAX_NUM_LCGID]; - - /// LCGID mapping - long lcgidmap[11]; - - /// phr information - int8_t phr_info; - - /// phr information - int8_t phr_info_configured; - - ///dl buffer info - uint32_t dl_buffer_info[MAX_NUM_LCID]; - /// total downlink buffer info - uint32_t dl_buffer_total; - /// total downlink pdus - uint32_t dl_pdus_total; - /// downlink pdus for each LCID - uint32_t dl_pdus_in_buffer[MAX_NUM_LCID]; - /// creation time of the downlink buffer head for each LCID - uint32_t dl_buffer_head_sdu_creation_time[MAX_NUM_LCID]; - /// maximum creation time of the downlink buffer head across all LCID - uint32_t dl_buffer_head_sdu_creation_time_max; - /// a flag indicating that the downlink head SDU is segmented - uint8_t dl_buffer_head_sdu_is_segmented[MAX_NUM_LCID]; - /// size of remaining size to send for the downlink head SDU - uint32_t dl_buffer_head_sdu_remaining_size_to_send[MAX_NUM_LCID]; - - /// total uplink buffer size - uint32_t ul_total_buffer; - /// uplink buffer creation time for each LCID - uint32_t ul_buffer_creation_time[MAX_NUM_LCGID]; - /// maximum uplink buffer creation time across all the LCIDs - uint32_t ul_buffer_creation_time_max; - /// uplink buffer size per LCID - uint32_t ul_buffer_info[MAX_NUM_LCGID]; - - /// UE tx power - int32_t ue_tx_power; - - /// stores the frame where the last TPC was transmitted - uint32_t pusch_tpc_tx_frame; - uint32_t pusch_tpc_tx_subframe; - uint32_t pucch_tpc_tx_frame; - uint32_t pucch_tpc_tx_subframe; - - /// stores the frame where the last bler was calculated - uint32_t pusch_bler_calc_frame; - uint32_t pusch_bler_calc_subframe; - -#ifdef LOCALIZATION - eNB_UE_estimated_distances distance; -#endif - -#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - uint8_t rach_resource_type; - - uint16_t mpdcch_repetition_cnt; - struct PhysicalConfigDedicated *physicalConfigDedicated; - frame_t Msg2_frame; - sub_frame_t Msg2_subframe; -#endif -} UE_TEMPLATE; - -/*! \brief scheduling control information set through an API (not used)*/ -typedef struct { - ///UL transmission bandwidth in RBs - uint8_t ul_bandwidth[MAX_NUM_LCID]; - ///DL transmission bandwidth in RBs - uint8_t dl_bandwidth[MAX_NUM_LCID]; - - //To do GBR bearer - uint8_t min_ul_bandwidth[MAX_NUM_LCID]; - - uint8_t min_dl_bandwidth[MAX_NUM_LCID]; - - ///aggregated bit rate of non-gbr bearer per UE - uint64_t ue_AggregatedMaximumBitrateDL; - ///aggregated bit rate of non-gbr bearer per UE - uint64_t ue_AggregatedMaximumBitrateUL; - ///CQI scheduling interval in subframes. - uint16_t cqiSchedInterval; - ///Contention resolution timer used during random access - uint8_t mac_ContentionResolutionTimer; - - uint16_t max_allowed_rbs[MAX_NUM_LCID]; - - uint8_t max_mcs[MAX_NUM_LCID]; - - uint16_t priority[MAX_NUM_LCID]; - - // resource scheduling information - - /// Current DL harq round per harq_pid on each CC - uint8_t round[MAX_NUM_CCs][10]; - /// Current Active TBs per harq_pid on each CC - uint8_t tbcnt[MAX_NUM_CCs][10]; - /// Current UL harq round per harq_pid on each CC - uint8_t round_UL[MAX_NUM_CCs][8]; - uint8_t dl_pow_off[MAX_NUM_CCs]; - uint16_t pre_nb_available_rbs[MAX_NUM_CCs]; - unsigned char rballoc_sub_UE[MAX_NUM_CCs][N_RBG_MAX]; - uint16_t ta_timer; - double ta_update_f; - int16_t ta_update; - uint16_t ul_consecutive_errors; - int32_t context_active_timer; - int32_t cqi_req_timer; - int32_t ul_inactivity_timer; - int32_t ul_failure_timer; - int32_t ul_scheduled; - int32_t ra_pdcch_order_sent; - int32_t ul_out_of_sync; - int32_t phr_received; - uint8_t periodic_ri_received[NFAPI_CC_MAX]; - uint8_t aperiodic_ri_received[NFAPI_CC_MAX]; - uint32_t pucch_tpc_accumulated[NFAPI_CC_MAX]; - int16_t pucch1_cqi_update[NFAPI_CC_MAX]; - int16_t pucch1_snr[NFAPI_CC_MAX]; - int16_t pucch2_cqi_update[NFAPI_CC_MAX]; - int16_t pucch2_snr[NFAPI_CC_MAX]; - int16_t pucch3_cqi_update[NFAPI_CC_MAX]; - int16_t pucch3_snr[NFAPI_CC_MAX]; - double pusch_cqi_f[NFAPI_CC_MAX]; - int16_t pusch_cqi[NFAPI_CC_MAX]; - int16_t pusch_snr[NFAPI_CC_MAX]; - int16_t pusch_snr_avg[NFAPI_CC_MAX]; - uint64_t pusch_rx_num[NFAPI_CC_MAX]; - uint64_t pusch_rx_num_old[NFAPI_CC_MAX]; - uint64_t pusch_rx_error_num[NFAPI_CC_MAX]; - uint64_t pusch_rx_error_num_old[NFAPI_CC_MAX]; - double pusch_bler[NFAPI_CC_MAX]; - uint8_t mcs_offset[NFAPI_CC_MAX]; - uint16_t feedback_cnt[NFAPI_CC_MAX]; - uint16_t timing_advance; - uint16_t timing_advance_r9; - uint8_t periodic_wideband_cqi[NFAPI_CC_MAX]; - uint8_t periodic_wideband_spatial_diffcqi[NFAPI_CC_MAX]; - uint8_t periodic_wideband_pmi[NFAPI_CC_MAX]; - uint8_t periodic_subband_cqi[NFAPI_CC_MAX][16]; - uint8_t periodic_subband_spatial_diffcqi[NFAPI_CC_MAX][16]; - uint8_t aperiodic_subband_cqi0[NFAPI_CC_MAX][25]; - uint8_t aperiodic_subband_pmi[NFAPI_CC_MAX][25]; - uint8_t aperiodic_subband_diffcqi0[NFAPI_CC_MAX][25]; - uint8_t aperiodic_subband_cqi1[NFAPI_CC_MAX][25]; - uint8_t aperiodic_subband_diffcqi1[NFAPI_CC_MAX][25]; - uint8_t aperiodic_wideband_cqi0[NFAPI_CC_MAX]; - uint8_t aperiodic_wideband_pmi[NFAPI_CC_MAX]; - uint8_t aperiodic_wideband_cqi1[NFAPI_CC_MAX]; - uint8_t aperiodic_wideband_pmi1[NFAPI_CC_MAX]; - uint8_t dl_cqi[NFAPI_CC_MAX]; -} UE_sched_ctrl; -/*! \brief eNB template for the Random access information */ -typedef struct { - /// Flag to indicate this process is active - boolean_t RA_active; - /// Size of DCI for RA-Response (bytes) - uint8_t RA_dci_size_bytes1; - /// Size of DCI for RA-Response (bits) - uint8_t RA_dci_size_bits1; - /// Actual DCI to transmit for RA-Response - uint8_t RA_alloc_pdu1[(MAX_DCI_SIZE_BITS>>3)+1]; - /// DCI format for RA-Response (should be 1A) - uint8_t RA_dci_fmt1; - /// Size of DCI for Msg4/ContRes (bytes) - uint8_t RA_dci_size_bytes2; - /// Size of DCI for Msg4/ContRes (bits) - uint8_t RA_dci_size_bits2; - /// Actual DCI to transmit for Msg4/ContRes - uint8_t RA_alloc_pdu2[(MAX_DCI_SIZE_BITS>>3)+1]; - /// DCI format for Msg4/ContRes (should be 1A) - uint8_t RA_dci_fmt2; - /// Flag to indicate the eNB should generate RAR. This is triggered by detection of PRACH - uint8_t generate_rar; - /// Subframe where preamble was received - uint8_t preamble_subframe; - /// Subframe where Msg2 is to be sent - uint8_t Msg2_subframe; - /// Frame where Msg2 is to be sent - frame_t Msg2_frame; - /// Subframe where Msg3 is to be sent - sub_frame_t Msg3_subframe; - /// Frame where Msg3 is to be sent - frame_t Msg3_frame; - /// Subframe where Msg4 is to be sent - sub_frame_t Msg4_subframe; - /// Frame where Msg4 is to be sent - frame_t Msg4_frame; - /// Flag to indicate the eNB should generate Msg4 upon reception of SDU from RRC. This is triggered by first ULSCH reception at eNB for new user. - uint8_t generate_Msg4; - /// Flag to indicate that eNB is waiting for ACK that UE has received Msg3. - uint8_t wait_ack_Msg4; - /// harq_pid used for Msg4 transmission - uint8_t harq_pid; - /// UE RNTI allocated during RAR - rnti_t rnti; - /// RA RNTI allocated from received PRACH - uint16_t RA_rnti; - /// Received preamble_index - uint8_t preamble_index; - /// Received UE Contention Resolution Identifier - uint8_t cont_res_id[6]; - /// Timing offset indicated by PHY - int16_t timing_offset; - /// Timeout for RRC connection - int16_t RRC_timer; - /// Msg3 first RB - uint8_t msg3_first_rb; - /// Msg3 number of RB - uint8_t msg3_nb_rb; - /// Msg3 MCS - uint8_t msg3_mcs; - /// Msg3 TPC command - uint8_t msg3_TPC; - /// Msg3 ULdelay command - uint8_t msg3_ULdelay; - /// Msg3 cqireq command - uint8_t msg3_cqireq; - /// Round of Msg3 HARQ - uint8_t msg3_round; - /// TBS used for Msg4 - int msg4_TBsize; - /// MCS used for Msg4 - int msg4_mcs; - /// size off piggybacked RRC SDU - uint8_t msg4_rrc_sdu_length; - uint32_t msg4_delay; - -#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - uint8_t rach_resource_type; - uint8_t msg2_mpdcch_repetition_cnt; - uint8_t msg2_mpdcch_done; - uint8_t msg4_mpdcch_repetition_cnt; - uint8_t msg4_mpdcch_done; - uint8_t msg2_narrowband; - uint32_t msg34_narrowband; -#endif -} RA_TEMPLATE; - - -/*! \brief subband bitmap confguration (for ALU icic algo purpose), in test phase */ -typedef struct { - uint8_t sbmap[NUMBER_OF_SUBBANDS_MAX]; //13 = number of SB MAX for 100 PRB - uint8_t periodicity; - uint8_t first_subframe; - uint8_t sb_size; - uint8_t nb_active_sb; -} SBMAP_CONF; -/*! \brief UE list used by eNB to order UEs/CC for scheduling*/ -typedef struct { - /// Dedicated information for UEs - struct PhysicalConfigDedicated *physicalConfigDedicated[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - /// DLSCH pdu - DLSCH_PDU DLSCH_pdu[MAX_NUM_CCs][2][NUMBER_OF_UE_MAX]; - /// DCI template and MAC connection parameters for UEs - UE_TEMPLATE UE_template[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - /// DCI template and MAC connection for RA processes - int pCC_id[NUMBER_OF_UE_MAX]; - /// sorted downlink component carrier for the scheduler - int ordered_CCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - /// number of downlink active component carrier - int numactiveCCs[NUMBER_OF_UE_MAX]; - /// sorted uplink component carrier for the scheduler - int ordered_ULCCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - /// number of uplink active component carrier - int numactiveULCCs[NUMBER_OF_UE_MAX]; - /// number of downlink active component carrier - uint8_t dl_CC_bitmap[NUMBER_OF_UE_MAX]; - /// eNB to UE statistics - eNB_UE_STATS eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - /// scheduling control info - UE_sched_ctrl UE_sched_ctrl[NUMBER_OF_UE_MAX]; - int next[NUMBER_OF_UE_MAX]; - int head; - int next_ul[NUMBER_OF_UE_MAX]; - int head_ul; - int avail; - int num_UEs; - boolean_t active[NUMBER_OF_UE_MAX]; -} UE_list_t; - -/*! \brief eNB common channels */ -typedef struct { - int physCellId; - int p_eNB; - int Ncp; - int eutra_band; - uint32_t dl_CarrierFreq; - BCCH_BCH_Message_t *mib; - RadioResourceConfigCommonSIB_t *radioResourceConfigCommon; -#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - RadioResourceConfigCommonSIB_t *radioResourceConfigCommon_BR; -#endif - TDD_Config_t *tdd_Config; - SchedulingInfoList_t *schedulingInfoList; - 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 RAR pdu for PHY - RAR_PDU RAR_pdu; - /// Template for RA computations - RA_TEMPLATE RA_template[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]; - /// MBSFN SubframeConfig - struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; - /// number of subframe allocation pattern available for MBSFN sync area - uint8_t num_sf_allocation_pattern; -#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - /// MBMS Flag - uint8_t MBMS_flag; - /// Outgoing MCCH pdu for PHY - MCCH_PDU MCCH_pdu; - /// MCCH active flag - uint8_t msi_active; - /// MCCH active flag - uint8_t mcch_active; - /// MTCH active flag - uint8_t mtch_active; - /// number of active MBSFN area - uint8_t num_active_mbsfn_area; - /// MBSFN Area Info - struct MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA]; - /// PMCH Config - struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN]; - /// MBMS session info list - struct MBMS_SessionInfoList_r9 *mbms_SessionList[MAX_PMCH_perMBSFN]; - /// Outgoing MCH pdu for PHY - MCH_PDU MCH_pdu; -#endif -#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - /// Rel13 parameters from SIB1 - SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext; - /// Counter for SIB1-BR scheduling - int SIB1_BR_cnt; - /// Outgoing BCCH-BR pdu for PHY - BCCH_PDU BCCH_BR_pdu[20]; -#endif -} COMMON_channels_t; -/*! \brief top level eNB MAC structure */ -typedef struct eNB_MAC_INST_s { - /// Ethernet parameters for northbound midhaul interface - eth_params_t eth_params_n; - /// Ethernet parameters for fronthaul interface - eth_params_t eth_params_s; - /// - module_id_t Mod_id; - /// frame counter - frame_t frame; - /// subframe counter - sub_frame_t subframe; - /// Pointer to IF module instance for PHY - IF_Module_t *if_inst; - /// Common cell resources - COMMON_channels_t common_channels[MAX_NUM_CCs]; - /// current PDU index (BCH,MCH,DLSCH) - uint16_t pdu_index[MAX_NUM_CCs]; - - /// NFAPI Config Request Structure - nfapi_config_request_t config[MAX_NUM_CCs]; - /// Preallocated DL pdu list - nfapi_dl_config_request_pdu_t dl_config_pdu_list[MAX_NUM_CCs][MAX_NUM_DL_PDU]; - /// NFAPI DL Config Request Structure - nfapi_dl_config_request_t DL_req[MAX_NUM_CCs]; - /// Preallocated UL pdu list - nfapi_ul_config_request_pdu_t ul_config_pdu_list[MAX_NUM_CCs][MAX_NUM_UL_PDU]; - /// Preallocated UL pdu list for ULSCH (n+k delay) - nfapi_ul_config_request_pdu_t ul_config_pdu_list_tmp[MAX_NUM_CCs][10][MAX_NUM_UL_PDU]; - /// NFAPI UL Config Request Structure, send to L1 4 subframes before processing takes place - nfapi_ul_config_request_t UL_req[MAX_NUM_CCs]; - /// NFAPI "Temporary" UL Config Request Structure, holds future UL_config requests - nfapi_ul_config_request_t UL_req_tmp[MAX_NUM_CCs][10]; - /// Preallocated HI_DCI0 pdu list - nfapi_hi_dci0_request_pdu_t hi_dci0_pdu_list[MAX_NUM_CCs][MAX_NUM_HI_DCI0_PDU]; - /// NFAPI HI/DCI0 Config Request Structure - nfapi_hi_dci0_request_t HI_DCI0_req[MAX_NUM_CCs]; - /// Prealocated TX pdu list - nfapi_tx_request_pdu_t tx_request_pdu[MAX_NUM_CCs][MAX_NUM_TX_REQUEST_PDU]; - /// NFAPI DL PDU structure - nfapi_tx_request_t TX_req[MAX_NUM_CCs]; - /// UL handle - uint32_t ul_handle; - UE_list_t UE_list; - - ///subband bitmap configuration - SBMAP_CONF sbmap_conf; - /// CCE table used to build DCI scheduling information - int CCE_table[MAX_NUM_CCs][800]; - /// active flag for Other lcid - uint8_t lcid_active[NB_RB_MAX]; - /// eNB stats - eNB_STATS eNB_stats[MAX_NUM_CCs]; - // MAC function execution peformance profiler - /// processing time of eNB scheduler - time_stats_t eNB_scheduler; - /// processing time of eNB scheduler for SI - time_stats_t schedule_si; - /// processing time of eNB scheduler for Random access - time_stats_t schedule_ra; - /// processing time of eNB ULSCH scheduler - time_stats_t schedule_ulsch; - /// processing time of eNB DCI generation - time_stats_t fill_DLSCH_dci; - /// processing time of eNB MAC preprocessor - time_stats_t schedule_dlsch_preprocessor; - /// processing time of eNB DLSCH scheduler - time_stats_t schedule_dlsch; // include rlc_data_req + MAC header + preprocessor - /// processing time of eNB MCH scheduler - time_stats_t schedule_mch; - /// processing time of eNB ULSCH reception - time_stats_t rx_ulsch_sdu; // include rlc_data_ind -} eNB_MAC_INST; - -/* - * UE part - */ - -typedef enum { - TYPE0, - TYPE1, - TYPE1A, - TYPE2, - TYPE2A, - TYPEUESPEC -} MPDCCH_TYPES_t; - -/*!\brief UE layer 2 status */ -typedef enum { - CONNECTION_OK=0, - CONNECTION_LOST, - PHY_RESYNCH, - PHY_HO_PRACH -} UE_L2_STATE_t; - -/*!\brief UE scheduling info */ -typedef struct { - /// buffer status for each lcgid - uint8_t BSR[MAX_NUM_LCGID]; // should be more for mesh topology - /// keep the number of bytes in rlc buffer for each lcgid - int32_t BSR_bytes[MAX_NUM_LCGID]; - /// after multiplexing buffer remain for each lcid - int32_t LCID_buffer_remain[MAX_NUM_LCID]; - /// sum of all lcid buffer size - uint16_t All_lcid_buffer_size_lastTTI; - /// buffer status for each lcid - uint8_t LCID_status[MAX_NUM_LCID]; - /// SR pending as defined in 36.321 - uint8_t SR_pending; - /// SR_COUNTER as defined in 36.321 - uint16_t SR_COUNTER; - /// logical channel group ide for each LCID - uint8_t LCGID[MAX_NUM_LCID]; - /// retxBSR-Timer, default value is sf2560 - uint16_t retxBSR_Timer; - /// retxBSR_SF, number of subframe before triggering a regular BSR - uint16_t retxBSR_SF; - /// periodicBSR-Timer, default to infinity - uint16_t periodicBSR_Timer; - /// periodicBSR_SF, number of subframe before triggering a periodic BSR - uint16_t periodicBSR_SF; - /// default value is 0: not configured - uint16_t sr_ProhibitTimer; - /// sr ProhibitTime running - uint8_t sr_ProhibitTimer_Running; - /// default value to n5 - uint16_t maxHARQ_Tx; - /// default value is false - uint16_t ttiBundling; - /// default value is release - struct DRX_Config *drx_config; - /// default value is release - struct MAC_MainConfig__phr_Config *phr_config; - ///timer before triggering a periodic PHR - uint16_t periodicPHR_Timer; - ///timer before triggering a prohibit PHR - uint16_t prohibitPHR_Timer; - ///DL Pathloss change value - uint16_t PathlossChange; - ///number of subframe before triggering a periodic PHR - int16_t periodicPHR_SF; - ///number of subframe before triggering a prohibit PHR - int16_t prohibitPHR_SF; - ///DL Pathloss Change in db - uint16_t PathlossChange_db; - - /// default value is false - uint16_t extendedBSR_Sizes_r10; - /// default value is false - uint16_t extendedPHR_r10; - - //Bj bucket usage per lcid - int16_t Bj[MAX_NUM_LCID]; - // Bucket size per lcid - int16_t bucket_size[MAX_NUM_LCID]; -} UE_SCHEDULING_INFO; -/*!\brief Top level UE MAC structure */ -typedef struct { - uint16_t Node_id; - /// RX frame counter - frame_t rxFrame; - /// RX subframe counter - sub_frame_t rxSubframe; - /// TX frame counter - frame_t txFrame; - /// TX subframe counter - sub_frame_t txSubframe; - /// C-RNTI of UE - uint16_t crnti; - /// C-RNTI of UE before HO - rnti_t crnti_before_ho; ///user id (rnti) of connected UEs - /// uplink active flag - uint8_t ul_active; - /// pointer to RRC PHY configuration - RadioResourceConfigCommonSIB_t *radioResourceConfigCommon; - /// pointer to RACH_ConfigDedicated (NULL when not active, i.e. upon HO completion or T304 expiry) - struct RACH_ConfigDedicated *rach_ConfigDedicated; - /// pointer to RRC PHY configuration - struct PhysicalConfigDedicated *physicalConfigDedicated; -#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - /// pointer to RRC PHY configuration SCEll - struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10; -#endif - /// pointer to TDD Configuration (NULL for FDD) - TDD_Config_t *tdd_Config; - /// Number of adjacent cells to measure - uint8_t n_adj_cells; - /// Array of adjacent physical cell ids - uint32_t adj_cell_id[6]; - /// Pointer to RRC MAC configuration - MAC_MainConfig_t *macConfig; - /// Pointer to RRC Measurement gap configuration - MeasGapConfig_t *measGapConfig; - /// Pointers to LogicalChannelConfig indexed by LogicalChannelIdentity. Note NULL means LCHAN is inactive. - LogicalChannelConfig_t *logicalChannelConfig[MAX_NUM_LCID]; - /// Scheduling Information - UE_SCHEDULING_INFO scheduling_info; - /// Outgoing CCCH pdu for PHY - CCCH_PDU CCCH_pdu; - /// Outgoing RAR pdu for PHY - RAR_PDU RAR_pdu; - /// Incoming DLSCH pdu for PHY - DLSCH_PDU DLSCH_pdu[NUMBER_OF_UE_MAX][2]; - /// number of attempt for rach - uint8_t RA_attempt_number; - /// Random-access procedure flag - uint8_t RA_active; - /// Random-access window counter - int8_t RA_window_cnt; - /// Random-access Msg3 size in bytes - uint8_t RA_Msg3_size; - /// Random-access prachMaskIndex - uint8_t RA_prachMaskIndex; - /// Flag indicating Preamble set (A,B) used for first Msg3 transmission - uint8_t RA_usedGroupA; - /// Random-access Resources - PRACH_RESOURCES_t RA_prach_resources; - /// Random-access PREAMBLE_TRANSMISSION_COUNTER - uint8_t RA_PREAMBLE_TRANSMISSION_COUNTER; - /// Random-access backoff counter - int16_t RA_backoff_cnt; - /// Random-access variable for window calculation (frame of last change in window counter) - uint32_t RA_tx_frame; - /// Random-access variable for window calculation (subframe of last change in window counter) - uint8_t RA_tx_subframe; - /// Random-access Group B maximum path-loss - /// Random-access variable for backoff (frame of last change in backoff counter) - uint32_t RA_backoff_frame; - /// Random-access variable for backoff (subframe of last change in backoff counter) - uint8_t RA_backoff_subframe; - /// Random-access Group B maximum path-loss - uint16_t RA_maxPL; - /// Random-access Contention Resolution Timer active flag - uint8_t RA_contention_resolution_timer_active; - /// Random-access Contention Resolution Timer count value - uint8_t RA_contention_resolution_cnt; - /// power headroom reporitng reconfigured - uint8_t PHR_reconfigured; - /// power headroom state as configured by the higher layers - uint8_t PHR_state; - /// power backoff due to power management (as allowed by P-MPRc) for this cell - uint8_t PHR_reporting_active; - /// power backoff due to power management (as allowed by P-MPRc) for this cell - uint8_t power_backoff_db[NUMBER_OF_eNB_MAX]; - /// BSR report falg management - uint8_t BSR_reporting_active; - /// retxBSR-Timer expires flag - uint8_t retxBSRTimer_expires_flag; - /// periodBSR-Timer expires flag - uint8_t periodBSRTimer_expires_flag; - - /// MBSFN_Subframe Configuration - struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA? - /// number of subframe allocation pattern available for MBSFN sync area - uint8_t num_sf_allocation_pattern; -#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0)) - /// number of active MBSFN area - uint8_t num_active_mbsfn_area; - /// MBSFN Area Info - struct MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA]; - /// PMCH Config - struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN]; - /// MCCH status - uint8_t mcch_status; - /// MSI status - uint8_t msi_status;// could be an array if there are >1 MCH in one MBSFN area -#endif - //#ifdef CBA - /// CBA RNTI for each group - uint16_t cba_rnti[NUM_MAX_CBA_GROUP]; - /// last SFN for CBA channel access - uint8_t cba_last_access[NUM_MAX_CBA_GROUP]; - //#endif - /// total UE scheduler processing time - time_stats_t ue_scheduler; // total - /// UE ULSCH tx processing time inlcuding RLC interface (rlc_data_req) and mac header generation - time_stats_t tx_ulsch_sdu; - /// UE DLSCH rx processing time inlcuding RLC interface (mac_rrc_data_ind or mac_rlc_status_ind+mac_rlc_data_ind) and mac header parser - time_stats_t rx_dlsch_sdu ; - /// UE query for MCH subframe processing time - time_stats_t ue_query_mch; - /// UE MCH rx processing time - time_stats_t rx_mch_sdu; - /// UE BCCH rx processing time including RLC interface (mac_rrc_data_ind) - time_stats_t rx_si; - /// UE PCCH rx processing time including RLC interface (mac_rrc_data_ind) - time_stats_t rx_p; -} UE_MAC_INST; -/*! \brief ID of the neighboring cells used for HO*/ -typedef struct { - uint16_t cell_ids[6]; - uint8_t n_adj_cells; -} neigh_cell_id_t; - -#include "proto.h" -/*@}*/ -#endif /*__LAYER2_MAC_DEFS_H__ */ diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 35082260f8..3dea211dbc 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -212,13 +212,6 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t *ra, frame_t frameP, hi_dci0_req->sfn_sf = sfnsf_add_subframe(frameP, subframeP, sf_ahead_dl); hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; - //if (NFAPI_MODE != NFAPI_MONOLITHIC) { - // oai_nfapi_hi_dci0_req(hi_dci0_req); - // hi_dci0_req_body->number_of_hi=0; - //} - - //LOG_D(MAC, "MSG3: HI_DCI0 SFN/SF:%d number_of_dci:%d number_of_hi:%d\n", NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req_body->number_of_dci, hi_dci0_req_body->number_of_hi); - // save UL scheduling information for preprocessor for (j = 0; j < ra->msg3_nb_rb; j++) cc->vrb_map_UL[ra->msg3_first_rb + j] = 1; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 5b8f6a9d5c..475b819d6c 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -202,7 +202,7 @@ rx_sdu(const module_id_t enb_mod_idP, } } else { // sduP == NULL => error UE_scheduling_control->pusch_rx_error_num[CC_idP]++; - LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d, UE_id %d, RNTI %x (len %d)\n", + LOG_W(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d, UE_id %d, RNTI %x (len %d)\n", enb_mod_idP, harq_pid, CC_idP, @@ -1656,11 +1656,9 @@ schedule_ulsch_rnti(module_id_t module_idP, UE_template_ptr->cshift[harq_pid] = cshift; /* Setting DCI0 NFAPI struct */ hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[dci_ul_pdu_idx]; - //memset((void *) hi_dci0_pdu, 0,sizeof(nfapi_hi_dci0_request_pdu_t)); hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; hi_dci0_pdu->pdu_size = 2 + sizeof(nfapi_hi_dci0_dci_pdu); hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dci_format = NFAPI_UL_DCI_FORMAT_0; - //hi_dci0_pdu->dci_pdu.dci_pdu_rel8.aggregation_level = aggregation; hi_dci0_pdu->dci_pdu.dci_pdu_rel8.rnti = rnti; hi_dci0_pdu->dci_pdu.dci_pdu_rel8.transmission_power = 6000; hi_dci0_pdu->dci_pdu.dci_pdu_rel8.resource_block_start = UE_template_ptr->pre_first_nb_rb_ul; diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 937f3c8f46..ac5025fd8c 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -6711,25 +6711,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( ); } } else { // remove LCHAN from MAC/PHY -#if 0 - if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { - // DRB has just been removed so remove RLC + PDCP for DRB - /* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE, - (ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE); - */ - if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { - rrc_rlc_config_req(ctxt_pP, - SRB_FLAG_NO, - MBMS_FLAG_NO, - CONFIG_ACTION_REMOVE, - DRB2LCHAN[i], - Rlc_info_um); - } - } - - ue_context_pP->ue_context.DRB_active[drb_id] = 0; -#endif - if (DRB_configList->list.array[i]->logicalChannelIdentity) { + if (DRB_configList->list.array[i]->logicalChannelIdentity) { DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity; } From 62d481f316e41fbca8ac1a30070d1a46e986dfac Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 7 Dec 2020 12:25:23 +0000 Subject: [PATCH 104/160] nr_dlsim and nr_ulsim segmentation fault issue solved --- openair1/SIMULATION/NR_PHY/dlsim.c | 18 +++++++++--------- openair2/RRC/NR/MESSAGES/asn1_msg.c | 11 ++++++++--- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 9b8f05364f..34501aace7 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -520,7 +520,7 @@ int main(int argc, char **argv) break; } } - + logInit(); set_glog(loglvl); T_stdout = 1; @@ -749,16 +749,16 @@ int main(int argc, char **argv) nr_l2_init_ue(NULL); UE_mac = get_mac_inst(0); - + UE->if_inst = nr_ue_if_module_init(0); UE->if_inst->scheduled_response = nr_ue_scheduled_response; UE->if_inst->phy_config_request = nr_ue_phy_config_request; UE->if_inst->dl_indication = nr_ue_dl_indication; UE->if_inst->ul_indication = dummy_nr_ue_ul_indication; - + UE_mac->if_module = nr_ue_if_module_init(0); - + unsigned int available_bits=0; unsigned char *estimated_output_bit; unsigned char *test_input_bit; @@ -816,7 +816,7 @@ int main(int argc, char **argv) reset_meas(&gNB->tinput); reset_meas(&gNB->tprep); reset_meas(&gNB->tparity); - reset_meas(&gNB->toutput); + reset_meas(&gNB->toutput); clear_pdsch_stats(gNB); @@ -916,7 +916,7 @@ int main(int argc, char **argv) } int tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0); if (n_trials==1) printf("tx_offset %d, txdataF_offset %d \n", tx_offset,txdataF_offset); - + //TODO: loop over slots for (aa=0; aaframe_parms.nb_antennas_tx; aa++) { @@ -978,7 +978,7 @@ int main(int argc, char **argv) } } } - + nr_ue_dcireq(&dcireq); //to be replaced with function pointer later nr_ue_scheduled_response(&scheduled_response); @@ -990,7 +990,7 @@ int main(int argc, char **argv) //printf("dlsim round %d ends\n",round); round++; } // round - + //---------------------------------------------------------- //---------------------- count errors ---------------------- //---------------------------------------------------------- @@ -1029,7 +1029,7 @@ int main(int argc, char **argv) } for (i = 0; i < TBS; i++) { - + estimated_output_bit[i] = (UE_harq_process->b[i/8] & (1 << (i & 7))) >> (i & 7); test_input_bit[i] = (gNB_dlsch->harq_processes[harq_pid]->b[i / 8] & (1 << (i & 7))) >> (i & 7); // Further correct for multiple segments diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 94b7a74238..70a0171eb0 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -227,13 +227,18 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) { mib->message.choice.mib->spare.bits_unused = 7; // This makes a spare of 1 bits mib->message.choice.mib->ssb_SubcarrierOffset = (carrier->ssb_SubcarrierOffset)&15; + /* * The SIB1 will be sent in this allocation (Type0-PDCCH) : 38.213, 13-4 Table and 38.213 13-11 to 13-14 tables * the reverse allocation is in nr_ue_decode_mib() */ - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero; - mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rrc->carrier.pdcch_ConfigSIB1->searchSpaceZero; - + if(rrc->carrier.pdcch_ConfigSIB1) { + mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero; + mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rrc->carrier.pdcch_ConfigSIB1->searchSpaceZero; + } else { + mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero; + mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero; + } AssertFatal(scc->ssbSubcarrierSpacing != NULL, "scc->ssbSubcarrierSpacing is null\n"); switch (*scc->ssbSubcarrierSpacing) { From da77bf33b9ded6dd4e2bae6dca71b6212358fa50 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 7 Dec 2020 16:36:50 +0000 Subject: [PATCH 105/160] Fix for DMRS symbol without data --- .../PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 5 +---- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 49e7956cc6..d2e45111f9 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -1598,10 +1598,7 @@ void nr_dlsch_channel_level(int **dl_ch_estimates_ext, int16_t y = (len)>>x; //printf("len = %d = %d * 2^(%d)\n",len,y,x); - if(y == 0) { - LOG_W(PHY,"Cannot divide by zero: in function %s of file %s \n", __func__, __FILE__); - return; - } + AssertFatal(y!=0,"Cannot divide by zero: in function %s of file %s\n", __func__, __FILE__); for (aatx=0; aatxnb_antenna_ports_gNB; aatx++) for (aarx=0; aarxnb_antennas_rx; aarx++) { diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 152d16090d..9830387499 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -731,6 +731,8 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ uint16_t pdsch_nb_rb = dlsch0->harq_processes[harq_pid]->nb_rb; uint16_t s0 = dlsch0->harq_processes[harq_pid]->start_symbol; uint16_t s1 = dlsch0->harq_processes[harq_pid]->nb_symbols; + NR_DL_UE_HARQ_t *dlsch0_harq = dlsch0->harq_processes[harq_pid]; + uint16_t nb_rb = dlsch0_harq->nb_rb/ue->frame_parms.nb_antennas_rx; LOG_D(PHY,"[UE %d] PDSCH type %d active in nr_slot_rx %d, harq_pid %d (%d), rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask %x\n",ue->Mod_id,pdsch,nr_slot_rx,harq_pid,dlsch0->harq_processes[harq_pid]->status,pdsch_start_rb,pdsch_nb_rb,s0,s1,dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos); @@ -762,13 +764,20 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ break; } } + + uint16_t first_symbol_with_data = s0; + uint8_t pilots = ((1<dlDmrsSymbPos)>0 ? 1 : 0; + uint32_t len = (pilots==1)? ((ue->dmrs_DownlinkConfig.pdsch_dmrs_type==pdsch_dmrs_type1)?nb_rb*(12-6*dlsch0_harq->n_dmrs_cdm_groups): nb_rb*(12-4*dlsch0_harq->n_dmrs_cdm_groups)):(nb_rb*12); + if(len == 0) { + first_symbol_with_data = first_symbol_with_data + 1; // TODO: Replace "1" by dmrs duration + } + for (m = s0; m < (s1 + s0); m++) { dual_stream_UE = 0; eNB_id_i = eNB_id+1; i_mod = 0; - - if ((m==s0) && (m<3)) + if (( m==first_symbol_with_data ) && (m<4)) first_symbol_flag = 1; else first_symbol_flag = 0; From 4be7f10efe92c4b77e2f0e0670d31aaf0c071dca Mon Sep 17 00:00:00 2001 From: rmagueta Date: Mon, 7 Dec 2020 19:30:45 +0000 Subject: [PATCH 106/160] nr_rrc_ue_decode_NR_SIB1_Message call was deleted from the PHY. It was used the UE FAPI interface to signal this to the MAC, who was send it to the RRC. --- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 9 --------- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 13 +++++++++++++ openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 10 ++++++++++ openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 4 ++-- openair2/RRC/NR_UE/L2_interface_ue.c | 15 ++++++++------- 5 files changed, 33 insertions(+), 18 deletions(-) diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 9830387499..a7c01915da 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1936,15 +1936,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // deactivate dlsch once dlsch proc is done ue->dlsch_SI[gNB_id]->active = 0; - // FIXME: It was assumed that SIB1 has only one segment - int harq_pid = PHY_vars_UE_g[ue->Mod_id][ue->CC_id]->dlsch_SI[0]->current_harq_pid; - if(ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->harq_ack.ack == 1) { - nr_rrc_ue_decode_NR_SIB1_Message(ue->Mod_id, gNB_id, &ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->c[0][0], - ue->dlsch_SI[gNB_id]->harq_processes[harq_pid]->TBS); - } else { - LOG_D(PHY,"SIB1 CRC NOT OK"); - } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_OUT); } diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 6f83b85c6a..59ce130c24 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -58,6 +58,19 @@ int8_t nr_ue_decode_mib( void *pduP, uint16_t cell_id ); +/**\brief decode sib1 pdu in NR_UE, from if_module dl_ind + \param module_id module id + \param cc_id component carrier id + \param gNB_index gNB index + \param sibs_mask sibs mask + \param pduP pointer to pdu + \param pdu_length length of pdu */ +int8_t nr_ue_decode_sib1(module_id_t module_id, + int cc_id, + unsigned int gNB_index, + uint32_t sibs_mask, + uint8_t *pduP, + uint32_t pdu_len); /**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config) \param module_id module id diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 2a96b2b438..b252a6660c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -1009,6 +1009,16 @@ int8_t nr_ue_decode_mib(module_id_t module_id, return 0; } +int8_t nr_ue_decode_sib1(module_id_t module_id, + int cc_id, + unsigned int gNB_index, + uint32_t sibs_mask, + uint8_t *pduP, + uint32_t pdu_len) { + LOG_D(MAC, "Decode sib1\n"); + nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len); + return 0; +} // TODO: change to UE parameter, scs: 15KHz, slot duration: 1ms uint32_t get_ssb_frame(uint32_t test){ diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 075c77982a..195c42f387 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -60,9 +60,9 @@ int handle_bcch_bch(module_id_t module_id, int cc_id, unsigned int gNB_index, ui // L2 Abstraction Layer int handle_bcch_dlsch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint32_t sibs_mask, uint8_t *pduP, uint32_t pdu_len){ - - return 0; + return nr_ue_decode_sib1(module_id, cc_id, gNB_index, sibs_mask, pduP, pdu_len); } + // L2 Abstraction Layer int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t frame, int slot, fapi_nr_dci_indication_pdu_t *dci){ diff --git a/openair2/RRC/NR_UE/L2_interface_ue.c b/openair2/RRC/NR_UE/L2_interface_ue.c index 44d50dd0ef..22e17f6266 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.c +++ b/openair2/RRC/NR_UE/L2_interface_ue.c @@ -46,16 +46,17 @@ nr_mac_rrc_data_ind_ue( const sdu_size_t pdu_len){ switch(channel){ - case NR_BCCH_BCH: - AssertFatal( nr_rrc_ue_decode_NR_BCCH_BCH_Message( module_id, gNB_index, (uint8_t*)pduP, pdu_len) == 0, "UE decode BCCH-BCH error!\n"); - break; - default: - break; + case NR_BCCH_BCH: + AssertFatal( nr_rrc_ue_decode_NR_BCCH_BCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len) == 0, "UE decode BCCH-BCH error!\n"); + break; + case NR_BCCH_DL_SCH: + AssertFatal( nr_rrc_ue_decode_NR_SIB1_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len) == 0, "UE decode BCCH-DLSCH error!\n"); + break; + default: + break; } - return(0); - } int8_t mac_rrc_nr_data_req_ue(const module_id_t Mod_idP, From 4338d5365b066e86e3b9745e51c48b0c54c777d4 Mon Sep 17 00:00:00 2001 From: frtabu Date: Mon, 7 Dec 2020 23:46:14 +0100 Subject: [PATCH 107/160] cancel thread pool modif --- common/utils/threadPool/thread-pool.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h index 4ec0f5768c..0ed8715811 100644 --- a/common/utils/threadPool/thread-pool.h +++ b/common/utils/threadPool/thread-pool.h @@ -236,6 +236,7 @@ static inline void pushTpool(tpool_t *t, notifiedFIFO_elt_t *msg) { static inline notifiedFIFO_elt_t *pullTpool(notifiedFIFO_t *responseFifo, tpool_t *t) { notifiedFIFO_elt_t *msg= pullNotifiedFIFO(responseFifo); + AssertFatal(t->traceFd, "Thread pool used while not initialized"); if (t->measurePerf) msg->returnTime=rdtsc(); @@ -247,6 +248,7 @@ static inline notifiedFIFO_elt_t *pullTpool(notifiedFIFO_t *responseFifo, tpool_ static inline notifiedFIFO_elt_t *tryPullTpool(notifiedFIFO_t *responseFifo, tpool_t *t) { notifiedFIFO_elt_t *msg= pollNotifiedFIFO(responseFifo); + AssertFatal(t->traceFd, "Thread pool used while not initialized"); if (msg == NULL) return NULL; From 711a997fdb06dab7c2f6725de64cb3949d68e4e5 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Tue, 8 Dec 2020 15:02:19 +0100 Subject: [PATCH 108/160] dynamic allocation of dl gold sequences at ue --- openair1/PHY/INIT/nr_init_ue.c | 34 +++++++++++++++++++ openair1/PHY/NR_REFSIG/nr_gold_ue.c | 2 +- .../nr_dl_channel_estimation.c | 4 +-- openair1/PHY/defs_nr_UE.h | 6 ++-- 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 9c74f3dba4..98f63867cc 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -580,6 +580,40 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } } + //PDCCH DMRS init (eNB offset = 0) + ue->nr_gold_pdcch[0] = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **)); + uint32_t ***pdcch_dmrs = ue->nr_gold_pdcch[0]; + AssertFatal(pdcch_dmrs!=NULL, "NR init: pdcch_dmrs malloc failed\n"); + + for (int slot=0; slotslots_per_frame; slot++) { + pdcch_dmrs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *)); + AssertFatal(pdcch_dmrs[slot]!=NULL, "NR init: pdcch_dmrs for slot %d - malloc failed\n", slot); + + for (int symb=0; symbsymbols_per_slot; symb++) { + pdcch_dmrs[slot][symb] = (uint32_t *)malloc16(NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t)); + AssertFatal(pdcch_dmrs[slot][symb]!=NULL, "NR init: pdcch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb); + } + } + + //PDSCH DMRS init (eNB offset = 0) + ue->nr_gold_pdsch[0] = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***)); + uint32_t ****pdsch_dmrs = ue->nr_gold_pdsch[0]; + + for (int slot=0; slotslots_per_frame; slot++) { + pdsch_dmrs[slot] = (uint32_t ***)malloc16(fp->symbols_per_slot*sizeof(uint32_t **)); + AssertFatal(pdsch_dmrs[slot]!=NULL, "NR init: pdsch_dmrs for slot %d - malloc failed\n", slot); + + for (int symb=0; symbsymbols_per_slot; symb++) { + pdsch_dmrs[slot][symb] = (uint32_t **)malloc16(NR_MAX_NB_CODEWORDS*sizeof(uint32_t *)); + AssertFatal(pdsch_dmrs[slot][symb]!=NULL, "NR init: pdsch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb); + + for (int q=0; qn_connected_eNB; eNB_id++) { for (th_id=0; th_id>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); - ue->nr_gold_pdsch[nscid][ns][l][n] = x1^x2; + ue->nr_gold_pdsch[0][ns][l][nscid][n] = x1^x2; // if ((ns==2)&&(l==0)) //printf("n=%d : c %x\n",n,x1^x2); } diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index 0a37f7d6ad..b8cababbbc 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -689,7 +689,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12; uint8_t config_type = ue->dmrs_DownlinkConfig.pdsch_dmrs_type; int8_t delta = get_delta(p, config_type); - nr_pdsch_dmrs_rx(ue,Ns,ue->nr_gold_pdsch[eNB_offset][Ns][symbol], &pilot[0],1000,0,nb_rb_pdsch+rb_offset); + nr_pdsch_dmrs_rx(ue,Ns,ue->nr_gold_pdsch[eNB_offset][Ns][symbol][0], &pilot[0],1000,0,nb_rb_pdsch+rb_offset); if (config_type == pdsch_dmrs_type1){ nushift = (p>>1)&1; @@ -1321,7 +1321,7 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue, nr_slot_rx, symbol,frame_parms->ofdm_symbol_size, (int16_t*)&pdsch_vars[eNB_id]->rxdataF_comp0[aarx][(symbol * nb_re_pdsch)], - ue->nr_gold_pdsch[eNB_id][nr_slot_rx][symbol], + ue->nr_gold_pdsch[eNB_id][nr_slot_rx][symbol][0], &phase_per_symbol[2* symbol], &ptrs_re_symbol[symbol]); } diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 4a685bfeb9..dca58ce61e 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -889,7 +889,7 @@ typedef struct { UE_MODE_t UE_mode[NUMBER_OF_CONNECTED_gNB_MAX]; /// cell-specific reference symbols - uint32_t lte_gold_table[7][20][2][14]; + //uint32_t lte_gold_table[7][20][2][14]; #if defined(UPGRADE_RAT_NR) @@ -903,10 +903,10 @@ typedef struct { uint32_t nr_gold_pbch[2][64][NR_PBCH_DMRS_LENGTH_DWORD]; /// PDSCH DMRS - uint32_t nr_gold_pdsch[2][20][14][NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD]; + uint32_t ****nr_gold_pdsch[NUMBER_OF_CONNECTED_eNB_MAX]; /// PDCCH DMRS - uint32_t nr_gold_pdcch[7][20][3][52]; + uint32_t ***nr_gold_pdcch[NUMBER_OF_CONNECTED_eNB_MAX]; /// PUSCH DMRS sequence uint32_t ****nr_gold_pusch_dmrs; From e7edc37b5d1f29316062a5e0716e162520a63391 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Tue, 8 Dec 2020 15:03:08 +0100 Subject: [PATCH 109/160] k2 for msg3 in fr2 --- .../GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf | 2 +- .../GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf index 19d9146f34..f2e468c71b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf @@ -140,7 +140,7 @@ gNBs = # this is SS=0 L=12 initialULBWPstartSymbolAndLength_1 = 69; - initialULBWPk2_2 = 7; + initialULBWPk2_2 = 14; initialULBWPmappingType_2 = 1; # this is SS=10 L=4 initialULBWPstartSymbolAndLength_2 = 52; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf index 6681a43a1d..f810dd546c 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf @@ -142,7 +142,7 @@ gNBs = # this is SS=0 L=12 initialULBWPstartSymbolAndLength_1 = 69; - initialULBWPk2_2 = 7; + initialULBWPk2_2 = 14; initialULBWPmappingType_2 = 1; # this is SS=10 L=4 initialULBWPstartSymbolAndLength_2 = 52; From 1bd84bf1fd2084f4bd650bd8b2543bce93a2ea8d Mon Sep 17 00:00:00 2001 From: Hongzhi Wang Date: Tue, 8 Dec 2020 16:02:04 +0100 Subject: [PATCH 110/160] update nr ue gold to simplified version --- openair1/PHY/NR_REFSIG/nr_gold_ue.c | 81 ++++++++--------------------- 1 file changed, 21 insertions(+), 60 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/nr_gold_ue.c b/openair1/PHY/NR_REFSIG/nr_gold_ue.c index c4d0a5ca1b..98a7fa2538 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold_ue.c +++ b/openair1/PHY/NR_REFSIG/nr_gold_ue.c @@ -26,6 +26,7 @@ void nr_gold_pbch(PHY_VARS_NR_UE* ue) unsigned int n, x1, x2; unsigned int Nid, i_ssb, i_ssb2; unsigned char Lmax, l, n_hf, N_hf; + uint8_t reset; Nid = ue->frame_parms.Nid_cell; Lmax = ue->frame_parms.Lmax; @@ -37,24 +38,13 @@ void nr_gold_pbch(PHY_VARS_NR_UE* ue) i_ssb = l & (Lmax-1); i_ssb2 = i_ssb + (n_hf<<2); - x1 = 1 + (1<<31); + reset = 1; x2 = (1<<11) * (i_ssb2 + 1) * ((Nid>>2) + 1) + (1<<6) * (i_ssb2 + 1) + (Nid&3); x2 = x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); - // skip first 50 double words (1600 bits) - for (n = 1; n < 50; n++) { - x1 = (x1>>1) ^ (x1>>4); - x1 = x1 ^ (x1<<31) ^ (x1<<28); - x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); - x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); - } - - for (n=0; n>1) ^ (x1>>4); - x1 = x1 ^ (x1<<31) ^ (x1<<28); - x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); - x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); - ue->nr_gold_pbch[n_hf][l][n] = x1 ^ x2; + for (n=0; nnr_gold_pbch[n_hf][l][n] = lte_gold_generic(&x1, &x2, reset); + reset = 0; } } @@ -69,6 +59,7 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, unsigned char ns,l; unsigned int n,x1,x2,x2tmp0; unsigned int nid; + uint8_t reset; if (n_idDMRS) nid = n_idDMRS; @@ -79,28 +70,14 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, for (l=0; lframe_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17; x2 = (x2tmp0+(nid<<1))%(1<<31); //cinit - - x1 = 1+ (1<<31); - x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); - - // skip first 50 double words (1600 bits) - for (n=1; n<50; n++) { - x1 = (x1>>1) ^ (x1>>4); - x1 = x1 ^ (x1<<31) ^ (x1<<28); - x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); - x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); - //printf("x1 : %x, x2 : %x\n",x1,x2); - } - for (n=0; n<52; n++) { - x1 = (x1>>1) ^ (x1>>4); - x1 = x1 ^ (x1<<31) ^ (x1<<28); - x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); - x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); - ue->nr_gold_pdcch[0][ns][l][n] = x1^x2; - // if (ns==1 && l==0) printf("n=%d : c %x\n",n,x1^x2); - } + + for (n=0; nnr_gold_pdcch[0][ns][l][n] = lte_gold_generic(&x1, &x2, reset); + reset = 0; + } } } } @@ -112,6 +89,7 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue, unsigned int n,x1,x2,x2tmp0; int nscid; unsigned int nid; + uint8_t reset; /// to be updated from higher layer //unsigned short lbar = 0; @@ -126,34 +104,17 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue, for (ns=0; nsframe_parms.slots_per_frame; ns++) { - for (l=0; l<14; l++) { + for (l=0; lframe_parms.symbols_per_slot; l++) { - x2tmp0 = ((14*ns+l+1)*((nid<<1)+1))<<17; + reset = 1; + x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17; x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid); - //printf("ns %d gold pdsch x2 %d\n",ns,x2); - - x1 = 1+ (1<<31); - x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); - - // skip first 50 double words (1600 bits) - for (n=1; n<50; n++) { - x1 = (x1>>1) ^ (x1>>4); - x1 = x1 ^ (x1<<31) ^ (x1<<28); - x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); - x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); - //printf("x1 : %x, x2 : %x\n",x1,x2); - } - + for (n=0; n>1) ^ (x1>>4); - x1 = x1 ^ (x1<<31) ^ (x1<<28); - x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); - x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); - ue->nr_gold_pdsch[0][ns][l][nscid][n] = x1^x2; - // if ((ns==2)&&(l==0)) - //printf("n=%d : c %x\n",n,x1^x2); - } + ue->nr_gold_pdsch[0][ns][l][nscid][n] = lte_gold_generic(&x1, &x2, reset); + reset = 0; + } } } } From 1de8776c4395e231976f9ca1d94655a8e2a53a25 Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Wed, 9 Dec 2020 13:59:49 +0900 Subject: [PATCH 111/160] Fix compile error --- openair2/LAYER2/MAC/eNB_scheduler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 81ca1c67a6..dbfae06e13 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -623,7 +623,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, UE_info->eNB_UE_stats[CC_id][UE_id].total_num_pdus, UE_info->eNB_UE_stats[CC_id][UE_id].total_rbs_used, #if defined(PRE_SCD_THREAD) - dl_buffer_total[CC_id][UE_id], + UE_info->UE_template[CC_id][UE_id].dl_buffer_total, #else 0, #endif From 3bae6a046d63c397f7066279302eba05f7936981 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 9 Dec 2020 10:46:19 +0100 Subject: [PATCH 112/160] workaround for UE to transmit msg3 --- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 4 ++-- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 4 +++- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index aa5fcf13dc..82fcbd4b9c 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -227,9 +227,9 @@ typedef struct { /// Random-access variable for window calculation (subframe of last change in window counter) uint8_t RA_tx_subframe; /// Scheduled TX frame for RA Msg3 - frame_t msg3_frame; + int16_t msg3_frame; /// Scheduled TX slot for RA Msg3 - slot_t msg3_slot; + int16_t msg3_slot; /// Random-access variable for backoff (frame of last change in backoff counter) uint32_t RA_backoff_frame; /// Random-access variable for backoff (subframe of last change in backoff counter) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 34b6d801c5..3280c67264 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -500,6 +500,8 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, mac->RA_PREAMBLE_TRANSMISSION_COUNTER = 1; mac->RA_PREAMBLE_POWER_RAMPING_COUNTER = 1; mac->RA_Msg3_size = size_sdu + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); + mac->msg3_frame = -1; // initialize to an invalid value + mac->msg3_slot = -1; mac->RA_prachMaskIndex = 0; // todo: add the backoff condition here mac->RA_backoff_cnt = 0; @@ -560,7 +562,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, mac->RA_window_cnt = -1; mac->ra_state = RA_SUCCEEDED; mac->generate_nr_prach = 2; - LOG_I(MAC, "[MAC][UE %d][RAPROC]: RAR successfully received \n", mod_id); + LOG_I(MAC, "[MAC][UE %d][RAPROC]: frame %d slot %d RAR successfully received\n", mod_id, frame, nr_slot_tx); } else if (mac->RA_window_cnt == 0 && !mac->RA_RAPID_found) { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 2d0f1fc002..5009c0bc0f 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -1664,7 +1664,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in NR_UE_MAC_INST_t *mac = get_mac_inst(ul_info->module_id); - if (mac->RA_active && ul_info->slot_tx == mac->msg3_slot && ul_info->frame_tx == mac->msg3_frame){ + if (ul_info->slot_tx == mac->msg3_slot && ul_info->frame_tx == mac->msg3_frame){ uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES]; nr_scheduled_response_t scheduled_response; @@ -1701,7 +1701,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in } //} - LOG_D(MAC, "[UE %d] Frame %d, Subframe %d Adding Msg3 UL Config Request for rnti: %x\n", + LOG_I(MAC, "[UE %d] Frame %d, Subframe %d Adding Msg3 UL Config Request for rnti: %x\n", ul_info->module_id, ul_info->frame_tx, ul_info->slot_tx, @@ -1721,6 +1721,8 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL){ mac->if_module->scheduled_response(&scheduled_response); } + mac->msg3_frame = -1; // re-initialize to an invalid value after scheduling + mac->msg3_slot = -1; } } } @@ -1763,9 +1765,7 @@ void nr_ue_msg3_scheduler(NR_UE_MAC_INST_t *mac, else mac->msg3_frame = current_frame; - #ifdef DEBUG_MSG3 LOG_D(MAC, "[DEBUG_MSG3] current_slot %d k2 %d delta %d temp_slot %d mac->msg3_frame %d mac->msg3_slot %d \n", current_slot, k2, delta, current_slot + k2 + delta, mac->msg3_frame, mac->msg3_slot); - #endif } // This function schedules the PRACH according to prach_ConfigurationIndex and TS 38.211, tables 6.3.3.2.x From f9e00c5168391d7bac396f68a7a9774ddda75301 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Wed, 9 Dec 2020 14:24:55 +0100 Subject: [PATCH 113/160] bugfix in msg3 freq allocation at UE --- openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c b/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c index 3fbd5a16b0..8273c9caff 100644 --- a/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c +++ b/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c @@ -116,6 +116,7 @@ void nr_config_Msg3_pdu(NR_UE_MAC_INST_t *mac, mask = (1 << ((int) ceil(log2((ibwp_size*(ibwp_size+1))>>1)))) - 1; else mask = (1 << (28 - (int)(ceil(log2((ibwp_size*(ibwp_size+1))>>1))))) - 1; + f_alloc = Msg3_f_alloc & mask; nr_ue_process_dci_freq_dom_resource_assignment(pusch_config_pdu, NULL, ibwp_size, 0, f_alloc); @@ -273,7 +274,8 @@ uint16_t nr_ue_process_rar(module_id_t mod_id, if (ue_mac->RA_RAPID_found) { - uint8_t freq_hopping, mcs, Msg3_t_alloc, Msg3_f_alloc; + uint8_t freq_hopping, mcs, Msg3_t_alloc; + uint16_t Msg3_f_alloc; unsigned char tpc_command; #ifdef DEBUG_RAR unsigned char csi_req; From 4eed33b0824a4573f7d4c61dd17c95d83765b6c1 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 9 Dec 2020 14:59:55 +0000 Subject: [PATCH 114/160] Added documentation. Minor source code format fixes. --- doc/FEATURE_SET.md | 16 +++++---- doc/RUNMODEM.md | 26 ++++++++++++++ openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 36 ++++++++++--------- .../gnb.sa.band78.fr1.106PRB.usrpb210.conf | 1 - 4 files changed, 56 insertions(+), 23 deletions(-) diff --git a/doc/FEATURE_SET.md b/doc/FEATURE_SET.md index 1f8d8cfccf..2840eed73c 100644 --- a/doc/FEATURE_SET.md +++ b/doc/FEATURE_SET.md @@ -295,6 +295,7 @@ The following features are valid for the gNB and the 5G-NR UE. - NR RRC (38.331) Rel 15 messages using new asn1c - LTE RRC (36.331) also updated to Rel 15 - Generation of CellGroupConfig (for eNB) and MIB +- Generation of system information block 1 (SIB1) - Application to read configuration file and program gNB RRC - RRC can configure PDCP, RLC, MAC @@ -305,7 +306,8 @@ The following features are valid for the gNB and the 5G-NR UE. **gNB MAC** - MAC -> PHY configuration using NR FAPI P5 interface - MAC <-> PHY data interface using FAPI P7 interface for BCH PDU, DCI PDU, PDSCH PDU -- Scheduler for RA procedreat gNB +- Scheduler procedures for SIB1 +- Scheduler procedures for RA - MAC downlink scheduler (fixed allocations) - MAC header generation (including timing advance) - ACK / NACK handling and HARQ procedures for downlink @@ -350,11 +352,13 @@ The following features are valid for the gNB and the 5G-NR UE. ## UE Higher Layers ## -**gNB MAC** -- Initial sync and MIB detection -- MAC -> PHY configuration of PHY via UE FAPI P5 interface -- Basic MAC to control PHY via UE FAPI P7 interface -- Random access procedure +**UE MAC** +* Minimum system information (MSI) + - Initial sync and MIB detection + - System information block 1 (SIB1) reception +* MAC -> PHY configuration of PHY via UE FAPI P5 interface +* Basic MAC to control PHY via UE FAPI P7 interface +* Random access procedure **RLC** diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index af4a57041f..9f4564a0ca 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -132,6 +132,32 @@ With the RF simulator (on the same machine): `sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --do-ra --rfsim --parallel-config PARALLEL_SINGLE_THREAD` +## sa setup with OAI + +The sa flag is used to run gNB in standalone mode. Currently OAI in NR standalone mode transmits and receives SIB1. + +In order to run gNB in standalone mode, the following flag is needed at gNB: + +`--sa` + +### Run OAI in sa mode + +From the `cmake_targets/ran_build/build` folder: + +gNB on machine 1: + +`sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --sa` + +UE on machine 2: + +`sudo ./nr-uesoftmodem --rrc_config_path . --phy-test` + +With the RF simulator (on the same machine): + +`sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --rfsim --sa` + +`sudo ./nr-uesoftmodem --rrc_config_path . --rfsim --phy-test` + ## IF setup with OAI The -C and -CO flags can be used together at UE side to set custom downlink and uplink FR1 intermediate frequencies for the IF equipment. diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index a7c01915da..ac559aa8dd 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -725,14 +725,12 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ if (!dlsch1) { int harq_pid = dlsch0->current_harq_pid; - uint16_t BWPStart = dlsch0->harq_processes[harq_pid]->BWPStart; - // uint16_t BWPSize = dlsch0->harq_processes[harq_pid]->BWPSize; - uint16_t pdsch_start_rb = dlsch0->harq_processes[harq_pid]->start_rb; - uint16_t pdsch_nb_rb = dlsch0->harq_processes[harq_pid]->nb_rb; - uint16_t s0 = dlsch0->harq_processes[harq_pid]->start_symbol; - uint16_t s1 = dlsch0->harq_processes[harq_pid]->nb_symbols; NR_DL_UE_HARQ_t *dlsch0_harq = dlsch0->harq_processes[harq_pid]; - uint16_t nb_rb = dlsch0_harq->nb_rb/ue->frame_parms.nb_antennas_rx; + uint16_t BWPStart = dlsch0_harq->BWPStart; + uint16_t pdsch_start_rb = dlsch0_harq->start_rb; + uint16_t pdsch_nb_rb = dlsch0_harq->nb_rb; + uint16_t s0 = dlsch0_harq->start_symbol; + uint16_t s1 = dlsch0_harq->nb_symbols; LOG_D(PHY,"[UE %d] PDSCH type %d active in nr_slot_rx %d, harq_pid %d (%d), rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask %x\n",ue->Mod_id,pdsch,nr_slot_rx,harq_pid,dlsch0->harq_processes[harq_pid]->status,pdsch_start_rb,pdsch_nb_rb,s0,s1,dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos); @@ -766,10 +764,15 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ } uint16_t first_symbol_with_data = s0; - uint8_t pilots = ((1<dlDmrsSymbPos)>0 ? 1 : 0; - uint32_t len = (pilots==1)? ((ue->dmrs_DownlinkConfig.pdsch_dmrs_type==pdsch_dmrs_type1)?nb_rb*(12-6*dlsch0_harq->n_dmrs_cdm_groups): nb_rb*(12-4*dlsch0_harq->n_dmrs_cdm_groups)):(nb_rb*12); - if(len == 0) { - first_symbol_with_data = first_symbol_with_data + 1; // TODO: Replace "1" by dmrs duration + uint32_t dmrs_data_re; + + if (ue->dmrs_DownlinkConfig.pdsch_dmrs_type == pdsch_dmrs_type1) + dmrs_data_re = 12 - 6 * dlsch0_harq->n_dmrs_cdm_groups; + else + dmrs_data_re = 12 - 4 * dlsch0_harq->n_dmrs_cdm_groups; + + while ((dmrs_data_re == 0) && (dlsch0_harq->dlDmrsSymbPos & (1 << first_symbol_with_data))) { + first_symbol_with_data++; } for (m = s0; m < (s1 + s0); m++) { @@ -778,9 +781,10 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ eNB_id_i = eNB_id+1; i_mod = 0; if (( m==first_symbol_with_data ) && (m<4)) - first_symbol_flag = 1; + first_symbol_flag = 1; else - first_symbol_flag = 0; + first_symbol_flag = 0; + #if UE_TIMING_TRACE uint8_t slot = 0; if(m >= ue->frame_parms.symbols_per_slot>>1) @@ -805,8 +809,8 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ return -1; } else { // This is to adjust the llr offset in the case of skipping over a dmrs symbol (i.e. in case of no PDSCH REs in DMRS) - if (pdsch == RA_PDSCH) ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]=ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m-1]; - else if (pdsch == PDSCH || pdsch == SI_PDSCH) { + if (pdsch == RA_PDSCH) ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]=ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m-1]; + else if (pdsch == PDSCH || pdsch == SI_PDSCH) { if (nr_rx_pdsch(ue, proc, pdsch, @@ -821,7 +825,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ dlsch0->current_harq_pid) < 0) return -1; } - else AssertFatal(1==0,"Not RA_PDSCH, SI_PDSCH or PDSCH\n"); + else AssertFatal(1==0,"Not RA_PDSCH, SI_PDSCH or PDSCH\n"); } if (pdsch == PDSCH) LOG_D(PHY,"Done processing symbol %d : llr_offset %d\n",m,ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]); #if UE_TIMING_TRACE diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index ce0505a4c0..3d4c3ff92e 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -274,7 +274,6 @@ RUs = ( eNB_instances = [0]; #beamforming 1x4 matrix: bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; - sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; clock_src = "internal"; } ); From 8380136c3a0c1575b2be3f46879909c67dcc0ec1 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 10 Dec 2020 01:12:03 +0000 Subject: [PATCH 115/160] SIB1 with dmrs-AdditionalPosition = pos2 --- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 12 ++++++------ openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 3 +-- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 1 + openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 15 ++++++++++----- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index ac559aa8dd..5238fb8f97 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -781,9 +781,9 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ eNB_id_i = eNB_id+1; i_mod = 0; if (( m==first_symbol_with_data ) && (m<4)) - first_symbol_flag = 1; + first_symbol_flag = 1; else - first_symbol_flag = 0; + first_symbol_flag = 0; #if UE_TIMING_TRACE uint8_t slot = 0; @@ -794,7 +794,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ // process DLSCH received in first slot // skip DMRS symbols (will have to check later if PDSCH/DMRS are multiplexed if (((1<harq_processes[harq_pid]->dlDmrsSymbPos) == 0) { - if (nr_rx_pdsch(ue, + if (nr_rx_pdsch(ue, proc, pdsch, eNB_id, @@ -807,9 +807,9 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ i_mod, dlsch0->current_harq_pid) < 0) return -1; - } + } else { // This is to adjust the llr offset in the case of skipping over a dmrs symbol (i.e. in case of no PDSCH REs in DMRS) - if (pdsch == RA_PDSCH) ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]=ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m-1]; + if (pdsch == RA_PDSCH) ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]=ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m-1]; else if (pdsch == PDSCH || pdsch == SI_PDSCH) { if (nr_rx_pdsch(ue, proc, @@ -825,7 +825,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ dlsch0->current_harq_pid) < 0) return -1; } - else AssertFatal(1==0,"Not RA_PDSCH, SI_PDSCH or PDSCH\n"); + else AssertFatal(1==0,"Not RA_PDSCH, SI_PDSCH or PDSCH\n"); } if (pdsch == PDSCH) LOG_D(PHY,"Done processing symbol %d : llr_offset %d\n",m,ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]); #if UE_TIMING_TRACE diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 96f70d46af..12245a96d0 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -2826,8 +2826,7 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i case 5 : case 6 : case 7 : - AssertFatal(1==0,"Incoompatible NrOfSymbols %d and dmrs_Additional_Position %d\n", - NrOfSymbols,(int)*dmrs_config->dmrs_AdditionalPosition); + return(1<BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; // For PDSCH with mapping type A, the UE shall assume dmrs-AdditionalPosition='pos2' } else { dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 262c34cf7d..17928df6b8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -246,7 +246,7 @@ void schedule_control_sib1(module_id_t module_id, fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset,servingcellconfigcommon); fill_default_initialDownlinkBWP(gNB_mac->sched_ctrlCommon->active_bwp,servingcellconfigcommon); } - //gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; + gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation; gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx; @@ -286,6 +286,8 @@ void schedule_control_sib1(module_id_t module_id, // Calculate number of PRB_DMRS uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; + uint16_t dlDmrsSymbPos = fill_dmrs_mask(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, startSymbolIndex+nrOfSymbols); + uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos); int rbSize = 0; uint32_t TBS = 0; @@ -293,8 +295,9 @@ void schedule_control_sib1(module_id_t module_id, rbSize++; TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - rbSize, nrOfSymbols, N_PRB_DMRS,0, 0,1) >> 3; - } while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes); + rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3; + } while ( (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes) || (TBS%8!=0) ); + gNB_mac->sched_ctrlCommon->rbSize = rbSize; gNB_mac->sched_ctrlCommon->rbStart = 0; @@ -445,7 +448,7 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) // TODO: Get these values from RRC const int CC_id = 0; - int time_domain_allocation = 4; // For OAI-UE (0-4), For 3rd party implementation and 3GPP compliant (4) + int time_domain_allocation = 0; uint8_t mcsTableIdx = 0; uint8_t mcs = 6; @@ -473,10 +476,12 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) // Calculate number of PRB_DMRS uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; + uint16_t dlDmrsSymbPos = fill_dmrs_mask(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, startSymbolIndex+nrOfSymbols); + uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos); const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS,0 ,0 ,1 ) >> 3; + gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0 ,0 ,1 ) >> 3; nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, TBS, startSymbolIndex, nrOfSymbols); From 06d76641677f0986a303b628155cf9c1281aadfb Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 10 Dec 2020 09:51:23 +0100 Subject: [PATCH 116/160] schedule 2nd DL slot in 3 instead of 2 --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index e4c2e11d7d..e7a80154ea 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -412,7 +412,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, nr_rrc_trigger(&ctxt, 0 /*CC_id*/, frame, slot >> *scc->ssbSubcarrierSpacing); } - const uint64_t dlsch_in_slot_bitmap = (1 << 1) | (1 << 2); + const uint64_t dlsch_in_slot_bitmap = (1 << 1) | (1 << 3); const uint64_t ulsch_in_slot_bitmap = (1 << 8); memset(RC.nrmac[module_idP]->cce_list[bwp_id][0],0,MAX_NUM_CCE*sizeof(int)); // coreset0 diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index a9839ed985..c84755db3e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -424,8 +424,7 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id, find_aggregation_candidates(&sched_ctrl->aggregation_level, &nr_of_candidates, sched_ctrl->search_space); - sched_ctrl->coreset = get_coreset( - sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */); + sched_ctrl->coreset = get_coreset(sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /*dedicated*/); int cid = sched_ctrl->coreset->controlResourceSetId; const uint16_t Y = UE_info->Y[UE_id][cid][slot]; const int m = UE_info->num_pdcch_cand[UE_id][cid]; From ee54e20ed99f1408ca6d7774b8aee8733f454a81 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Thu, 10 Dec 2020 10:30:23 +0100 Subject: [PATCH 117/160] change assertion to error if no CCE is found --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index d34dc2d433..046a162881 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -195,12 +195,9 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, const uint16_t N_cce = N_reg / NR_NB_REG_PER_CCE; const uint16_t M_s_max = nr_of_candidates; - AssertFatal(m < nr_of_candidates, - "PDCCH candidate index %d in CORESET %d exceeds the maximum " - "number of PDCCH candidates (%d)\n", - m, - coreset_id, - nr_of_candidates); + //PDCCH candidate index m in CORESET exceeds the maximum number of PDCCH candidates + if(m >= nr_of_candidates) + return -1; int first_cce = aggregation * (( Y + CEILIDIV((m*N_cce),(aggregation*M_s_max)) + n_CI ) % CEILIDIV(N_cce,aggregation)); From 519ab68b211c3920a612d15d19d79ff25f55bd4a Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Thu, 10 Dec 2020 20:27:55 +0900 Subject: [PATCH 118/160] Fix some merge miss. --- openair1/PHY/LTE_TRANSPORT/dci_tools.c | 2 ++ openair1/PHY/LTE_TRANSPORT/phich.c | 11 ++++++--- openair1/PHY/LTE_TRANSPORT/phich_common.c | 28 +++++++++++++++++++++++ openair1/PHY/LTE_TRANSPORT/pucch.c | 6 ++--- 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index 8de011acef..4b06f67bbe 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -2071,6 +2071,8 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu ulsch->harq_processes[harq_pid]->round++; ulsch->harq_processes[harq_pid]->TBS = ulsch_pdu->ulsch_pdu_rel8.size<<3; ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks; + ulsch->harq_processes[harq_pid]->Or1 = 0; + ulsch->harq_processes[harq_pid]->Or2 = 0; } ulsch->rnti = ulsch_pdu->ulsch_pdu_rel8.rnti; diff --git a/openair1/PHY/LTE_TRANSPORT/phich.c b/openair1/PHY/LTE_TRANSPORT/phich.c index 6d8b58818b..1725588f4c 100644 --- a/openair1/PHY/LTE_TRANSPORT/phich.c +++ b/openair1/PHY/LTE_TRANSPORT/phich.c @@ -716,6 +716,7 @@ void generate_phich_top(PHY_VARS_eNB *eNB, uint8_t NSF_PHICH = 4; uint8_t pusch_subframe=-1; uint8_t i; + uint8_t harq_pid = 0; int subframe = proc->subframe_tx; phich_config_t *phich; @@ -748,16 +749,20 @@ void generate_phich_top(PHY_VARS_eNB *eNB, nseq_PHICH = ((phich->first_rb/Ngroup_PHICH) + phich->n_DMRS)%(2*NSF_PHICH); + harq_pid = subframe2harq_pid(frame_parms,phich_frame2_pusch_frame(frame_parms,proc->frame_tx,subframe),pusch_subframe); + if (harq_pid == 255) { + LOG_E(PHY,"FATAL ERROR: illegal harq_pid, returning\n"); + return; + } LOG_D(PHY,"[eNB %d][PUSCH %d] Frame %d subframe %d Generating PHICH, AMP %d ngroup_PHICH %d/%d, nseq_PHICH %d : HI %d, first_rb %d)\n", - eNB->Mod_id,subframe2harq_pid(frame_parms, - phich_frame2_pusch_frame(frame_parms,proc->frame_tx,subframe),pusch_subframe),proc->frame_tx, + eNB->Mod_id,harq_pid,proc->frame_tx, subframe,amp,ngroup_PHICH,Ngroup_PHICH,nseq_PHICH, phich->hi, phich->first_rb); T(T_ENB_PHY_PHICH, T_INT(eNB->Mod_id), T_INT(proc->frame_tx), T_INT(subframe), T_INT(-1 /* TODO: rnti */), - T_INT(subframe2harq_pid(frame_parms,phich_frame2_pusch_frame(frame_parms,proc->frame_tx,subframe),pusch_subframe)), + T_INT(harq_pid), T_INT(Ngroup_PHICH), T_INT(NSF_PHICH), T_INT(ngroup_PHICH), T_INT(nseq_PHICH), T_INT(phich->hi), diff --git a/openair1/PHY/LTE_TRANSPORT/phich_common.c b/openair1/PHY/LTE_TRANSPORT/phich_common.c index 89c826be66..302229b88d 100644 --- a/openair1/PHY/LTE_TRANSPORT/phich_common.c +++ b/openair1/PHY/LTE_TRANSPORT/phich_common.c @@ -102,6 +102,34 @@ unsigned char subframe2_ul_harq(LTE_DL_FRAME_PARMS *frame_parms,unsigned char su return(subframe&7); switch (frame_parms->tdd_config) { + case 1: + if (subframe == 6) { + return(0); + } else if (subframe==9){ + return(1); + } else if (subframe==1){ + return(2); + } else if (subframe==4){ + return(3); + } else { + LOG_E(PHY,"phich.c: subframe2_ul_harq, illegal subframe %d for tdd_config %d\n", + subframe,frame_parms->tdd_config); + return(0); + } + + break; + case 2: + if (subframe == 3) { + return(1); + } else if (subframe==8){ + return(0); + } else { + LOG_E(PHY,"phich.c: subframe2_ul_harq, illegal subframe %d for tdd_config %d\n", + subframe,frame_parms->tdd_config); + return(0); + } + + break; case 3: if ( (subframe == 8) || (subframe == 9) ) { return(subframe-8); diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c index fa4d883d64..c72fa1b480 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch.c @@ -741,7 +741,7 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, uint8_t m,l; uint8_t n_cs,alpha_ind; int16_t tmp_re,tmp_im,W_re=0,W_im=0; - int16_t W4_nouse[4]={1,1,-1,-1}; + int16_t W4_nouse[4]={32767,32767,-32768,-32768}; int32_t n0_IQ[2]; double interference_power; int16_t *rxptr; @@ -846,7 +846,7 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, } // antenna } interference_power /= calc_cnt; - eNB->measurements.n0_pucch_dB = dB_fixed_x10((int)(interference_power/calc_cnt))/10; + eNB->measurements.n0_pucch_dB = dB_fixed_x10((int)interference_power)/10; LOG_D(PHY,"estimate pucch noise %lf %d %d\n",interference_power,calc_cnt,eNB->measurements.n0_pucch_dB); return 0; } @@ -1188,7 +1188,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, #endif } - stat += (stat_re*stat_re); + stat += ((stat_re*stat_re) + (stat_im*stat_im)); } //re } // aa From 205d98bdb93aa776ba488fb34e045a4c13e26c07 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 10 Dec 2020 16:13:42 +0000 Subject: [PATCH 119/160] Fix for TBS = 84 --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 17928df6b8..66766535e8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -296,7 +296,9 @@ void schedule_control_sib1(module_id_t module_id, TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3; - } while ( (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes) || (TBS%8!=0) ); + + // FIXME: Something is not working in nr_modulation() for TBS = 84, so we need to skip it + } while ( (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes) || (TBS==84) ); gNB_mac->sched_ctrlCommon->rbSize = rbSize; gNB_mac->sched_ctrlCommon->rbStart = 0; @@ -305,6 +307,7 @@ void schedule_control_sib1(module_id_t module_id, LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex); LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols); LOG_D(MAC,"rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); + LOG_D(MAC,"TBS = %i\n", TBS); // Mark the corresponding RBs as used for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) { From 58d2aafb5f8e080545a3c3d8fc245ab8b1deec33 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 10 Dec 2020 17:24:56 +0000 Subject: [PATCH 120/160] Minor updates in documentation --- doc/RUNMODEM.md | 8 ++++++++ openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 9 ++------- openair2/LAYER2/NR_MAC_UE/config_ue.c | 1 - 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index 9f4564a0ca..00ca4582e2 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -142,6 +142,14 @@ In order to run gNB in standalone mode, the following flag is needed at gNB: ### Run OAI in sa mode +At the gNB the --sa flag does the following +- it reads the RRC configuration from the configuration file +- it encodes the RRCConfiguration and the RBconfig message and stores them in the binary files rbconfig.raw and reconfig.raw +- the RRC encodes SIB1 according the configuration file and transmits it through PDSCH + +At the UE the --phy-test flag will +- read the binary files rbconfig.raw and reconfig.raw from the current directory (a different directory can be specified with the flag --rrc_config_path) and process them. + From the `cmake_targets/ran_build/build` folder: gNB on machine 1: diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index e0bf63a8d3..f48a3eeb71 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -60,8 +60,8 @@ #define MAX_FDM (8) // Maximum nb of PRACH occasions FDMed in a slot typedef enum frequency_range_e { - FR1 = 0, - FR2 + FR1 = 0, + FR2 } frequency_range_t; // PRACH occasion details @@ -131,11 +131,6 @@ typedef enum channel_bandwidth_e { bw_100MHz = 0x32 } channel_bandwidth_t; -typedef enum frequency_range_e { - FR1 = 0, - FR2 -} frequency_range_t; - typedef enum nr_ssb_and_cset_mux_pattern_type_e { NR_SSB_AND_CSET_MUX_PATTERN_TYPE1=1, NR_SSB_AND_CSET_MUX_PATTERN_TYPE2, diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 49780039a0..31b96018e3 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -390,7 +390,6 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ NR_SearchSpace_t *css = commonSearchSpaceList->list.array[css_id]; AssertFatal(css->controlResourceSetId != NULL, "ss->controlResourceSetId is null\n"); AssertFatal(*css->controlResourceSetId == mac->coreset[bwp_id - 1][coreset_id - 1]->controlResourceSetId, "ss->controlResourceSetId is unknown\n"); - AssertFatal(&css->searchSpaceId != NULL, "css->searchSpaceId is null\n"); AssertFatal(css->searchSpaceType != NULL, "css->searchSpaceType is null\n"); AssertFatal(css->monitoringSymbolsWithinSlot != NULL, "css->monitoringSymbolsWithinSlot is null\n"); AssertFatal(css->monitoringSymbolsWithinSlot->buf != NULL, "css->monitoringSymbolsWithinSlot->buf is null\n"); From 8c9753ca3c0f419dbef5e1cba43df2cfdf19e81e Mon Sep 17 00:00:00 2001 From: He Shanyun Date: Fri, 11 Dec 2020 16:28:03 +0900 Subject: [PATCH 121/160] fix issue about error locking mutex_rxtx of L2 sim --- nfapi/oai_integration/nfapi_vnf.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index b93cb9c342..f76cad87f7 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -333,11 +333,11 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) { // wake up TX for subframe n+sf_ahead // lock the TX mutex and make sure the thread is ready - if (pthread_mutex_timedlock(&L1_proc->mutex,&wait) != 0) { - LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)\n", L1_proc->subframe_rx&1,L1_proc->instance_cnt ); - exit_fun( "error locking mutex_rxtx" ); - return(-1); - } + //if (pthread_mutex_timedlock(&L1_proc->mutex,&wait) != 0) { + // LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)\n", L1_proc->subframe_rx&1,L1_proc->instance_cnt ); + // exit_fun( "error locking mutex_rxtx" ); + // return(-1); + //} { static uint16_t old_sf = 0; @@ -405,9 +405,6 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) { return(-1); } - //LOG_D(PHY,"%s() About to attempt pthread_mutex_unlock\n", __FUNCTION__); - pthread_mutex_unlock( &L1_proc->mutex ); - //LOG_D(PHY,"%s() UNLOCKED pthread_mutex_unlock\n", __FUNCTION__); return(0); } From 65bad0f5a87b632f16f215a8c8e27fa67860e947 Mon Sep 17 00:00:00 2001 From: He Shanyun Date: Fri, 11 Dec 2020 16:42:58 +0900 Subject: [PATCH 122/160] fix cppcheck warning --- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 475b819d6c..77eab37f57 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -169,9 +169,10 @@ rx_sdu(const module_id_t enb_mod_idP, */ UE_scheduling_control->ta_update_f = ((double)UE_scheduling_control->ta_update_f * 3 + (double)timing_advance) / 4; UE_scheduling_control->ta_update = (int)UE_scheduling_control->ta_update_f; - UE_scheduling_control->pusch_snr[CC_idP] = (5 * ul_cqi - 640) / 10; - - if(UE_scheduling_control->pusch_snr[CC_idP] > 0 || UE_scheduling_control->pusch_snr[CC_idP] < 63) { + int tmp_snr = (5 * ul_cqi - 640) / 10; + UE_scheduling_control->pusch_snr[CC_idP] = tmp_snr; + + if(tmp_snr > 0 && tmp_snr < 63) { double snr_filter_tpc=0.7; int snr_thres_tpc=30; int diff = UE_scheduling_control->pusch_snr_avg[CC_idP] - UE_scheduling_control->pusch_snr[CC_idP]; From 9fae23b625a4e04d84270e68f0e6ed7ab57771e4 Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Fri, 11 Dec 2020 18:14:06 +0100 Subject: [PATCH 123/160] quick fix for nb of rb allocated in phytest for ul --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 851540b2f2..a33f87d757 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -389,8 +389,12 @@ void nr_ul_preprocessor_phytest(module_id_t module_id, if (!(is_xlsch_in_slot(ulsch_in_slot_bitmap, sched_slot) && sched_slot == 8)) return; - const uint16_t rbStart = 0; - const uint16_t rbSize = 50; /* due to OAI UE limitations */ + const int bw = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, 275); + uint16_t rbStart = 0; + uint16_t rbSize = 50; /* due to OAI UE limitations */ + if (rbSize>bw) + rbSize = bw; + uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * 275]; for (int i = rbStart; i < rbStart + rbSize; ++i) { From b125b93e9e0f7543e348a2a555b806b8759242dd Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Tue, 15 Dec 2020 18:19:22 +0900 Subject: [PATCH 124/160] Fix log and minor bugs. --- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 77eab37f57..edb8c18c78 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -203,7 +203,7 @@ rx_sdu(const module_id_t enb_mod_idP, } } else { // sduP == NULL => error UE_scheduling_control->pusch_rx_error_num[CC_idP]++; - LOG_W(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d, UE_id %d, RNTI %x (len %d)\n", + LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d, UE_id %d, RNTI %x (len %d)\n", enb_mod_idP, harq_pid, CC_idP, @@ -213,10 +213,10 @@ rx_sdu(const module_id_t enb_mod_idP, ul_cqi, UE_id, current_rnti, - sdu_lenP); + sdu_lenP); if (ul_cqi > 200) { // too high energy pattern - UE_scheduling_control->pusch_snr[CC_idP] = ul_cqi; + UE_scheduling_control->pusch_snr[CC_idP] = (5 * ul_cqi - 640) / 10; LOG_W(MAC, "[MAC] Too high energy pattern\n"); } From dc4dd10d1a77309147e90ff05efb82e839e83178 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 16 Dec 2020 18:02:24 +0000 Subject: [PATCH 125/160] RA BWP fix at UE --- doc/RUNMODEM.md | 6 +++--- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 20 +++++++------------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/doc/RUNMODEM.md b/doc/RUNMODEM.md index 00ca4582e2..d13b193ff9 100644 --- a/doc/RUNMODEM.md +++ b/doc/RUNMODEM.md @@ -147,7 +147,7 @@ At the gNB the --sa flag does the following - it encodes the RRCConfiguration and the RBconfig message and stores them in the binary files rbconfig.raw and reconfig.raw - the RRC encodes SIB1 according the configuration file and transmits it through PDSCH -At the UE the --phy-test flag will +At the UE the --sa flag will - read the binary files rbconfig.raw and reconfig.raw from the current directory (a different directory can be specified with the flag --rrc_config_path) and process them. From the `cmake_targets/ran_build/build` folder: @@ -158,13 +158,13 @@ gNB on machine 1: UE on machine 2: -`sudo ./nr-uesoftmodem --rrc_config_path . --phy-test` +`sudo ./nr-uesoftmodem --rrc_config_path . --sa` With the RF simulator (on the same machine): `sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --rfsim --sa` -`sudo ./nr-uesoftmodem --rrc_config_path . --rfsim --phy-test` +`sudo ./nr-uesoftmodem --rrc_config_path . --rfsim --sa` ## IF setup with OAI diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 59a182fba6..a0ddfe84db 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3367,24 +3367,18 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; - NR_ServingCellConfigCommon_t *scc = mac->scc; - NR_BWP_DownlinkCommon_t *initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP; - - if (mac->RA_window_cnt >= 0 && rnti == mac->ra_rnti){ - dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH; - dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); - dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); - dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; - } - else if(rnti == SI_RNTI) { + if(rnti == SI_RNTI) { dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH; dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; // For PDSCH with mapping type A, the UE shall assume dmrs-AdditionalPosition='pos2' - } - else { - dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; + } else { + if (mac->RA_window_cnt >= 0 && rnti == mac->ra_rnti){ + dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH; + } else { + dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; + } dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; From 6b8ffb43c12ab13ba0c5fb670082c26b95b2a263 Mon Sep 17 00:00:00 2001 From: dir Date: Thu, 3 Dec 2020 12:53:11 +0200 Subject: [PATCH 126/160] fix DFT bug identified by Laurent Thomas --- openair1/PHY/TOOLS/oai_dfts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/TOOLS/oai_dfts.c b/openair1/PHY/TOOLS/oai_dfts.c index 25244eeff5..e4e85f7ba9 100644 --- a/openair1/PHY/TOOLS/oai_dfts.c +++ b/openair1/PHY/TOOLS/oai_dfts.c @@ -112,7 +112,7 @@ static inline void cmac_256(__m256i a,__m256i b, __m256i *re32, __m256i *im32) { __m256i cmac_tmp,cmac_tmp_re32,cmac_tmp_im32; - __m256i imshuffle = _mm256_set_epi8(29,28,31,30,25,24,27,26,21,20,19,18,17,16,19,18,13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2); + __m256i imshuffle = _mm256_set_epi8(29,28,31,30,25,24,27,26,21,20,23,22,17,16,19,18,13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2); cmac_tmp = _mm256_sign_epi16(b,*(__m256i*)reflip); cmac_tmp_re32 = _mm256_madd_epi16(a,cmac_tmp); @@ -129,7 +129,7 @@ static inline void cmacc_256(__m256i a,__m256i b, __m256i *re32, __m256i *im32) { __m256i cmac_tmp,cmac_tmp_re32,cmac_tmp_im32; - __m256i imshuffle = _mm256_set_epi8(29,28,31,30,25,24,27,26,21,20,19,18,17,16,19,18,13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2); + __m256i imshuffle = _mm256_set_epi8(29,28,31,30,25,24,27,26,21,20,23,22,17,16,19,18,13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2); cmac_tmp_re32 = _mm256_madd_epi16(a,b); From a17f00784ca0207f2d5d4300ef2d8e8c636e1a78 Mon Sep 17 00:00:00 2001 From: dir Date: Thu, 3 Dec 2020 12:57:36 +0200 Subject: [PATCH 127/160] NR_SC_FDMA changes - CDM groups used, multiple DMRS locations tested - REMOVED compiler define NR_SC_FDMA - enabled -Z option in ulsim for testing NR SC-FDMA - Gnb UL Processing of LLRS even if last symbol allocated has no data - transform precoding Enumerations used --- cmake_targets/CMakeLists.txt | 1 + openair1/PHY/INIT/nr_init.c | 11 ++ .../NR_ESTIMATION/nr_ul_channel_estimation.c | 32 ++++- openair1/PHY/NR_REFSIG/nr_dmrs_rx.c | 48 +++++++ openair1/PHY/NR_REFSIG/nr_refsig.h | 14 ++ openair1/PHY/NR_REFSIG/ul_ref_seq_nr.c | 129 +++++++++++++++--- openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h | 75 +++++++++- .../PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 72 ++++++---- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 120 ++++++++++++---- openair1/PHY/defs_nr_common.h | 5 - openair1/PHY/impl_defs_nr.h | 8 +- openair1/SIMULATION/NR_PHY/ulsim.c | 71 +++++++++- 12 files changed, 494 insertions(+), 92 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 0b9d925017..cf7d95739a 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1758,6 +1758,7 @@ set(PHY_SRC_UE ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_prach.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c + ${OPENAIR1_DIR}/PHY/NR_REFSIG/ul_ref_seq_nr.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_csi_rs.c ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 49ec60c94b..70f57dd4d1 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -43,6 +43,8 @@ #include "SCHED_NR/fapi_nr_l1.h" #include "nfapi_nr_interface.h" +#include "PHY/NR_REFSIG/ul_ref_seq_nr.h" + /* extern uint32_t from_nrarfcn(int nr_bandP,uint32_t dl_nrarfcn); extern openair0_config_t openair0_cfg[MAX_CARDS]; @@ -194,6 +196,10 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, } } + /* Generate low PAPR type 1 sequences for PUSCH DMRS, these are used if transform precoding is enabled. */ + generate_lowpapr_typ1_refsig_sequences(SHRT_MAX); + + nr_init_csi_rs(gNB, 0); // TODO scramblingID currently hardcoded to 0, to be taken from higher layer parameter scramblingID when implemented /// Transport init necessary for NR synchro @@ -388,6 +394,11 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) /* for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) gNB->UE_stats_ptr[UE_id] = NULL; */ + + + free_gnb_lowpapr_sequences(); + + } /* void install_schedule_handlers(IF_Module_t *if_inst) diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c index 27c1ef2ac6..713e71674b 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c @@ -30,6 +30,9 @@ #include "PHY/NR_TRANSPORT/nr_transport_proto.h" #include "PHY/NR_UE_ESTIMATION/filt16a_32.h" +#include "PHY/NR_REFSIG/ul_ref_seq_nr.h" + + //#define DEBUG_CH //#define DEBUG_PUSCH @@ -119,15 +122,36 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, break; } - //------------------generate DMRS------------------// - if (pusch_pdu->transform_precoding==1) // if transform precoding is disabled + if (pusch_pdu->transform_precoding == transform_precoder_disabled) nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch, pusch_pdu->rb_start*NR_NB_SC_PER_RB, pusch_pdu->dmrs_config_type); - else - nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch, 0, pusch_pdu->dmrs_config_type); + + else { // if transform precoding or SC-FDMA is enabled in Uplink + // NR_SC_FDMA supports type1 DMRS so only 6 DMRS REs per RB possible + uint16_t index = get_index_for_dmrs_lowpapr_seq(nb_rb_pusch * (NR_NB_SC_PER_RB/2)); + uint8_t u = pusch_pdu->dfts_ofdm.low_papr_group_number; + uint8_t v = pusch_pdu->dfts_ofdm.low_papr_sequence_number; + int16_t *dmrs_seq = gNB_dmrs_lowpaprtype1_sequence[u][v][index]; + + AssertFatal(index >= 0, "Num RBs not configured according to 3GPP 38.211 section 6.3.1.4. For PUSCH with transform precoding, num RBs cannot be multiple of any other primenumber other than 2,3,5\n"); + AssertFatal(dmrs_seq != NULL, "DMRS low PAPR seq not found, check if DMRS sequences are generated"); + + LOG_D(PHY,"Transform Precoding params. u: %d, v: %d, index for dmrsseq: %d\n", u, v, index); + + nr_pusch_lowpaprtype1_dmrs_rx(gNB, Ns, dmrs_seq, &pilot[0], 1000, 0, nb_rb_pusch, 0, pusch_pdu->dmrs_config_type); + + #ifdef DEBUG_PUSCH + printf ("NR_UL_CHANNEL_EST: index %d, u %d,v %d\n", index, u, v); + LOG_M("gNb_DMRS_SEQ.m","gNb_DMRS_SEQ", dmrs_seq,6*nb_rb_pusch,1,1); + #endif + + } //------------------------------------------------// + + + #ifdef DEBUG_PUSCH for (int i=0;i<(6*nb_rb_pusch);i++) printf("%d+j*(%d)\n",((int16_t*)pilot)[2*i],((int16_t*)pilot)[1+(2*i)]); diff --git a/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c b/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c index 764885dbf8..5d62f9dbb9 100644 --- a/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c +++ b/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c @@ -247,3 +247,51 @@ void nr_gen_ref_conj_symbols(uint32_t *in, uint32_t length, int16_t *output, uin output[(i<<1)+1] = nr_rx_mod_table[((offset+idx)<<1)+1]; } } + +int nr_pusch_lowpaprtype1_dmrs_rx(PHY_VARS_gNB *gNB, + unsigned int Ns, + int16_t *dmrs_seq, + int32_t *output, + unsigned short p, + unsigned char lp, + unsigned short nb_pusch_rb, + uint32_t re_offset, + uint8_t dmrs_type) +{ + int8_t w, nb_dmrs; + int k; + + int dmrs_offset = re_offset/((dmrs_type==pusch_dmrs_type1)?2:3); + + if (dmrs_type != pusch_dmrs_type1) + LOG_E(PHY,"PUSCH DMRS config type %d not valid\n", dmrs_type); + + if ((p>=1000) && (p<1008)) { + if (gNB->frame_parms.Ncp == NORMAL) { + nb_dmrs = NR_NB_SC_PER_RB/2; // for DMRS TYPE 1 - 6 DMRS REs present per RB + for (int i=dmrs_offset; i= dmrs_ul_allocated_res[(MAX_INDEX_DMRS_UL_ALLOCATED_REs-1)]) + index = MAX_INDEX_DMRS_UL_ALLOCATED_REs-1; + else + index = (num_dmrs_res/6) -1; + + for (;index >= 0; index--) { + if (dmrs_ul_allocated_res[index] == num_dmrs_res) + break; + + } + + LOG_D(PHY, "num_dmrs_res: %d INDEX RETURNED: %d", num_dmrs_res, index); + return index; + +} + /******************************************************************* * * NAME : base_sequence_36_or_larger @@ -126,13 +159,19 @@ int16_t *base_sequence_less_than_36(unsigned int M_ZC, int16_t *base_sequence_36_or_larger(unsigned int Msc_RS, unsigned int u, unsigned int v, - unsigned int scaling) + unsigned int scaling, unsigned int if_dmrs_seq) { int16_t *rv_overbar; - unsigned int N_ZC; + unsigned int N_ZC, M_ZC; double q_overbar, x; unsigned int q,m,n; - unsigned int M_ZC = ul_allocated_re[Msc_RS]; + + + if (if_dmrs_seq) + M_ZC = dmrs_ul_allocated_res[Msc_RS]; + else + M_ZC = ul_allocated_re[Msc_RS]; + rv_overbar = malloc16(IQ_SIZE*M_ZC); if (rv_overbar == NULL) { @@ -140,7 +179,11 @@ int16_t *base_sequence_36_or_larger(unsigned int Msc_RS, assert(0); } - N_ZC = ref_ul_primes[Msc_RS]; /* The length N_ZC is given by the largest prime number such that N_ZC < M_ZC */ + if (if_dmrs_seq) + N_ZC = dmrs_ref_ul_primes[Msc_RS]; + else + N_ZC = ref_ul_primes[Msc_RS]; /* The length N_ZC is given by the largest prime number such that N_ZC < M_ZC */ + q_overbar = N_ZC * (u+1)/(double)31; @@ -159,19 +202,24 @@ int16_t *base_sequence_36_or_larger(unsigned int Msc_RS, return rv_overbar; } -/******************************************************************* -* -* NAME : generate_ul_srs_sequences -* -* PARAMETERS : scaling to apply -* -* RETURN : none -* -* DESCRIPTION : uplink reference signal sequences generation -* which are Low-PAPR base sequences -* see TS 38.211 5.2.2 Low-PAPR sequence generation -* -*********************************************************************/ +void generate_lowpapr_typ1_refsig_sequences(unsigned int scaling) +{ + unsigned int u,Msc_RS; + unsigned int v = 0; // sequence hopping and group hopping are not supported yet + + for (Msc_RS=0; Msc_RS <= INDEX_SB_LESS_32; Msc_RS++) { + for (u=0; u < U_GROUP_NUMBER; u++) { + gNB_dmrs_lowpaprtype1_sequence[u][v][Msc_RS] = base_sequence_less_than_36(ul_allocated_re[Msc_RS], u, scaling); + } + } + + for (Msc_RS=INDEX_SB_LESS_32+1; Msc_RS < MAX_INDEX_DMRS_UL_ALLOCATED_REs; Msc_RS++) { + for (u=0; u < U_GROUP_NUMBER; u++) { + gNB_dmrs_lowpaprtype1_sequence[u][v][Msc_RS] = base_sequence_36_or_larger(Msc_RS, u, v, scaling, 1); + } + } +} + void generate_ul_reference_signal_sequences(unsigned int scaling) { @@ -184,10 +232,13 @@ void generate_ul_reference_signal_sequences(unsigned int scaling) #endif + for (Msc_RS=0; Msc_RS <= INDEX_SB_LESS_32; Msc_RS++) { - v = 0; + v = 0; for (u=0; u < U_GROUP_NUMBER; u++) { rv_ul_ref_sig[u][v][Msc_RS] = base_sequence_less_than_36(ul_allocated_re[Msc_RS], u, scaling); + dmrs_lowpaprtype1_ul_ref_sig[u][v][Msc_RS] = base_sequence_less_than_36(ul_allocated_re[Msc_RS], u, scaling); + #if 0 sprintf(output_file, "rv_seq_%d_%d_%d.m", u, v, ul_allocated_re[Msc_RS]); sprintf(sequence_name, "rv_seq_%d_%d_%d.m", u, v, ul_allocated_re[Msc_RS]); @@ -198,10 +249,19 @@ void generate_ul_reference_signal_sequences(unsigned int scaling) } } + for (Msc_RS=INDEX_SB_LESS_32+1; Msc_RS < MAX_INDEX_DMRS_UL_ALLOCATED_REs; Msc_RS++) { + v = 0; // neither group hopping or sequnce hopping is supported for PUSCH DMRS hence v = 0 + for (u=0; u < U_GROUP_NUMBER; u++) { + dmrs_lowpaprtype1_ul_ref_sig[u][v][Msc_RS] = base_sequence_36_or_larger(Msc_RS, u, v, scaling, 1); + } + + } + for (Msc_RS=INDEX_SB_LESS_32+1; Msc_RS < SRS_SB_CONF; Msc_RS++) { for (u=0; u < U_GROUP_NUMBER; u++) { - for (v=0; v < V_BASE_SEQUENCE_NUMBER; v++) { - rv_ul_ref_sig[u][v][Msc_RS] = base_sequence_36_or_larger(Msc_RS, u, v, scaling); + for (v=0; v < V_BASE_SEQUENCE_NUMBER; v++) { + rv_ul_ref_sig[u][v][Msc_RS] = base_sequence_36_or_larger(Msc_RS, u, v, scaling, 0); + #if 0 sprintf(output_file, "rv_seq_%d_%d_%d.m", u, v, ul_allocated_re[Msc_RS]); sprintf(sequence_name, "rv_seq_%d_%d_%d.m", u, v, ul_allocated_re[Msc_RS]); @@ -212,8 +272,11 @@ void generate_ul_reference_signal_sequences(unsigned int scaling) } } } + + } + /******************************************************************* * * NAME : free_ul_reference_signal_sequences @@ -233,7 +296,33 @@ void free_ul_reference_signal_sequences(void) for (v=0; v < V_BASE_SEQUENCE_NUMBER; v++) { if (rv_ul_ref_sig[u][v][Msc_RS]) free16(rv_ul_ref_sig[u][v][Msc_RS],2*sizeof(int16_t)*ul_allocated_re[Msc_RS]); + if ((v==0) && (Msc_RS < MAX_INDEX_DMRS_UL_ALLOCATED_REs)) + if (dmrs_lowpaprtype1_ul_ref_sig[u][v][Msc_RS]) + free16(dmrs_lowpaprtype1_ul_ref_sig[u][v][Msc_RS],2*sizeof(int16_t)*dmrs_ul_allocated_res[Msc_RS]); } } } } +/******************************************************************* +* +* NAME : free_gnb_lowpapr_sequences +* +* PARAMETERS : none +* +* RETURN : none +* +* DESCRIPTION : free of uplink reference signal sequences +* +*********************************************************************/ +void free_gnb_lowpapr_sequences(void) +{ + unsigned int u,v,Msc_RS; + for (Msc_RS=0; Msc_RS < MAX_INDEX_DMRS_UL_ALLOCATED_REs; Msc_RS++) { + v=0; + for (u=0; u < U_GROUP_NUMBER; u++) { + if (gNB_dmrs_lowpaprtype1_sequence[u][v][Msc_RS]) + free16(gNB_dmrs_lowpaprtype1_sequence[u][v][Msc_RS],2*sizeof(int16_t)*dmrs_ul_allocated_res[Msc_RS]); + } + } +} + diff --git a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h index dd967e8e5e..44d30da8f3 100644 --- a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h +++ b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h @@ -38,6 +38,10 @@ #include "PHY/NR_REFSIG/ss_pbch_nr.h" +#include "PHY/defs_nr_common.h" +#include "PHY/defs_gNB.h" + + #ifdef DEFINE_VARIABLES_LOWPAPR_SEQUENCES_NR_H #define EXTERN #define INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H @@ -255,7 +259,10 @@ const char phi_M_ZC_24[24*U_GROUP_NUMBER] ; /************** FUNCTION ******************************************/ -int16_t *base_sequence_36_or_larger(unsigned int M_ZC, unsigned int u, unsigned int v, unsigned int scaling); + +int16_t *base_sequence_36_or_larger(unsigned int M_ZC, unsigned int u, unsigned int v, unsigned int scaling, unsigned int if_dmrs_seq); + + int16_t *base_sequence_less_than_36(unsigned int M_ZC, unsigned int u, unsigned int scaling); /*! \brief This function generate the sounding reference symbol (SRS) for the uplink. @@ -265,6 +272,72 @@ int16_t *base_sequence_less_than_36(unsigned int M_ZC, unsigned int u, unsigned void generate_ul_reference_signal_sequences(unsigned int scaling); void free_ul_reference_signal_sequences(void); + + +// Supported for 100Mhz configuration - which has max 273 RBs +#define MAX_INDEX_DMRS_UL_ALLOCATED_REs 53 + + +const uint16_t dmrs_ul_allocated_res[MAX_INDEX_DMRS_UL_ALLOCATED_REs] +/* Number of possible DMRS REs based on PRBs allocated for PUSCH. Array has values until 273 RBs (100Mhz BW) + Number of PUSCH RBs allocated should be able to be expressed as 2topowerofn*3topowerofn*5tothepowerofn + According to 3GPP spec 38.211 section 6.3.1.4 + Table used in calculating DMRS low papr type1 sequence for transform precoding */ +#ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H += { +/*RBs 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, */ + 6, 12, 18, 24, 30, 36, 48, 54, 60, 72, 90, 96, + +/*RBs 18, 20, 24, 25, 27, 30, 32, 36, 40, 45, 48, 50, */ + 108, 120, 144, 150, 162, 180, 192, 216, 240, 270, 288, 300, + +/*RBs 54, 60, 64, 72 75, 80, 81, 90, 96, 100, (Bw 40Mhz) */ + 324, 360, 384, 432, 450, 480, 486, 540, 576, 600, + +/*RBs 108, 120 125 128 135 144 150 160 162 180 192 200 */ + 648, 720, 750, 768, 810, 864, 900, 960, 972, 1080, 1152, 1200, + +/*RBs 216 225 240 243 250 256 270 supported until 100Mhz */ + 1296, 1350, 1440, 1458, 1500, 1536, 1620 + +} +#endif +; + +/* Table of largest prime number N_ZC < possible DMRS REs M_ZC, this array has values until 100Mhz + According to 3GPP spec 38.211 section 5.2.2.1 + Table used in calculating DMRS low papr type1 sequence for transform precoding */ +const uint16_t dmrs_ref_ul_primes[MAX_INDEX_DMRS_UL_ALLOCATED_REs] +#ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H += { +/*DMRS REs 6, 12, 18, 24, 30, 36, 48, 54, 60, 72, 90, 96, */ + 5, 11, 17, 23, 29, 31, 47, 53, 59, 71, 89, 89, + +/*DMRS REs 108, 120, 144, 150, 162, 180, 192, 216, 240, 270, 288, 300, */ + 107, 113, 139, 149, 157, 179, 191, 211, 239, 269, 283, 293, + +/*DMRS REs 324, 360, 384, 432, 450, 480, 486, 540, 576, 600, */ + 317, 359, 383, 431, 449, 479, 479, 523, 571, 599, + +/*DMRS REs 648, 720, 750, 768, 810, 864, 900, 960, 972, 1080, 1152, 1200, */ + 647, 719, 743, 761, 809, 863, 887, 953, 971, 1069, 1151, 1193, + +/*DMRS REs 1296, 1350, 1440, 1458, 1500, 1536 1620 supported until 100Mhz */ + 1291, 1327, 1439, 1453, 1499, 1531, 1619 + + +} +#endif +; + +/// PUSCH DMRS for transform precoding +int16_t *gNB_dmrs_lowpaprtype1_sequence[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MAX_INDEX_DMRS_UL_ALLOCATED_REs]; +int16_t *dmrs_lowpaprtype1_ul_ref_sig[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MAX_INDEX_DMRS_UL_ALLOCATED_REs]; +int16_t get_index_for_dmrs_lowpapr_seq(int16_t num_dmrs_res); +void generate_lowpapr_typ1_refsig_sequences(unsigned int scaling); +void free_gnb_lowpapr_sequences(void); + + #undef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H #undef EXTERN diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 1372250aca..7b7e54fa43 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -1118,6 +1118,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, } LOG_D(PHY,"dmrs_symbol: nb_re_pusch %d\n",nb_re_pusch); gNB->pusch_vars[ulsch_id]->dmrs_symbol = symbol; + } else { nb_re_pusch = rel15_ul->rb_size * NR_NB_SC_PER_RB; } @@ -1219,9 +1220,21 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, symbol, rel15_ul->rb_size); stop_meas(&gNB->ulsch_mrc_stats); -#ifdef NR_SC_FDMA - nr_idft(&((uint32_t*)gNB->pusch_vars[ulsch_id]->rxdataF_ext[0])[symbol * rel15_ul->rb_size * NR_NB_SC_PER_RB], nb_re_pusch); -#endif + + + if (rel15_ul->transform_precoding == transform_precoder_enabled) { + + #ifdef __AVX2__ + // For odd number of resource blocks need byte alignment to multiple of 8 + int nb_re_pusch2 = nb_re_pusch + (nb_re_pusch&7); + #else + int nb_re_pusch2 = nb_re_pusch; + #endif + + // perform IDFT operation on the compensated rxdata if transform precoding is enabled + nr_idft(&((uint32_t*)gNB->pusch_vars[ulsch_id]->rxdataF_comp[0])[symbol * nb_re_pusch2], nb_re_pusch); + LOG_D(PHY,"Transform precoding being done on data- symbol: %d, nb_re_pusch: %d\n", symbol, nb_re_pusch); + } //---------------------------------------------------------- @@ -1245,32 +1258,33 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB, /* Subtract total PTRS RE's in the symbol from PUSCH RE's */ gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol] -= gNB->pusch_vars[ulsch_id]->ptrs_re_per_slot; } - - /*---------------------------------------------------------------------------------------------------- */ - /*-------------------- LLRs computation -------------------------------------------------------------*/ - /*-----------------------------------------------------------------------------------------------------*/ - if(symbol == (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols -1)) - { -#ifdef __AVX2__ - int off = ((rel15_ul->rb_size&1) == 1)? 4:0; -#else - int off = 0; -#endif - uint32_t rxdataF_ext_offset = 0; - for(uint8_t i =rel15_ul->start_symbol_index; i< (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols);i++) { - start_meas(&gNB->ulsch_llr_stats); - nr_ulsch_compute_llr(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][i * (off + rel15_ul->rb_size * NR_NB_SC_PER_RB)], - gNB->pusch_vars[ulsch_id]->ul_ch_mag0, - gNB->pusch_vars[ulsch_id]->ul_ch_magb0, - &gNB->pusch_vars[ulsch_id]->llr[rxdataF_ext_offset * rel15_ul->qam_mod_order], - rel15_ul->rb_size, - gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[i], - i, - rel15_ul->qam_mod_order); - stop_meas(&gNB->ulsch_llr_stats); - rxdataF_ext_offset += gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[i]; - }// symbol loop - }// last symbol check } + + /*---------------------------------------------------------------------------------------------------- */ + /*-------------------- LLRs computation -------------------------------------------------------------*/ + /*-----------------------------------------------------------------------------------------------------*/ + if(symbol == (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols -1)) { + +#ifdef __AVX2__ + int off = ((rel15_ul->rb_size&1) == 1)? 4:0; +#else + int off = 0; +#endif + uint32_t rxdataF_ext_offset = 0; + for(uint8_t i =rel15_ul->start_symbol_index; i< (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols);i++) { + start_meas(&gNB->ulsch_llr_stats); + nr_ulsch_compute_llr(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][i * (off + rel15_ul->rb_size * NR_NB_SC_PER_RB)], + gNB->pusch_vars[ulsch_id]->ul_ch_mag0, + gNB->pusch_vars[ulsch_id]->ul_ch_magb0, + &gNB->pusch_vars[ulsch_id]->llr[rxdataF_ext_offset * rel15_ul->qam_mod_order], + rel15_ul->rb_size, + gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[i], + i, + rel15_ul->qam_mod_order); + stop_meas(&gNB->ulsch_llr_stats); + rxdataF_ext_offset += gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[i]; + }// symbol loop + }// last symbol check + return (0); } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 61e39aa79d..c36c4b98ed 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -46,9 +46,11 @@ #include "executables/softmodem-common.h" #include "LAYER2/NR_MAC_UE/mac_proto.h" -//#define DEBUG_SCFDMA +#include "PHY/NR_REFSIG/ul_ref_seq_nr.h" + //#define DEBUG_PUSCH_MAPPING //#define DEBUG_MAC_PDU +//#define DEBUG_DFT_IDFT //extern int32_t uplink_counter; @@ -153,6 +155,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, unsigned int G = nr_get_G(nb_rb, number_of_symbols, nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl); + + nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid, G); /////////// @@ -184,8 +188,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, (int16_t *)ulsch_ue->d_mod); - // pusch_transform_precoding(ulsch_ue, frame_parms, harq_pid); - + /////////// //////////////////////////////////////////////////////////////////////// @@ -243,26 +246,72 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, l_prime[0] = 0; // single symbol ap 0 -#ifdef NR_SC_FDMA - uint32_t nb_re_pusch, nb_re_dmrs_per_rb; - uint32_t y_offset = 0; + uint16_t index; + uint8_t u = 0, v = 0; + int16_t *dmrs_seq = NULL; - for (l = start_symbol; l < start_symbol + number_of_symbols; l++) { + if (pusch_pdu->transform_precoding == transform_precoder_enabled) { - if((ul_dmrs_symb_pos >> l) & 0x01) - nb_re_dmrs_per_rb = nb_dmrs_re_per_rb; - else - nb_re_dmrs_per_rb = 0; + uint32_t nb_re_pusch=nb_rb * NR_NB_SC_PER_RB; + uint32_t y_offset = 0; + uint16_t num_dmrs_res_per_symbol = nb_rb*(NR_NB_SC_PER_RB/2); - nb_re_pusch = nb_rb * (NR_NB_SC_PER_RB - nb_re_dmrs_per_rb); + // Calculate index to dmrs seq array based on number of DMRS Subcarriers on this symbol + index = get_index_for_dmrs_lowpapr_seq(num_dmrs_res_per_symbol); + u = pusch_pdu->dfts_ofdm.low_papr_group_number; + v = pusch_pdu->dfts_ofdm.low_papr_sequence_number; + dmrs_seq = dmrs_lowpaprtype1_ul_ref_sig[u][v][index]; - nr_dft(&ulsch_ue->y[y_offset], &((int32_t*)tx_layers[0])[y_offset], nb_re_pusch); + AssertFatal(index >= 0, "Num RBs not configured according to 3GPP 38.211 section 6.3.1.4. For PUSCH with transform precoding, num RBs cannot be multiple of any other primenumber other than 2,3,5\n"); + AssertFatal(dmrs_seq != NULL, "DMRS low PAPR seq not found, check if DMRS sequences are generated"); + + LOG_D(PHY,"Transform Precoding params. u: %d, v: %d, index for dmrsseq: %d\n", u, v, index); + + for (l = start_symbol; l < start_symbol + number_of_symbols; l++) { + + if((ul_dmrs_symb_pos >> l) & 0x01) + /* In the symbol with DMRS no data would be transmitted CDM groups is 2*/ + continue; + + nr_dft(&ulsch_ue->y[y_offset], &((int32_t*)tx_layers[0])[y_offset], nb_re_pusch); + + y_offset = y_offset + nb_re_pusch; + + LOG_D(PHY,"Transform precoding being done on data- symbol: %d, nb_re_pusch: %d, y_offset: %d\n", l, nb_re_pusch, y_offset); + + #ifdef DEBUG_PUSCH_MAPPING + printf("NR_ULSCH_UE: y_offset %d\t nb_re_pusch %d \t Symbol %d \t nb_rb %d \n", + y_offset, nb_re_pusch, l, nb_rb); + #endif + } + + #ifdef DEBUG_DFT_IDFT + uint32_t debug_symbols[MAX_NUM_NR_RE] __attribute__ ((aligned(16))); + int offset = 0; + printf("NR_ULSCH_UE: available_bits: %d, mod_order: %d", available_bits,mod_order); + + for (int ll = 0; ll < (available_bits/mod_order); ll++) { + debug_symbols[ll] = ulsch_ue->y[ll]; + } + + printf("NR_ULSCH_UE: numSym: %d, num_dmrs_sym: %d", number_of_symbols,number_dmrs_symbols); + for (int ll = 0; ll < (number_of_symbols-number_dmrs_symbols); ll++) { + + nr_idft(&debug_symbols[offset], nb_re_pusch); + + offset = offset + nb_re_pusch; + + } + LOG_M("preDFT_all_symbols.m","UE_preDFT", tx_layers[0],number_of_symbols*nb_re_pusch,1,1); + LOG_M("postDFT_all_symbols.m","UE_postDFT", &(ulsch_ue->y[0]),number_of_symbols*nb_re_pusch,1,1); + LOG_M("DEBUG_IDFT_SYMBOLS.m","UE_Debug_IDFT", debug_symbols,number_of_symbols*nb_re_pusch,1,1); + LOG_M("UE_DMRS_SEQ.m","UE_DMRS_SEQ", dmrs_seq,nb_re_pusch,1,1); + #endif - y_offset = y_offset + nb_re_pusch; } -#else - memcpy(ulsch_ue->y, tx_layers[0], (available_bits/mod_order)*sizeof(int32_t)); -#endif + else + memcpy(ulsch_ue->y, tx_layers[0], (available_bits/mod_order)*sizeof(int32_t)); + /////////// //////////////////////////////////////////////////////////////////////// @@ -279,6 +328,13 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint8_t k_prime = 0; uint16_t m = 0; + + #ifdef DEBUG_PUSCH_MAPPING + printf("NR_ULSCH_UE: Value of CELL ID %d /t, u %d \n", frame_parms->Nid_cell, u); + #endif + + + // DMRS params for this ap get_Wt(Wt, ap, dmrs_type); get_Wf(Wf, ap, dmrs_type); @@ -295,18 +351,25 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, if ((ul_dmrs_symb_pos >> l) & 0x01) { is_dmrs_sym = 1; - if (pusch_pdu->transform_precoding == 1){ // if transform precoding is disabled + + if (pusch_pdu->transform_precoding == transform_precoder_disabled){ + if (dmrs_type == pusch_dmrs_type1) dmrs_idx = start_rb*6; else dmrs_idx = start_rb*4; + + // Perform this on gold sequence, not required when SC FDMA operation is done, + nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated + } else { dmrs_idx = 0; - } + } + + + } else if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { - nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated - - } else if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { + AssertFatal(pusch_pdu->transform_precoding == transform_precoder_disabled, "PTRS NOT SUPPORTED IF TRANSFORM PRECODING IS ENABLED\n"); if(is_ptrs_symbol(l, ulsch_ue->ptrs_symbols)) { is_ptrs_sym = 1; @@ -338,8 +401,17 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, if (is_dmrs == 1) { - ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15; - ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; + if (pusch_pdu->transform_precoding == transform_precoder_enabled) { + + ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*dmrs_seq[2*dmrs_idx]) >> 15; + ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*dmrs_seq[(2*dmrs_idx) + 1]) >> 15; + + } else { + + ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[dmrs_idx<<1]) >> 15; + ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*AMP*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; + + } #ifdef DEBUG_PUSCH_MAPPING printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t dmrs: %d %d\n", diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index 89c6a2d9c8..76610da412 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -42,11 +42,6 @@ #define nr_subframe_t lte_subframe_t #define nr_slot_t lte_subframe_t -// [hna] This enables SC-FDMA transmission in Uplink. If disabled, then OFDMA is used in UPLINK. -#ifndef NR_SC_FDMA -// #define NR_SC_FDMA -#endif - #define MAX_NUM_SUBCARRIER_SPACING 5 #define NR_MAX_NB_RB 275 diff --git a/openair1/PHY/impl_defs_nr.h b/openair1/PHY/impl_defs_nr.h index 9d6f1703e5..ceb75c2554 100644 --- a/openair1/PHY/impl_defs_nr.h +++ b/openair1/PHY/impl_defs_nr.h @@ -601,9 +601,11 @@ typedef enum{ ul_rgb_config1 = 1, ul_rgb_config2 = 2 } ul_rgb_Size_t; -typedef enum { - transformPrecoder_enabled = 1, - transformPrecoder_disabled = 2 +/* Aligned values of this enum to other tranform precoder enums + * eg: as defined in fapi_nr_ue_interface.h for transform_precoder_t*/ +typedef enum { + transformPrecoder_enabled = 0, + transformPrecoder_disabled = 1 } transformPrecoder_t; typedef enum { codebookSubset_fullyAndPartialAndNonCoherent = 1, diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 821ac75a64..d5126ed356 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -63,6 +63,8 @@ #include #include +#include "PHY/NR_REFSIG/ul_ref_seq_nr.h" + //#define DEBUG_ULSIM LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC; @@ -201,6 +203,10 @@ int main(int argc, char **argv) uint16_t ptrsSymbPerSlot = 0; uint16_t ptrsRePerSymb = 0; + uint8_t transform_precoding = transform_precoder_disabled; // 0 - ENABLE, 1 - DISABLE + uint8_t num_dmrs_cdm_grps_no_data = 1; + uint8_t mcs_table = 0; + UE_nr_rxtx_proc_t UE_proc; FILE *scg_fd=NULL; int file_offset = 0; @@ -221,7 +227,7 @@ int main(int argc, char **argv) /* initialize the sin-cos table */ InitSinLUT(); - while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:i:j:kl:m:n:p:r:s:y:z:F:G:H:M:N:PR:S:T:U:L:")) != -1) { + while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:i:j:kl:m:n:p:r:s:y:z:F:G:H:M:N:PR:S:T:U:L:Z")) != -1) { printf("handling optarg %c\n",c); switch (c) { @@ -454,9 +460,19 @@ int main(int argc, char **argv) params_from_file = 1; break; + case 'Z': + + transform_precoding = transform_precoder_enabled; + num_dmrs_cdm_grps_no_data = 2; + mcs_table = 3; + + printf("NOTE: TRANSFORM PRECODING (SC-FDMA) is ENABLED in UPLINK (0 - ENABLE, 1 - DISABLE) : %d \n", transform_precoding); + + break; + default: case 'h': - printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", argv[0]); + printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId -Z Enable SC-FDMA in Uplink \n", argv[0]); //printf("-d Use TDD\n"); printf("-d Introduce delay in terms of number of samples\n"); printf("-f Number of frames to simulate\n"); @@ -486,6 +502,7 @@ int main(int argc, char **argv) printf("-T Enable PTRS, arguments list L_PTRS{0,1,2} K_PTRS{2,4}, e.g. -T 2 0 2 \n"); printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:3}, e.g. -U 2 0 2 \n"); printf("-Q If -F used, read parameters from file\n"); + printf("-Z If -Z is used, SC-FDMA or transform precoding is enabled in Uplink \n"); exit(-1); break; @@ -681,13 +698,13 @@ int main(int argc, char **argv) uint8_t ptrs_mcs3 = 10; uint16_t n_rb0 = 25; uint16_t n_rb1 = 75; - uint8_t mcs_table = 0; + uint16_t pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; // | PUSCH_PDU_BITMAP_PUSCH_PTRS; uint8_t max_rounds = 4; uint8_t crc_status = 0; - unsigned char mod_order = nr_get_Qm_ul(Imcs, 0); - uint16_t code_rate = nr_get_code_rate_ul(Imcs, 0); + unsigned char mod_order = nr_get_Qm_ul(Imcs, mcs_table); + uint16_t code_rate = nr_get_code_rate_ul(Imcs, mcs_table); uint8_t mapping_type = typeB; // Default Values pusch_dmrs_type_t dmrs_config_type = pusch_dmrs_type1; // Default Values @@ -717,9 +734,32 @@ int main(int argc, char **argv) uint16_t l_prime_mask = get_l_prime(nb_symb_sch, mapping_type, add_pos, length_dmrs); uint16_t number_dmrs_symbols = get_dmrs_symbols_in_slot(l_prime_mask, nb_symb_sch); uint8_t nb_re_dmrs = (dmrs_config_type == pusch_dmrs_type1) ? 6 : 4; + + if (transform_precoding == transform_precoder_enabled) { + + AssertFatal(enable_ptrs == 0, "PTRS NOT SUPPORTED IF TRANSFORM PRECODING IS ENABLED\n"); + + int8_t index = get_index_for_dmrs_lowpapr_seq((NR_NB_SC_PER_RB/2) * nb_rb); + AssertFatal(index >= 0, "Num RBs not configured according to 3GPP 38.211 section 6.3.1.4. For PUSCH with transform precoding, num RBs cannot be multiple of any other primenumber other than 2,3,5\n"); + + dmrs_config_type = pusch_dmrs_type1; + nb_re_dmrs = nb_re_dmrs * num_dmrs_cdm_grps_no_data; + + printf("[ULSIM]: TRANSFORM PRECODING ENABLED. Num RBs: %d, index for DMRS_SEQ: %d\n", nb_rb, index); + } + + unsigned int available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, number_dmrs_symbols, mod_order, 1); unsigned int TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs * number_dmrs_symbols, 0, 0, precod_nbr_layers); + + printf("[ULSIM]: length_dmrs: %d, l_prime_mask: %d number_dmrs_symbols: %d, mapping_type: %d add_pos: %d \n", length_dmrs, l_prime_mask, number_dmrs_symbols, mapping_type,add_pos); + printf("[ULSIM]: CDM groups: %d, dmrs_config_type: %d, num_rbs: %d, nb_symb_sch: %d\n", num_dmrs_cdm_grps_no_data, dmrs_config_type, nb_rb, nb_symb_sch); + printf("[ULSIM]: MCS: %d, mod order: %d, code_rate: %d\n", Imcs, mod_order, code_rate); + printf("[ULSIM]: VALUE OF G: %d, TBS: %d\n", available_bits, TBS); + + + uint8_t ulsch_input_buffer[TBS/8]; ulsch_input_buffer[0] = 0x31; @@ -874,7 +914,7 @@ int main(int argc, char **argv) pusch_pdu->mcs_table = mcs_table; pusch_pdu->target_code_rate = code_rate; pusch_pdu->qam_mod_order = mod_order; - pusch_pdu->transform_precoding = 1; + pusch_pdu->transform_precoding = transform_precoding; pusch_pdu->data_scrambling_id = *scc->physCellId; pusch_pdu->nrOfLayers = 1; pusch_pdu->ul_dmrs_symb_pos = l_prime_mask << start_symbol; @@ -900,6 +940,13 @@ int main(int argc, char **argv) pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t)); pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; + if (transform_precoding == transform_precoder_enabled) { + + pusch_pdu->dfts_ofdm.low_papr_group_number = *scc->physCellId % 30; // U as defined in 38.211 section 6.4.1.1.1.2 + pusch_pdu->dfts_ofdm.low_papr_sequence_number = 0; // V as defined in 38.211 section 6.4.1.1.1.2 + pusch_pdu->num_dmrs_cdm_grps_no_data = num_dmrs_cdm_grps_no_data; + } + // prepare ULSCH/PUSCH reception nr_schedule_response(Sched_INFO); @@ -951,6 +998,18 @@ int main(int argc, char **argv) ul_config.ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list = (nfapi_nr_ue_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ue_ptrs_ports_t)); ul_config.ul_config_list[0].pusch_config_pdu.pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; + ul_config.ul_config_list[0].pusch_config_pdu.transform_precoding = transform_precoding; + + if (transform_precoding == transform_precoder_enabled) { + + ul_config.ul_config_list[0].pusch_config_pdu.dfts_ofdm.low_papr_group_number = *scc->physCellId % 30;// U as defined in 38.211 section 6.4.1.1.1.2 + ul_config.ul_config_list[0].pusch_config_pdu.dfts_ofdm.low_papr_sequence_number = 0;// V as defined in 38.211 section 6.4.1.1.1.2 + //ul_config.ul_config_list[0].pusch_config_pdu.pdu_bit_map |= PUSCH_PDU_BITMAP_DFTS_OFDM; + ul_config.ul_config_list[0].pusch_config_pdu.num_dmrs_cdm_grps_no_data = num_dmrs_cdm_grps_no_data; + + } + + nr_fill_ulsch(gNB,frame,slot,pusch_pdu); for (int i=0;i<(TBS/8);i++) ulsch_ue[0]->harq_processes[harq_pid]->a[i]=i&0xff; From c5bce98b48f03851dccb1b974a1cae3da807380c Mon Sep 17 00:00:00 2001 From: dir Date: Thu, 17 Dec 2020 14:25:29 +0200 Subject: [PATCH 128/160] RRC, MAC changes to enable RFSIM testing of feature transform precoding. - Enable -Z option to test Transform precoding on ULSIM. - Set msg3_transformPrecoder to 0 in uplinkcommonconfig params in conf file to test on RFSIM. --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 90 ++++++++++++++++++- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 7 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 19 ++++ openair2/RRC/NR/rrc_gNB_reconfig.c | 41 ++++++++- 4 files changed, 149 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 53bc5f31b9..6f5e0170c0 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -1579,6 +1579,44 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in ulcfg_pdu->pusch_config_pdu.pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS } + /* TRANSFORM PRECODING ------------------------------------------------------------------------------------------*/ + + if (ulcfg_pdu->pusch_config_pdu.transform_precoding == transform_precoder_enabled) { + + uint32_t n_RS_Id = 0; + + NR_PUSCH_Config_t *pusch_config=mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup; + NR_DMRS_UplinkConfig_t *NR_DMRS_ulconfig = NULL; + + ulcfg_pdu->pusch_config_pdu.num_dmrs_cdm_grps_no_data = 2; + + if(pusch_config->dmrs_UplinkForPUSCH_MappingTypeA != NULL) + NR_DMRS_ulconfig = pusch_config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup; + else + NR_DMRS_ulconfig = pusch_config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; + + + if (NR_DMRS_ulconfig->transformPrecodingEnabled->nPUSCH_Identity != NULL) + n_RS_Id = *NR_DMRS_ulconfig->transformPrecodingEnabled->nPUSCH_Identity; + else + n_RS_Id = *mac->scc->physCellId; + + // U as specified in section 6.4.1.1.1.2 in 38.211, if sequence hopping and group hopping are disabled + ulcfg_pdu->pusch_config_pdu.dfts_ofdm.low_papr_group_number = n_RS_Id % 30; + + // V as specified in section 6.4.1.1.1.2 in 38.211 V = 0 if sequence hopping and group hopping are disabled + if ((NR_DMRS_ulconfig->transformPrecodingEnabled->sequenceGroupHopping == NULL) && + (NR_DMRS_ulconfig->transformPrecodingEnabled->sequenceHopping == NULL)) + ulcfg_pdu->pusch_config_pdu.dfts_ofdm.low_papr_sequence_number = 0; + else + AssertFatal(1==0,"SequenceGroupHopping or sequenceHopping are NOT Supported\n"); + + LOG_D(MAC,"TRANSFORM PRECODING IS ENABLED. CDM groups: %d, U: %d \n", ulcfg_pdu->pusch_config_pdu.num_dmrs_cdm_grps_no_data, + ulcfg_pdu->pusch_config_pdu.dfts_ofdm.low_papr_group_number); + } + + /* TRANSFORM PRECODING --------------------------------------------------------------------------------------------------------*/ + get_num_re_dmrs(&ulcfg_pdu->pusch_config_pdu, &nb_dmrs_re_per_rb, &number_dmrs_symbols); @@ -3220,9 +3258,9 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr /* MCS TABLE */ if (mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL) - pusch_config_pdu_0_0->transform_precoding = 1; + pusch_config_pdu_0_0->transform_precoding = transform_precoder_disabled; else - pusch_config_pdu_0_0->transform_precoding = 0; + pusch_config_pdu_0_0->transform_precoding = transform_precoder_enabled; if (pusch_config_pdu_0_0->transform_precoding == transform_precoder_disabled) pusch_config_pdu_0_0->mcs_table = get_pusch_mcs_table(pusch_config->mcs_Table, 0, @@ -3340,9 +3378,9 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr /* MCS TABLE */ if (pusch_config->transformPrecoder == NULL) { if (mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL) - pusch_config_pdu_0_1->transform_precoding = 1; + pusch_config_pdu_0_1->transform_precoding = transform_precoder_disabled; else - pusch_config_pdu_0_1->transform_precoding = 0; + pusch_config_pdu_0_1->transform_precoding = transform_precoder_enabled; } else pusch_config_pdu_0_1->transform_precoding = *pusch_config->transformPrecoder; @@ -3456,14 +3494,58 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr } } } + +/*-------------------- Changed to enable Transform precoding in RF SIM------------------------------------------------*/ + + NR_DMRS_UplinkConfig_t *NR_DMRS_ulconfig = NULL; + + if (pusch_config_pdu_0_1->transform_precoding == transform_precoder_enabled) { + + mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder = transform_precoder_enabled; + + if(pusch_config->dmrs_UplinkForPUSCH_MappingTypeA != NULL) { + + NR_DMRS_ulconfig = pusch_config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup; + + if (NR_DMRS_ulconfig->dmrs_Type == NULL) + mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.dmrs_type = 1; + if (NR_DMRS_ulconfig->maxLength == NULL) + mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.max_length = 1; + + } else if(pusch_config->dmrs_UplinkForPUSCH_MappingTypeB != NULL) { + + NR_DMRS_ulconfig = pusch_config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; + + if (NR_DMRS_ulconfig->dmrs_Type == NULL) + mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_b.dmrs_type = 1; + if (NR_DMRS_ulconfig->maxLength == NULL) + mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_b.max_length = 1; + + } + } else + mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder = transform_precoder_disabled; + + // mapping type b configured from RRC. TBD: Mapping type b is not handled in this function. + if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_enabled) && + (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_b.dmrs_type == 1) && + (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_b.max_length == 1)) { // tables 7.3.1.1.2-6 + pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = 2; + pusch_config_pdu_0_1->dmrs_ports = dci->antenna_ports.val; + } + + /*-------------------- ---------------------------------------------------------------------------------------------------------------*/ + + /* ANTENNA_PORTS */ uint8_t rank=0; // We need to initialize rank FIXME!!! + if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_enabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 1) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.max_length == 1)) { // tables 7.3.1.1.2-6 pusch_config_pdu_0_1->num_dmrs_cdm_grps_no_data = 2; //TBC pusch_config_pdu_0_1->dmrs_ports = dci->antenna_ports.val; //TBC } + if ((mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.transform_precoder == transform_precoder_enabled) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 1) && (mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated.dmrs_ul_for_pusch_mapping_type_a.max_length == 2)) { // tables 7.3.1.1.2-7 diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index f3260ea3cf..841c035206 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -218,7 +218,6 @@ void nr_save_pusch_fields(const NR_ServingCellConfigCommon_t *scc, { ps->dci_format = dci_format; ps->time_domain_allocation = tda; - ps->num_dmrs_cdm_grps_no_data = num_dmrs_cdm_grps_no_data; const struct NR_PUSCH_TimeDomainResourceAllocationList *tdaList = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; @@ -240,13 +239,17 @@ void nr_save_pusch_fields(const NR_ServingCellConfigCommon_t *scc, NR_RNTI_C, target_ss, false); - else + else { ps->mcs_table = get_pusch_mcs_table(ps->pusch_Config->mcs_TableTransformPrecoder, 1, ps->dci_format, NR_RNTI_C, target_ss, false); + num_dmrs_cdm_grps_no_data = 2; // in case of transform precoding - no Data sent in DMRS symbol + } + + ps->num_dmrs_cdm_grps_no_data = num_dmrs_cdm_grps_no_data; /* DMRS calculations */ ps->mapping_type = tdaList->list.array[tda]->mappingType; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 75b00ea6ba..b92ee1dba3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -742,6 +742,25 @@ void nr_schedule_ulsch(module_id_t module_id, pusch_pdu->pusch_data.tb_size = sched_pusch->tb_size; pusch_pdu->pusch_data.num_cb = 0; //CBG not supported + /* TRANSFORM PRECODING --------------------------------------------------------*/ + + if (pusch_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled){ + + // U as specified in section 6.4.1.1.1.2 in 38.211, if sequence hopping and group hopping are disabled + pusch_pdu->dfts_ofdm.low_papr_group_number = pusch_pdu->pusch_identity % 30; + + // V as specified in section 6.4.1.1.1.2 in 38.211 V = 0 if sequence hopping and group hopping are disabled + if ((ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceGroupHopping == NULL) && + (ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceHopping == NULL)) + pusch_pdu->dfts_ofdm.low_papr_sequence_number = 0; + else + AssertFatal(1==0,"SequenceGroupHopping or sequenceHopping are NOT Supported\n"); + + LOG_D(NR_MAC,"TRANSFORM PRECODING IS ENABLED. CDM groups: %d, U: %d MCS table: %d\n", pusch_pdu->num_dmrs_cdm_grps_no_data, pusch_pdu->dfts_ofdm.low_papr_group_number, ps->mcs_table); + } + + /*-----------------------------------------------------------------------------*/ + /* PUSCH PTRS */ if (ps->NR_DMRS_UplinkConfig->phaseTrackingRS != NULL) { // TODO to be fixed from RRC config diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 29bf2fde06..6cbd79bb77 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -794,8 +794,12 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pusch_Config->pusch_AggregationFactor=NULL; pusch_Config->mcs_Table=NULL; pusch_Config->mcs_TableTransformPrecoder=NULL; - pusch_Config->transformPrecoder=calloc(1,sizeof(*pusch_Config->transformPrecoder)); - *pusch_Config->transformPrecoder = NR_PUSCH_Config__transformPrecoder_disabled; + pusch_Config->transformPrecoder= NULL; + /* if msg3_transformprecoding is set in conf file - pusch config should not disable it */ + if (servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder == NULL) { + pusch_Config->transformPrecoder=calloc(1,sizeof(*pusch_Config->transformPrecoder)); + *pusch_Config->transformPrecoder = NR_PUSCH_Config__transformPrecoder_disabled; + } pusch_Config->codebookSubset=calloc(1,sizeof(*pusch_Config->codebookSubset)); *pusch_Config->codebookSubset = NR_PUSCH_Config__codebookSubset_nonCoherent; pusch_Config->maxRank=calloc(1,sizeof(*pusch_Config->maxRank)); @@ -804,6 +808,39 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pusch_Config->uci_OnPUSCH=NULL; pusch_Config->tp_pi2BPSK=NULL; + /*------------------------------TRANSFORM PRECODING- -----------------------------------------------------------------------*/ + + uint8_t transform_precoding = NR_PUSCH_Config__transformPrecoder_disabled; + + // TBD: configure this from .conf file, Dedicated params cannot yet be configured in .conf file. + // Enable this to test transform precoding enabled from dedicated config. + /*if (pusch_Config->transformPrecoder == NULL) + pusch_Config->transformPrecoder=calloc(1,sizeof(*pusch_Config->transformPrecoder)); + + *pusch_Config->transformPrecoder = NR_PUSCH_Config__transformPrecoder_enabled; */ + // END ------- + + if (pusch_Config->transformPrecoder == NULL) { + if (servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder != NULL) + transform_precoding = NR_PUSCH_Config__transformPrecoder_enabled; + } + else + transform_precoding = *pusch_Config->transformPrecoder; + + + if (transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled ) { + /* Enable DMRS uplink config for transform precoding enabled */ + NR_DMRS_UplinkConfig->transformPrecodingEnabled = calloc(1,sizeof(*NR_DMRS_UplinkConfig->transformPrecodingEnabled)); + NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity = NULL; + NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceGroupHopping = NULL; + NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceHopping = NULL; + NR_DMRS_UplinkConfig->transformPrecodingEnabled->ext1 = NULL; + + LOG_I(RRC,"TRANSFORM PRECODING ENABLED......\n"); + + } + /*----------------------------------------------------------------------------------------------------------------------------*/ + initialUplinkBWP->srs_Config = calloc(1,sizeof(*initialUplinkBWP->srs_Config)); initialUplinkBWP->srs_Config->present = NR_SetupRelease_SRS_Config_PR_setup; NR_SRS_Config_t *srs_Config = calloc(1,sizeof(*srs_Config)); From 42a110338cdca80142dfa28a9d66559e1d6a40fa Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 23 Dec 2020 13:56:01 +0100 Subject: [PATCH 129/160] itti dynamic queue creation, and 64 bits instance id --- cmake_targets/CMakeLists.txt | 2 +- common/utils/itti_analyzer/AUTHORS | 0 common/utils/itti_analyzer/ChangeLog | 0 common/utils/itti_analyzer/INSTALL | 370 ------- common/utils/itti_analyzer/Makefile.am | 17 - common/utils/itti_analyzer/NEWS | 0 common/utils/itti_analyzer/README | 14 - common/utils/itti_analyzer/autogen.sh | 6 - .../utils/itti_analyzer/common/itti_types.h | 73 -- common/utils/itti_analyzer/common/logs.h | 56 - common/utils/itti_analyzer/common/rc.h | 71 -- common/utils/itti_analyzer/configure.ac | 97 -- common/utils/itti_analyzer/filters.xml | 135 --- common/utils/itti_analyzer/filters_mme.xml | 131 --- common/utils/itti_analyzer/filters_ue_enb.xml | 174 ---- common/utils/itti_analyzer/itti_analyzer.c | 145 --- .../itti_analyzer/libbuffers/Makefile.am | 13 - .../utils/itti_analyzer/libbuffers/buffers.c | 241 ----- .../utils/itti_analyzer/libbuffers/buffers.h | 66 -- common/utils/itti_analyzer/libbuffers/file.c | 75 -- common/utils/itti_analyzer/libbuffers/file.h | 27 - .../utils/itti_analyzer/libbuffers/socket.c | 444 -------- .../utils/itti_analyzer/libbuffers/socket.h | 52 - .../utils/itti_analyzer/libparser/Makefile.am | 23 - .../itti_analyzer/libparser/array_type.c | 180 ---- .../itti_analyzer/libparser/array_type.h | 35 - .../utils/itti_analyzer/libparser/enum_type.c | 124 --- .../utils/itti_analyzer/libparser/enum_type.h | 37 - .../itti_analyzer/libparser/enum_value_type.c | 99 -- .../itti_analyzer/libparser/enum_value_type.h | 37 - .../itti_analyzer/libparser/field_type.c | 180 ---- .../itti_analyzer/libparser/field_type.h | 35 - .../utils/itti_analyzer/libparser/file_type.c | 53 - .../utils/itti_analyzer/libparser/file_type.h | 31 - .../libparser/fundamental_type.c | 144 --- .../libparser/fundamental_type.h | 37 - .../libparser/intertask_contexts.h | 35 - .../itti_analyzer/libparser/pointer_type.c | 103 -- .../itti_analyzer/libparser/pointer_type.h | 35 - .../itti_analyzer/libparser/reference_type.c | 96 -- .../itti_analyzer/libparser/reference_type.h | 35 - .../itti_analyzer/libparser/struct_type.c | 148 --- .../itti_analyzer/libparser/struct_type.h | 35 - .../itti_analyzer/libparser/typedef_type.c | 113 -- .../itti_analyzer/libparser/typedef_type.h | 35 - common/utils/itti_analyzer/libparser/types.c | 147 --- common/utils/itti_analyzer/libparser/types.h | 187 ---- .../itti_analyzer/libparser/union_type.c | 188 ---- .../itti_analyzer/libparser/union_type.h | 39 - .../utils/itti_analyzer/libparser/xml_parse.c | 904 ---------------- .../utils/itti_analyzer/libparser/xml_parse.h | 43 - .../itti_analyzer/libresolver/Makefile.am | 13 - .../itti_analyzer/libresolver/locate_root.c | 251 ----- .../itti_analyzer/libresolver/locate_root.h | 62 -- .../itti_analyzer/libresolver/resolvers.c | 384 ------- .../itti_analyzer/libresolver/resolvers.h | 45 - common/utils/itti_analyzer/libui/Makefile.am | 21 - .../utils/itti_analyzer/libui/ui_callbacks.c | 983 ------------------ .../utils/itti_analyzer/libui/ui_callbacks.h | 114 -- common/utils/itti_analyzer/libui/ui_filters.c | 609 ----------- common/utils/itti_analyzer/libui/ui_filters.h | 95 -- .../utils/itti_analyzer/libui/ui_interface.c | 122 --- .../utils/itti_analyzer/libui/ui_interface.h | 78 -- .../itti_analyzer/libui/ui_main_screen.c | 238 ----- .../itti_analyzer/libui/ui_main_screen.h | 96 -- .../utils/itti_analyzer/libui/ui_menu_bar.c | 503 --------- .../utils/itti_analyzer/libui/ui_menu_bar.h | 33 - .../utils/itti_analyzer/libui/ui_notebook.c | 88 -- .../utils/itti_analyzer/libui/ui_notebook.h | 31 - .../utils/itti_analyzer/libui/ui_notif_dlg.c | 83 -- .../utils/itti_analyzer/libui/ui_notif_dlg.h | 31 - .../itti_analyzer/libui/ui_notifications.c | 636 ----------- .../itti_analyzer/libui/ui_notifications.h | 47 - .../libui/ui_signal_dissect_view.c | 117 --- .../libui/ui_signal_dissect_view.h | 36 - .../utils/itti_analyzer/libui/ui_tree_view.c | 610 ----------- .../utils/itti_analyzer/libui/ui_tree_view.h | 96 -- common/utils/msc/msc.c | 2 +- common/utils/ocp_itti/intertask_interface.cpp | 138 +-- common/utils/ocp_itti/intertask_interface.h | 17 +- executables/main-ocp.c | 8 +- executables/nr-softmodem.c | 8 +- executables/nr-uesoftmodem.c | 2 +- executables/ocp-gnb.c | 6 +- openair1/SCHED_UE/phy_procedures_lte_ue.c | 2 +- openair1/SIMULATION/LTE_PHY/dlsim.c | 2 +- openair1/SIMULATION/LTE_PHY/dlsim_tm4.c | 2 +- openair1/SIMULATION/LTE_PHY/mbmssim.c | 2 +- openair1/SIMULATION/LTE_PHY/pucchsim.c | 2 +- openair1/SIMULATION/LTE_PHY/ulsim.c | 2 +- openair2/COMMON/platform_types.h | 7 +- openair2/ENB_APP/enb_app.c | 48 +- openair2/ENB_APP/enb_config.c | 4 +- openair2/ENB_APP/flexran_agent.c | 2 +- .../ENB_APP/flexran_agent_common_internal.c | 2 +- openair2/ENB_APP/flexran_agent_ran_api.c | 4 +- openair2/F1AP/f1ap_cu_interface_management.c | 2 +- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 6 +- openair2/F1AP/f1ap_cu_task.c | 32 +- openair2/F1AP/f1ap_du_interface_management.c | 2 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 6 +- openair2/F1AP/f1ap_du_task.c | 16 +- openair2/F1AP/f1ap_du_ue_context_management.c | 2 +- openair2/F1AP/f1ap_handlers.c | 2 +- openair2/F1AP/f1ap_itti_messaging.c | 6 +- openair2/GNB_APP/gnb_app.c | 16 +- openair2/GNB_APP/gnb_config.c | 2 +- openair2/LAYER2/MAC/eNB_scheduler.c | 2 +- openair2/LAYER2/MAC/main.c | 2 +- openair2/LAYER2/MAC/ue_procedures.c | 4 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 10 +- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 12 +- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 2 +- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 2 +- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 2 +- openair2/LAYER2/rlc_v2/rlc_oai_api.c | 8 +- openair2/M2AP/m2ap_MCE.c | 42 +- openair2/M2AP/m2ap_MCE_handler.c | 2 +- openair2/M2AP/m2ap_MCE_interface_management.c | 16 +- openair2/M2AP/m2ap_eNB.c | 56 +- openair2/M2AP/m2ap_eNB_handler.c | 2 +- openair2/M2AP/m2ap_eNB_interface_management.c | 24 +- .../M2AP/m2ap_eNB_management_procedures.c | 2 +- openair2/M2AP/m2ap_itti_messaging.c | 8 +- openair2/MCE_APP/mce_app.c | 56 +- openair2/MCE_APP/mce_config.c | 2 +- openair2/RRC/LTE/L2_interface_common.c | 4 +- openair2/RRC/LTE/L2_interface_ue.c | 20 +- openair2/RRC/LTE/rrc_UE.c | 34 +- openair2/RRC/LTE/rrc_UE_ral.c | 8 +- openair2/RRC/LTE/rrc_eNB.c | 82 +- openair2/RRC/LTE/rrc_eNB_GTPV1U.c | 6 +- openair2/RRC/LTE/rrc_eNB_M2AP.c | 12 +- openair2/RRC/LTE/rrc_eNB_S1AP.c | 92 +- openair2/RRC/LTE/rrc_eNB_ral.c | 8 +- openair2/RRC/LTE/rrm_2_rrc_msg.c | 187 ---- openair2/RRC/NR/L2_nr_interface.c | 2 +- openair2/RRC/NR/rrc_gNB.c | 26 +- openair2/RRC/NR/rrc_gNB_NGAP.c | 10 +- openair2/RRC/NR/rrc_gNB_nsa.c | 4 +- openair2/RRC/NR_UE/L2_interface_ue.c | 2 +- openair2/RRC/NR_UE/rrc_UE.c | 24 +- openair2/SIMULATION/NR_RRC/itti_sim.c | 8 +- openair2/X2AP/x2ap_eNB.c | 42 +- openair2/X2AP/x2ap_eNB_handler.c | 30 +- openair2/X2AP/x2ap_eNB_itti_messaging.c | 4 +- .../X2AP/x2ap_eNB_management_procedures.c | 2 +- openair2/X2AP/x2ap_timers.c | 6 +- openair3/GTPV1-U/gtpv1u_eNB.c | 12 +- openair3/M3AP/m3ap_MCE.c | 40 +- openair3/M3AP/m3ap_MCE_handler.c | 2 +- openair3/M3AP/m3ap_MCE_interface_management.c | 8 +- .../M3AP/m3ap_MCE_management_procedures.c | 2 +- openair3/M3AP/m3ap_MME.c | 50 +- openair3/M3AP/m3ap_MME_handler.c | 2 +- openair3/M3AP/m3ap_MME_interface_management.c | 8 +- .../M3AP/m3ap_MME_management_procedures.c | 2 +- openair3/M3AP/m3ap_itti_messaging.c | 8 +- openair3/MME_APP/mme_app.c | 28 +- openair3/MME_APP/mme_config.c | 2 +- openair3/NAS/UE/nas_itti_messaging.c | 10 +- openair3/NAS/UE/nas_ue_task.c | 4 +- openair3/NGAP/ngap_gNB.c | 38 +- openair3/NGAP/ngap_gNB_handlers.c | 18 +- openair3/NGAP/ngap_gNB_itti_messaging.c | 6 +- openair3/NGAP/ngap_gNB_nas_procedures.c | 8 +- openair3/S1AP/s1ap_eNB.c | 42 +- openair3/S1AP/s1ap_eNB_handlers.c | 20 +- openair3/S1AP/s1ap_eNB_itti_messaging.c | 6 +- openair3/S1AP/s1ap_eNB_nas_procedures.c | 8 +- openair3/SCTP/sctp_eNB_itti_messaging.c | 8 +- openair3/SCTP/sctp_eNB_task.c | 14 +- openair3/SCTP/sctp_primitives_client.c | 307 ------ openair3/SCTP/sctp_primitives_client.h | 101 -- openair3/TEST/EPC_TEST/play_scenario.c | 4 +- openair3/TEST/EPC_TEST/play_scenario_s1ap.c | 4 +- openair3/TEST/oaisim_mme_itti_test.c | 2 +- openair3/TEST/oaisim_mme_test_s1c.c | 4 +- openair3/TEST/oaisim_mme_test_s1c_s1ap.c | 4 +- openair3/UDP/udp_eNB_task.c | 4 +- targets/RT/USER/lte-softmodem.c | 10 +- targets/RT/USER/lte-ue.c | 4 +- targets/RT/USER/lte-uesoftmodem.c | 6 +- 183 files changed, 718 insertions(+), 12086 deletions(-) delete mode 100644 common/utils/itti_analyzer/AUTHORS delete mode 100644 common/utils/itti_analyzer/ChangeLog delete mode 100644 common/utils/itti_analyzer/INSTALL delete mode 100644 common/utils/itti_analyzer/Makefile.am delete mode 100644 common/utils/itti_analyzer/NEWS delete mode 100644 common/utils/itti_analyzer/README delete mode 100755 common/utils/itti_analyzer/autogen.sh delete mode 100644 common/utils/itti_analyzer/common/itti_types.h delete mode 100644 common/utils/itti_analyzer/common/logs.h delete mode 100644 common/utils/itti_analyzer/common/rc.h delete mode 100644 common/utils/itti_analyzer/configure.ac delete mode 100644 common/utils/itti_analyzer/filters.xml delete mode 100644 common/utils/itti_analyzer/filters_mme.xml delete mode 100644 common/utils/itti_analyzer/filters_ue_enb.xml delete mode 100644 common/utils/itti_analyzer/itti_analyzer.c delete mode 100644 common/utils/itti_analyzer/libbuffers/Makefile.am delete mode 100644 common/utils/itti_analyzer/libbuffers/buffers.c delete mode 100644 common/utils/itti_analyzer/libbuffers/buffers.h delete mode 100644 common/utils/itti_analyzer/libbuffers/file.c delete mode 100644 common/utils/itti_analyzer/libbuffers/file.h delete mode 100644 common/utils/itti_analyzer/libbuffers/socket.c delete mode 100644 common/utils/itti_analyzer/libbuffers/socket.h delete mode 100644 common/utils/itti_analyzer/libparser/Makefile.am delete mode 100644 common/utils/itti_analyzer/libparser/array_type.c delete mode 100644 common/utils/itti_analyzer/libparser/array_type.h delete mode 100644 common/utils/itti_analyzer/libparser/enum_type.c delete mode 100644 common/utils/itti_analyzer/libparser/enum_type.h delete mode 100644 common/utils/itti_analyzer/libparser/enum_value_type.c delete mode 100644 common/utils/itti_analyzer/libparser/enum_value_type.h delete mode 100644 common/utils/itti_analyzer/libparser/field_type.c delete mode 100644 common/utils/itti_analyzer/libparser/field_type.h delete mode 100644 common/utils/itti_analyzer/libparser/file_type.c delete mode 100644 common/utils/itti_analyzer/libparser/file_type.h delete mode 100644 common/utils/itti_analyzer/libparser/fundamental_type.c delete mode 100644 common/utils/itti_analyzer/libparser/fundamental_type.h delete mode 100644 common/utils/itti_analyzer/libparser/intertask_contexts.h delete mode 100644 common/utils/itti_analyzer/libparser/pointer_type.c delete mode 100644 common/utils/itti_analyzer/libparser/pointer_type.h delete mode 100644 common/utils/itti_analyzer/libparser/reference_type.c delete mode 100644 common/utils/itti_analyzer/libparser/reference_type.h delete mode 100644 common/utils/itti_analyzer/libparser/struct_type.c delete mode 100644 common/utils/itti_analyzer/libparser/struct_type.h delete mode 100644 common/utils/itti_analyzer/libparser/typedef_type.c delete mode 100644 common/utils/itti_analyzer/libparser/typedef_type.h delete mode 100644 common/utils/itti_analyzer/libparser/types.c delete mode 100644 common/utils/itti_analyzer/libparser/types.h delete mode 100644 common/utils/itti_analyzer/libparser/union_type.c delete mode 100644 common/utils/itti_analyzer/libparser/union_type.h delete mode 100644 common/utils/itti_analyzer/libparser/xml_parse.c delete mode 100644 common/utils/itti_analyzer/libparser/xml_parse.h delete mode 100644 common/utils/itti_analyzer/libresolver/Makefile.am delete mode 100644 common/utils/itti_analyzer/libresolver/locate_root.c delete mode 100644 common/utils/itti_analyzer/libresolver/locate_root.h delete mode 100644 common/utils/itti_analyzer/libresolver/resolvers.c delete mode 100644 common/utils/itti_analyzer/libresolver/resolvers.h delete mode 100644 common/utils/itti_analyzer/libui/Makefile.am delete mode 100644 common/utils/itti_analyzer/libui/ui_callbacks.c delete mode 100644 common/utils/itti_analyzer/libui/ui_callbacks.h delete mode 100644 common/utils/itti_analyzer/libui/ui_filters.c delete mode 100644 common/utils/itti_analyzer/libui/ui_filters.h delete mode 100644 common/utils/itti_analyzer/libui/ui_interface.c delete mode 100644 common/utils/itti_analyzer/libui/ui_interface.h delete mode 100644 common/utils/itti_analyzer/libui/ui_main_screen.c delete mode 100644 common/utils/itti_analyzer/libui/ui_main_screen.h delete mode 100644 common/utils/itti_analyzer/libui/ui_menu_bar.c delete mode 100644 common/utils/itti_analyzer/libui/ui_menu_bar.h delete mode 100644 common/utils/itti_analyzer/libui/ui_notebook.c delete mode 100644 common/utils/itti_analyzer/libui/ui_notebook.h delete mode 100644 common/utils/itti_analyzer/libui/ui_notif_dlg.c delete mode 100644 common/utils/itti_analyzer/libui/ui_notif_dlg.h delete mode 100644 common/utils/itti_analyzer/libui/ui_notifications.c delete mode 100644 common/utils/itti_analyzer/libui/ui_notifications.h delete mode 100644 common/utils/itti_analyzer/libui/ui_signal_dissect_view.c delete mode 100644 common/utils/itti_analyzer/libui/ui_signal_dissect_view.h delete mode 100644 common/utils/itti_analyzer/libui/ui_tree_view.c delete mode 100644 common/utils/itti_analyzer/libui/ui_tree_view.h delete mode 100644 openair2/RRC/LTE/rrm_2_rrc_msg.c mode change 100755 => 100644 openair2/RRC/NR_UE/rrc_UE.c delete mode 100644 openair3/SCTP/sctp_primitives_client.c delete mode 100644 openair3/SCTP/sctp_primitives_client.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 0b9d925017..832a8f91cc 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -3069,7 +3069,7 @@ target_link_libraries (ocp-gnb -Wl,--start-group UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB - S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB + NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB SIMU_COMMON -Wl,--end-group z dl) diff --git a/common/utils/itti_analyzer/AUTHORS b/common/utils/itti_analyzer/AUTHORS deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/common/utils/itti_analyzer/ChangeLog b/common/utils/itti_analyzer/ChangeLog deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/common/utils/itti_analyzer/INSTALL b/common/utils/itti_analyzer/INSTALL deleted file mode 100644 index 2099840756..0000000000 --- a/common/utils/itti_analyzer/INSTALL +++ /dev/null @@ -1,370 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, -Inc. - - Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. This file is offered as-is, -without warranty of any kind. - -Basic Installation -================== - - Briefly, the shell command `./configure && make && make install' -should configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for -instructions specific to this package. Some packages provide this -`INSTALL' file but do not implement all of the features documented -below. The lack of an optional feature in a given package is not -necessarily a bug. More recommendations for GNU packages can be found -in *note Makefile Conventions: (standards)Makefile Conventions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. - - The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. - - Running `configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package, generally using the just-built uninstalled binaries. - - 4. Type `make install' to install the programs and any data files and - documentation. When installing into a prefix owned by root, it is - recommended that the package be configured and built as a regular - user, and only the `make install' phase executed with root - privileges. - - 5. Optionally, type `make installcheck' to repeat any self-tests, but - this time using the binaries in their final installed location. - This target does not install anything. Running this target as a - regular user, particularly if the prior `make install' required - root privileges, verifies that the installation completed - correctly. - - 6. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - - 7. Often, you can also type `make uninstall' to remove the installed - files again. In practice, not all packages have tested that - uninstallation works correctly, even though it is required by the - GNU Coding Standards. - - 8. Some packages, particularly those that use Automake, provide `make - distcheck', which can by used by developers to test that all other - targets like `make install' and `make uninstall' work correctly. - This target is generally not run by end users. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' -for details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. This -is known as a "VPATH" build. - - With a non-GNU `make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before -reconfiguring for another architecture. - - On MacOS X 10.5 and later systems, you can create libraries and -executables that work on multiple system types--known as "fat" or -"universal" binaries--by specifying multiple `-arch' options to the -compiler but only a single `-arch' option to the preprocessor. Like -this: - - ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CPP="gcc -E" CXXCPP="g++ -E" - - This is not guaranteed to produce working output in all cases, you -may have to build one architecture at a time and combine the results -using the `lipo' tool if you have problems. - -Installation Names -================== - - By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX', where PREFIX must be an -absolute file name. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. In general, the -default for these options is expressed in terms of `${prefix}', so that -specifying just `--prefix' will affect all of the other directory -specifications that were not explicitly provided. - - The most portable way to affect installation locations is to pass the -correct locations to `configure'; however, many packages provide one or -both of the following shortcuts of passing variable assignments to the -`make install' command line to change installation locations without -having to reconfigure or recompile. - - The first method involves providing an override variable for each -affected directory. For example, `make install -prefix=/alternate/directory' will choose an alternate location for all -directory configuration variables that were expressed in terms of -`${prefix}'. Any directories that were specified during `configure', -but not in terms of `${prefix}', must each be overridden at install -time for the entire installation to be relocated. The approach of -makefile variable overrides for each directory variable is required by -the GNU Coding Standards, and ideally causes no recompilation. -However, some platforms have known limitations with the semantics of -shared libraries that end up requiring recompilation when using this -method, particularly noticeable in packages that use GNU Libtool. - - The second method involves providing the `DESTDIR' variable. For -example, `make install DESTDIR=/alternate/directory' will prepend -`/alternate/directory' before all installation names. The approach of -`DESTDIR' overrides is not required by the GNU Coding Standards, and -does not work on platforms that have drive letters. On the other hand, -it does better at avoiding recompilation issues, and works well even -when some directory options were not specified in terms of `${prefix}' -at `configure' time. - -Optional Features -================= - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - - Some packages offer the ability to configure how verbose the -execution of `make' will be. For these packages, running `./configure ---enable-silent-rules' sets the default to minimal output, which can be -overridden with `make V=1'; while running `./configure ---disable-silent-rules' sets the default to verbose, which can be -overridden with `make V=0'. - -Particular systems -================== - - On HP-UX, the default C compiler is not ANSI C compatible. If GNU -CC is not installed, it is recommended to use the following options in -order to use an ANSI C compiler: - - ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" - -and if that doesn't work, install pre-built binaries of GCC for HP-UX. - - HP-UX `make' updates targets which have the same time stamps as -their prerequisites, which makes it generally unusable when shipped -generated files such as `configure' are involved. Use GNU `make' -instead. - - On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot -parse its `' header file. The option `-nodtk' can be used as -a workaround. If GNU CC is not installed, it is therefore recommended -to try - - ./configure CC="cc" - -and if that doesn't work, try - - ./configure CC="cc -nodtk" - - On Solaris, don't put `/usr/ucb' early in your `PATH'. This -directory contains several dysfunctional programs; working variants of -these programs are available in `/usr/bin'. So, if you need `/usr/ucb' -in your `PATH', put it _after_ `/usr/bin'. - - On Haiku, software installed for all users goes in `/boot/common', -not `/usr/local'. It is recommended to use the following options: - - ./configure --prefix=/boot/common - -Specifying the System Type -========================== - - There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS - KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - - Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). - -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf limitation. Until the limitation is lifted, you can use -this workaround: - - CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash - -`configure' Invocation -====================== - - `configure' recognizes the following options to control how it -operates. - -`--help' -`-h' - Print a summary of all of the options to `configure', and exit. - -`--help=short' -`--help=recursive' - Print a summary of the options unique to this package's - `configure', and exit. The `short' variant lists options used - only in the top level, while the `recursive' variant lists options - also present in any nested packages. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--prefix=DIR' - Use DIR as the installation prefix. *note Installation Names:: - for more details, including other options available for fine-tuning - the installation locations. - -`--no-create' -`-n' - Run the configure checks, but stop before creating any output - files. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. diff --git a/common/utils/itti_analyzer/Makefile.am b/common/utils/itti_analyzer/Makefile.am deleted file mode 100644 index b1a371cfe8..0000000000 --- a/common/utils/itti_analyzer/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -AM_CFLAGS = \ - @ADD_CFLAGS@ \ - -I$(top_srcdir)/common \ - -I$(top_srcdir)/libparser \ - -I$(top_srcdir)/libresolver \ - -I$(top_srcdir)/libbuffers \ - -I$(top_srcdir)/libui - -SUBDIRS = libparser libresolver libbuffers libui . - -itti_analyzer_LDADD = \ - $(top_builddir)/libui/libui.la \ - $(top_builddir)/libparser/libparser.la \ - $(top_builddir)/libresolver/libresolver.la \ - $(top_builddir)/libbuffers/libbuffers.la - -bin_PROGRAMS = itti_analyzer diff --git a/common/utils/itti_analyzer/NEWS b/common/utils/itti_analyzer/NEWS deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/common/utils/itti_analyzer/README b/common/utils/itti_analyzer/README deleted file mode 100644 index 8ca077a227..0000000000 --- a/common/utils/itti_analyzer/README +++ /dev/null @@ -1,14 +0,0 @@ - -To run itti_analyzer, please perform the following actions: - -1) apt-get install autotools-dev automake libtool - -2) libtoolize - -3) ./autogen.sh - -4) ./configure - -5) make - -6) ./itti_analyzer \ No newline at end of file diff --git a/common/utils/itti_analyzer/autogen.sh b/common/utils/itti_analyzer/autogen.sh deleted file mode 100755 index 6d08b67921..0000000000 --- a/common/utils/itti_analyzer/autogen.sh +++ /dev/null @@ -1,6 +0,0 @@ -#! /bin/sh - -aclocal \ -&& autoheader \ -&& automake --add-missing \ -&& autoconf \ No newline at end of file diff --git a/common/utils/itti_analyzer/common/itti_types.h b/common/utils/itti_analyzer/common/itti_types.h deleted file mode 100644 index d405e48cbd..0000000000 --- a/common/utils/itti_analyzer/common/itti_types.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 - */ - -/** @brief Intertask Interface common types - * Contains type definitions used for generating and parsing ITTI messages. - * @author Laurent Winckel - */ - -#ifndef _ITTI_TYPES_H_ -#define _ITTI_TYPES_H_ - -#include - -#define CHARS_TO_UINT32(c1, c2, c3, c4) (((c4) << 24) | ((c3) << 16) | ((c2) << 8) | (c1)) - -#define MESSAGE_NUMBER_CHAR_FORMAT "%11u" - -/* Intertask message types */ -enum itti_message_types_e -{ - ITTI_DUMP_XML_DEFINITION = CHARS_TO_UINT32 ('\n', 'I', 'x', 'd'), - ITTI_DUMP_XML_DEFINITION_END = CHARS_TO_UINT32 ('i', 'X', 'D', '\n'), - - ITTI_DUMP_MESSAGE_TYPE = CHARS_TO_UINT32 ('\n', 'I', 'm', 's'), - ITTI_DUMP_MESSAGE_TYPE_END = CHARS_TO_UINT32 ('i', 'M', 'S', '\n'), - - ITTI_STATISTIC_MESSAGE_TYPE = CHARS_TO_UINT32 ('\n', 'I', 's', 't'), - ITTI_STATISTIC_MESSAGE_TYPE_END = CHARS_TO_UINT32 ('i', 'S', 'T', '\n'), - - /* This signal is not meant to be used by remote analyzer */ - ITTI_DUMP_EXIT_SIGNAL = CHARS_TO_UINT32 ('e', 'X', 'I', 'T'), -}; - -typedef uint32_t itti_message_types_t; - -/* Message header is the common part that should never change between - * remote process and this one. - */ -typedef struct { - /* The size of this structure */ - uint32_t message_size; - itti_message_types_t message_type; -} itti_socket_header_t; - -typedef struct { - char message_number_char[12]; /* 9 chars are needed to store an unsigned 32 bits value in decimal, but must be a multiple of 32 bits to avoid alignment issues */ -} itti_signal_header_t; - - -#define INSTANCE_DEFAULT (UINT16_MAX - 1) -#define INSTANCE_ALL (UINT16_MAX) - -typedef uint16_t instance_t; - -#endif diff --git a/common/utils/itti_analyzer/common/logs.h b/common/utils/itti_analyzer/common/logs.h deleted file mode 100644 index bd901cc394..0000000000 --- a/common/utils/itti_analyzer/common/logs.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 - */ - -/* - * logs.h - * - * Created on: Nov 22, 2013 - * Author: Laurent Winckel - */ - -#ifndef LOGS_H_ -#define LOGS_H_ - -/* Added definition of the g_info log function to complete the set of log functions from "gmessages.h" */ - -#include - -#ifdef G_HAVE_ISO_VARARGS - -#define g_info(...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_INFO, \ - __VA_ARGS__) - -#else - -static void -g_info (const gchar *format, - ...) -{ - va_list args; - va_start (args, format); - g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format, args); - va_end (args); -} - -#endif - -#endif /* LOGS_H_ */ diff --git a/common/utils/itti_analyzer/common/rc.h b/common/utils/itti_analyzer/common/rc.h deleted file mode 100644 index 50786f460f..0000000000 --- a/common/utils/itti_analyzer/common/rc.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 - */ - -#include -#include - -#ifndef RC_H_ -#define RC_H_ - -#define RC_OK 0 -#define RC_FAIL -1 -#define RC_BAD_PARAM -2 -#define RC_NULL_POINTER -3 - -static const char * const rc_strings[] = - {"Ok", "fail", "bad parameter", "null pointer"}; - -#define CHECK_FCT(fCT) \ -do { \ - int rET; \ - if ((rET = fCT) != RC_OK) { \ - fprintf(stderr, #fCT" has failed (%s:%d)\n", __FILE__, __LINE__); \ - return rET; \ - } \ -} while(0) - -#define CHECK_FCT_POSIX(fCT) \ -do { \ - if (fCT == -1) { \ - fprintf(stderr, #fCT" has failed (%d:%s) (%s:%d)\n", errno, \ - strerror(errno), __FILE__, __LINE__); \ - return RC_FAIL; \ - } \ -} while(0) - -#define CHECK_FCT_DO(fCT, dO) \ -do { \ - int rET; \ - if ((rET = fCT) != RC_OK) { \ - fprintf(stderr, #fCT" has returned %d (%s:%d)\n", rET, __FILE__, __LINE__); \ - dO; \ - } \ -} while(0) - -#define CHECK_BUFFER(bUFFER) \ -do { \ - if ((bUFFER) == NULL) { \ - fprintf(stderr, #bUFFER" is NULL (%s:%d)\n", __FILE__, __LINE__); \ - return RC_NULL_POINTER; \ - } \ -} while(0) - -#endif /* RC_H_ */ diff --git a/common/utils/itti_analyzer/configure.ac b/common/utils/itti_analyzer/configure.ac deleted file mode 100644 index c6be3e01ab..0000000000 --- a/common/utils/itti_analyzer/configure.ac +++ /dev/null @@ -1,97 +0,0 @@ -AC_PREREQ([2.68]) - -define([svnversion], esyscmd([sh -c "svnversion ..|tr -d '\n'"])) - -AC_DEFINE(SVN_REVISION, "svnversion", [SVN Revision]) - -AC_INIT([itti_analyzer], [0.2.svnversion], [openair_admin@eurecom.fr]) -AC_CANONICAL_BUILD -AC_CANONICAL_TARGET -AM_INIT_AUTOMAKE([1.11 silent-rules]) - -AC_CONFIG_MACRO_DIR([m4]) - -AC_CONFIG_HEADERS([config.h]) - -AM_MAINTAINER_MODE - -AM_SILENT_RULES([yes]) - -AM_PROG_LIBTOOL - -AC_PROG_RANLIB -AC_PROG_CXX - -AC_FUNC_ALLOCA -AC_FUNC_MALLOC -AC_FUNC_REALLOC - -AC_TYPE_SIZE_T -AC_TYPE_SSIZE_T -AC_TYPE_INT8_T -AC_TYPE_INT16_T -AC_TYPE_INT32_T -AC_TYPE_INT64_T -AC_TYPE_UINT8_T -AC_TYPE_UINT16_T -AC_TYPE_UINT32_T -AC_TYPE_UINT64_T - -AC_CHECK_FUNCS([memset]) -AC_CHECK_FUNCS([socket]) -AC_CHECK_FUNCS([strdup]) -AC_CHECK_FUNCS([strerror]) -AC_CHECK_FUNCS([select]) -AC_CHECK_FUNCS([strstr]) - -AC_CHECK_HEADERS([arpa/inet.h]) -AC_CHECK_HEADERS([fcntl.h]) -AC_CHECK_HEADERS([libintl.h]) -AC_CHECK_HEADERS([malloc.h]) -AC_CHECK_HEADERS([stddef.h]) -AC_CHECK_HEADERS([netinet/in.h]) - -AC_CHECK_LIB(m, log10) - -PKG_CHECK_MODULES(XML2, [libxml-2.0 >= 2.7.8], [HAVE_XML2=true], [AC_MSG_ERROR(lixml-2.0 not installed)]) -CFLAGS="$CFLAGS $XML2_CFLAGS" -LIBS="$LIBS $XML2_LIBS" - -AM_PATH_GTK_3_0(3.0.0, [], AC_MSG_ERROR(Requirement not met: gtk >= 3.0.0)) -CFLAGS="$CFLAGS $GTK_CFLAGS" -LIBS="$LIBS $GTK_LIBS" - -dnl Add these flags -CFLAGS="$CFLAGS -Wall" -CFLAGS="$CFLAGS -Wshadow" -CFLAGS="$CFLAGS -Wcast-align" -CFLAGS="$CFLAGS -Wchar-subscripts" -CFLAGS="$CFLAGS -Wmissing-prototypes" -CFLAGS="$CFLAGS -Wmissing-declarations" -CFLAGS="$CFLAGS -Werror=implicit-function-declaration" - -AC_SUBST([AM_CFLAGS]) -AC_SUBST(ADD_CFLAGS) - -dnl *** Autoconf support *** -AC_ARG_ENABLE(autoconf, - [ --disable-autoconf disable automatic generation of configure script ], - enable_autoconf=$enableval, enable_autoconf=yes -) -AC_PATH_PROG(AUTOCONF, autoconf, @echo autoconf not available) -AC_PATH_PROG(AUTOHEADER, autoheader, @echo autoheader not available) -if test -z "$AUTOCONF"; then enable_autoconf=no ; fi -if test -z "$AUTOHEADER"; then enable_autoconf=no ; fi -if test x$enable_autoconf = xyes; then - CONFIGURE_DEPENDS="configure.in aclocal.m4" -fi -AC_SUBST(CONFIGURE_DEPENDS) - -AC_CONFIG_FILES( - libbuffers/Makefile \ - libparser/Makefile \ - libresolver/Makefile \ - libui/Makefile \ - Makefile \ -) -AC_OUTPUT diff --git a/common/utils/itti_analyzer/filters.xml b/common/utils/itti_analyzer/filters.xml deleted file mode 100644 index 7305a2294c..0000000000 --- a/common/utils/itti_analyzer/filters.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/utils/itti_analyzer/filters_mme.xml b/common/utils/itti_analyzer/filters_mme.xml deleted file mode 100644 index 7838982613..0000000000 --- a/common/utils/itti_analyzer/filters_mme.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/utils/itti_analyzer/filters_ue_enb.xml b/common/utils/itti_analyzer/filters_ue_enb.xml deleted file mode 100644 index 77859d20b6..0000000000 --- a/common/utils/itti_analyzer/filters_ue_enb.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/utils/itti_analyzer/itti_analyzer.c b/common/utils/itti_analyzer/itti_analyzer.c deleted file mode 100644 index d87deb46e2..0000000000 --- a/common/utils/itti_analyzer/itti_analyzer.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include - -#include - -#include - -#include "xml_parse.h" -#include "resolvers.h" -#include "locate_root.h" -#include "file.h" -#include "ui_main_screen.h" - -#include "rc.h" - -#define G_LOG_LEVELS (G_LOG_LEVEL_ERROR | \ - G_LOG_LEVEL_CRITICAL | \ - G_LOG_LEVEL_WARNING | \ - G_LOG_LEVEL_MESSAGE | \ - G_LOG_LEVEL_INFO | \ - G_LOG_LEVEL_DEBUG) - -int debug_buffers = 1; -int debug_parser = 0; - -static void console_log_handler(const char *log_domain, GLogLevelFlags log_level, - const char *message, gpointer user_data) -{ - GLogLevelFlags domain_log_level = (GLogLevelFlags) user_data; - time_t curr; - struct tm *today; - const char *level; - - if (ui_main_data.log_flags & domain_log_level & log_level) - { - switch (log_level & G_LOG_LEVEL_MASK) - { - case G_LOG_LEVEL_ERROR: - level = "Err "; - break; - case G_LOG_LEVEL_CRITICAL: - level = "Crit"; - break; - case G_LOG_LEVEL_WARNING: - level = "Warn"; - break; - case G_LOG_LEVEL_MESSAGE: - level = "Msg "; - break; - case G_LOG_LEVEL_INFO: - level = "Info"; - break; - case G_LOG_LEVEL_DEBUG: - level = "Dbg "; - break; - default: - fprintf(stderr, "unknown log_level %u\n", log_level); - level = NULL; - g_assert_not_reached(); - break; - } - - /* create a "timestamp" */ - time(&curr); - today = localtime(&curr); - - fprintf(stderr, "%02u:%02u:%02u %-9s %s %s\n", today->tm_hour, today->tm_min, today->tm_sec, - log_domain != NULL ? log_domain : "", level, message); - } -} - -int main(int argc, char *argv[]) -{ - int ret = 0; - - GLogLevelFlags log_flags; - - log_flags = (GLogLevelFlags) - (G_LOG_LEVEL_ERROR | - G_LOG_LEVEL_CRITICAL | - G_LOG_LEVEL_WARNING | - G_LOG_LEVEL_MESSAGE | - G_LOG_LEVEL_INFO | - G_LOG_LEVEL_DEBUG); - - /* This initialize the library and check potential ABI mismatches - * between the version it was compiled for and the actual shared - * library used. - */ - LIBXML_TEST_VERSION; - xmlInitParser(); - - /* Initialize the widget set */ - gtk_init(&argc, &argv); - - /* Parse command line options */ - ui_gtk_parse_arg (argc, argv); - - /* Set log handlers: - * Domain, Levels, Handler, Domain enabled levels */ - g_log_set_handler( NULL, log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS)); - g_log_set_handler("BUFFERS", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG)))); - g_log_set_handler("PARSER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG)))); - g_log_set_handler("RESOLVER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG)))); - g_log_set_handler("UI", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG)))); - g_log_set_handler("UI_CB", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS)); - g_log_set_handler("UI_FILTER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG)))); - g_log_set_handler("UI_INTER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS)); - g_log_set_handler("UI_TREE", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG)))); - - CHECK_FCT(ui_gtk_initialize(argc, argv)); - - /* Enter the main event loop, and wait for user interaction */ - gtk_main (); - - /* Free the global variables that may - * have been allocated by the parser. - */ - xmlCleanupParser (); - - return ret; -} diff --git a/common/utils/itti_analyzer/libbuffers/Makefile.am b/common/utils/itti_analyzer/libbuffers/Makefile.am deleted file mode 100644 index 7af612e5e7..0000000000 --- a/common/utils/itti_analyzer/libbuffers/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -AM_CFLAGS = \ - @ADD_CFLAGS@ \ - -I$(top_srcdir)/common \ - -I$(top_srcdir)/libparser \ - -I$(top_srcdir)/libui - -noinst_LTLIBRARIES = libbuffers.la - -libbuffers_la_LDFLAGS = -all-static -libbuffers_la_SOURCES = \ - buffers.c buffers.h \ - file.c file.h \ - socket.c socket.h diff --git a/common/utils/itti_analyzer/libbuffers/buffers.c b/common/utils/itti_analyzer/libbuffers/buffers.c deleted file mode 100644 index 870c9cd40a..0000000000 --- a/common/utils/itti_analyzer/libbuffers/buffers.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include - -#define G_LOG_DOMAIN ("BUFFERS") - -#include - -#include "rc.h" -#include "buffers.h" - -extern int debug_buffers; - -static -int buffer_fetch(buffer_t *buffer, uint32_t offset, int size, void *value); - -/* Try to fetch 8 bits unsigned from the buffer */ -uint8_t buffer_get_uint8_t(buffer_t *buffer, uint32_t offset) -{ - uint8_t value; - - buffer_fetch(buffer, offset, 1, &value); - - return value; -} - -/* Try to fetch 16 bits unsigned from the buffer */ -uint16_t buffer_get_uint16_t(buffer_t *buffer, uint32_t offset) -{ - uint16_t value; - - buffer_fetch(buffer, offset, 2, &value); - - return value; -} - -/* Try to fetch 32 bits unsigned from the buffer */ -uint32_t buffer_get_uint32_t(buffer_t *buffer, uint32_t offset) -{ - uint32_t value; - - buffer_fetch(buffer, offset, 4, &value); - - return value; -} - -/* Try to fetch 64 bits unsigned from the buffer */ -uint64_t buffer_get_uint64_t(buffer_t *buffer, uint32_t offset) -{ - uint64_t value; - - buffer_fetch(buffer, offset, 8, &value); - - return value; -} - -static -int buffer_fetch(buffer_t *buffer, uint32_t offset, int size, void *value) -{ - if (buffer == NULL || value == NULL) - return -1; - if (size <= 0) - return -1; - - if (buffer->size_bytes < ((offset >> 3) + size)) { - g_warning("Not enough data to fetch"); - return -1; - } - - memcpy(value, &buffer->data[offset >> 3], size); - buffer->buffer_current = &buffer->data[(offset >> 3) + size]; - - return 0; -} - -int buffer_fetch_nbytes(buffer_t *buffer, uint32_t offset, int n_bytes, uint8_t *value) -{ - if (buffer->size_bytes < ((offset >> 3) + n_bytes)) { - g_warning("Not enough data to fetch"); - return -1; - } - memcpy(&value[0], &buffer->data[offset >> 3], n_bytes); - - return 0; -} - -int buffer_fetch_bits(buffer_t *buffer, uint32_t offset, int nbits, uint32_t *value) -{ - uint32_t temp = 0; - int i; - - if (buffer == NULL || value == NULL) - return RC_BAD_PARAM; - - /* We cannot fetch more than 32 bits */ - if (nbits > 32) - return RC_BAD_PARAM; - - for (i = 0; i < nbits; i++) - { - temp |= ((buffer->data[(offset + i) / 8] >> ((offset + i) % 8)) & 1) << i; - } - - *value = temp; - - return RC_OK; -} - -/** - * @brief Create a new buffer from data - * @param buffer caller reference where created buffer will be stored - * @param data Data to attach to the new buffer - * @param length Length of data buffer - * @param data_static flag that indicates if data pointer has been statically (= 0) or not (!= 0) - */ -int buffer_new_from_data(buffer_t **buffer, uint8_t *data, const uint32_t length, - int data_static) -{ - buffer_t *new; - - if (!buffer) - return RC_BAD_PARAM; - - new = malloc(sizeof(buffer_t)); - - new->size_bytes = length; - if (data && length > 0) { - if (data_static == 0) { - new->data = malloc(sizeof(uint8_t) * new->size_bytes); - memcpy(new->data, data, new->size_bytes); - } else { - new->data = data; - } - new->buffer_current = &new->data[0]; - } else { - new->buffer_current = NULL; - } - - *buffer = new; - - return 0; -} - -#define INDENTED(fILE, x, y) \ -do { \ - int indentation = x; \ - while(indentation--) fprintf(fILE, " "); \ - y; \ -} while(0) - -#define INDENT_BREAK 20 - -void buffer_dump(buffer_t *buffer, FILE *to) -{ - FILE *file = to; - uint32_t i; - - if (!buffer) - return; - if (!to) - to = stdout; - - fprintf(file, "\n"); - INDENTED(file, 4, fprintf(file, "%u\n", buffer->size_bytes)); - INDENTED(file, 4, fprintf(file, "\n")); - for (i = 0; i < buffer->size_bytes; i++) - { - if ((i % INDENT_BREAK) == 0) - fprintf(file, " "); - fprintf(file, "0x%02x ", buffer->data[i]); - if ((i % INDENT_BREAK) == (INDENT_BREAK - 1)) - fprintf(file, "\n"); - } - if ((i % INDENT_BREAK) != (INDENT_BREAK - 1)) - fprintf(file, "\n"); - INDENTED(file, 4, fprintf(file, "\n")); - fprintf(file, "\n"); -} - -int buffer_append_data(buffer_t *buffer, const uint8_t *data, const uint32_t length) -{ - if (!buffer) - return -1; - - if (data && length > 0) { - if (!buffer->data) { - buffer->size_bytes = length; - buffer->data = malloc(sizeof(uint8_t) * buffer->size_bytes); - memcpy(buffer->data, data, buffer->size_bytes); - } else { - buffer->data = realloc(buffer->data, sizeof(uint8_t) * (buffer->size_bytes + length)); - memcpy(&buffer->data[buffer->size_bytes], data, length); - buffer->size_bytes += length; - } - buffer->buffer_current = &buffer->data[0]; - } - - return 0; -} - -int buffer_has_enouch_data(buffer_t *buffer, uint32_t offset, uint32_t to_get) -{ - int underflow; - if (!buffer) - return -1; - underflow = (buffer->size_bytes >= ((offset + to_get) / 8)) ? 0 : -1; - if (underflow && debug_buffers) - g_warning("Detected Underflow offset %u, to_get %u, buffer size %u\n", - offset, to_get, buffer->size_bytes); - return underflow; -} - -void *buffer_at_offset(buffer_t *buffer, uint32_t offset) -{ -// if (buffer_has_enouch_data(buffer, 0, offset) != 0) { -// return NULL; -// } - return &buffer->data[offset / 8]; -} diff --git a/common/utils/itti_analyzer/libbuffers/buffers.h b/common/utils/itti_analyzer/libbuffers/buffers.h deleted file mode 100644 index 34ecb355ab..0000000000 --- a/common/utils/itti_analyzer/libbuffers/buffers.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 - */ - -#include - -#ifndef BUFFERS_H_ -#define BUFFERS_H_ - -typedef struct buffer_s { - /* The size in bytes as read from socket */ - uint32_t size_bytes; - - /* Current position */ - uint8_t *buffer_current; - - /* The complete data */ - uint8_t *data; - - /* The message number as read from socket */ - uint32_t message_number; - - uint32_t message_id; -} buffer_t; - -uint8_t buffer_get_uint8_t(buffer_t *buffer, uint32_t offset); - -uint16_t buffer_get_uint16_t(buffer_t *buffer, uint32_t offset); - -uint32_t buffer_get_uint32_t(buffer_t *buffer, uint32_t offset); - -uint64_t buffer_get_uint64_t(buffer_t *buffer, uint32_t offset); - -int buffer_fetch_bits(buffer_t *buffer, uint32_t offset, int nbits, uint32_t *value); - -int buffer_fetch_nbytes(buffer_t *buffer, uint32_t offset, int n_bytes, uint8_t *value); - -void buffer_dump(buffer_t *buffer, FILE *to); - -int buffer_append_data(buffer_t *buffer, const uint8_t *data, const uint32_t length); - -int buffer_new_from_data(buffer_t **buffer, uint8_t *data, const uint32_t length, - int data_static); - -int buffer_has_enouch_data(buffer_t *buffer, uint32_t offset, uint32_t to_get); - -void *buffer_at_offset(buffer_t *buffer, uint32_t offset); - -#endif /* BUFFERS_H_ */ diff --git a/common/utils/itti_analyzer/libbuffers/file.c b/common/utils/itti_analyzer/libbuffers/file.c deleted file mode 100644 index 291bf2d216..0000000000 --- a/common/utils/itti_analyzer/libbuffers/file.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include -#include -#include - -#define G_LOG_DOMAIN ("BUFFERS") - -#include - -#include "rc.h" -#include "buffers.h" -#include "file.h" - -#define READ_BUFFER_SIZE 1024 - -int file_read_dump(buffer_t **buffer, const char *filename) -{ - int fd = -1; - buffer_t *new_buf = NULL; - uint8_t data[READ_BUFFER_SIZE]; - ssize_t current_read; - - if (!filename) - return RC_BAD_PARAM; - - if ((fd = open(filename, O_RDONLY)) == -1) { - g_warning("Cannot open %s for reading, returned %d:%s\n", - filename, errno, strerror(errno)); - return RC_FAIL; - } - - CHECK_FCT(buffer_new_from_data(&new_buf, NULL, 0, 0)); - - do { - current_read = read(fd, data, READ_BUFFER_SIZE); - if (current_read == -1) - { - g_warning("Failed to read data from file, returned %d:%s\n", - errno, strerror(errno)); - return RC_FAIL; - } - CHECK_FCT(buffer_append_data(new_buf, data, current_read)); - } while(current_read == READ_BUFFER_SIZE); - - *buffer = new_buf; - - buffer_dump(new_buf, stdout); - - close(fd); - - return RC_OK; -} diff --git a/common/utils/itti_analyzer/libbuffers/file.h b/common/utils/itti_analyzer/libbuffers/file.h deleted file mode 100644 index be0fa6ba2d..0000000000 --- a/common/utils/itti_analyzer/libbuffers/file.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 - */ - -#ifndef FILE_H_ -#define FILE_H_ - -int file_read_dump(buffer_t **buffer, const char *filename); - -#endif /* FILE_H_ */ diff --git a/common/utils/itti_analyzer/libbuffers/socket.c b/common/utils/itti_analyzer/libbuffers/socket.c deleted file mode 100644 index f732af70ec..0000000000 --- a/common/utils/itti_analyzer/libbuffers/socket.c +++ /dev/null @@ -1,444 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define G_LOG_DOMAIN ("BUFFERS") - -#include - -#include "logs.h" -#include "itti_types.h" -#include "rc.h" - -#include "ui_interface.h" -#include "ui_notifications.h" -#include "ui_notif_dlg.h" - -#include "socket.h" -#include "buffers.h" - -#include "xml_parse.h" - -/* Retry connection after 100 ms */ -#define SOCKET_US_BEFORE_CONNECT_RETRY (100 * 1000) -/* About 10 minutes time-out for connecting to peer */ -#define SOCKET_NB_CONNECT_RETRY ((10 * 60 * 1000 * 1000) / SOCKET_US_BEFORE_CONNECT_RETRY) - -#define SOCKET_NB_SIGNALS_BEFORE_SIGNALLING 10 -#define SOCKET_MS_BEFORE_SIGNALLING 100 - -gboolean socket_abort_connection = FALSE; - -void *socket_thread_fct(void *arg); - -static ssize_t socket_read_data(socket_data_t *socket_data, void *buffer, size_t size, int flags) -{ - ssize_t recv_ret; - - recv_ret = recv(socket_data->sd, buffer, size, flags); - if (recv_ret == -1) { - /* Failure case */ - switch (errno) { -// case EWOULDBLOCK: - case EAGAIN: - return -1; - default: - g_info("recv failed: %s", g_strerror(errno)); - pthread_exit(NULL); - break; - } - } else if (recv_ret == 0) { - /* We lost the connection with other peer or shutdown asked */ - ui_pipe_write_message(socket_data->pipe_fd, - UI_PIPE_CONNECTION_LOST, NULL, 0); - free(socket_data->ip_address); - free(socket_data); - pthread_exit(NULL); - } - - return recv_ret; -} - -static void socket_notify_gui_update(socket_data_t *socket_data) -{ - pipe_new_signals_list_message_t pipe_signal_list_message; - - pipe_signal_list_message.signal_list = socket_data->signal_list; - - socket_data->signal_list = NULL; - socket_data->nb_signals_since_last_update = 0; - - /* Send an update notification */ - ui_pipe_write_message(socket_data->pipe_fd, - UI_PIPE_UPDATE_SIGNAL_LIST, &pipe_signal_list_message, - sizeof(pipe_signal_list_message)); - - /* Acquire the last data notification */ - socket_data->last_data_notification = g_get_monotonic_time(); -} - -static int socket_read_itti_message(socket_data_t *socket_data, - itti_socket_header_t *message_header) -{ - itti_signal_header_t itti_signal_header; - buffer_t *buffer; - uint8_t *data; - size_t data_length; - ssize_t data_read = 0; - ssize_t total_data_read = 0; - - g_assert(message_header != NULL); - - g_debug("Attempting to read signal header from socket"); - - /* Read the sub-header of signal */ - while (data_read != sizeof(itti_signal_header_t)) { - data_read = socket_read_data(socket_data, &itti_signal_header, - sizeof(itti_signal_header_t), 0); - } - - data_length = message_header->message_size - sizeof(itti_socket_header_t) - sizeof(itti_signal_header_t); - data = malloc(sizeof(uint8_t) * data_length); - - while (total_data_read < data_length) { - data_read = socket_read_data(socket_data, &data[total_data_read], - data_length - total_data_read, 0); - /* We are waiting for data */ - if (data_read < 0) { - usleep(10); - } else { - total_data_read += data_read; - } - } - - /* Create the new buffer */ - if (buffer_new_from_data(&buffer, data, data_length - sizeof(itti_message_types_t), 1) != RC_OK) { - g_error("Failed to create new buffer"); - g_assert_not_reached(); - } - - sscanf (itti_signal_header.message_number_char, MESSAGE_NUMBER_CHAR_FORMAT, &buffer->message_number); -// buffer_dump(buffer, stdout); - - /* Update the number of signals received since last GUI update */ - socket_data->nb_signals_since_last_update++; - - socket_data->signal_list = g_list_append(socket_data->signal_list, (gpointer)buffer); - - if (socket_data->nb_signals_since_last_update >= SOCKET_NB_SIGNALS_BEFORE_SIGNALLING) { - socket_notify_gui_update(socket_data); - } - - g_debug("Successfully read new signal %u from socket", buffer->message_number); - - return total_data_read + sizeof(itti_signal_header); -} - -static int socket_read_xml_definition(socket_data_t *socket_data, - itti_socket_header_t *message_header) -{ - ssize_t data_read; - ssize_t total_data_read = 0; - char *xml_definition; - size_t xml_definition_length; - pipe_xml_definition_message_t pipe_xml_definition_message; - - xml_definition_length = message_header->message_size - sizeof(*message_header); - xml_definition = malloc(xml_definition_length * sizeof(char)); - - g_debug("Attempting to read XML definition of size %zu from socket", - xml_definition_length); - - /* XML definition is a long message... so function may take some time */ - - do { - data_read = socket_read_data(socket_data, &xml_definition[total_data_read], - xml_definition_length - total_data_read, 0); - - /* We are waiting for data */ - if (data_read < 0) { - usleep(10); - } else { - total_data_read += data_read; - } - } while (total_data_read != xml_definition_length); - - pipe_xml_definition_message.xml_definition = xml_definition; - pipe_xml_definition_message.xml_definition_length = xml_definition_length - sizeof(itti_message_types_t); - - g_debug("Received XML definition of size %zu, effectively read %zu bytes", - xml_definition_length, total_data_read); - - ui_pipe_write_message(socket_data->pipe_fd, UI_PIPE_XML_DEFINITION, - &pipe_xml_definition_message, sizeof(pipe_xml_definition_message)); - - return total_data_read; -} - -static int socket_read(socket_data_t *socket_data) -{ - int ret = 0; - itti_socket_header_t message_header; - - while (ret >= 0) { - ret = socket_read_data(socket_data, &message_header, sizeof(message_header), 0); - - if (ret == -1) { - return 0; - } - - switch(message_header.message_type) { - case ITTI_DUMP_XML_DEFINITION: - socket_read_xml_definition(socket_data, &message_header); - break; - - case ITTI_DUMP_MESSAGE_TYPE: - socket_read_itti_message(socket_data, &message_header); - break; - - case ITTI_STATISTIC_MESSAGE_TYPE: - default: - g_warning("Received unknow (or not implemented) message from socket type: %d", - message_header.message_type); - break; - } - } - - return 0; -} - -static int socket_handle_disconnect_evt(socket_data_t *socket_data) -{ - /* Send shutdown to remote host */ - CHECK_FCT_POSIX(shutdown(socket_data->sd, SHUT_RDWR)); - /* Close file descriptor */ - CHECK_FCT_POSIX(close(socket_data->sd)); - - socket_data->sd = -1; - - /* Close pipe */ - close(socket_data->pipe_fd); - - /* Leaving the thread */ - pthread_exit(NULL); - - return 0; -} - -static int pipe_read_message(socket_data_t *socket_data) -{ - pipe_input_header_t input_header; - uint8_t *input_data = NULL; - size_t input_data_length = 0; - - /* Read the header */ - if (read(socket_data->pipe_fd, &input_header, sizeof(input_header)) < 0) { - g_warning("Failed to read from pipe %d: %s", socket_data->pipe_fd, - g_strerror(errno)); - return -1; - } - - input_data_length = input_header.message_size - sizeof(input_header); - - /* Checking for non-header part */ - if (input_data_length > 0) { - input_data = malloc(sizeof(uint8_t) * input_data_length); - - if (read(socket_data->pipe_fd, input_data, input_data_length) < 0) { - g_warning("Failed to read from pipe %d: %s", socket_data->pipe_fd, - g_strerror(errno)); - return -1; - } - } - - switch (input_header.message_type) { - case UI_PIPE_DISCONNECT_EVT: - return socket_handle_disconnect_evt(socket_data); - default: - g_warning("[socket] Unhandled message type %u", input_header.message_type); - g_assert_not_reached(); - } - return 0; -} - -void *socket_thread_fct(void *arg) -{ - int ret; - struct sockaddr_in si_me; - socket_data_t *socket_data; - int retry = SOCKET_NB_CONNECT_RETRY; - - /* master file descriptor list */ - fd_set master_fds; - /* temp file descriptor list for select() */ - fd_set read_fds; - int fd_max = 0; - struct timeval tv; - - socket_data = (socket_data_t *)arg; - - g_assert(socket_data != NULL); - - /* Preparing the socket */ - if ((socket_data->sd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) { - g_warning("socket failed: %s", g_strerror(errno)); - free(socket_data->ip_address); - free(socket_data); - pthread_exit(NULL); - } - memset((void *)&si_me, 0, sizeof(si_me)); - - si_me.sin_family = AF_INET; - si_me.sin_port = htons(socket_data->port); - if (inet_aton(socket_data->ip_address, &si_me.sin_addr) == 0) { - g_warning("inet_aton() failed\n"); - free(socket_data->ip_address); - free(socket_data); - pthread_exit(NULL); - } - - /* clear the master and temp sets */ - FD_ZERO(&master_fds); - FD_ZERO(&read_fds); - - /* Add the GUI pipe to the list of sockets to monitor */ - FD_SET(socket_data->pipe_fd, &master_fds); - - /* Add the client socket to the list of sockets to monitor */ - FD_SET(socket_data->sd, &master_fds); - - /* Update the fd_max with the MAX of socket/pipe */ - fd_max = MAX(socket_data->pipe_fd, socket_data->sd); - - /* Setup the timeout for select. - * When a timeout is caught, check for new notifications to send to GUI. - */ - tv.tv_sec = 0; - tv.tv_usec = 1000 * SOCKET_MS_BEFORE_SIGNALLING; - - do { - /* Connecting to remote peer */ - ret = connect(socket_data->sd, (struct sockaddr *) &si_me, sizeof(struct sockaddr_in)); - if (ret < 0) { - if ((socket_abort_connection) || (retry < 0)) { - if (retry < 0) { - g_warning("Failed to connect to peer %s:%d", socket_data->ip_address, socket_data->port); - ui_pipe_write_message(socket_data->pipe_fd, UI_PIPE_CONNECTION_FAILED, NULL, 0); - } - free(socket_data->ip_address); - free(socket_data); - socket_abort_connection = FALSE; - /* Quit the thread */ - pthread_exit(NULL); - } - usleep(SOCKET_US_BEFORE_CONNECT_RETRY); - retry--; - } - } while (ret < 0); - - /* Set the socket as non-blocking */ - fcntl(socket_data->sd, F_SETFL, O_NONBLOCK); - - while (1) { - memcpy(&read_fds, &master_fds, sizeof(master_fds)); - - ret = select(fd_max + 1, &read_fds, NULL, NULL, &tv); - if (ret < 0) { - g_warning("Error in select: %s", g_strerror(errno)); - free(socket_data->ip_address); - free(socket_data); - /* Quit the thread */ - pthread_exit(NULL); - } else if (ret == 0) { - /* Timeout for select: check if there is new incoming messages - * since last GUI update - */ - if (socket_data->nb_signals_since_last_update > 0) { - g_debug("Timout on select and data new signal in list"); - g_debug("-> notify GUI"); - socket_notify_gui_update(socket_data); - } - - /* Reset the timeval to the max value */ - tv.tv_usec = 1000 * SOCKET_MS_BEFORE_SIGNALLING; - } - - /* Checking if there is data to read from the pipe */ - if (FD_ISSET(socket_data->pipe_fd, &read_fds)) { - FD_CLR(socket_data->pipe_fd, &read_fds); - pipe_read_message(socket_data); - } - - /* Checking if there is data to read from the socket */ - if (FD_ISSET(socket_data->sd, &read_fds)) { - FD_CLR(socket_data->sd, &read_fds); - socket_read(socket_data); - - /* Update the timeout of select if there is data not notify to GUI */ - if (socket_data->nb_signals_since_last_update > 0) { - gint64 current_time; - - current_time = g_get_monotonic_time(); - - if ((current_time - socket_data->last_data_notification) > SOCKET_MS_BEFORE_SIGNALLING) { - socket_notify_gui_update(socket_data); - tv.tv_usec = 1000 * SOCKET_MS_BEFORE_SIGNALLING; - } else { - /* Update tv */ - tv.tv_usec = (1000 * SOCKET_MS_BEFORE_SIGNALLING) - (current_time - socket_data->last_data_notification); - } - } - } - } - - return NULL; -} - -int socket_connect_to_remote_host(const char *remote_ip, const uint16_t port, - int pipe_fd) -{ - socket_data_t *socket_data; - - socket_data = calloc(1, sizeof(*socket_data)); - - socket_data->ip_address = strdup(remote_ip); - - socket_data->pipe_fd = pipe_fd; - socket_data->port = port; - socket_data->sd = -1; - - if (pthread_create(&socket_data->thread, NULL, socket_thread_fct, socket_data) != 0) { - g_warning("Failed to create thread %d:%s", errno, strerror(errno)); - free(socket_data->ip_address); - free(socket_data); - return RC_FAIL; - } - - return RC_OK; -} diff --git a/common/utils/itti_analyzer/libbuffers/socket.h b/common/utils/itti_analyzer/libbuffers/socket.h deleted file mode 100644 index 8c2be2243e..0000000000 --- a/common/utils/itti_analyzer/libbuffers/socket.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 - */ - -#include -#include - -#ifndef SOCKET_H_ -#define SOCKET_H_ - -typedef struct { - pthread_t thread; - int sd; - char *ip_address; - uint16_t port; - - /* The pipe used between main thread (running GTK) and the socket thread */ - int pipe_fd; - - /* Time used to avoid refreshing UI every time a new signal is incoming */ - gint64 last_data_notification; - uint8_t nb_signals_since_last_update; - - /* The last signals received which are not yet been updated in GUI */ - GList *signal_list; -} socket_data_t; - -gboolean socket_abort_connection; - -int socket_connect_to_remote_host(const char *remote_ip, const uint16_t port, - int pipe_fd); - -int socket_disconnect_from_remote_host(void); - -#endif /* SOCKET_H_ */ diff --git a/common/utils/itti_analyzer/libparser/Makefile.am b/common/utils/itti_analyzer/libparser/Makefile.am deleted file mode 100644 index bf80db2867..0000000000 --- a/common/utils/itti_analyzer/libparser/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -AM_CFLAGS = \ - @ADD_CFLAGS@ \ - -I$(top_srcdir)/common \ - -I$(top_srcdir)/libbuffers \ - -I$(top_srcdir)/libui - -noinst_LTLIBRARIES = libparser.la - -libparser_la_LDFLAGS = -all-static -libparser_la_SOURCES = \ - xml_parse.c \ - array_type.c array_type.h \ - enum_type.c enum_type.h \ - enum_value_type.c enum_value_type.h \ - file_type.c file_type.h \ - field_type.c field_type.h \ - fundamental_type.c fundamental_type.h \ - pointer_type.h pointer_type.c \ - reference_type.c reference_type.h \ - struct_type.c struct_type.h \ - typedef_type.c typedef_type.h \ - types.h types.c \ - union_type.c union_type.h diff --git a/common/utils/itti_analyzer/libparser/array_type.c b/common/utils/itti_analyzer/libparser/array_type.c deleted file mode 100644 index 1d9f741281..0000000000 --- a/common/utils/itti_analyzer/libparser/array_type.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include -#include - -#include - -#define G_LOG_DOMAIN ("PARSER") - -#include "array_type.h" -#include "fundamental_type.h" -#include "ui_interface.h" - -int array_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line) -{ - types_t *type_child; - int length = 0; - char cbuf[50]; - - DISPLAY_PARSE_INFO("array", type->name, offset, parent_offset); - - /* Ignore TYPEDEF children */ - for (type_child = type->child; type_child != NULL && type_child->type == TYPE_TYPEDEF; - type_child = type_child->child) { - } - - if (type->name) { - INDENTED(stdout, indent, fprintf(stdout, "<%s>\n", type->name)); - } - if (type->child != NULL) { - int items = type->size / type_child->size; - int i; - int zero_counter = 0; - gboolean is_string = FALSE; - char *string; - int nb_digits = 0; - - /* Factorizes trailing 0 */ - if ((items > 1) && (type_child->type == TYPE_FUNDAMENTAL)) - { - for (i = items - 1; i >= 0; i--) - { - if (fundamental_read_from_buffer(type_child, buffer, parent_offset, offset + i * type_child->size) == 0) - { - zero_counter ++; - } - else - { - break; - } - } - - /* Check if this is an array of 8 bits items and if at least the firsts ones are not null */ - if ((type_child->size == 8) && (zero_counter >= 1) && ((items - zero_counter) >= 2)) - { - int end = items - zero_counter; - - /* check if this is a printable string */ - is_string = TRUE; - string = malloc(end + 1); - - for (i = 0; i < end; i++) - { - string[i] = fundamental_read_from_buffer(type_child, buffer, parent_offset, offset + i * type_child->size); - if (isprint(string[i]) == 0) - { - /* This is not a printable string */ - is_string = FALSE; - break; - } - } - - if (is_string) - { - string[i] = '\0'; - INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "[0 .. %d] \"%s\"\n", end - 1, string)); - ui_set_signal_text_cb(user_data, cbuf, length); - } - } - - /* Do not factorize if there is only one null item */ - if (zero_counter <= 1) - { - zero_counter = 0; - } - } - - if (is_string == FALSE) - { - nb_digits = log10(items - zero_counter) + 1; - - for (i = 0; i < (items - zero_counter); i++) - { - INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "[%*d] ", nb_digits, i)); - ui_set_signal_text_cb(user_data, cbuf, length); - - type->child->type_dissect_from_buffer ( - type->child, ui_set_signal_text_cb, user_data, buffer, parent_offset, - offset + i * type_child->size, indent, - FALSE); - } - if (zero_counter > 0) - { - INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "[%d .. %d] ", i, items -1)); - ui_set_signal_text_cb(user_data, cbuf, length); - - type->child->type_dissect_from_buffer ( - type->child, ui_set_signal_text_cb, user_data, - buffer, parent_offset, offset + i * type_child->size, indent, FALSE); - } - } - } - if (type->name) { - INDENTED(stdout, indent, fprintf(stdout, "\n", type->name)); - } - - return 0; -} - -int array_type_file_print(types_t *type, int indent, FILE *file) { - if (type == NULL) - return -1; - INDENTED(file, indent, fprintf(file, "\n")); - INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id)); - INDENTED(file, indent+4, fprintf(file, "Min ........: %d\n", type->min)); - INDENTED(file, indent+4, fprintf(file, "Max ........: %d\n", type->max)); - INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml)); - INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size)); - INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align)); - if (type->file_ref != NULL) - type->file_ref->type_file_print (type->file_ref, indent + 4, file); - if (type->child != NULL) - type->child->type_file_print (type->child, indent + 4, file); - INDENTED(file, indent, fprintf(file, "\n")); - - return 0; -} - -int array_type_hr_display(types_t *type, int indent) { - if (type == NULL) - return -1; - INDENTED(stdout, indent, printf("\n")); - INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id)); - INDENTED(stdout, indent+4, printf("Min ........: %d\n", type->min)); - INDENTED(stdout, indent+4, printf("Max ........: %d\n", type->max)); - INDENTED(stdout, indent+4, printf("Type .......: %d\n", type->type_xml)); - INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size)); - INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align)); - if (type->file_ref != NULL) - type->file_ref->type_hr_display (type->file_ref, indent + 4); - if (type->child != NULL) - type->child->type_hr_display (type->child, indent + 4); - INDENTED(stdout, indent, printf("\n")); - - return 0; -} diff --git a/common/utils/itti_analyzer/libparser/array_type.h b/common/utils/itti_analyzer/libparser/array_type.h deleted file mode 100644 index b336934dbb..0000000000 --- a/common/utils/itti_analyzer/libparser/array_type.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 - */ - -#include "types.h" - -#ifndef ARRAY_TYPE_H_ -#define ARRAY_TYPE_H_ - -int array_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line); - -int array_type_hr_display(types_t *type, int indent); - -int array_type_file_print(types_t *type, int indent, FILE *file); - -#endif /* ARRAY_TYPE_H_ */ diff --git a/common/utils/itti_analyzer/libparser/enum_type.c b/common/utils/itti_analyzer/libparser/enum_type.c deleted file mode 100644 index dbc99095bc..0000000000 --- a/common/utils/itti_analyzer/libparser/enum_type.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include - -#define G_LOG_DOMAIN ("PARSER") - -#include "enum_type.h" -#include "ui_interface.h" - -char *enum_type_get_name_from_value(types_t *type, uint32_t value) -{ - char *enum_name = "UNKNOWN"; - types_t *enum_value; - - /* Loop on each enumeration values */ - for (enum_value = type->child; enum_value; enum_value = enum_value->next) { - if (value == enum_value->init_value) { - enum_name = enum_value->name; - break; - } - } - return enum_name; -} - -int enum_type_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line) -{ - uint32_t value = 0; - types_t *values; - - DISPLAY_PARSE_INFO("enum", type->name, offset, parent_offset); - - value = buffer_get_uint32_t(buffer, parent_offset + offset); - - for (values = type->child; values; values = values->next) { - if (value == values->init_value) { - values->parent = type; - values->type_dissect_from_buffer( - values, ui_set_signal_text_cb, user_data, buffer, offset, parent_offset, - type->name == NULL ? indent: indent + DISPLAY_TAB_SIZE, FALSE); - break; - } - } - if (values == NULL) { - int length = 0; - char cbuf[50]; - - length = sprintf(cbuf, "(0x%08x) UNKNOWN;\n", value); - ui_set_signal_text_cb(user_data, cbuf, length); - } - - return 0; -} - -int enum_type_file_print(types_t *type, int indent, FILE *file) -{ - types_t *values; - - if (type == NULL) - return -1; - INDENTED(file, indent, fprintf(file, "\n")); - INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name)); - INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size)); - INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align)); - INDENTED(file, indent+4, fprintf(file, "Artificial .: %d\n", type->artificial)); - INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file)); - INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line)); - if (type->file_ref != NULL) - type->file_ref->type_file_print(type->file_ref, indent+4, file); - /* Call enum values display */ - for (values = type->child; values; values = values->next) { - values->type_file_print(values, indent + 4, file); - } - INDENTED(file, indent, fprintf(file, "\n")); - - return 0; -} - -int enum_type_hr_display(types_t *type, int indent) -{ - types_t *values; - - if (type == NULL) - return -1; - INDENTED(stdout, indent, printf("\n")); - INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name)); - INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size)); - INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align)); - INDENTED(stdout, indent+4, printf("Artificial .: %d\n", type->artificial)); - INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file)); - INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line)); - if (type->file_ref != NULL) - type->file_ref->type_hr_display(type->file_ref, indent+4); - /* Call enum values display */ - for (values = type->child; values; values = values->next) { - values->type_hr_display(values, indent + 4); - } - INDENTED(stdout, indent, printf("\n")); - - return 0; -} diff --git a/common/utils/itti_analyzer/libparser/enum_type.h b/common/utils/itti_analyzer/libparser/enum_type.h deleted file mode 100644 index 4538829e78..0000000000 --- a/common/utils/itti_analyzer/libparser/enum_type.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 - */ - -#include "types.h" - -#ifndef ENUM_TYPE_H_ -#define ENUM_TYPE_H_ - -char *enum_type_get_name_from_value(types_t *type, uint32_t value); - -int enum_type_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line); - -int enum_type_file_print(types_t *type, int indent, FILE *file); - -int enum_type_hr_display(types_t *type, int indent); - -#endif /* ENUM_TYPE_H_ */ diff --git a/common/utils/itti_analyzer/libparser/enum_value_type.c b/common/utils/itti_analyzer/libparser/enum_value_type.c deleted file mode 100644 index 801317daaf..0000000000 --- a/common/utils/itti_analyzer/libparser/enum_value_type.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include - -#define G_LOG_DOMAIN ("PARSER") - -#include "enum_value_type.h" -#include "ui_interface.h" - -uint32_t last_enum_value; - -int enum_value_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line) -{ - types_t *type_parent = NULL; - uint32_t value = 0; - - DISPLAY_PARSE_INFO("enum_value", type->name, offset, parent_offset); - - value = buffer_get_uint32_t(buffer, parent_offset + offset); - if (type->name) { - int length = 0; - char cbuf[50 + strlen(type->name)]; - - /* Search for enum variable name and check if it is used in association with a union type */ - { - if (type->parent != NULL) { - /* Ignore ENUMERATION and TYPEDEF parents */ - for (type_parent = type->parent; (type_parent != NULL) && ((type_parent->type == TYPE_ENUMERATION) || (type_parent->type == TYPE_TYPEDEF)); - type_parent = type_parent->parent) { - } - } - if ((type_parent != NULL) && (type_parent->name != NULL) && (strcmp(type_parent->name, "present") == 0)) - { - /* ASN1 union, keep the "present" member */ - last_enum_value = value; - } - else - { - last_enum_value = 0; - } - } - length = sprintf(cbuf, "(0x%08x) %s;\n", value, type->name); - ui_set_signal_text_cb(user_data, cbuf, length); - } - - return 0; -} - -int enum_value_file_print(types_t *type, int indent, FILE *file) -{ - if (type == NULL) - return -1; - INDENTED(file, indent, fprintf(file, "\n")); - INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name)); - INDENTED(file, indent+4, fprintf(file, "Value ......: %d\n", type->init_value)); - if (type->file_ref != NULL) - type->file_ref->type_file_print(type->file_ref, indent+4, file); - INDENTED(file, indent, fprintf(file, "\n")); - - return 0; -} - -int enum_value_type_hr_display(types_t *type, int indent) -{ - if (type == NULL) - return -1; - INDENTED(stdout, indent, printf("\n")); - INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name)); - INDENTED(stdout, indent+4, printf("Value ......: %d\n", type->init_value)); - if (type->file_ref != NULL) - type->file_ref->type_hr_display(type->file_ref, indent+4); - INDENTED(stdout, indent, printf("\n")); - - return 0; -} diff --git a/common/utils/itti_analyzer/libparser/enum_value_type.h b/common/utils/itti_analyzer/libparser/enum_value_type.h deleted file mode 100644 index 997e6cc3fe..0000000000 --- a/common/utils/itti_analyzer/libparser/enum_value_type.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 - */ - -#include "types.h" - -#ifndef ENUM_VALUE_TYPE_H_ -#define ENUM_VALUE_TYPE_H_ - -extern uint32_t last_enum_value; - -int enum_value_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line); - -int enum_value_file_print(types_t *type, int indent, FILE *file); - -int enum_value_type_hr_display(types_t *type, int indent); - -#endif /* ENUM_VALUE_TYPE_H_ */ diff --git a/common/utils/itti_analyzer/libparser/field_type.c b/common/utils/itti_analyzer/libparser/field_type.c deleted file mode 100644 index b64d3bd0c1..0000000000 --- a/common/utils/itti_analyzer/libparser/field_type.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include - -#define G_LOG_DOMAIN ("PARSER") - -#include "rc.h" - -#include "field_type.h" -#include "buffers.h" -#include "ui_interface.h" - -int field_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line) -{ - int length = 0; - char cbuf[50 + (type->name ? strlen (type->name) : 0)]; - types_t *type_child; - char array_info[50]; - new_line = FALSE; - - DISPLAY_PARSE_INFO("field", type->name, offset, parent_offset); - - CHECK_FCT(buffer_has_enouch_data(buffer, parent_offset + offset, type->size / 8)); - - if (type->bits == -1) { - if ((type->name != NULL) && (strcmp(type->name, "_asn_ctx") == 0)) { - /* Hide ASN1 asn_struct_ctx_t struct that hold context for parsing across buffer boundaries */ - /* - INDENTED_STRING(cbuf, indent, sprintf(cbuf, ".asn_ctx ...\n")); - length = strlen (cbuf); - - ui_set_signal_text_cb(user_data, cbuf, length); - */ - } - else { - if (type->child != NULL) { - /* Ignore TYPEDEF children */ - for (type_child = type->child; type_child != NULL && type_child->type == TYPE_TYPEDEF; type_child = - type_child->child) { - } - - if (type_child->type == TYPE_ARRAY) { - types_t *type_array_child; - - /* Ignore TYPEDEF children */ - for (type_array_child = type_child->child; - type_array_child != NULL && type_array_child->type == TYPE_TYPEDEF; type_array_child = - type_array_child->child) { - } - - sprintf (array_info, "[%d]", type_child->size / type_array_child->size); - } - else { - array_info[0] = '\0'; - } - - DISPLAY_TYPE("Fld"); - - INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, ".%s%s = ", type->name ? type->name : "Field", array_info)); - ui_set_signal_text_cb(user_data, cbuf, length); - - if (type_child->type == TYPE_ARRAY) { - DISPLAY_BRACE(ui_set_signal_text_cb(user_data, "{", 1);) - ui_set_signal_text_cb(user_data, "\n", 1); - new_line = TRUE; - } - /* - if (type_child->type == TYPE_STRUCT || type_child->type == TYPE_UNION) { - DISPLAY_BRACE(ui_set_signal_text_cb(user_data, "{", 1);) - ui_set_signal_text_cb(user_data, "\n", 1); - new_line = TRUE; - } - */ - - type->child->parent = type; - type->child->type_dissect_from_buffer( - type->child, ui_set_signal_text_cb, user_data, buffer, - parent_offset, offset + type->offset, new_line ? indent + DISPLAY_TAB_SIZE : indent, new_line); - - DISPLAY_BRACE( - if (type_child->type == TYPE_ARRAY) { - DISPLAY_TYPE("Fld"); - - INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "};\n")); - ui_set_signal_text_cb(user_data, cbuf, length); - }); - /* - DISPLAY_BRACE( - if (type_child->type == TYPE_STRUCT || type_child->type == TYPE_UNION) { - DISPLAY_TYPE("Fld"); - INDENTED_STRING(cbuf, indent, sprintf(cbuf, "};\n")); - length = strlen (cbuf); - - ui_set_signal_text_cb(user_data, cbuf, length); - }); - */ - } - } - } - else { - /* The field is only composed of bits */ - uint32_t value = 0; - - CHECK_FCT(buffer_fetch_bits(buffer, offset + type->offset + parent_offset, type->bits, &value)); - - DISPLAY_TYPE("Fld"); - - INDENTED_STRING(cbuf, indent, - length = sprintf(cbuf, ".%s:%d = (0x%0*x) %d;\n", type->name ? type->name : "Field", type->bits, (type->bits + 3) / 4, value, value)); - ui_set_signal_text_cb(user_data, cbuf, length); - } - - return 0; -} - -int field_type_file_print(types_t *type, int indent, FILE *file) { - if (type == NULL) - return -1; - INDENTED(file, indent, fprintf(file, "\n")); - INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id)); - INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name)); - INDENTED(file, indent+4, fprintf(file, "Bits .......: %d\n", type->bits)); - INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml)); - INDENTED(file, indent+4, fprintf(file, "Offset .....: %d\n", type->offset)); - INDENTED(file, indent+4, fprintf(file, "Context ....: %d\n", type->context)); - INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file)); - INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line)); - if (type->file_ref != NULL) - type->file_ref->type_file_print (type->file_ref, indent + 4, file); - if (type->child != NULL) - type->child->type_file_print (type->child, indent + 4, file); - INDENTED(file, indent, fprintf(file, "\n")); - - return 0; -} - -int field_type_hr_display(types_t *type, int indent) { - if (type == NULL) - return -1; - INDENTED(stdout, indent, printf("\n")); - INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id)); - INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name)); - INDENTED(stdout, indent+4, printf("Bits .......: %d\n", type->bits)); - INDENTED(stdout, indent+4, printf("Type .......: %d\n", type->type_xml)); - INDENTED(stdout, indent+4, printf("Offset .....: %d\n", type->offset)); - INDENTED(stdout, indent+4, printf("Context ....: %d\n", type->context)); - INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file)); - INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line)); - if (type->file_ref != NULL) - type->file_ref->type_hr_display (type->file_ref, indent + 4); - if (type->child != NULL) - type->child->type_hr_display (type->child, indent + 4); - INDENTED(stdout, indent, printf("\n")); - - return 0; -} diff --git a/common/utils/itti_analyzer/libparser/field_type.h b/common/utils/itti_analyzer/libparser/field_type.h deleted file mode 100644 index 329e90c3be..0000000000 --- a/common/utils/itti_analyzer/libparser/field_type.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 - */ - -#include "types.h" - -#ifndef FIELD_TYPE_H_ -#define FIELD_TYPE_H_ - -int field_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line); - -int field_type_file_print(types_t *type, int indent, FILE *file); - -int field_type_hr_display(types_t *type, int indent); - -#endif /* FIELD_TYPE_H_ */ diff --git a/common/utils/itti_analyzer/libparser/file_type.c b/common/utils/itti_analyzer/libparser/file_type.c deleted file mode 100644 index 04d66b7a08..0000000000 --- a/common/utils/itti_analyzer/libparser/file_type.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include - -#define G_LOG_DOMAIN ("PARSER") - -#include "file_type.h" - -int file_type_file_print(types_t *type, int indent, FILE *file) -{ - if (type == NULL) - return -1; - INDENTED(file, indent, fprintf(file, "\n")); - INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id)); - INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name)); - INDENTED(file, indent, fprintf(file, "\n")); - - return 0; -} - -int file_type_hr_display(types_t *type, int indent) -{ - if (type == NULL) - return -1; - INDENTED(stdout, indent, printf("\n")); - INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id)); - INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name)); - INDENTED(stdout, indent, printf("\n")); - - return 0; -} diff --git a/common/utils/itti_analyzer/libparser/file_type.h b/common/utils/itti_analyzer/libparser/file_type.h deleted file mode 100644 index 34ebea6745..0000000000 --- a/common/utils/itti_analyzer/libparser/file_type.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 - */ - -#include "types.h" - -#ifndef FILE_TYPE_H_ -#define FILE_TYPE_H_ - -int file_type_file_print(types_t *type, int indent, FILE *file); - -int file_type_hr_display(types_t *type, int indent); - -#endif /* FILE_TYPE_H_ */ diff --git a/common/utils/itti_analyzer/libparser/fundamental_type.c b/common/utils/itti_analyzer/libparser/fundamental_type.c deleted file mode 100644 index 92dd1c75cb..0000000000 --- a/common/utils/itti_analyzer/libparser/fundamental_type.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include - -#define G_LOG_DOMAIN ("PARSER") - -#include "fundamental_type.h" -#include "ui_interface.h" - -uint64_t fundamental_read_from_buffer(types_t *type, buffer_t *buffer, uint32_t offset, uint32_t parent_offset) { - uint64_t value; - - switch (type->size) { - case 8: - value = buffer_get_uint8_t (buffer, offset + parent_offset); - break; - - case 16: - value = buffer_get_uint16_t (buffer, offset + parent_offset); - break; - - case 32: - value = buffer_get_uint32_t (buffer, offset + parent_offset); - break; - - case 64: - value = buffer_get_uint64_t (buffer, offset + parent_offset); - break; - - default: - /* ??? */ - value = 0; - break; - } - return value; -} - -int fundamental_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line) -{ - int length = 0; - char cbuf[200]; - int type_unsigned; - uint8_t value8; - uint16_t value16; - uint32_t value32; - uint64_t value64; - - DISPLAY_PARSE_INFO("fundamental", type->name, offset, parent_offset); - - memset (cbuf, 0, 200); - - type_unsigned = strstr (type->name, "unsigned") == NULL ? 0 : 1; - - value64 = fundamental_read_from_buffer(type, buffer, offset, parent_offset); - - indent = new_line ? indent : 0; - if (indent > 0) - { - DISPLAY_TYPE("Fun"); - } - switch (type->size) { - case 8: - value8 = (uint8_t) value64; - INDENTED_STRING(cbuf, indent, - length = sprintf(cbuf, type_unsigned ? "(0x%02" PRIx8 ") %3" PRIu8 ";\n" : "(0x%02" PRIx8 ") %4" PRId8 ";\n", value8, value8)); - break; - - case 16: - value16 = (uint16_t) value64; - INDENTED_STRING(cbuf, indent, - length = sprintf(cbuf, type_unsigned ? "(0x%04" PRIx16 ") %5" PRIu16 ";\n" : "(0x%04" PRIx16 ") %6" PRId16 ";\n", value16, value16)); - break; - - case 32: - value32 = (uint32_t) value64; - INDENTED_STRING(cbuf, indent, - length = sprintf(cbuf, type_unsigned ? "(0x%08" PRIx32 ") %9" PRIu32 ";\n" : "(0x%08" PRIx32 ") %10" PRId32 ";\n", value32, value32)); - break; - - case 64: - INDENTED_STRING(cbuf, indent, - length = sprintf(cbuf, type_unsigned ? "(0x%016" PRIx64 ") %20" PRIu64 ";\n" : "(0x%016" PRIx64 ") %20" PRId64 ";\n", value64, value64)); - break; - - default: - /* ??? */ - break; - } - ui_set_signal_text_cb(user_data, cbuf, length); - - return 0; -} - -int fundamental_type_file_print(types_t *type, int indent, FILE *file) { - if (type == NULL) - return -1; - INDENTED(file, indent, fprintf(file, "\n")); - INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name)); - INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id)); - INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size)); - INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align)); - if (type->file_ref != NULL) - type->file_ref->type_file_print (type->file_ref, indent + 4, file); - INDENTED(file, indent, fprintf(file, "\n")); - return 0; -} - -int fundamental_type_hr_display(types_t *type, int indent) { - if (type == NULL) - return -1; - INDENTED(stdout, indent, printf("\n")); - INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name)); - INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id)); - INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size)); - INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align)); - if (type->file_ref != NULL) - type->file_ref->type_hr_display (type->file_ref, indent + 4); - INDENTED(stdout, indent, printf("\n")); - return 0; -} diff --git a/common/utils/itti_analyzer/libparser/fundamental_type.h b/common/utils/itti_analyzer/libparser/fundamental_type.h deleted file mode 100644 index 07ceb3b9ed..0000000000 --- a/common/utils/itti_analyzer/libparser/fundamental_type.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 - */ - -#include "types.h" - -#ifndef FUNDAMENTAL_TYPE_H_ -#define FUNDAMENTAL_TYPE_H_ - -uint64_t fundamental_read_from_buffer(types_t *type, buffer_t *buffer, uint32_t offset, uint32_t parent_offset); - -int fundamental_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line); - -int fundamental_type_file_print(types_t *type, int indent, FILE *file); - -int fundamental_type_hr_display(types_t *type, int indent); - -#endif /* FUNDAMENTAL_TYPE_H_ */ diff --git a/common/utils/itti_analyzer/libparser/intertask_contexts.h b/common/utils/itti_analyzer/libparser/intertask_contexts.h deleted file mode 100644 index cfe8f59402..0000000000 --- a/common/utils/itti_analyzer/libparser/intertask_contexts.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 - */ - -#include "fundamental_type.h" -#include "struct_type.h" - -#ifndef INTERTASK_CONTEXTS_H_ -#define INTERTASK_CONTEXTS_H_ - -typedef struct { - /* List of fundamental types that can contruct any other type */ - fundamental_type_t *ft_list; - - struct_type_t *struct_list; -} intertask_context_t; - -#endif /* INTERTASK_CONTEXTS_H_ */ diff --git a/common/utils/itti_analyzer/libparser/pointer_type.c b/common/utils/itti_analyzer/libparser/pointer_type.c deleted file mode 100644 index e4571f9f48..0000000000 --- a/common/utils/itti_analyzer/libparser/pointer_type.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include - -#define G_LOG_DOMAIN ("PARSER") - -#include "pointer_type.h" -#include "ui_interface.h" - -int pointer_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line) -{ - int length = 0, i; - char cbuf[200]; - - DISPLAY_PARSE_INFO("pointer", type->name, offset, parent_offset); - - memset (cbuf, 0, 200); - - uint8_t value[type->size / 8]; - - buffer_fetch_nbytes(buffer, parent_offset + offset, type->size / 8, value); - - indent = new_line ? indent : 0; - if (indent > 0) - { - DISPLAY_TYPE("Ptr"); - } - if (type->child && type->child->name) { - /* - INDENTED(stdout, indent, fprintf(stdout, "<%s>0x%08x\n", - type->child->name, value, type->child->name)); - */ - INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "(%s *) 0x", type->child->name)); - } - else { - /* - INDENTED(stdout, indent, fprintf(stdout, "0x%08x\n", - value)); - */ - INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "(void *) 0x")); - } - - /* Append the value */ - for (i = type->size / 8 - 1; i >= 0; i--) { - length += sprintf(&cbuf[length], "%02x", value[i]); - } - length += sprintf(&cbuf[length], ";\n"); - ui_set_signal_text_cb(user_data, cbuf, length); - - return 0; -} - -int pointer_type_file_print(types_t *type, int indent, FILE *file) { - if (type == NULL) - return -1; - INDENTED(file, indent, fprintf(file, "\n")); - INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id)); - INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml)); - INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size)); - INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align)); - if (type->child != NULL) { - if (type->child->type == TYPE_FUNCTION) { - INDENTED(file, indent+4, fprintf(file, "\n")); - INDENTED(file, indent+8, fprintf(file, "To be done\n")); - INDENTED(file, indent+4, fprintf(file, "\n")); - } else { - type->child->type_file_print (type->child, indent + 4, file); - } - } - if (type->file_ref != NULL) - type->file_ref->type_file_print (type->file_ref, indent + 4, file); - INDENTED(file, indent, fprintf(file, "\n")); - - return 0; -} - -int pointer_type_hr_display(types_t *type, int indent) { - return pointer_type_file_print(type, indent, stdout); -} diff --git a/common/utils/itti_analyzer/libparser/pointer_type.h b/common/utils/itti_analyzer/libparser/pointer_type.h deleted file mode 100644 index be2b6cc33c..0000000000 --- a/common/utils/itti_analyzer/libparser/pointer_type.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 - */ - -#include "types.h" - -#ifndef POINTER_TYPE_H_ -#define POINTER_TYPE_H_ - -int pointer_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line); - -int pointer_type_file_print(types_t *type, int indent, FILE *file); - -int pointer_type_hr_display(types_t *type, int indent); - -#endif /* POINTER_TYPE_H_ */ diff --git a/common/utils/itti_analyzer/libparser/reference_type.c b/common/utils/itti_analyzer/libparser/reference_type.c deleted file mode 100644 index 8d0fec4e61..0000000000 --- a/common/utils/itti_analyzer/libparser/reference_type.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include - -#define G_LOG_DOMAIN ("PARSER") - -#include "reference_type.h" -#include "ui_interface.h" - -int reference_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line) -{ - DISPLAY_PARSE_INFO("reference", type->name, offset, parent_offset); - - if (type->name) { - INDENTED(stdout, indent, fprintf(stdout, "<%s>\n", type->name)); - } - if (type->child != NULL) - type->child->type_dissect_from_buffer(type->child, ui_set_signal_text_cb, - user_data, buffer, offset, parent_offset, - type->name == NULL ? indent: indent + DISPLAY_TAB_SIZE, TRUE); - if (type->name) { - INDENTED(stdout, indent, fprintf(stdout, "\n", type->name)); - } - - return 0; -} - -int reference_type_file_print(types_t *type, int indent, FILE *file) -{ - if (type == NULL) - return -1; - INDENTED(file, indent, fprintf(file, "\n")); - INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name)); - INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id)); - INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml)); - INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size)); - INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align)); - INDENTED(file, indent+4, fprintf(file, "Context ....: %d\n", type->context)); - INDENTED(file, indent+4, fprintf(file, "Offset .....: %d\n", type->offset)); - INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line)); - INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file)); - if (type->child != NULL) - type->child->type_file_print(type->child, indent+4, file); - if (type->file_ref != NULL) - type->file_ref->type_file_print(type->file_ref, indent+4, file); - INDENTED(file, indent, fprintf(file, "\n")); - - return 0; -} - -int reference_type_hr_display(types_t *type, int indent) -{ - if (type == NULL) - return -1; - INDENTED(stdout, indent, printf("\n")); - INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name)); - INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id)); - INDENTED(stdout, indent+4, printf("Type .......: %d\n", type->type_xml)); - INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size)); - INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align)); - INDENTED(stdout, indent+4, printf("Context ....: %d\n", type->context)); - INDENTED(stdout, indent+4, printf("Offset .....: %d\n", type->offset)); - INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line)); - INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file)); - if (type->child != NULL) - type->child->type_hr_display(type->child, indent+4); - if (type->file_ref != NULL) - type->file_ref->type_hr_display(type->file_ref, indent+4); - INDENTED(stdout, indent, printf("\n")); - - return 0; -} diff --git a/common/utils/itti_analyzer/libparser/reference_type.h b/common/utils/itti_analyzer/libparser/reference_type.h deleted file mode 100644 index da56e9f942..0000000000 --- a/common/utils/itti_analyzer/libparser/reference_type.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 - */ - -#include "types.h" - -#ifndef REFERENCE_TYPE_H_ -#define REFERENCE_TYPE_H_ - -int reference_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line); - -int reference_type_file_print(types_t *type, int indent, FILE *file); - -int reference_type_hr_display(types_t *type, int indent); - -#endif /* REFERENCE_TYPE_H_ */ diff --git a/common/utils/itti_analyzer/libparser/struct_type.c b/common/utils/itti_analyzer/libparser/struct_type.c deleted file mode 100644 index 09d5280ea5..0000000000 --- a/common/utils/itti_analyzer/libparser/struct_type.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include - -#define G_LOG_DOMAIN ("PARSER") - -#include "rc.h" - -#include "struct_type.h" -#include "buffers.h" -#include "ui_callbacks.h" -#include "ui_interface.h" - -int struct_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line) -{ - int i; - char cbuf[50 + (type->name ? strlen (type->name) : 0)]; - int length = 0; - char *name; - - memset (cbuf, 0, sizeof(cbuf)); - - DISPLAY_PARSE_INFO("structure", type->name, offset, parent_offset); - - if (new_line) { - DISPLAY_TYPE("Str"); - } - - if (type->name) { - name = type->name; - } - else { - name = "_anonymous_"; - } - - if ((strcmp (name, "IttiMsgText_s") == 0) && - (type->members_child[0] != NULL) && (strcmp (type->members_child[0]->name, "size") == 0) && - (type->members_child[1] != NULL) && (strcmp (type->members_child[1]->name, "text") == 0)) { - uint8_t *buf; - - length = buffer_get_uint32_t (buffer, offset + parent_offset); - buf = malloc (length + 1); - buf[0] = '\n'; - buffer_fetch_nbytes(buffer, parent_offset + offset + 32, length, &buf[1]); - length = ui_callback_check_string ((char *) &buf[1], length, 0); - ui_set_signal_text_cb(user_data, (char *) buf, length + 1); - } - else - { - INDENTED_STRING(cbuf, new_line ? indent : 0, length = sprintf (cbuf, "%s :", name)); - DISPLAY_BRACE(length += sprintf(&cbuf[length], " {");); - length += sprintf(&cbuf[length], "\n"); - ui_set_signal_text_cb(user_data, cbuf, length); - - for (i = 0; i < type->nb_members; i++) { - if (type->members_child[i] != NULL) - type->members_child[i]->type_dissect_from_buffer ( - type->members_child[i], ui_set_signal_text_cb, user_data, - buffer, offset, parent_offset, indent + DISPLAY_TAB_SIZE, TRUE); - } - } - - DISPLAY_BRACE( - DISPLAY_TYPE("Str"); - - INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "};\n")); - ui_set_signal_text_cb(user_data, cbuf, length);) - - return 0; -} - -int struct_type_file_print(types_t *type, int indent, FILE *file) { - int i; - if (type == NULL) - return -1; - if (file == NULL) - return -1; - INDENTED(file, indent, fprintf(file, "\n")); - INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name)); - INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id)); - INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size)); - INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align)); - INDENTED(file, indent+4, fprintf(file, "Artificial .: %d\n", type->artificial)); - INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file)); - INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line)); - INDENTED(file, indent+4, fprintf(file, "Members ....: %s\n", type->members)); - INDENTED(file, indent+4, fprintf(file, "Mangled ....: %s\n", type->mangled)); - INDENTED(file, indent+4, fprintf(file, "Demangled ..: %s\n", type->demangled)); - if (type->file_ref != NULL) - type->file_ref->type_file_print (type->file_ref, indent + 4, file); - for (i = 0; i < type->nb_members; i++) { - if (type->members_child[i] != NULL) - type->members_child[i]->type_file_print (type->members_child[i], indent + 4, file); - } - INDENTED(file, indent, fprintf(file, "\n")); - - return 0; -} - -int struct_type_hr_display(types_t *type, int indent) { - int i; - if (type == NULL) - return -1; - INDENTED(stdout, indent, printf("\n")); - INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name)); - INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id)); - INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size)); - INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align)); - INDENTED(stdout, indent+4, printf("Artificial .: %d\n", type->artificial)); - INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file)); - INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line)); - INDENTED(stdout, indent+4, printf("Members ....: %s\n", type->members)); - INDENTED(stdout, indent+4, printf("Mangled ....: %s\n", type->mangled)); - INDENTED(stdout, indent+4, printf("Demangled ..: %s\n", type->demangled)); - if (type->file_ref != NULL) - type->file_ref->type_hr_display (type->file_ref, indent + 4); - for (i = 0; i < type->nb_members; i++) { - if (type->members_child[i] != NULL) - type->members_child[i]->type_hr_display (type->members_child[i], indent + 4); - } - INDENTED(stdout, indent, printf("\n")); - - return 0; -} diff --git a/common/utils/itti_analyzer/libparser/struct_type.h b/common/utils/itti_analyzer/libparser/struct_type.h deleted file mode 100644 index 29d4113b6f..0000000000 --- a/common/utils/itti_analyzer/libparser/struct_type.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 - */ - -#include "types.h" - -#ifndef STRUCT_TYPE_H_ -#define STRUCT_TYPE_H_ - -int struct_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line); - -int struct_type_hr_display(types_t *type, int indent); - -int struct_type_file_print(types_t *type, int indent, FILE *file); - -#endif /* STRUCT_TYPE_H_ */ diff --git a/common/utils/itti_analyzer/libparser/typedef_type.c b/common/utils/itti_analyzer/libparser/typedef_type.c deleted file mode 100644 index e5cee1a1cf..0000000000 --- a/common/utils/itti_analyzer/libparser/typedef_type.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include - -#define G_LOG_DOMAIN ("PARSER") - -#include "typedef_type.h" -#include "ui_interface.h" - -int typedef_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line) -{ - int length = 0; - char cbuf[50 + (type->name ? strlen (type->name) : 0)]; - types_t *type_child = NULL; - - DISPLAY_PARSE_INFO("typedef", type->name, offset, parent_offset); - - if (type->child != NULL) { - /* Ignore TYPEDEF children */ - for (type_child = type->child; type_child != NULL && type_child->type == TYPE_TYPEDEF; type_child = - type_child->child) { - } - } - - if ((type_child == NULL) || (type_child->type != TYPE_FUNDAMENTAL)) - { - INDENTED_STRING(cbuf, new_line ? indent : 0, length = sprintf (cbuf, "%s, ", type->name)); - ui_set_signal_text_cb(user_data, cbuf, length); - - new_line = FALSE; - } - - /* Simply call next_type */ - if (type->child != NULL) { - type->child->parent = type; - type->child->type_dissect_from_buffer( - type->child, ui_set_signal_text_cb, user_data, buffer, offset, parent_offset, indent, new_line); - } - - return 0; -} - -int typedef_type_file_print(types_t *type, int indent, FILE *file) -{ - if (type == NULL) - return -1; - INDENTED(file, indent, fprintf(file, "\n")); - INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name)); - INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml)); - INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size)); - INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align)); - INDENTED(file, indent+4, fprintf(file, "Artificial .: %d\n", type->artificial)); - INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file)); - INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line)); - INDENTED(file, indent+4, fprintf(file, "Members ....: %s\n", type->members)); - INDENTED(file, indent+4, fprintf(file, "Mangled ....: %s\n", type->mangled)); - INDENTED(file, indent+4, fprintf(file, "Demangled ..: %s\n", type->demangled)); - if (type->file_ref != NULL) - type->file_ref->type_file_print(type->file_ref, indent+4, file); - if (type->child != NULL) - type->child->type_file_print(type->child, indent+4, file); - INDENTED(file, indent, fprintf(file, "\n")); - - return 0; -} - -int typedef_type_hr_display(types_t *type, int indent) -{ - if (type == NULL) - return -1; - INDENTED(stdout, indent, printf("\n")); - INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name)); - INDENTED(stdout, indent+4, printf("Type .......: %d\n", type->type_xml)); - INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size)); - INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align)); - INDENTED(stdout, indent+4, printf("Artificial .: %d\n", type->artificial)); - INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file)); - INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line)); - INDENTED(stdout, indent+4, printf("Members ....: %s\n", type->members)); - INDENTED(stdout, indent+4, printf("Mangled ....: %s\n", type->mangled)); - INDENTED(stdout, indent+4, printf("Demangled ..: %s\n", type->demangled)); - if (type->file_ref != NULL) - type->file_ref->type_hr_display(type->file_ref, indent+4); - if (type->child != NULL) - type->child->type_hr_display(type->child, indent+4); - INDENTED(stdout, indent, printf("\n")); - - return 0; -} diff --git a/common/utils/itti_analyzer/libparser/typedef_type.h b/common/utils/itti_analyzer/libparser/typedef_type.h deleted file mode 100644 index b5710dbfcb..0000000000 --- a/common/utils/itti_analyzer/libparser/typedef_type.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 - */ - -#include "types.h" - -#ifndef TYPEDEF_TYPE_H_ -#define TYPEDEF_TYPE_H_ - -int typedef_type_file_print(types_t *type, int indent, FILE *file); - -int typedef_type_hr_display(types_t *type, int indent); - -int typedef_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line); - -#endif /* TYPEDEF_TYPE_H_ */ diff --git a/common/utils/itti_analyzer/libparser/types.c b/common/utils/itti_analyzer/libparser/types.c deleted file mode 100644 index 406db5249c..0000000000 --- a/common/utils/itti_analyzer/libparser/types.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include - -#define G_LOG_DOMAIN ("PARSER") - -#include "types.h" -#include "array_type.h" -#include "enum_type.h" -#include "fundamental_type.h" -#include "struct_type.h" -#include "union_type.h" -#include "typedef_type.h" -#include "enum_value_type.h" -#include "file_type.h" -#include "field_type.h" -#include "reference_type.h" -#include "pointer_type.h" - -types_t *type_new(enum type_e type) -{ - types_t *new_p; - - new_p = calloc(1, sizeof(types_t)); - - new_p->type = type; - - switch(type) { - case TYPE_FUNCTION: - /* Nothing to do for now. Display is done by pointer type */ - break; - case TYPE_ENUMERATION: - new_p->type_hr_display = enum_type_hr_display; - new_p->type_file_print = enum_type_file_print; - new_p->type_dissect_from_buffer = enum_type_dissect_from_buffer; - break; - case TYPE_FUNDAMENTAL: - new_p->type_hr_display = fundamental_type_hr_display; - new_p->type_file_print = fundamental_type_file_print; - new_p->type_dissect_from_buffer = fundamental_dissect_from_buffer; - break; - case TYPE_STRUCT: - new_p->type_hr_display = struct_type_hr_display; - new_p->type_file_print = struct_type_file_print; - new_p->type_dissect_from_buffer = struct_dissect_from_buffer; - break; - case TYPE_UNION: - new_p->type_hr_display = union_type_hr_display; - new_p->type_file_print = union_type_file_print; - new_p->type_dissect_from_buffer = union_dissect_from_buffer; - break; - case TYPE_TYPEDEF: - new_p->type_hr_display = typedef_type_hr_display; - new_p->type_file_print = typedef_type_file_print; - new_p->type_dissect_from_buffer = typedef_dissect_from_buffer; - break; - case TYPE_ENUMERATION_VALUE: - new_p->type_hr_display = enum_value_type_hr_display; - new_p->type_file_print = enum_value_file_print; - new_p->type_dissect_from_buffer = enum_value_dissect_from_buffer; - break; - case TYPE_FILE: - new_p->type_hr_display = file_type_hr_display; - new_p->type_file_print = file_type_file_print; -// new_p->type_dissect_from_buffer = file_dissect_from_buffer; - break; - case TYPE_FIELD: - new_p->type_hr_display = field_type_hr_display; - new_p->type_file_print = field_type_file_print; - new_p->type_dissect_from_buffer = field_dissect_from_buffer; - break; - case TYPE_REFERENCE: - new_p->type_hr_display = reference_type_hr_display; - new_p->type_file_print = reference_type_file_print; - new_p->type_dissect_from_buffer = reference_dissect_from_buffer; - break; - case TYPE_ARRAY: - new_p->type_hr_display = array_type_hr_display; - new_p->type_file_print = array_type_file_print; - new_p->type_dissect_from_buffer = array_dissect_from_buffer; - break; - case TYPE_POINTER: - new_p->type_hr_display = pointer_type_hr_display; - new_p->type_file_print = pointer_type_file_print; - new_p->type_dissect_from_buffer = pointer_dissect_from_buffer; - break; - default: - break; - } - - return new_p; -} - -int types_insert_tail(types_t **head, types_t *to_insert) -{ - if (to_insert == NULL || head == NULL) - return -1; - if (*head == NULL) { - *head = to_insert; - } else { - types_t *last = *head; - while(last->next != NULL) { - last = last->next; - } - last->next = to_insert; - to_insert->previous = last; - } - to_insert->head = *head; - return 0; -} - -void types_hr_display(types_t *head) -{ - types_t *current = head; - - if (head == NULL) { - printf("Empty list\n"); - /* Empty list */ - return; - } - - while((current = current->next) != NULL) - { - current->type_hr_display(current, 0); - } -} diff --git a/common/utils/itti_analyzer/libparser/types.h b/common/utils/itti_analyzer/libparser/types.h deleted file mode 100644 index c449c445fd..0000000000 --- a/common/utils/itti_analyzer/libparser/types.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * 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 - */ - -#include - -#include "buffers.h" -#include "ui_main_screen.h" -#include "ui_interface.h" - -#ifndef TYPES_H_ -#define TYPES_H_ - -/* Activate to display the type at the beginning of the line (debug option) */ -#define ENABLE_DISPLAY_TYPE 0 - -/* Activate to display the parse information before processing each item (debug option) */ -#define ENABLE_DISPLAY_PARSE_INFO 0 - -/* Activate to show braces, in increase the number of displayed lines (formating option)*/ -#define ENABLE_DISPLAY_BRACE 1 - -#if (ENABLE_DISPLAY_TYPE != 0) -# define DISPLAY_TYPE(tYPE) ui_set_signal_text_cb(user_data, tYPE" ", strlen(tYPE) + 1); -#else -# define DISPLAY_TYPE(tYPE) -#endif - -#define DISPLAY_TAB_SIZE (2) - -#if (ENABLE_DISPLAY_PARSE_INFO != 0) -# define DISPLAY_PARSE_INFO(tYPE, nAME, oFFSET, pARENToFFSET) \ - { \ - char buf[200]; \ - sprintf(buf, "/* %s \"%s\" %d %d */\n", tYPE, nAME, oFFSET, pARENToFFSET); \ - ui_set_signal_text_cb(user_data, buf, strlen(buf)); \ - } -#else -# define DISPLAY_PARSE_INFO(tYPE, nAME, oFFSET, pARENToFFSET) -#endif - -#if (ENABLE_DISPLAY_BRACE != 0) -# define DISPLAY_BRACE(cODE) if (ui_main_data.display_brace) {cODE} -#else -# define DISPLAY_BRACE(cODE) -#endif - -enum type_e { - TYPE_ENUMERATION, - TYPE_ENUMERATION_VALUE, - TYPE_STRUCT, - TYPE_UNION, - TYPE_FUNDAMENTAL, - TYPE_TYPEDEF, - TYPE_ARRAY, - TYPE_REFERENCE, - TYPE_FIELD, - TYPE_FUNCTION, - TYPE_ARGUMENT, - TYPE_POINTER, - TYPE_FILE, -}; - -/* Forward declarations */ -struct types_s; - -typedef int (*type_hr_display_t)(struct types_s *type, int indent); -typedef int (*type_ui_display_t)(struct types_s *type, int indent); -typedef int (*type_file_print_t)(struct types_s *type, int indent, FILE *file); - -/** - * type_dissect_from_buffer_t - * @param type The current type - * @param ui_set_signal_text_cb GUI display function - * @param user_data Transparent data to pass to the GUI display function - * @param buffer The buffer containing data to dissect - * @param offset offset of field from the beginning of the parent - * @param parent_offset offset of the parent from begining - **/ -typedef int (*type_dissect_from_buffer_t)( - struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line); - -typedef struct types_s { - /* The type of the current description */ - enum type_e type; - - /* Printable name for the current type */ - char *name; - - int type_xml; - - int size; - int align; - int bits; - - /* Used only for arrays */ - int min; - int max; - - int context; - - /* Init value for enumerations */ - int init_value; - - int incomplete; - - /* Id of the type as defined in XML file */ - int id; - int artificial; - - char *mangled; - char *demangled; - - /* List of members in constructed types */ - char *members; - - /* The file containing the definition */ - char *file; - /* Line number of the current definition */ - int line; - - /* offset of the field in the parent type - * -1 means no parent - */ - int offset; - - struct types_s *previous; - struct types_s *next; - struct types_s *parent; - struct types_s *child; - struct types_s *file_ref; - /* Reference to the head */ - struct types_s *head; - - /* For structures or union */ - int nb_members; - struct types_s **members_child; - - /* Some procedures to display the type on terminal */ - type_hr_display_t type_hr_display; - /* Some procedures to display the type on UI */ - type_ui_display_t type_ui_display; - /* Procedure to display the type to a file */ - type_file_print_t type_file_print; - /* Dissect the type */ - type_dissect_from_buffer_t type_dissect_from_buffer; -} types_t; - -types_t *type_new(enum type_e type); - -int types_insert_tail(types_t **head, types_t *to_insert); - -void types_hr_display(types_t *head); - -#define INDENTED(fILE, x, y) \ -do { \ - int indentation = x; \ - while(indentation--) fprintf(fILE, " "); \ - y; \ -} while(0) - -#define INDENTED_STRING(sTR, x, y) \ -do { \ - int indentation = x; \ - while(indentation--) ui_set_signal_text_cb(user_data, " ", 1); \ - y; \ -} while(0) - -#endif /* TYPES_H_ */ diff --git a/common/utils/itti_analyzer/libparser/union_type.c b/common/utils/itti_analyzer/libparser/union_type.c deleted file mode 100644 index f38b7a1ccc..0000000000 --- a/common/utils/itti_analyzer/libparser/union_type.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include - -#define G_LOG_DOMAIN ("PARSER") - -#include "rc.h" - -#include "enum_value_type.h" -#include "union_type.h" -#include "../libresolver/locate_root.h" -#include "ui_interface.h" - -/* There is only one special case of union which is associated to an index: the message id */ -int union_msg_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line) -{ - uint32_t message_id; - int length = 0; - char cbuf[200]; - - DISPLAY_PARSE_INFO("union_msg", type->name, offset, parent_offset); - - CHECK_FCT(get_message_id(type->head, buffer, &message_id)); - - if (type->name) { - DISPLAY_TYPE("Uni"); - - length = sprintf(cbuf, "%s |", type->name); - DISPLAY_BRACE(length += sprintf(&cbuf[length], " {");); - length += sprintf(&cbuf[length], "\n"); - ui_set_signal_text_cb(user_data, cbuf, length); - } - - if (type->members_child[message_id] != NULL) - type->members_child[message_id]->type_dissect_from_buffer( - type->members_child[message_id], ui_set_signal_text_cb, user_data, - buffer, offset, parent_offset, type->name == NULL ? indent : indent + DISPLAY_TAB_SIZE, TRUE); - - DISPLAY_BRACE( - if (type->name) { - DISPLAY_TYPE("Uni"); - - INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "};\n")); - ui_set_signal_text_cb(user_data, cbuf, length); - }); - - return RC_OK; -} - -int union_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line) -{ - int length = 0; - char cbuf[50 + (type->name ? strlen (type->name) : 0)]; - char *name; - int union_child = 0; - - DISPLAY_PARSE_INFO("union", type->name, offset, parent_offset); - - memset (cbuf, 0, sizeof(cbuf)); - -// CHECK_FCT(buffer_has_enouch_data(buffer, offset + parent_offset, type->size / 8)); - - if (type->name) { - name = type->name; - } - else { - name = "_anonymous_"; - } - if (new_line) { - DISPLAY_TYPE("Uni"); - } - INDENTED_STRING(cbuf, new_line ? indent : 0, length = sprintf(cbuf, "%s |", name)); - DISPLAY_BRACE(length += sprintf(&cbuf[length], " {");); - length += sprintf(&cbuf[length], "\n"); - ui_set_signal_text_cb(user_data, cbuf, length); - - if (type->name) { - if (type->parent != NULL) - { - if ((type->parent->name != NULL) && (strcmp(type->parent->name, "choice") == 0)) - { - /* ASN1 union */ - - if ((last_enum_value > 0) && (last_enum_value <= type->nb_members)) - { - union_child = last_enum_value - 1; - - g_debug("ASN1 union \"%s\' detected, use member %d", type->name, union_child); - } - } - } - } - - - /* Only dissect the first field present in unions */ - if (type->members_child[union_child] != NULL) - type->members_child[union_child]->type_dissect_from_buffer( - type->members_child[union_child], ui_set_signal_text_cb, user_data, buffer, - offset, parent_offset, indent + DISPLAY_TAB_SIZE, TRUE); - - DISPLAY_BRACE( - DISPLAY_TYPE("Uni"); - INDENTED_STRING(cbuf, indent, sprintf(cbuf, "};\n")); - - length = strlen (cbuf); - - ui_set_signal_text_cb(user_data, cbuf, length);); - - return 0; -} - -int union_type_file_print(types_t *type, int indent, FILE *file) { - int i; - if (type == NULL) - return -1; - INDENTED(file, indent, fprintf(file, "\n")); - INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name)); - INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id)); - INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size)); - INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align)); - INDENTED(file, indent+4, fprintf(file, "Artificial .: %d\n", type->artificial)); - INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file)); - INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line)); - INDENTED(file, indent+4, fprintf(file, "Members ....: %s\n", type->members)); - INDENTED(file, indent+4, fprintf(file, "Mangled ....: %s\n", type->mangled)); - INDENTED(file, indent+4, fprintf(file, "Demangled ..: %s\n", type->demangled)); - if (type->file_ref != NULL) - type->file_ref->type_file_print (type->file_ref, indent + 4, file); - for (i = 0; i < type->nb_members; i++) { - if (type->members_child[i] != NULL) - type->members_child[i]->type_file_print (type->members_child[i], indent + 4, file); - } - INDENTED(file, indent, fprintf(file, "\n")); - - return 0; -} - -int union_type_hr_display(types_t *type, int indent) { - int i; - if (type == NULL) - return -1; - INDENTED(stdout, indent, printf("\n")); - INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name)); - INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id)); - INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size)); - INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align)); - INDENTED(stdout, indent+4, printf("Artificial .: %d\n", type->artificial)); - INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file)); - INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line)); - INDENTED(stdout, indent+4, printf("Members ....: %s\n", type->members)); - INDENTED(stdout, indent+4, printf("Mangled ....: %s\n", type->mangled)); - INDENTED(stdout, indent+4, printf("Demangled ..: %s\n", type->demangled)); - if (type->file_ref != NULL) - type->file_ref->type_hr_display (type->file_ref, indent + 4); - for (i = 0; i < type->nb_members; i++) { - if (type->members_child[i] != NULL) - type->members_child[i]->type_hr_display (type->members_child[i], indent + 4); - } - INDENTED(stdout, indent, printf("\n")); - - return 0; -} diff --git a/common/utils/itti_analyzer/libparser/union_type.h b/common/utils/itti_analyzer/libparser/union_type.h deleted file mode 100644 index ed2dca73ba..0000000000 --- a/common/utils/itti_analyzer/libparser/union_type.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 - */ - -#include "types.h" - -#ifndef UNION_TYPE_H_ -#define UNION_TYPE_H_ - -int union_msg_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line); - -int union_dissect_from_buffer( - types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data, - buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line); - -int union_type_file_print(types_t *type, int indent, FILE *file); - -int union_type_hr_display(types_t *type, int indent); - -#endif /* UNION_TYPE_H_ */ diff --git a/common/utils/itti_analyzer/libparser/xml_parse.c b/common/utils/itti_analyzer/libparser/xml_parse.c deleted file mode 100644 index 72447e7669..0000000000 --- a/common/utils/itti_analyzer/libparser/xml_parse.c +++ /dev/null @@ -1,904 +0,0 @@ -/* - * 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 - */ - -#include -#include - -#define G_LOG_DOMAIN ("PARSER") - -#include - -#include -#include - -#include "logs.h" -#include "types.h" -#include "xml_parse.h" -#include "union_type.h" - -#include "ui_interface.h" -#include "ui_main_screen.h" -#include "ui_notif_dlg.h" -#include "ui_filters.h" - -#include "../libresolver/locate_root.h" -#include "../libresolver/resolvers.h" - -extern int debug_parser; - -#if (ENABLE_DISPLAY_PARSE_INFO != 0) -# define INDENT_START 30 -#else -# define INDENT_START 0 -#endif - -void *xml_raw_data; -uint32_t xml_raw_data_size; - -types_t *xml_head; -types_t *root; - -static int xml_parse_doc(xmlDocPtr doc); - -static int parse_attribute_name(xmlNode *node, types_t *type, int mandatory) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "name")) == NULL) { - if (mandatory) { - g_error("cannot retrieve name attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - return -1; - } - else { - g_debug("cannot retrieve name attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - return 0; - } - } - type->name = strdup ((char *) node_attribute->children->content); - return 0; -} - -static int parse_attribute_id(xmlNode *node, types_t *type) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "id")) == NULL) { - g_error("cannot retrieve id attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - return -1; - } - type->id = atoi ((char *) &node_attribute->children->content[1]); - return 0; -} - -static int parse_attribute_size(xmlNode *node, types_t *type, int mandatory) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "size")) == NULL) { - if (mandatory) { - g_error("cannot retrieve size attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->size = -1; - return -1; - } - else { - g_debug("cannot retrieve size attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->size = -1; - return 0; - } - } - type->size = atoi ((char *) node_attribute->children->content); - return 0; -} - -static int parse_attribute_align(xmlNode *node, types_t *type, int mandatory) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "align")) == NULL) { - if (mandatory) { - g_error("cannot retrieve align attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->align = -1; - return -1; - } - else { - g_debug("cannot retrieve align attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->align = -1; - return 0; - } - } - type->align = atoi ((char *) node_attribute->children->content); - return 0; -} - -static int parse_attribute_line(xmlNode *node, types_t *type) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "line")) == NULL) { - type->line = -1; - return 0; - } - type->line = atoi ((char *) node_attribute->children->content); - return 0; -} - -static int parse_attribute_file(xmlNode *node, types_t *type) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "file")) == NULL) { - type->file = NULL; - return 0; - } - type->file = strdup ((char *) node_attribute->children->content); - return 0; -} - -static int parse_attribute_context(xmlNode *node, types_t *type, int mandatory) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "context")) == NULL) { - if (mandatory) { - g_error("cannot retrieve context attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->context = -1; - return -1; - } - else { - type->context = -1; - return 0; - } - } - type->context = atoi ((char *) &node_attribute->children->content[1]); - return 0; -} - -static int parse_attribute_artificial(xmlNode *node, types_t *type) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "artificial")) == NULL) { - g_debug("cannot retrieve artificial attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->artificial = -1; - return 0; - } - type->artificial = atoi ((char *) &node_attribute->children->content[1]); - return 0; -} - -static int parse_attribute_init(xmlNode *node, types_t *type) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "init")) == NULL) { - g_error("cannot retrieve init attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->init_value = -1; - return 0; - } - type->init_value = atoi ((char *) node_attribute->children->content); - return 0; -} - -static int parse_attribute_members(xmlNode *node, types_t *type, int mandatory) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "members")) == NULL) { - if (mandatory) { - g_error("cannot retrieve members attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->members = 0; - return -1; - } - else { - g_debug("cannot retrieve members attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->members = 0; - return 0; - } - } - type->members = strdup ((char *) node_attribute->children->content); - return 0; -} - -static int parse_attribute_mangled(xmlNode *node, types_t *type, int mandatory) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "mangled")) == NULL) { - if (mandatory) { - g_error("cannot retrieve mangled attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->mangled = 0; - return -1; - } - else { - g_debug("cannot retrieve mangled attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->mangled = 0; - return 0; - } - } - type->mangled = strdup ((char *) node_attribute->children->content); - return 0; -} - -static int parse_attribute_demangled(xmlNode *node, types_t *type, int mandatory) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "mangled")) == NULL) { - if (mandatory) { - g_error("cannot retrieve demangled attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->demangled = 0; - return -1; - } - else { - g_debug("cannot retrieve demangled attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->demangled = 0; - return 0; - } - } - type->demangled = strdup ((char *) node_attribute->children->content); - return 0; -} - -static int parse_attribute_offset(xmlNode *node, types_t *type, int mandatory) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "offset")) == NULL) { - if (mandatory) { - g_error("cannot retrieve offset attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->offset = -1; - return -1; - } - else { - g_debug("cannot retrieve offset attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->offset = -1; - return 0; - } - } - type->offset = atoi ((char *) node_attribute->children->content); - return 0; -} - -static int parse_attribute_bits(xmlNode *node, types_t *type, int mandatory) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "bits")) == NULL) { - if (mandatory) { - g_error("cannot retrieve bits attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->bits = -1; - return -1; - } - else { - g_debug("cannot retrieve bits attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->bits = -1; - return 0; - } - } - type->bits = atoi ((char *) node_attribute->children->content); - return 0; -} - -static int parse_attribute_type(xmlNode *node, types_t *type, int mandatory) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "type")) == NULL) { - if (mandatory) { - g_error("cannot retrieve type attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->type_xml = 0; - return -1; - } - else { - g_debug("cannot retrieve type attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->type_xml = 0; - return 0; - } - } - type->type_xml = atoi ((char *) &node_attribute->children->content[1]); - return 0; -} - -static int parse_attribute_min(xmlNode *node, types_t *type, int mandatory) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "min")) == NULL) { - if (mandatory) { - g_error("cannot retrieve min attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->min = 0; - return -1; - } - else { - g_debug("cannot retrieve min attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->min = 0; - return 0; - } - } - type->min = atoi ((char *) node_attribute->children->content); - return 0; -} - -static int parse_attribute_max(xmlNode *node, types_t *type, int mandatory) { - xmlAttrPtr node_attribute; - if ((node_attribute = xmlHasProp (node, (xmlChar *) "max")) == NULL) { - if (mandatory) { - g_error("cannot retrieve max attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->max = 0; - return -1; - } - else { - g_debug("cannot retrieve max attribute in node %s, %s:%ld", - (char *)node->name, node->doc->URL, XML_GET_LINE(node)); - type->max = 0; - return 0; - } - } - type->max = atoi ((char *) &node_attribute->children->content[1]); - return 0; -} - -static int parse_enum_values(xmlNode *node, types_t *parent) { - types_t *new; - - if (node == NULL || parent == NULL) - return -1; - - new = type_new (TYPE_ENUMERATION_VALUE); - - CHECK_FCT(parse_attribute_name(node, new, 1)); - CHECK_FCT(parse_attribute_init(node, new)); - - CHECK_FCT(types_insert_tail(&parent->child, new)); - - return 0; -} - -static int parse_enumeration(xmlNode *node, types_t **head) { - types_t *new; - xmlNode *enum_value_node; - - if (node == NULL) - return -1; - - new = type_new (TYPE_ENUMERATION); - - CHECK_FCT(parse_attribute_name(node, new, 1)); - CHECK_FCT(parse_attribute_id(node, new)); - CHECK_FCT(parse_attribute_size(node, new, 1)); - CHECK_FCT(parse_attribute_align(node, new, 1)); - CHECK_FCT(parse_attribute_context(node, new, 0)); - CHECK_FCT(parse_attribute_line(node, new)); - CHECK_FCT(parse_attribute_file(node, new)); - CHECK_FCT(parse_attribute_artificial(node, new)); - - CHECK_FCT(types_insert_tail(head, new)); - - /* Parse enum values */ - for (enum_value_node = node->children; enum_value_node; enum_value_node = enum_value_node->next) { - if (strcmp ((char *) enum_value_node->name, "EnumValue") == 0) - CHECK_FCT(parse_enum_values(enum_value_node, new)); - } - - return 0; -} - -static int parse_union(xmlNode *node, types_t **head) { - types_t *new; - - if (node == NULL) - return -1; - - new = type_new (TYPE_UNION); - - CHECK_FCT(parse_attribute_name(node, new, 0)); - CHECK_FCT(parse_attribute_id(node, new)); - CHECK_FCT(parse_attribute_size(node, new, 1)); - CHECK_FCT(parse_attribute_align(node, new, 1)); - CHECK_FCT(parse_attribute_context(node, new, 0)); - CHECK_FCT(parse_attribute_members(node, new, 0)); - CHECK_FCT(parse_attribute_line(node, new)); - CHECK_FCT(parse_attribute_file(node, new)); - CHECK_FCT(parse_attribute_artificial(node, new)); - CHECK_FCT(parse_attribute_mangled(node, new, 0)); - CHECK_FCT(parse_attribute_demangled(node, new, 0)); - - if (new->name) - if (strcmp (new->name, "msg_s") == 0) - new->type_dissect_from_buffer = union_msg_dissect_from_buffer; - - CHECK_FCT(types_insert_tail(head, new)); - - return 0; -} - -static int parse_fundamental(xmlNode *node, types_t **head) { - types_t *new; - - if (node == NULL) - return -1; - - new = type_new (TYPE_FUNDAMENTAL); - - CHECK_FCT(parse_attribute_name(node, new, 1)); - CHECK_FCT(parse_attribute_id(node, new)); - CHECK_FCT(parse_attribute_size(node, new, 0)); - CHECK_FCT(parse_attribute_align(node, new, 0)); - - CHECK_FCT(types_insert_tail(head, new)); - - return 0; -} - -static int parse_struct(xmlNode *node, types_t **head) { - types_t *new; - - if (node == NULL) - return -1; - - new = type_new (TYPE_STRUCT); - - CHECK_FCT(parse_attribute_name(node, new, 0)); - CHECK_FCT(parse_attribute_id(node, new)); - CHECK_FCT(parse_attribute_size(node, new, 0)); - CHECK_FCT(parse_attribute_align(node, new, 0)); - CHECK_FCT(parse_attribute_file(node, new)); - CHECK_FCT(parse_attribute_line(node, new)); - CHECK_FCT(parse_attribute_context(node, new, 0)); - CHECK_FCT(parse_attribute_artificial(node, new)); - CHECK_FCT(parse_attribute_members(node, new, 0)); - CHECK_FCT(parse_attribute_mangled(node, new, 0)); - CHECK_FCT(parse_attribute_demangled(node, new, 0)); - - CHECK_FCT(types_insert_tail(head, new)); - - return 0; -} - -static int parse_typedef(xmlNode *node, types_t **head) { - types_t *new; - - if (node == NULL) - return -1; - - new = type_new (TYPE_TYPEDEF); - - CHECK_FCT(parse_attribute_name(node, new, 1)); - CHECK_FCT(parse_attribute_id(node, new)); - CHECK_FCT(parse_attribute_file(node, new)); - CHECK_FCT(parse_attribute_line(node, new)); - CHECK_FCT(parse_attribute_type(node, new, 1)); - CHECK_FCT(parse_attribute_size(node, new, 0)); - CHECK_FCT(parse_attribute_align(node, new, 0)); - CHECK_FCT(parse_attribute_context(node, new, 0)); - CHECK_FCT(parse_attribute_artificial(node, new)); - CHECK_FCT(parse_attribute_members(node, new, 0)); - CHECK_FCT(parse_attribute_mangled(node, new, 0)); - CHECK_FCT(parse_attribute_demangled(node, new, 0)); - - CHECK_FCT(types_insert_tail(head, new)); - - return 0; -} - -static int parse_field(xmlNode *node, types_t **head) { - types_t *new; - - if (node == NULL) - return -1; - - new = type_new (TYPE_FIELD); - - CHECK_FCT(parse_attribute_name(node, new, 1)); - CHECK_FCT(parse_attribute_id(node, new)); - CHECK_FCT(parse_attribute_type(node, new, 1)); - CHECK_FCT(parse_attribute_size(node, new, 0)); - CHECK_FCT(parse_attribute_bits(node, new, 0)); - CHECK_FCT(parse_attribute_offset(node, new, 0)); - CHECK_FCT(parse_attribute_align(node, new, 0)); - CHECK_FCT(parse_attribute_context(node, new, 0)); - CHECK_FCT(parse_attribute_artificial(node, new)); - CHECK_FCT(parse_attribute_members(node, new, 0)); - CHECK_FCT(parse_attribute_mangled(node, new, 0)); - CHECK_FCT(parse_attribute_demangled(node, new, 0)); - - CHECK_FCT(types_insert_tail(head, new)); - - return 0; -} - -static int parse_file(xmlNode *node, types_t **head) { - types_t *new; - - if (node == NULL) - return -1; - - new = type_new (TYPE_FILE); - - CHECK_FCT(parse_attribute_name(node, new, 1)); - CHECK_FCT(parse_attribute_id(node, new)); - - CHECK_FCT(types_insert_tail(head, new)); - - return 0; -} - -static int parse_reference_type(xmlNode *node, types_t **head) { - types_t *new; - - if (node == NULL) - return -1; - - new = type_new (TYPE_REFERENCE); - - CHECK_FCT(parse_attribute_id(node, new)); - CHECK_FCT(parse_attribute_type(node, new, 1)); - CHECK_FCT(parse_attribute_size(node, new, 1)); - CHECK_FCT(parse_attribute_align(node, new, 1)); - CHECK_FCT(parse_attribute_context(node, new, 0)); - CHECK_FCT(parse_attribute_offset(node, new, 0)); - CHECK_FCT(parse_attribute_file(node, new)); - CHECK_FCT(parse_attribute_line(node, new)); - - CHECK_FCT(types_insert_tail(head, new)); - - return 0; -} - -static int parse_array_type(xmlNode *node, types_t **head) { - types_t *new; - - if (node == NULL) - return -1; - - new = type_new (TYPE_ARRAY); - - CHECK_FCT(parse_attribute_id(node, new)); - CHECK_FCT(parse_attribute_type(node, new, 1)); - CHECK_FCT(parse_attribute_size(node, new, 0)); - CHECK_FCT(parse_attribute_align(node, new, 1)); - CHECK_FCT(parse_attribute_min(node, new, 1)); - CHECK_FCT(parse_attribute_max(node, new, 1)); - - CHECK_FCT(types_insert_tail(head, new)); - - return 0; -} - -static int parse_pointer_type(xmlNode *node, types_t **head) { - types_t *new; - - if (node == NULL) - return -1; - - new = type_new (TYPE_POINTER); - - CHECK_FCT(parse_attribute_id(node, new)); - CHECK_FCT(parse_attribute_type(node, new, 1)); - CHECK_FCT(parse_attribute_size(node, new, 1)); - CHECK_FCT(parse_attribute_align(node, new, 1)); - - CHECK_FCT(types_insert_tail(head, new)); - - return 0; -} - -static int parse_function_type(xmlNode *node, types_t **head) { - types_t *new; - - if (node == NULL) - return -1; - - new = type_new (TYPE_FUNCTION); - - CHECK_FCT(parse_attribute_id(node, new)); - - CHECK_FCT(types_insert_tail(head, new)); - - return 0; -} - -/** - * print_element_names: - * @a_node: the initial xml node to consider. - * - * Prints the names of the all the xml elements - * that are siblings or children of a given xml node. - */ -static int parse_elements(xmlNode * a_node, types_t **head) { - xmlNode *cur_node = NULL; - xmlNode *child_node = NULL; - - for (cur_node = a_node; cur_node; cur_node = cur_node->next) { - for (child_node = cur_node->children; child_node; child_node = child_node->next) { - if (child_node->type == XML_ELEMENT_NODE) { - if (strcmp ((char *) child_node->name, "Enumeration") == 0) { - CHECK_FCT_DO(parse_enumeration(child_node, head), return RC_FAIL); - } - else - if (strcmp ((char *) child_node->name, "FundamentalType") == 0) { - CHECK_FCT_DO(parse_fundamental(child_node, head), return RC_FAIL); - } - else - if (strcmp ((char *) child_node->name, "Struct") == 0) { - CHECK_FCT_DO(parse_struct(child_node, head), return RC_FAIL); - } - else - if (strcmp ((char *) child_node->name, "Union") == 0) { - CHECK_FCT_DO(parse_union(child_node, head), return RC_FAIL); - } - else - if (strcmp ((char *) child_node->name, "Typedef") == 0) { - CHECK_FCT_DO(parse_typedef(child_node, head), return RC_FAIL); - } - else - if (strcmp ((char *) child_node->name, "File") == 0) { - CHECK_FCT_DO(parse_file(child_node, head), return RC_FAIL); - } - else - if (strcmp ((char *) child_node->name, "Field") == 0) { - CHECK_FCT_DO(parse_field(child_node, head), return RC_FAIL); - } - else - if (strcmp ((char *) child_node->name, "ReferenceType") == 0) { - CHECK_FCT_DO(parse_reference_type(child_node, head), return RC_FAIL); - } - else - if (strcmp ((char *) child_node->name, "ArrayType") == 0) { - CHECK_FCT_DO(parse_array_type(child_node, head), return RC_FAIL); - } - else - if (strcmp ((char *) child_node->name, "PointerType") == 0) { - CHECK_FCT_DO(parse_pointer_type(child_node, head), return RC_FAIL); - } - else - if (strcmp ((char *) child_node->name, "FunctionType") == 0) { - CHECK_FCT_DO(parse_function_type(child_node, head), return RC_FAIL); - } - } - } - } - - return RC_OK; -} - -static int free_elements(types_t *parent, int indent) { - types_t *cur_node = parent; - types_t *child_node; - - g_debug("%*s%p %s", indent, "", cur_node, cur_node->name != NULL ? cur_node->name : ""); - - for (; cur_node != NULL; cur_node = cur_node->next) { - if (cur_node->child != NULL) { - child_node = cur_node->child; - cur_node->child = NULL; /* Clear the child pointer to avoid re-processing it, we are handling a graph with loops */ - CHECK_FCT_DO(free_elements((child_node), indent + 2), return RC_FAIL); - } - } - free (cur_node); - - return RC_OK; -} - -int xml_parse_buffer(char *xml_buffer, const int size) { - xmlDocPtr doc; /* the resulting document tree */ - - if (xml_buffer == NULL) { - return RC_NULL_POINTER; - } - - if (xml_raw_data != NULL) - { - /* Free previous raw data */ - free (xml_raw_data); - } - xml_raw_data = xml_buffer; - xml_raw_data_size = size; - - if (xml_head != NULL) - { - /* Free previous definitions */ - free_elements(xml_head, 0); - - g_info("xml_parse_buffer freed previous definitions"); - } - - xml_head = NULL; - root = NULL; - messages_id_enum = NULL; - lte_time_type = NULL; - lte_time_frame_type = NULL; - lte_time_slot_type = NULL; - origin_task_id_type = NULL; - destination_task_id_type = NULL; - instance_type = NULL; - message_header_type = NULL; - message_type = NULL; - message_size_type = NULL; - - g_info("Parsing XML definition from buffer ..."); - - doc = xmlReadMemory(xml_buffer, size, NULL, NULL, 0); - - if (doc == NULL) { - g_warning("Failed to parse XML buffer: %s", xml_buffer); - ui_notification_dialog(GTK_MESSAGE_ERROR, FALSE, "parse messages format definition", "Fail to parse XML buffer"); - return RC_FAIL; - } - - return xml_parse_doc(doc); -} - -static int update_filters() { - types_t *types; - - ui_init_filters(FALSE, TRUE); - - types = messages_id_enum; - if (types != NULL) - { - types = types->child; - - while (types != NULL) - { - if (strcmp (types->name, "MESSAGES_ID_MAX") != 0) - { - ui_filters_add (FILTER_MESSAGES, types->init_value, types->name, ENTRY_ENABLED_UNDEFINED, NULL, NULL); - } - types = types->next; - } - } - - types = origin_task_id_type; - if (types != NULL) - { - types = types->child->child; - - while (types != NULL) { - if ((strcmp (types->name, "TASK_FIRST") != 0) && (strcmp (types->name, "TASK_MAX") != 0)) - { - ui_filters_add(FILTER_ORIGIN_TASKS, types->init_value, types->name, ENTRY_ENABLED_UNDEFINED, NULL, NULL); - } - types = types->next; - } - } - - types = destination_task_id_type; - if (types != NULL) - { - types = types->child->child; - - while (types != NULL) { - if ((strcmp (types->name, "TASK_FIRST") != 0) && (strcmp (types->name, "TASK_MAX") != 0)) - { - ui_filters_add(FILTER_DESTINATION_TASKS, types->init_value, types->name, ENTRY_ENABLED_UNDEFINED, NULL, NULL); - } - types = types->next; - } - } - - return RC_OK; -} - -static int xml_parse_doc(xmlDocPtr doc) { - xmlNode *root_element = NULL; - int ret = 0; - FILE *dissect_file = NULL; - - if (ui_main_data.dissect_file_name != NULL) { - dissect_file = fopen (ui_main_data.dissect_file_name, "w"); - } - - /* Get the root element node */ - root_element = xmlDocGetRootElement(doc); - - ret = parse_elements(root_element, &xml_head); - - /* Free the document */ - xmlFreeDoc(doc); - - if (ret == RC_OK) { - resolve_typedefs (&xml_head); - resolve_pointer_type (&xml_head); - resolve_field (&xml_head); - resolve_array (&xml_head); - resolve_reference (&xml_head); - resolve_struct (&xml_head); - resolve_file (&xml_head); - resolve_union (&xml_head); - resolve_function (&xml_head); - - /* Locate the root element which corresponds to the MessageDef struct */ - CHECK_FCT(locate_root("MessageDef", xml_head, &root)); - - /* Locate the LTE time fields */ - if (locate_type("lte_time", xml_head, <e_time_type) == RC_OK) - { - CHECK_FCT(locate_type("frame", lte_time_type->child->child, <e_time_frame_type)); - CHECK_FCT(locate_type("slot", lte_time_type->child->child, <e_time_slot_type)); - } - - /* Locate the message id field */ - CHECK_FCT(locate_type("MessagesIds", xml_head, &messages_id_enum)); - - /* Locate the header part of a message */ - CHECK_FCT(locate_type("ittiMsgHeader", xml_head, &message_header_type)); - /* Locate the main message part */ - CHECK_FCT(locate_type("ittiMsg", xml_head, &message_type)); - - /* Locate the origin task id field */ - CHECK_FCT(locate_type_children("originTaskId", message_header_type->child->child, &origin_task_id_type)); - /* Locate the destination task id field */ - CHECK_FCT(locate_type_children("destinationTaskId", message_header_type->child->child, &destination_task_id_type)); - /* Locate the instance field */ - CHECK_FCT(locate_type_children("instance", message_header_type->child->child, &instance_type)); - /* Locate the message size field */ - CHECK_FCT(locate_type_children("ittiMsgSize", message_header_type->child->child, &message_size_type)); - - // root->type_hr_display(root, 0); - - update_filters(); - if (dissect_file != NULL) { - g_debug("generating dissected types file \"%s\" ...", ui_main_data.dissect_file_name); - root->type_file_print (root, 0, dissect_file); - } - } - - if (dissect_file != NULL) { - fclose (dissect_file); - } - - g_message("Parsed XML definition"); - - return ret; -} - -int dissect_signal_header(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb, - gpointer cb_user_data) -{ - if (message_header_type == NULL) { - g_error("No messages format definition provided"); - return RC_FAIL; - } - - if (buffer == NULL) { - g_error("Failed buffer is NULL"); - return RC_FAIL; - } - - message_header_type->type_dissect_from_buffer( - message_header_type, ui_set_signal_text_cb, cb_user_data, - buffer, 0, 0, INDENT_START, TRUE); - - return RC_OK; -} - -int dissect_signal(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb, - gpointer cb_user_data) -{ - if (message_type == NULL) { - g_error("No messages format definition provided"); - return RC_FAIL; - } - - if (buffer == NULL) { - g_error("Failed buffer is NULL"); - return RC_FAIL; - } - - message_type->type_dissect_from_buffer(message_type, ui_set_signal_text_cb, cb_user_data, - buffer, 0, 0, INDENT_START, TRUE); - - return RC_OK; -} diff --git a/common/utils/itti_analyzer/libparser/xml_parse.h b/common/utils/itti_analyzer/libparser/xml_parse.h deleted file mode 100644 index f9624bc06b..0000000000 --- a/common/utils/itti_analyzer/libparser/xml_parse.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 - */ - -#include "rc.h" -#include "types.h" - -#ifndef XML_PARSE_H_ -#define XML_PARSE_H_ - -extern void *xml_raw_data; -extern uint32_t xml_raw_data_size; - -extern types_t *root; - -int xml_parse_file(const char *filename); - -int xml_parse_buffer(char *xml_buffer, const int size); - -int dissect_signal(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb, - gpointer user_data); - -int dissect_signal_header(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb, - gpointer cb_user_data); - -#endif /* XML_PARSE_H_ */ diff --git a/common/utils/itti_analyzer/libresolver/Makefile.am b/common/utils/itti_analyzer/libresolver/Makefile.am deleted file mode 100644 index 875fc81916..0000000000 --- a/common/utils/itti_analyzer/libresolver/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -AM_CFLAGS = \ - @ADD_CFLAGS@ \ - -I$(top_srcdir)/common \ - -I$(top_srcdir)/libparser \ - -I$(top_srcdir)/libui \ - -I$(top_srcdir)/libbuffers - -noinst_LTLIBRARIES = libresolver.la - -libresolver_la_LDFLAGS = -all-static -libresolver_la_SOURCES = \ - locate_root.c locate_root.h \ - resolvers.c resolvers.h diff --git a/common/utils/itti_analyzer/libresolver/locate_root.c b/common/utils/itti_analyzer/libresolver/locate_root.c deleted file mode 100644 index dffd489944..0000000000 --- a/common/utils/itti_analyzer/libresolver/locate_root.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * 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 - */ - -#include -#include - -#define G_LOG_DOMAIN ("RESOLVER") - -#include - -#include "logs.h" -#include "rc.h" - -#include "types.h" -#include "enum_type.h" -#include "locate_root.h" -#include "xml_parse.h" - -types_t *messages_id_enum; -types_t *lte_time_type; -types_t *lte_time_frame_type; -types_t *lte_time_slot_type; -types_t *origin_task_id_type; -types_t *destination_task_id_type; -types_t *instance_type; -types_t *message_header_type; -types_t *message_type; -types_t *message_size_type; - -int locate_root(const char *root_name, types_t *head, types_t **root_elm) { - types_t *next_type; - int next_counter = 0; - - /* The root element is for example : MessageDef. - * This element is the entry for other sub-types. - */ - if (!root_name || (strlen (root_name) == 0)) { - g_warning("FATAL: no root element name provided"); - return -1; - } - if (!head) { - g_warning("Empty list detected"); - return -1; - } - if (!root_elm) { - g_warning("NULL root reference"); - return -1; - } - - for (next_type = head; next_type; next_type = next_type->next) { - if (next_type->name == NULL) - continue; - if (strcmp (root_name, next_type->name) == 0) { - /* Matching reference */ - break; - } - next_counter ++; - } - g_info("locate_root: %s %d", root_name, next_counter); - - *root_elm = next_type; - return (next_type == NULL) ? -2 : 0; -} - -int locate_type(const char *type_name, types_t *head, types_t **type) { - types_t *next_type; - int next_counter = 0; - - /* The root element is for example : MessageDef. - * This element is the entry for other sub-types. - */ - if (!type_name) { - g_warning("FATAL: no element name provided"); - return RC_BAD_PARAM; - } - if (!head) { - g_warning("Empty list detected"); - return RC_BAD_PARAM; - } - - for (next_type = head; next_type; next_type = next_type->next) { - if (next_type->name == NULL) - continue; - if (strcmp (type_name, next_type->name) == 0) { - /* Matching reference */ - break; - } - next_counter ++; - } - g_info("locate_type: %s %d %p", type_name, next_counter, next_type); - - if (type) - *type = next_type; - return (next_type == NULL) ? RC_FAIL : RC_OK; -} - -int locate_type_children(const char *type_name, types_t *head, types_t **type) { - types_t *found_type = NULL; - int i; - - /* The root element is for example : MessageDef. - * This element is the entry for other sub-types. - */ - if (!type_name) { - g_warning("FATAL: no element name provided"); - return RC_BAD_PARAM; - } - if (!head) { - g_warning("Empty list detected"); - return RC_BAD_PARAM; - } - - for (i = 0; i < head->nb_members; i++) { - if (head->members_child[i]->name == NULL) - continue; - if (strcmp (type_name, head->members_child[i]->name) == 0) { - /* Matching reference */ - found_type = head->members_child[i]; - break; - } - } - g_info("locate_type: %s %d %p", type_name, i, found_type); - - if (type) - *type = found_type; - return (found_type == NULL) ? RC_FAIL : RC_OK; -} - -uint32_t get_message_header_type_size(void) -{ - /* Typedef */ - if (message_header_type->child != NULL) { - /* Struct */ - if (message_header_type->child->child != NULL) { - return message_header_type->child->child->size; - } - } - return 0; -} - -uint32_t get_message_size(buffer_t *buffer) -{ - uint32_t value = 0; - - if (message_size_type != NULL) - { - types_t *temp = message_size_type; - - while (temp->size == -1) { - temp = temp->child; - } - - /* Fetch instance value */ - buffer_fetch_bits (buffer, message_size_type->offset, temp->size, &value); - } - - return value; -} - -uint32_t get_lte_frame(buffer_t *buffer) { - uint32_t value = 0; - - if (lte_time_type !=NULL) - { - /* Fetch instance value */ - buffer_fetch_bits (buffer, lte_time_type->offset + lte_time_frame_type->offset, lte_time_frame_type->child->child->size, &value); - } - - return value; -} - -uint32_t get_lte_slot(buffer_t *buffer) { - uint32_t value = 0; - - if (lte_time_type !=NULL) - { - /* Fetch instance value */ - buffer_fetch_bits (buffer, lte_time_type->offset + lte_time_slot_type->offset, lte_time_slot_type->child->child->size, &value); - } - - return value; -} - -uint32_t get_message_id(types_t *head, buffer_t *buffer, uint32_t *message_id) { - uint32_t value; - - g_assert(message_id != NULL); - g_assert(buffer != NULL); - - /* MessageId is an offset from start of buffer */ - value = buffer_get_uint32_t(buffer, messages_id_enum->offset); - - *message_id = value; - return RC_OK; -} - -uint32_t get_task_id(buffer_t *buffer, types_t *task_id_type) { - uint32_t task_id_value; - - /* Fetch task id value */ - if (buffer_fetch_bits (buffer, task_id_type->offset, task_id_type->child->size, &task_id_value) != RC_OK) - { - return ~0; - } - - return task_id_value; -} - -char *task_id_to_string(uint32_t task_id_value, types_t *task_id_type) { - char *task_id = "UNKNOWN"; - - if (task_id_value < ((uint32_t) ~0)) - { - /* Search task id name */ - task_id = enum_type_get_name_from_value (task_id_type->child, task_id_value); - } - - return task_id; -} - -uint32_t get_instance(buffer_t *buffer) { - uint32_t instance_value; - - /* Fetch instance value */ - buffer_fetch_bits (buffer, instance_type->offset, instance_type->child->child->child->size, &instance_value); - - return instance_value; -} - -char *message_id_to_string(uint32_t message_id) -{ - return enum_type_get_name_from_value(messages_id_enum, message_id); -} diff --git a/common/utils/itti_analyzer/libresolver/locate_root.h b/common/utils/itti_analyzer/libresolver/locate_root.h deleted file mode 100644 index 5cb2eb2588..0000000000 --- a/common/utils/itti_analyzer/libresolver/locate_root.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 - */ - -#ifndef LOCATE_ROOT_H_ -#define LOCATE_ROOT_H_ - -#include "types.h" - -extern types_t *messages_id_enum; -extern types_t *lte_time_type; -extern types_t *lte_time_frame_type; -extern types_t *lte_time_slot_type; -extern types_t *origin_task_id_type; -extern types_t *destination_task_id_type; -extern types_t *instance_type; -extern types_t *message_header_type; -extern types_t *message_type; -extern types_t *message_size_type; - -int locate_root(const char *root_name, types_t *head, types_t **root); - -int locate_type(const char *type_name, types_t *head, types_t **type); - -int locate_type_children(const char *type_name, types_t *head, types_t **type); - -uint32_t get_message_header_type_size(void); - -uint32_t get_message_size(buffer_t *buffer); - -uint32_t get_lte_frame(buffer_t *buffer); - -uint32_t get_lte_slot(buffer_t *buffer); - -uint32_t get_message_id(types_t *head, buffer_t *buffer, uint32_t *message_id); - -char *message_id_to_string(uint32_t message_id); - -uint32_t get_task_id(buffer_t *buffer, types_t *task_id_type); - -char *task_id_to_string(uint32_t task_id_value, types_t *task_id_type); - -uint32_t get_instance(buffer_t *buffer); - -#endif /* LOCATE_ROOT_H_ */ diff --git a/common/utils/itti_analyzer/libresolver/resolvers.c b/common/utils/itti_analyzer/libresolver/resolvers.c deleted file mode 100644 index 8702c08942..0000000000 --- a/common/utils/itti_analyzer/libresolver/resolvers.c +++ /dev/null @@ -1,384 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include - -#define G_LOG_DOMAIN ("RESOLVER") - -#include - -#include "types.h" -#include "resolvers.h" - -typedef enum { - RESOLV_OK = 0, - RESOLV_ERROR = -1, - RESOLV_LIST_EMPTY = -2, - RESOLV_NOT_FOUND = -3, -} resolv_rc_e; - -static int search_id(types_t *head, types_t **found, int id) -{ - types_t *next_type; - - if (!head) { - g_warning("Empty list detected"); - return RESOLV_LIST_EMPTY; - } - - for (next_type = head; next_type; next_type = next_type->next) - { - if (next_type->id == id && next_type->type != TYPE_FILE) - break; - } - if (found) - *found = next_type; - - return next_type == NULL ? RESOLV_NOT_FOUND : RESOLV_OK; -} - -int search_file(types_t *head, types_t **found, int file_id) -{ - types_t *next_type; - - if (!head) { - g_warning("Empty list detected"); - return RESOLV_LIST_EMPTY; - } - - for (next_type = head; next_type; next_type = next_type->next) - { - if (next_type->type != TYPE_FILE) - continue; - if (file_id == next_type->id) - break; - } - if (found) - *found = next_type; - - return next_type == NULL ? RESOLV_NOT_FOUND : RESOLV_OK; -} - -int resolve_typedefs(types_t **head) -{ - types_t *next_type; - - if (!head) { - g_warning("Empty list detected"); - return RESOLV_LIST_EMPTY; - } - - for (next_type = *head; next_type; next_type = next_type->next) - { - /* Only resolve typedef */ - if (next_type->type != TYPE_TYPEDEF) - continue; - -// printf("Trying to resolve typedef %s with type %d\n", next_type->name, next_type->id); - - if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) { - /* We have to remove this reference */ - }/* else { - next_type->type_hr_display(next_type, 0); - }*/ - } - - return 0; -} - -int resolve_struct(types_t **head) -{ - types_t *next_type; - - if (!head) { - g_warning("Empty list detected"); - return RESOLV_LIST_EMPTY; - } - - for (next_type = *head; next_type; next_type = next_type->next) - { - char *member; - char *members; - - /* Only resolve typedef */ - if (next_type->type != TYPE_STRUCT) - continue; - - g_debug("Trying to resolve struct members %s with type %d", next_type->name, next_type->id); - - /* Struct may have no member */ - if (next_type->members == NULL) - continue; - - /* We have to copy the string as strtok will split the string in argument */ - members = strdup(next_type->members); - - /* Split the string on spaces and _ */ - member = strtok(members, " _"); - while(member != NULL) - { - if (next_type->nb_members == 0) { - next_type->members_child = malloc(sizeof(types_t *)); - } else { - next_type->members_child = realloc(next_type->members_child, - (next_type->nb_members + 1) * sizeof(types_t *)); - } - if (search_id(*head, &next_type->members_child[next_type->nb_members], atoi(member)) != RESOLV_OK) { - /* We have to remove this reference */ - } - if ((next_type->members_child[next_type->nb_members] != NULL) - && (next_type->members_child[next_type->nb_members]->type != TYPE_FIELD)) - { - /* Only keep field child for structure, other member can be present - * for defining types (union or struct) used by fields but should not be considered. */ - next_type->members_child[next_type->nb_members] = NULL; - /* We have to remove this reference */ - } - next_type->nb_members++; - /* Pick up the next string available */ - member = strtok(NULL, " _"); - } - - free(members); - } - - return 0; -} - -int resolve_union(types_t **head) -{ - types_t *next_type; - - if (!head) { - g_warning("Empty list detected"); - return RESOLV_LIST_EMPTY; - } - - for (next_type = *head; next_type; next_type = next_type->next) - { - char *member; - char *members; - - /* Only resolve typedef */ - if (next_type->type != TYPE_UNION) - continue; - - g_debug("Trying to resolve union members %s with type %d\n", next_type->name, next_type->id); - - /* Struct may have no member */ - if (next_type->members == NULL) - continue; - - /* We have to copy the string as strtok will modify the string in argument */ - members = strdup(next_type->members); - - /* Split the string on spaces and _ */ - member = strtok(members, " _"); - while(member != NULL) - { - if (next_type->nb_members == 0) { - next_type->members_child = malloc(sizeof(types_t *)); - } else { - next_type->members_child = realloc(next_type->members_child, - (next_type->nb_members + 1) * sizeof(types_t *)); - } - if (search_id(*head, &next_type->members_child[next_type->nb_members], atoi(member)) != RESOLV_OK) { - /* We have to remove this reference */ - } - next_type->nb_members++; - /* Pick up the next string available */ - member = strtok(NULL, " _"); - } - - free(members); - } - - return 0; -} - -int resolve_pointer_type(types_t **head) -{ - types_t *next_type; - - if (!head) { - g_warning("Empty list detected"); - return RESOLV_LIST_EMPTY; - } - - for (next_type = *head; next_type; next_type = next_type->next) - { - /* Only resolve typedef */ - if (next_type->type != TYPE_POINTER) - continue; - - g_debug("Trying to resolve pointer id %d with type %d", - next_type->id, next_type->type_xml); - - if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) { - /* We have to remove this reference */ - } -// next_type->type_hr_display(next_type, 0); - } - - return 0; -} - -int resolve_reference(types_t **head) -{ - types_t *next_type; - - if (!head) { - g_warning("Empty list detected"); - return RESOLV_LIST_EMPTY; - } - - for (next_type = *head; next_type; next_type = next_type->next) - { - /* Only resolve typedef */ - if (next_type->type != TYPE_REFERENCE) - continue; - - g_debug("Trying to resolve reference id %d with type %d\n", - next_type->id, next_type->type_xml); - - if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) { - /* We have to remove this reference */ - } -// next_type->type_hr_display(next_type, 0); - } - - return 0; -} - -int resolve_field(types_t **head) -{ - types_t *next_type; - - if (!head) { - g_warning("Empty list detected"); - return RESOLV_LIST_EMPTY; - } - - for (next_type = *head; next_type; next_type = next_type->next) - { - /* Only resolve typedef */ - if (next_type->type != TYPE_FIELD) - continue; - - g_debug("Trying to resolve pointer id %d with type %d\n", - next_type->id, next_type->type_xml); - - if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) { - /* We have to remove this reference */ - } -// next_type->type_hr_display(next_type, 0); - } - - return 0; -} - -int resolve_array(types_t **head) -{ - types_t *next_type; - - if (!head) { - g_warning("Empty list detected"); - return RESOLV_LIST_EMPTY; - } - - for (next_type = *head; next_type; next_type = next_type->next) - { - /* Only resolve typedef */ - if (next_type->type != TYPE_ARRAY) - continue; - - g_debug("Trying to resolve array id %d with type %d\n", - next_type->id, next_type->type_xml); - - if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) { - /* We have to remove this reference */ - } -// next_type->type_hr_display(next_type, 0); - } - - return 0; -} - -int resolve_function(types_t **head) -{ - types_t *next_type; - - if (!head) { - g_warning("Empty list detected"); - return RESOLV_LIST_EMPTY; - } - - for (next_type = *head; next_type; next_type = next_type->next) - { - /* Only resolve typedef */ - if (next_type->type != TYPE_FUNCTION) - continue; - - g_debug("Trying to resolve function id %d with type %d", - next_type->id, next_type->type_xml); - - if (search_id(*head, &next_type->child, next_type->type_xml) != RESOLV_OK) { - /* We have to remove this reference */ - } -// next_type->type_hr_display(next_type, 0); - } - - return 0; -} - -int resolve_file(types_t **head) -{ - types_t *next_type; - - if (!head) { - g_warning("Empty list detected"); - return RESOLV_LIST_EMPTY; - } - - for (next_type = *head; next_type; next_type = next_type->next) - { - /* Only resolve typedef */ - if (next_type->type == TYPE_FILE) - continue; - - /* No reference to a file */ - if (next_type->file == NULL) { - continue; - } - - g_debug("Trying to resolve file %s\n", next_type->file); - - if (search_file(*head, &next_type->file_ref, atoi(&next_type->file[1])) != RESOLV_OK) { - /* We have to remove this reference */ - } -// next_type->type_hr_display(next_type, 0); - } - - return 0; -} - diff --git a/common/utils/itti_analyzer/libresolver/resolvers.h b/common/utils/itti_analyzer/libresolver/resolvers.h deleted file mode 100644 index 17e16462b4..0000000000 --- a/common/utils/itti_analyzer/libresolver/resolvers.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 - */ - -#ifndef RESOLVERS_H_ -#define RESOLVERS_H_ - -int resolve_typedefs(types_t **head); - -int resolve_struct(types_t **head); - -int resolve_pointer_type(types_t **head); - -int resolve_field(types_t **head); - -int resolve_array(types_t **head); - -int resolve_reference(types_t **head); - -int resolve_union(types_t **head); - -int resolve_file(types_t **head); - -int resolve_function(types_t **head); - -int search_file(types_t *head, types_t **found, int id); - -#endif /* RESOLVERS_H_ */ diff --git a/common/utils/itti_analyzer/libui/Makefile.am b/common/utils/itti_analyzer/libui/Makefile.am deleted file mode 100644 index 4a0d88cb95..0000000000 --- a/common/utils/itti_analyzer/libui/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -AM_CFLAGS = \ - @ADD_CFLAGS@ \ - -I$(top_srcdir)/common \ - -I$(top_srcdir)/libbuffers \ - -I$(top_srcdir)/libparser \ - -I$(top_srcdir)/libresolver - -noinst_LTLIBRARIES = libui.la - -libui_la_LDFLAGS = -all-static -libui_la_SOURCES = \ - ui_main_screen.c ui_main_screen.h \ - ui_menu_bar.c ui_menu_bar.h \ - ui_callbacks.c ui_callbacks.h \ - ui_tree_view.c ui_tree_view.h \ - ui_signal_dissect_view.c ui_signal_dissect_view.h \ - ui_notifications.c ui_notifications.h \ - ui_notif_dlg.c ui_notif_dlg.h \ - ui_interface.c ui_interface.h \ - ui_notebook.c ui_notebook.h \ - ui_filters.c ui_filters.h \ No newline at end of file diff --git a/common/utils/itti_analyzer/libui/ui_callbacks.c b/common/utils/itti_analyzer/libui/ui_callbacks.c deleted file mode 100644 index 6fc480e333..0000000000 --- a/common/utils/itti_analyzer/libui/ui_callbacks.c +++ /dev/null @@ -1,983 +0,0 @@ -/* - * 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 - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include - -#define G_LOG_DOMAIN ("UI_CB") - -#include - -#include "logs.h" -#include "rc.h" - -#include "socket.h" - -#include "ui_notif_dlg.h" -#include "ui_main_screen.h" -#include "ui_menu_bar.h" -#include "ui_callbacks.h" -#include "ui_interface.h" -#include "ui_notifications.h" -#include "ui_tree_view.h" -#include "ui_signal_dissect_view.h" -#include "ui_filters.h" -#include "ui_notebook.h" - -#include "types.h" -#include "locate_root.h" -#include "xml_parse.h" - -static gboolean refresh_message_list = TRUE; -static gboolean filters_changed = FALSE; -static gboolean operation_running = FALSE; - -static const char *ui_ip; -static uint16_t ui_port; -static GtkWidget *dialogbox_connect; -static gboolean ui_auto_reconnect; - -gboolean ui_callback_on_open_messages(GtkWidget *widget, gpointer data) -{ - gboolean refresh = (data != NULL) ? TRUE : FALSE; - - g_message("Open messages event occurred %d", refresh); - - if (operation_running == FALSE) - { - operation_running = TRUE; - if (refresh && (ui_main_data.messages_file_name != NULL)) - { - ui_messages_read (ui_main_data.messages_file_name); - } - else - { - ui_messages_open_file_chooser (); - } - operation_running = FALSE; - } - - return TRUE; -} - -gboolean ui_callback_on_save_messages(GtkWidget *widget, gpointer data) -{ - gboolean filtered = (data != NULL) ? TRUE : FALSE; - - g_message("Save messages event occurred %d", filtered); - - if (operation_running == FALSE) - { - operation_running = TRUE; - ui_messages_save_file_chooser(filtered); - operation_running = FALSE; - } - - return TRUE; -} - -gboolean ui_callback_on_filters_enabled(GtkToolButton *button, gpointer data) -{ - gboolean enabled; - gboolean changed; - - enabled = gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON(button)); - - g_info("Filters enabled event occurred %d", enabled); - - changed = ui_filters_enable (enabled); - - if (changed) - { - /* Set the tool tip text */ - if (enabled) - { - gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM(button), "Disable messages filtering"); - } - else - { - gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM(button), "Enable messages filtering"); - } - ui_tree_view_refilter (); - } - - return TRUE; -} - -gboolean ui_callback_on_open_filters(GtkWidget *widget, gpointer data) -{ - gboolean refresh = (data != NULL) ? TRUE : FALSE; - - g_message("Open filters event occurred"); - - if (operation_running == FALSE) - { - operation_running = TRUE; - if (refresh && (ui_main_data.filters_file_name != NULL)) - { - ui_filters_read (ui_main_data.filters_file_name); - } - else - { - ui_filters_open_file_chooser (); - } - operation_running = FALSE; - } - - return TRUE; -} - -gboolean ui_callback_on_save_filters(GtkWidget *widget, gpointer data) -{ - if (operation_running == FALSE) - { - operation_running = TRUE; - g_message("Save filters event occurred"); - ui_filters_save_file_chooser(); - operation_running = FALSE; - } - - return TRUE; -} - -gboolean ui_callback_on_enable_filters(GtkWidget *widget, gpointer data) -{ - gboolean enabled; - - enabled = gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.filters_enabled)); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.filters_enabled), !enabled); - - return TRUE; -} - -gboolean ui_callback_on_about(GtkWidget *widget, gpointer data) -{ -#if defined(PACKAGE_STRING) - ui_notification_dialog (GTK_MESSAGE_INFO, FALSE, "about", "Eurecom %s", PACKAGE_STRING); -#else - ui_notification_dialog (GTK_MESSAGE_INFO, FALSE, "about", "Eurecom itti_analyzer"); -#endif - - return TRUE; -} - -gint ui_callback_check_string (const char *string, const gint lenght, const guint message_number) -{ - gint real_length; - - real_length = strnlen (string, lenght); - if (lenght != real_length) - { - if (message_number) - { - g_warning("Bad string format for message %u, '\\0' found before end of string (%d/%d)\n", message_number, real_length, lenght); - } - else - { - g_warning("Bad string format, '\\0' found before end of string (%d/%d)\n", real_length, lenght); - } - return (real_length); - } - else - { - return (lenght); - } -} - -gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, - gboolean path_currently_selected, gpointer user_data) -{ - static gpointer buffer_current; - ui_text_view_t *text_view; - GtkTreeIter iter; - - g_debug("Message selected %d %p %p %s", path_currently_selected, buffer_current, path, gtk_tree_path_to_string(path)); - - if (!path_currently_selected) - { - text_view = (ui_text_view_t *) user_data; - - g_assert(text_view != NULL); - - if (gtk_tree_model_get_iter (model, &iter, path)) - { - gpointer buffer; - - uint32_t message_number; - uint32_t message_id; - uint32_t origin_task_id; - uint32_t destination_task_id; - char *instance_name; - uint32_t instance; - char label[100]; - - gtk_tree_model_get (model, &iter, COL_MSG_NUM, &message_number, COL_MESSAGE_ID, &message_id, - COL_FROM_TASK_ID, &origin_task_id, COL_TO_TASK_ID, &destination_task_id, COL_INSTANCE, &instance_name, - COL_INSTANCE_ID, &instance, COL_BUFFER, &buffer, -1); - - g_debug(" Get iter %p %p", buffer_current, buffer); - - if (ui_tree_view_last_event) - { - g_debug("last_event %p %d %d", ui_tree_view_last_event, ui_tree_view_last_event->type, ui_tree_view_last_event->button); - - if (ui_tree_view_last_event->type == GDK_BUTTON_PRESS) - { - /* Callback is due to a button click */ - if (ui_tree_view_last_event->button == 1) - { - /* It was a left mouse click */ - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.signals_go_to_last_button), FALSE); - } - - if (ui_tree_view_last_event->button == 3) - { - /* It was a right mouse click */ - int item; - - /* Clear event */ - ui_tree_view_last_event = NULL; - - /* Create filter menus to refers its items in the pop-up menu */ - ui_create_filter_menus (); - - g_info("Message selected right click %d %d %d %d", message_id, origin_task_id, destination_task_id, instance); - - /* Message Id menu */ - { - /* Invalidate associated menu item to avoid issue with call back when updating the menu item check state */ - ui_tree_view_menu_enable[MENU_MESSAGE].filter_item = NULL; - item = ui_filters_search_id (&ui_filters.messages, message_id); - /* Update the menu item check state based on message ID state */ - gtk_check_menu_item_set_active ( - GTK_CHECK_MENU_ITEM(ui_tree_view_menu_enable[MENU_MESSAGE].menu_enable), - ui_filters.messages.items[item].enabled); - /* Set menu item label */ - sprintf (label, "Message: %s", message_id_to_string (message_id)); - gtk_menu_item_set_label (GTK_MENU_ITEM(ui_tree_view_menu_enable[MENU_MESSAGE].menu_enable), - label); - /* Save menu item associated to this row */ - ui_tree_view_menu_enable[MENU_MESSAGE].filter_item = &ui_filters.messages.items[item]; - } - - /* Origin task id */ - { - /* Invalidate associated menu item to avoid issue with call back when updating the menu item check state */ - ui_tree_view_menu_enable[MENU_FROM_TASK].filter_item = NULL; - item = ui_filters_search_id (&ui_filters.origin_tasks, origin_task_id); - /* Update the menu item check state based on message ID state */ - gtk_check_menu_item_set_active ( - GTK_CHECK_MENU_ITEM(ui_tree_view_menu_enable[MENU_FROM_TASK].menu_enable), - ui_filters.origin_tasks.items[item].enabled); - /* Set menu item label */ - sprintf (label, "From: %s", task_id_to_string (origin_task_id, origin_task_id_type)); - gtk_menu_item_set_label ( - GTK_MENU_ITEM(ui_tree_view_menu_enable[MENU_FROM_TASK].menu_enable), label); - /* Save menu item associated to this row */ - ui_tree_view_menu_enable[MENU_FROM_TASK].filter_item = &ui_filters.origin_tasks.items[item]; - } - - /* Destination task id */ - { - /* Invalidate associated menu item to avoid issue with call back when updating the menu item check state */ - ui_tree_view_menu_enable[MENU_TO_TASK].filter_item = NULL; - item = ui_filters_search_id (&ui_filters.destination_tasks, destination_task_id); - /* Update the menu item check state based on message ID state */ - gtk_check_menu_item_set_active ( - GTK_CHECK_MENU_ITEM(ui_tree_view_menu_enable[MENU_TO_TASK].menu_enable), - ui_filters.destination_tasks.items[item].enabled); - /* Set menu item label */ - sprintf (label, "To: %s", - task_id_to_string (destination_task_id, destination_task_id_type)); - gtk_menu_item_set_label (GTK_MENU_ITEM(ui_tree_view_menu_enable[MENU_TO_TASK].menu_enable), - label); - /* Save menu item associated to this row */ - ui_tree_view_menu_enable[MENU_TO_TASK].filter_item = - &ui_filters.destination_tasks.items[item]; - } - - /* Instance */ - { - /* Invalidate associated menu item to avoid issue with call back when updating the menu item check state */ - ui_tree_view_menu_enable[MENU_INSTANCE].filter_item = NULL; - item = ui_filters_search_id (&ui_filters.instances, instance); - /* Update the menu item check state based on message ID state */ - gtk_check_menu_item_set_active ( - GTK_CHECK_MENU_ITEM(ui_tree_view_menu_enable[MENU_INSTANCE].menu_enable), - ui_filters.instances.items[item].enabled); - /* Set menu item label */ - sprintf (label, "Instance: %s", instance_name); - gtk_menu_item_set_label (GTK_MENU_ITEM(ui_tree_view_menu_enable[MENU_INSTANCE].menu_enable), - label); - /* Save menu item associated to this row */ - ui_tree_view_menu_enable[MENU_INSTANCE].filter_item = &ui_filters.instances.items[item]; - } - - gtk_menu_popup (GTK_MENU (ui_tree_view_menu), NULL, NULL, NULL, NULL, 0, - gtk_get_current_event_time ()); - } - } - - /* Clear event */ - ui_tree_view_last_event = NULL; - } - - if (buffer_current != buffer) - { - buffer_current = buffer; - - /* Clear the view */ - CHECK_FCT_DO(ui_signal_dissect_clear_view(text_view), return FALSE); - - if (ui_main_data.display_message_header) - { - CHECK_FCT_DO(dissect_signal_header((buffer_t*)buffer, ui_signal_set_text, text_view), return FALSE); - } - - if ((strcmp (message_id_to_string (message_id), "ERROR_LOG") == 0) - || (strcmp (message_id_to_string (message_id), "WARNING_LOG") == 0) - || (strcmp (message_id_to_string (message_id), "NOTICE_LOG") == 0) - || (strcmp (message_id_to_string (message_id), "INFO_LOG") == 0) - || (strcmp (message_id_to_string (message_id), "DEBUG_LOG") == 0) - || (strcmp (message_id_to_string (message_id), "GENERIC_LOG") == 0)) - { - gchar *data; - gint data_size; - uint32_t message_header_type_size; - - if (ui_main_data.display_message_header) - { - ui_signal_set_text (text_view, "\n", 1); - } - - message_header_type_size = get_message_header_type_size (); - data = (gchar *) buffer_at_offset ((buffer_t*) buffer, message_header_type_size); - data_size = get_message_size ((buffer_t*) buffer); - data_size = ui_callback_check_string (data, data_size, message_number); - - g_info(" dump message %d: header type size: %u, data size: %u, buffer %p, follow last %d", - message_number, message_header_type_size, data_size, buffer, ui_main_data.follow_last); - - ui_signal_set_text (text_view, data, data_size); - } - else - { - g_info(" dissect message %d: id %d, buffer %p, follow last %d", message_number, message_id, buffer, ui_main_data.follow_last); - - /* Dissect the signal */ - CHECK_FCT_DO(dissect_signal((buffer_t*)buffer, ui_signal_set_text, text_view), return FALSE); - } - } - } - } - return TRUE; -} - -gboolean ui_callback_on_menu_enable(GtkWidget *widget, gpointer data) -{ - ui_tree_view_menu_enable_t *menu_enable = data; - - if (menu_enable->filter_item != NULL) - { - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_enable->filter_item->menu_item), - gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(menu_enable->menu_enable))); - menu_enable->filter_item = NULL; - } - - return TRUE; -} - -gboolean ui_callback_on_menu_color(GtkWidget *widget, gpointer data) -{ - ui_tree_view_menu_color_t *menu_color = data; - - GdkRGBA color; - GtkWidget *color_chooser; - gint response; - - color_chooser = gtk_color_chooser_dialog_new ("Select message background color", GTK_WINDOW(ui_main_data.window)); - gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER(color_chooser), FALSE); - response = gtk_dialog_run (GTK_DIALOG (color_chooser)); - - if (response == GTK_RESPONSE_OK) - { - int red, green, blue; - char *color_string; - - color_string = - menu_color->foreground ? - menu_color->menu_enable->filter_item->foreground : - menu_color->menu_enable->filter_item->background; - - gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER(color_chooser), &color); - - red = (int) (color.red * 255); - green = (int) (color.green * 255); - blue = (int) (color.blue * 255); - - snprintf (color_string, COLOR_SIZE, "#%02x%02x%02x", red, green, blue); - ui_tree_view_refilter (); - - g_info("Selected color for %s %f->%02x %f->%02x %f->%02x %s", - menu_color->menu_enable->filter_item->name, color.red, red, color.green, green, color.blue, blue, color_string); - } - gtk_widget_destroy (color_chooser); - - return TRUE; -} - -void ui_signal_add_to_list(gpointer data, gpointer user_data) -{ - gboolean goto_last = user_data ? TRUE : FALSE; - buffer_t *signal_buffer; - GtkTreePath *path; - GtkTreeViewColumn *focus_column; - uint32_t lte_frame; - uint32_t lte_slot; - uint32_t origin_task_id; - uint32_t destination_task_id; - uint32_t instance; - char lte_time[15]; - - g_assert(data != NULL); - g_assert(origin_task_id_type != NULL); - g_assert(destination_task_id_type != NULL); - - gtk_tree_view_get_cursor (GTK_TREE_VIEW(ui_main_data.messages_list), &path, &focus_column); - - signal_buffer = (buffer_t *) data; - - lte_frame = get_lte_frame (signal_buffer); - lte_slot = get_lte_slot (signal_buffer); - sprintf (lte_time, "%d.%02d", lte_frame, lte_slot); - - get_message_id (root, signal_buffer, &signal_buffer->message_id); - origin_task_id = get_task_id (signal_buffer, origin_task_id_type); - destination_task_id = get_task_id (signal_buffer, destination_task_id_type); - instance = get_instance (signal_buffer); - - ui_tree_view_new_signal_ind (signal_buffer->message_number, lte_time, signal_buffer->message_id, - message_id_to_string (signal_buffer->message_id), origin_task_id, - task_id_to_string (origin_task_id, origin_task_id_type), destination_task_id, - task_id_to_string (destination_task_id, destination_task_id_type), instance, data); - - if ((strcmp (message_id_to_string (signal_buffer->message_id), "ERROR_LOG") == 0) - || (strcmp (message_id_to_string (signal_buffer->message_id), "WARNING_LOG") == 0) - || (strcmp (message_id_to_string (signal_buffer->message_id), "NOTICE_LOG") == 0) - || (strcmp (message_id_to_string (signal_buffer->message_id), "INFO_LOG") == 0) - || (strcmp (message_id_to_string (signal_buffer->message_id), "DEBUG_LOG") == 0) - || (strcmp (message_id_to_string (signal_buffer->message_id), "GENERIC_LOG") == 0)) - { - gchar *string_terminal; - gint string_terminal_size; - uint32_t message_header_type_size; - - message_header_type_size = get_message_header_type_size (); - string_terminal = (gchar *) buffer_at_offset ((buffer_t*) signal_buffer, message_header_type_size); - string_terminal_size = get_message_size ((buffer_t*) signal_buffer); - string_terminal_size = ui_callback_check_string (string_terminal, string_terminal_size, signal_buffer->message_number); - ui_notebook_terminal_append_data(string_terminal, string_terminal_size); - } - - /* Increment number of messages */ - ui_main_data.nb_message_received++; - - if ((ui_main_data.follow_last) && (goto_last)) - { - /* Advance to the new last signal */ - ui_tree_view_select_row (ui_tree_view_get_filtered_number () - 1); - } -} - -static gboolean ui_handle_update_signal_list(gint fd, void *data, size_t data_length) -{ - pipe_new_signals_list_message_t *signal_list_message; - - /* Enable buttons to move in the list of signals */ - ui_set_sensitive_move_buttons (TRUE); - - signal_list_message = (pipe_new_signals_list_message_t *) data; - - g_assert(signal_list_message != NULL); - g_assert(signal_list_message->signal_list != NULL); - - g_list_foreach (signal_list_message->signal_list, ui_signal_add_to_list, (gpointer) TRUE); - - /* Free the list but not user data associated with each element */ - g_list_free (signal_list_message->signal_list); - /* Free the message */ - free (signal_list_message); - - ui_gtk_flush_events (); - - return TRUE; -} - -static gboolean ui_handle_socket_connection_failed(gint fd) -{ - gtk_dialog_response(GTK_DIALOG (dialogbox_connect), GTK_RESPONSE_REJECT); - - return TRUE; -} - -static gboolean ui_handle_socket_connection_lost(gint fd) -{ - if (operation_running) - { - operation_running = FALSE; - if (ui_auto_reconnect) - { - ui_callback_on_connect (NULL, (gpointer) FALSE); - } - else - { - ui_enable_connect_button(); - ui_set_sensitive_save_message_buttons (TRUE); - } - } - - return TRUE; -} - -static gboolean ui_handle_socket_xml_definition(gint fd, void *data, size_t data_length) -{ - pipe_xml_definition_message_t *xml_definition_message; - - xml_definition_message = (pipe_xml_definition_message_t *) data; - g_assert(xml_definition_message != NULL); - g_assert(data_length == sizeof(pipe_xml_definition_message_t)); - - xml_parse_buffer (xml_definition_message->xml_definition, xml_definition_message->xml_definition_length); - - return TRUE; -} - -gboolean ui_pipe_callback(gint source, gpointer user_data) -{ - void *input_data = NULL; - size_t input_data_length = 0; - pipe_input_header_t input_header; - - /* Read the header */ - if (read (source, &input_header, sizeof(input_header)) < 0) - { - g_warning("Failed to read from pipe %d: %s", source, g_strerror(errno)); - return FALSE; - } - - input_data_length = input_header.message_size - sizeof(input_header); - - /* Checking for non-header part */ - if (input_data_length > 0) - { - input_data = malloc (input_data_length); - - if (read (source, input_data, input_data_length) < 0) - { - g_warning("Failed to read from pipe %d: %s", source, g_strerror(errno)); - return FALSE; - } - } - - switch (input_header.message_type) - { - case UI_PIPE_CONNECTION_FAILED: - return ui_handle_socket_connection_failed (source); - - case UI_PIPE_CONNECTION_LOST: - return ui_handle_socket_connection_lost (source); - - case UI_PIPE_XML_DEFINITION: - gtk_dialog_response(GTK_DIALOG (dialogbox_connect), GTK_RESPONSE_OK); - return ui_handle_socket_xml_definition (source, input_data, input_data_length); - - case UI_PIPE_UPDATE_SIGNAL_LIST: - return ui_handle_update_signal_list (source, input_data, input_data_length); - - default: - g_warning("[gui] Unhandled message type %u", input_header.message_type); - g_assert_not_reached(); - } - return FALSE; -} - -gboolean ui_callback_on_auto_reconnect(GtkWidget *widget, gpointer data) -{ - gboolean enabled; - gboolean changed = TRUE; - - gboolean toggle = (data != NULL) ? TRUE : FALSE; - - enabled = gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.auto_reconnect)); - - if (toggle) - { - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.auto_reconnect), !enabled); - return TRUE; - } - - g_info("Auto reconnect event occurred %d %d ", toggle, enabled); - - ui_auto_reconnect = enabled; - - if (changed) - { - /* Set the tool tip text */ - if (enabled) - { - gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM(ui_main_data.auto_reconnect), "Disable automatic reconnection"); - } - else - { - gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM(ui_main_data.auto_reconnect), "Enable automatic reconnection"); - } - } - - return TRUE; -} - -void ui_callback_dialogbox_connect_destroy(void) -{ - if (dialogbox_connect != NULL) - { - gtk_widget_destroy (dialogbox_connect); - dialogbox_connect = NULL; - g_message("Connect dialogbox destroyed"); - } -} - -gboolean ui_callback_on_connect(GtkWidget *widget, gpointer data) -{ - /* We have to retrieve the ip address and ui_port of remote host */ - gboolean start = (data != NULL) ? TRUE : FALSE; - int pipe_fd[2]; - - if (start) - { - ui_port = atoi (gtk_entry_get_text (GTK_ENTRY(ui_main_data.port_entry))); - ui_ip = gtk_entry_get_text (GTK_ENTRY(ui_main_data.ip_entry)); - } - - g_message("Connect event occurred to %s:%d %s", ui_ip, ui_port, start ? "START" : "RETRY"); - - if (start) - { - if (strlen (ui_ip) == 0) - { - ui_notification_dialog (GTK_MESSAGE_ERROR, FALSE, "Connect", "Empty host ip address"); - return FALSE; - } - - if (ui_port == 0) - { - ui_notification_dialog (GTK_MESSAGE_ERROR, FALSE, "Connect", "Invalid host ui_port value"); - return FALSE; - } - } - - if (operation_running == FALSE) - { - operation_running = TRUE; - - ui_pipe_new (pipe_fd, ui_pipe_callback, NULL); - - memcpy (ui_main_data.pipe_fd, pipe_fd, sizeof(int) * 2); - - /* Disable the connect button */ - ui_disable_connect_button (); - - ui_set_title ("connecting to %s:%d ...", ui_ip, ui_port); - { - const static char *message_formats[] = - { - "Connecting to %s:%d ...", - "Connection lost!\n\n" "Trying to reconnect to %s:%d ..." - }; - gint response; - gint x, y; - gint w, h; - - if (socket_connect_to_remote_host (ui_ip, ui_port, pipe_fd[1]) != 0) - { - ui_enable_connect_button (); - operation_running = FALSE; - return FALSE; - } - - /* Create dialog box for connect message: - * - non modal mode does not seems to work, don't set the parent window to allow some interactions with it! - */ - dialogbox_connect = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_OTHER, - GTK_BUTTONS_CANCEL, message_formats[start ? 0 : 1], ui_ip, ui_port); - gtk_window_set_title (GTK_WINDOW(dialogbox_connect), "Connect"); - - /* Set the window at center of main window manually as there is no parent defined */ - gtk_window_get_position (GTK_WINDOW(ui_main_data.window), &x, &y); - gtk_window_get_size (GTK_WINDOW(ui_main_data.window), &w, &h); - g_message("Main window position: %d,%d dimension: %d,%d", x, y, w, h); - x += w / 2; - y += h / 2; - g_message("Connect window position %d,%d", x, y); - gtk_window_set_gravity (GTK_WINDOW(dialogbox_connect), GDK_GRAVITY_CENTER); - gtk_window_move (GTK_WINDOW(dialogbox_connect), x, y); - - response = gtk_dialog_run (GTK_DIALOG (dialogbox_connect)); - g_message("Connect dialog response %s (%d)", gtk_get_respose_string(response), response); - - if (response == GTK_RESPONSE_NONE) - { - /* Dialogbox has been destroyed when program is exited, do nothing */ - return (TRUE); - } - if (response == GTK_RESPONSE_OK) - { - /* Connection is established */ - ui_set_sensitive_save_message_buttons (FALSE); - ui_callback_signal_clear_list (NULL, NULL); - ui_set_title ("%s:%d", ui_ip, ui_port); - } - else - { - /* Connection can not be established */ - if (response == GTK_RESPONSE_REJECT) - { - /* Connection retry time-out */ - ui_notification_dialog (GTK_MESSAGE_WARNING, FALSE, "Connect", "Failed to connect to provided host/ip address"); - } - - /* Re-enable connect button */ - ui_enable_connect_button(); - operation_running = FALSE; - } - ui_callback_dialogbox_connect_destroy (); - } - } - - return TRUE; -} - -gboolean ui_callback_on_disconnect(GtkWidget *widget, gpointer data) -{ - g_message("Disconnect event occurred"); - - ui_pipe_write_message (ui_main_data.pipe_fd[0], UI_PIPE_DISCONNECT_EVT, NULL, 0); - - if (dialogbox_connect != NULL) - { - gtk_dialog_response(GTK_DIALOG (dialogbox_connect), GTK_RESPONSE_CLOSE); - } - else - { - ui_enable_connect_button (); - operation_running = FALSE; - } - - return TRUE; -} - -gboolean ui_callback_signal_go_to_first(GtkWidget *widget, gpointer data) -{ - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.signals_go_to_last_button), FALSE); - ui_tree_view_select_row (0); - - return TRUE; -} - -gboolean ui_callback_signal_go_to(GtkWidget *widget, gpointer data) -{ - gtk_window_set_focus (GTK_WINDOW(ui_main_data.window), ui_main_data.signals_go_to_entry); - return TRUE; -} - -gboolean ui_callback_signal_go_to_entry(GtkWidget *widget, gpointer data) -{ - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.signals_go_to_last_button), FALSE); - // gtk_entry_buffer_set_text(GTK_ENTRY(ui_main_data.signals_go_to_entry), ""); - gtk_window_set_focus (GTK_WINDOW(ui_main_data.window), ui_main_data.messages_list); - return TRUE; -} - -gboolean ui_callback_signal_go_to_last(GtkWidget *widget, gpointer data) -{ - gboolean enable = (data != NULL) ? TRUE : FALSE; - gboolean enabled; - - if (enable) - { - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.signals_go_to_last_button), TRUE); - return TRUE; - } - - enabled = gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.signals_go_to_last_button)); - - g_info("Button signal go to last event occurred %d %d", enable, enabled); - - if (enabled) - { - ui_main_data.follow_last = TRUE; - ui_tree_view_select_row (ui_tree_view_get_filtered_number () - 1); - } - else - { - ui_main_data.follow_last = FALSE; - } - - return TRUE; -} - -gboolean ui_callback_display_message_header(GtkWidget *widget, gpointer data) -{ - ui_main_data.display_message_header = !ui_main_data.display_message_header; - // TODO refresh textview. - return TRUE; -} - -gboolean ui_callback_display_brace(GtkWidget *widget, gpointer data) -{ - ui_main_data.display_brace = !ui_main_data.display_brace; - // TODO refresh textview. - return TRUE; -} - -gboolean ui_callback_signal_clear_list(GtkWidget *widget, gpointer data) -{ - /* Disable buttons to move in the list of signals */ - ui_set_sensitive_move_buttons (FALSE); - ui_set_title (""); - - /* Clear list of signals */ - ui_tree_view_destroy_list (ui_main_data.messages_list); - - if (ui_main_data.text_view != NULL) - { - ui_signal_dissect_clear_view (ui_main_data.text_view); - } - - ui_notebook_terminal_clear(); - - return TRUE; -} - -static void ui_callback_on_menu_items_selected(GtkWidget *widget, gpointer data) -{ - gboolean active = data != NULL; - - if (GTK_IS_CHECK_MENU_ITEM(widget)) - { - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(widget), active); - } -} - -gboolean ui_callback_on_menu_none(GtkWidget *widget, gpointer data) -{ - GtkWidget *menu = (GtkWidget *) data; - - g_info("ui_callback_on_menu_none occurred %lx %lx)", (long) widget, (long) data); - - refresh_message_list = FALSE; - gtk_container_foreach (GTK_CONTAINER(menu), ui_callback_on_menu_items_selected, (gpointer) FALSE); - refresh_message_list = TRUE; - - if (filters_changed) - { - ui_tree_view_refilter (); - filters_changed = FALSE; - } - - return TRUE; -} - -gboolean ui_callback_on_menu_all(GtkWidget *widget, gpointer data) -{ - GtkWidget *menu = (GtkWidget *) data; - - g_info("ui_callback_on_menu_all occurred %lx %lx)", (long) widget, (long) data); - - refresh_message_list = FALSE; - gtk_container_foreach (GTK_CONTAINER(menu), ui_callback_on_menu_items_selected, (gpointer) TRUE); - refresh_message_list = TRUE; - - if (filters_changed) - { - ui_tree_view_refilter (); - filters_changed = FALSE; - } - - return TRUE; -} - -gboolean ui_callback_on_menu_item_selected(GtkWidget *widget, gpointer data) -{ - ui_filter_item_t *filter_entry = data; - gboolean enabled; - - enabled = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM(widget)); - if (filter_entry->enabled != enabled) - { - filter_entry->enabled = enabled; - if (refresh_message_list) - { - ui_tree_view_refilter (); - } - else - { - filters_changed = TRUE; - } - } - g_info("ui_callback_on_menu_item_selected occurred %p %p %s %d (%d messages to display)", widget, data, filter_entry->name, enabled, ui_tree_view_get_filtered_number()); - - return TRUE; -} - -gboolean ui_callback_on_tree_column_header_click(GtkWidget *widget, gpointer data) -{ - col_type_t col = (col_type_t) data; - - g_info("ui_callback_on_tree_column_header_click %d", col); - switch (col) - { - case COL_MESSAGE: - ui_show_filter_menu (&ui_main_data.menu_filter_messages, &ui_filters.messages); - break; - - case COL_FROM_TASK: - ui_show_filter_menu (&ui_main_data.menu_filter_origin_tasks, &ui_filters.origin_tasks); - break; - - case COL_TO_TASK: - ui_show_filter_menu (&ui_main_data.menu_filter_destination_tasks, &ui_filters.destination_tasks); - break; - - case COL_INSTANCE: - ui_show_filter_menu (&ui_main_data.menu_filter_instances, &ui_filters.instances); - break; - - default: - g_warning("Unknown column filter %d in call to ui_callback_on_tree_column_header_click", col); - return FALSE; - } - - return TRUE; -} diff --git a/common/utils/itti_analyzer/libui/ui_callbacks.h b/common/utils/itti_analyzer/libui/ui_callbacks.h deleted file mode 100644 index b3d4b31c60..0000000000 --- a/common/utils/itti_analyzer/libui/ui_callbacks.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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 - */ - -#ifndef UI_CALLBACKS_H_ -#define UI_CALLBACKS_H_ - -#include - -gboolean ui_callback_on_open_messages(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_on_save_messages(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_on_filters_enabled(GtkToolButton *button, - gpointer data); - -gboolean ui_callback_on_open_filters(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_on_save_filters(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_on_enable_filters(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_on_about(GtkWidget *widget, - gpointer data); - -gint ui_callback_check_string (const char *string, - const gint lenght, - const guint message_number); - -gboolean ui_pipe_callback(gint source, gpointer user_data); - -gboolean ui_callback_on_auto_reconnect(GtkWidget *widget, - gpointer data); - -void ui_callback_dialogbox_connect_destroy(void); - -gboolean ui_callback_on_connect(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_on_disconnect(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_on_tree_view_select(GtkWidget *widget, - GdkEvent *event, - gpointer data); - -gboolean ui_callback_on_select_signal(GtkTreeSelection *selection, - GtkTreeModel *model, - GtkTreePath *path, - gboolean path_currently_selected, - gpointer userdata); - -void ui_signal_add_to_list(gpointer data, - gpointer user_data); - -gboolean ui_callback_on_menu_enable (GtkWidget *widget, gpointer data); - -gboolean ui_callback_on_menu_color (GtkWidget *widget, gpointer data); - -gboolean ui_callback_signal_go_to_first(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_signal_go_to(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_signal_go_to_entry(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_signal_go_to_last(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_display_message_header(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_display_brace(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_signal_clear_list(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_on_menu_none(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_on_menu_all(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_on_menu_item_selected(GtkWidget *widget, - gpointer data); - -gboolean ui_callback_on_tree_column_header_click(GtkWidget *widget, - gpointer data); -#endif /* UI_CALLBACKS_H_ */ diff --git a/common/utils/itti_analyzer/libui/ui_filters.c b/common/utils/itti_analyzer/libui/ui_filters.c deleted file mode 100644 index 8a6321a538..0000000000 --- a/common/utils/itti_analyzer/libui/ui_filters.c +++ /dev/null @@ -1,609 +0,0 @@ -/* - * 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 - */ - -#include -#include - -#define G_LOG_DOMAIN ("UI_FILTER") - -#include - -#include -#include - -#include "ui_callbacks.h" -#include "ui_main_screen.h" -#include "ui_filters.h" -#include "ui_tree_view.h" -#include "ui_notif_dlg.h" -#include "rc.h" - -const uint32_t FILTER_ALLOC_NUMBER = 100; -const uint32_t FILTER_ID_UNDEFINED = ~0; - -const char * const COLOR_WHITE = "#ffffff"; -const char * const COLOR_DARK_GREY = "#585858"; - -#define ENABLED_NAME "enabled" -#define FOREGROUND_NAME "foreground_color" -#define BACKGROUND_NAME "background_color" - -ui_filters_t ui_filters; - -static int ui_init_filter(ui_filter_t *filter, int reset, int clear_ids, char *name) -{ - if (filter->items == NULL) - { - filter->name = name; - - /* Allocate some filter entries */ - filter->items = malloc (FILTER_ALLOC_NUMBER * sizeof(ui_filter_item_t)); - filter->allocated = FILTER_ALLOC_NUMBER; - } - if (reset) - { - /* Reset number of used filter entries */ - filter->used = 0; - } - else - { - if (clear_ids) - { - /* Clear entries IDs */ - int item; - - for (item = 0; item < filter->used; item++) - { - filter->items[item].id = FILTER_ID_UNDEFINED; - } - } - } - - return (RC_OK); -} - -int ui_init_filters(int reset, int clear_ids) -{ - ui_init_filter (&ui_filters.messages, reset, clear_ids, "messages"); - ui_init_filter (&ui_filters.origin_tasks, reset, clear_ids, "origin_tasks"); - ui_init_filter (&ui_filters.destination_tasks, reset, clear_ids, "destination_tasks"); - ui_init_filter (&ui_filters.instances, reset, clear_ids, "instances"); - - ui_destroy_filter_menus (); - - return (RC_OK); -} - -gboolean ui_filters_enable(gboolean enabled) -{ - gboolean changed = ui_filters.filters_enabled != enabled; - - if (changed) - { - ui_filters.filters_enabled = enabled; - } - - return changed; -} - -static int ui_filters_search_name(ui_filter_t *filter, const char *name) -{ - int item; - - for (item = 0; item < filter->used; item++) - { - if (strncmp (name, filter->items[item].name, SIGNAL_NAME_LENGTH) == 0) - { - return (item); - } - } - - return (item); -} - -int ui_filters_search_id(ui_filter_t *filter, uint32_t value) -{ - int item; - - for (item = 0; item < filter->used; item++) - { - if (filter->items[item].id == value) - { - return (item); - } - } - - return (-1); -} - -static void ui_filter_set_enabled(uint8_t *enabled, ui_entry_enabled_e entry_enabled, gboolean new) -{ - if (entry_enabled == ENTRY_ENABLED_UNDEFINED) - { - if (new) - { - *enabled = TRUE; - } - } - else - { - if (entry_enabled == ENTRY_ENABLED_FALSE) - { - *enabled = FALSE; - } - else - { - *enabled = TRUE; - } - } -} - -static int ui_filter_add(ui_filter_t *filter, uint32_t value, const char *name, ui_entry_enabled_e entry_enabled, - const char *foreground, const char *background) -{ - int item = ui_filters_search_name (filter, name); - - if (item >= filter->allocated) - { - /* Increase number of filter entries */ - filter->items = realloc (filter->items, (filter->allocated + FILTER_ALLOC_NUMBER) * sizeof(ui_filter_item_t)); - filter->allocated += FILTER_ALLOC_NUMBER; - } - - if (value != FILTER_ID_UNDEFINED) - { - filter->items[item].id = value; - } - if (item >= filter->used) - { - /* New entry */ - strncpy (filter->items[item].name, name, SIGNAL_NAME_LENGTH); - ui_filter_set_enabled (&filter->items[item].enabled, entry_enabled, TRUE); - strncpy (filter->items[item].foreground, foreground != NULL ? foreground : COLOR_DARK_GREY, COLOR_SIZE); - strncpy (filter->items[item].background, background != NULL ? background : COLOR_WHITE, COLOR_SIZE); - - filter->used++; - } - else - { - ui_filter_set_enabled (&filter->items[item].enabled, entry_enabled, FALSE); - if (foreground != NULL) - { - strncpy (filter->items[item].foreground, foreground, COLOR_SIZE); - } - if (background != NULL) - { - strncpy (filter->items[item].background, background, COLOR_SIZE); - } - } - - g_debug("filter \"%s\" add %d \"%s\" %d", filter->name, value, name, entry_enabled); - - return (item); -} - -void ui_filters_add(ui_filter_e filter, uint32_t value, const char *name, ui_entry_enabled_e entry_enabled, - const char *foreground, const char *background) -{ - switch (filter) - { - case FILTER_MESSAGES: - ui_filter_add (&ui_filters.messages, value, name, entry_enabled, foreground, background); - break; - - case FILTER_ORIGIN_TASKS: - ui_filter_add (&ui_filters.origin_tasks, value, name, entry_enabled, foreground, background); - break; - - case FILTER_DESTINATION_TASKS: - ui_filter_add (&ui_filters.destination_tasks, value, name, entry_enabled, foreground, background); - break; - - case FILTER_INSTANCES: - ui_filter_add (&ui_filters.instances, value, name, entry_enabled, foreground, background); - break; - - default: - g_warning("unknown filter type %d", filter); - break; - } -} - -static gboolean ui_item_enabled(ui_filter_t *filter, const uint32_t value) -{ - int item; - - if (value != (uint32_t) ~0) - { - item = ui_filters_search_id (filter, value); - - if (item >= 0) - { - return (filter->items[item].enabled ? TRUE : FALSE); - } - } - return (FALSE); -} - -gboolean ui_filters_message_enabled(const uint32_t message, const uint32_t origin_task, const uint32_t destination_task, - const uint32_t instance) -{ - gboolean result; - - result = (ui_item_enabled (&ui_filters.messages, message) && ui_item_enabled (&ui_filters.origin_tasks, origin_task) - && ui_item_enabled (&ui_filters.destination_tasks, destination_task) - && ui_item_enabled (&ui_filters.instances, instance)); - - return result; -} - -static ui_filter_e ui_filter_from_name(const char *name) -{ - if (strcmp (name, ui_filters.messages.name) == 0) - { - return FILTER_MESSAGES; - } - if (strcmp (name, ui_filters.origin_tasks.name) == 0) - { - return FILTER_ORIGIN_TASKS; - } - if (strcmp (name, ui_filters.destination_tasks.name) == 0) - { - return FILTER_DESTINATION_TASKS; - } - if (strcmp (name, ui_filters.instances.name) == 0) - { - return FILTER_INSTANCES; - } - return FILTER_UNKNOWN; -} - -static int xml_parse_filters(xmlDocPtr doc, const char *file_name) -{ - xmlNode *root_element = NULL; - xmlNode *filter_node = NULL; - xmlNode *cur_node = NULL; - ui_filter_e filter; - guint filters_entries = 0; - int ret = RC_FAIL; - - /* Get the root element node */ - root_element = xmlDocGetRootElement (doc); - - if (root_element != NULL) - { - /* Search for the start of filters definition */ - for (cur_node = root_element; (cur_node != NULL) && (strcmp ((char *) cur_node->name, "filters") != 0); - cur_node = cur_node->next) - ; - - if (cur_node != NULL) - { - /* Search for filter header */ - for (filter_node = cur_node->children; filter_node != NULL;) - { - /* Search for next element node */ - for (; (filter_node != NULL) && (filter_node->type != XML_ELEMENT_NODE); filter_node = - filter_node->next) - ; - - if (filter_node != NULL) - { - filter = ui_filter_from_name ((const char*) filter_node->name); - g_debug("Found filter %s %d", filter_node->name, filter); - - if (filter == FILTER_UNKNOWN) - { - g_warning("Unknown filter \"%s\"", filter_node->name); - } - else - { - /* Search for entries */ - for (cur_node = filter_node->children; cur_node != NULL;) - { - /* Search for next element node */ - for (; (cur_node != NULL) && (cur_node->type != XML_ELEMENT_NODE); cur_node = - cur_node->next) - ; - - if (cur_node != NULL) - { - xmlAttr *prop_node; - ui_entry_enabled_e enabled = ENTRY_ENABLED_UNDEFINED; - char *foreground = NULL; - char *background = NULL; - - for (prop_node = cur_node->properties; prop_node != NULL; prop_node = prop_node->next) - { - if (strcmp ((char *) prop_node->name, ENABLED_NAME) == 0) - { - enabled = - prop_node->children->content[0] == '0' ? - ENTRY_ENABLED_FALSE : ENTRY_ENABLED_TRUE; - } - if (strcmp ((char *) prop_node->name, FOREGROUND_NAME) == 0) - { - foreground = (char *) prop_node->children->content; - } - if (strcmp ((char *) prop_node->name, BACKGROUND_NAME) == 0) - { - background = (char *) prop_node->children->content; - } - } - - g_debug(" Found entry %s %s", cur_node->name, cur_node->properties->children->content); - ui_filters_add (filter, FILTER_ID_UNDEFINED, (const char*) cur_node->name, enabled, - foreground, background); - - filters_entries++; - cur_node = cur_node->next; - } - } - } - filter_node = filter_node->next; - } - } - - /* Filters have changed destroy filter menus and update tree view */ - ui_destroy_filter_menus (); - - /* Reactivate filtering */ - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.filters_enabled), TRUE); - ui_tree_view_refilter (); - } - } - /* Free the document */ - xmlFreeDoc (doc); - - if (filters_entries > 0) - { - ret = RC_OK; - } - - g_message("Parsed XML filters file \"%s\", found %d entries (%d messages to display)", file_name, filters_entries, ui_tree_view_get_filtered_number()); - - return ret; -} - -int ui_filters_read(const char *file_name) -{ - xmlDocPtr doc; /* the resulting document tree */ - int ret; - - if (file_name == NULL) - { - g_warning("No name for filters file"); - return RC_FAIL; - } - - doc = xmlReadFile (file_name, NULL, 0); - if (doc == NULL) - { - ui_notification_dialog (GTK_MESSAGE_ERROR, FALSE, "open filters", "Failed to parse file \"%s\"", file_name); - return RC_FAIL; - } - - ret = xml_parse_filters (doc, file_name); - if (ret != RC_OK) - { - ui_notification_dialog (GTK_MESSAGE_WARNING, FALSE, "open filters", "Found no filter definitions in \"%s\"", - file_name); - return RC_FAIL; - } - - return ret; -} - -static void write_filter(FILE *filter_file, ui_filter_t *filter, gboolean save_colors) -{ - int item; - - fprintf (filter_file, " <%s>\n", filter->name); - for (item = 0; item < filter->used; item++) - { - if (save_colors) - { - fprintf (filter_file, - " <%s " ENABLED_NAME "=\"%d\" " FOREGROUND_NAME "=\"%s\" " BACKGROUND_NAME "=\"%s\"/>\n", - filter->items[item].name, filter->items[item].enabled ? 1 : 0, filter->items[item].foreground, - filter->items[item].background); - } - else - { - fprintf (filter_file, " <%s " ENABLED_NAME "=\"%d\"/>\n", filter->items[item].name, - filter->items[item].enabled ? 1 : 0); - } - } - fprintf (filter_file, " \n", filter->name); -} - -int ui_filters_file_write(const char *file_name) -{ - FILE *filter_file; - - if (file_name == NULL) - { - g_warning("No name for filters file"); - return RC_FAIL; - } - - filter_file = fopen (file_name, "w"); - if (filter_file == NULL) - { - ui_notification_dialog (GTK_MESSAGE_ERROR, FALSE, "Failed to open file \"%s\": %s", file_name, g_strerror (errno)); - return RC_FAIL; - } - - fprintf (filter_file, "\n" - "\n"); - - write_filter (filter_file, &ui_filters.messages, TRUE); - write_filter (filter_file, &ui_filters.origin_tasks, FALSE); - write_filter (filter_file, &ui_filters.destination_tasks, FALSE); - - fprintf (filter_file, "\n"); - - fclose (filter_file); - return RC_OK; -} - -static void ui_create_filter_menu(GtkWidget **menu, ui_filter_t *filter) -{ - if (*menu == NULL) - { - GtkWidget *menu_items; - int item; - gpointer data; - - *menu = gtk_menu_new (); - - /* Create the "NONE" menu-item */ - { - /* Create a new menu-item with a name */ - menu_items = gtk_menu_item_new_with_label ("NONE"); - - /* Add it to the menu. */ - gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items); - - g_debug("ui_create_filter_menu %lx", (long) menu_items); - g_signal_connect(G_OBJECT(menu_items), "activate", G_CALLBACK(ui_callback_on_menu_none), *menu); - - /* Show the widget */ - gtk_widget_show (menu_items); - } - - /* Create the "ALL" menu-item */ - { - /* Create a new menu-item with a name */ - menu_items = gtk_menu_item_new_with_label ("ALL"); - - /* Add it to the menu. */ - gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items); - - g_debug("ui_create_filter_menu %lx", (long) menu_items); - g_signal_connect(G_OBJECT(menu_items), "activate", G_CALLBACK(ui_callback_on_menu_all), *menu); - - /* Show the widget */ - gtk_widget_show (menu_items); - } - - /* Create separator */ - { - menu_items = gtk_menu_item_new (); - - /* Add it to the menu. */ - gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items); - - /* Show the widget */ - gtk_widget_show (menu_items); - } - - /* Creates menu-items */ - for (item = 0; item < filter->used; item++) - { - /* Create a new menu-item with a name */ - menu_items = gtk_check_menu_item_new_with_label (filter->items[item].name); - - /* Add it to the menu. */ - gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items); - - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_items), filter->items[item].enabled); - - /* Connect function to be called when the menu item is selected */ - data = &filter->items[item]; - g_debug("ui_create_filter_menu %lx %lx", (long) menu_items, (long) data); - g_signal_connect(G_OBJECT(menu_items), "activate", G_CALLBACK(ui_callback_on_menu_item_selected), data); - /* Save the menu_item reference */ - filter->items[item].menu_item = menu_items; - - /* Show the widget */ - gtk_widget_show (menu_items); - } - } -} - -void ui_create_filter_menus(void) -{ - ui_create_filter_menu (&ui_main_data.menu_filter_messages, &ui_filters.messages); - ui_create_filter_menu (&ui_main_data.menu_filter_origin_tasks, &ui_filters.origin_tasks); - ui_create_filter_menu (&ui_main_data.menu_filter_destination_tasks, &ui_filters.destination_tasks); - ui_create_filter_menu (&ui_main_data.menu_filter_instances, &ui_filters.instances); -} - -static void ui_destroy_filter_menu_item(GtkWidget *widget, gpointer data) -{ - if (GTK_IS_MENU_ITEM(widget)) - { - gtk_widget_destroy (widget); - } -} - -static void ui_destroy_filter_menu_widget(GtkWidget **menu) -{ - if (*menu != NULL) - { - gtk_container_foreach (GTK_CONTAINER(*menu), ui_destroy_filter_menu_item, NULL); - - gtk_widget_destroy (*menu); - *menu = NULL; - } -} - -void ui_destroy_filter_menus(void) -{ - ui_destroy_filter_menu_widget (&ui_main_data.menu_filter_messages); - ui_destroy_filter_menu_widget (&ui_main_data.menu_filter_origin_tasks); - ui_destroy_filter_menu_widget (&ui_main_data.menu_filter_destination_tasks); - ui_destroy_filter_menu_widget (&ui_main_data.menu_filter_instances); -} - -void ui_destroy_filter_menu(ui_filter_e filter) -{ - switch (filter) - { - case FILTER_MESSAGES: - ui_destroy_filter_menu_widget (&ui_main_data.menu_filter_messages); - break; - - case FILTER_ORIGIN_TASKS: - ui_destroy_filter_menu_widget (&ui_main_data.menu_filter_origin_tasks); - break; - - case FILTER_DESTINATION_TASKS: - ui_destroy_filter_menu_widget (&ui_main_data.menu_filter_destination_tasks); - break; - - case FILTER_INSTANCES: - ui_destroy_filter_menu_widget (&ui_main_data.menu_filter_instances); - break; - - default: - g_warning("unknown filter type %d", filter); - break; - } -} - -void ui_show_filter_menu(GtkWidget **menu, ui_filter_t *filter) -{ - ui_create_filter_menu (menu, filter); - - gtk_menu_popup (GTK_MENU (*menu), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time ()); -} diff --git a/common/utils/itti_analyzer/libui/ui_filters.h b/common/utils/itti_analyzer/libui/ui_filters.h deleted file mode 100644 index 16bb38834b..0000000000 --- a/common/utils/itti_analyzer/libui/ui_filters.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 - */ - -#ifndef UI_FILTERS_H_ -#define UI_FILTERS_H_ - -#include - -#include "itti_types.h" - -#define SIGNAL_NAME_LENGTH 100 -#define COLOR_SIZE 10 - -typedef enum -{ - FILTER_UNKNOWN, FILTER_MESSAGES, FILTER_ORIGIN_TASKS, FILTER_DESTINATION_TASKS, FILTER_INSTANCES, -} ui_filter_e; - -typedef enum -{ - ENTRY_ENABLED_FALSE, ENTRY_ENABLED_TRUE, ENTRY_ENABLED_UNDEFINED, -} ui_entry_enabled_e; - -typedef struct -{ - uint32_t id; - char name[SIGNAL_NAME_LENGTH]; - uint8_t enabled; - char foreground[COLOR_SIZE]; - char background[COLOR_SIZE]; - GtkWidget *menu_item; -} ui_filter_item_t; - -typedef struct -{ - char *name; - uint32_t allocated; - uint32_t used; - ui_filter_item_t *items; -} ui_filter_t; - -typedef struct -{ - gboolean filters_enabled; - ui_filter_t messages; - ui_filter_t origin_tasks; - ui_filter_t destination_tasks; - ui_filter_t instances; -} ui_filters_t; - -extern ui_filters_t ui_filters; - -int ui_init_filters(int reset, int clear_ids); - -gboolean ui_filters_enable(gboolean enabled); - -int ui_filters_search_id(ui_filter_t *filter, uint32_t value); - -void ui_filters_add(ui_filter_e filter, uint32_t value, const char *name, ui_entry_enabled_e entry_enabled, - const char *foreground, const char *background); - -gboolean ui_filters_message_enabled(const uint32_t message, const uint32_t origin_task, const uint32_t destination_task, - const uint32_t instance); - -int ui_filters_read(const char *file_name); - -int ui_filters_file_write(const char *file_name); - -void ui_create_filter_menus(void); - -void ui_destroy_filter_menus(void); - -void ui_destroy_filter_menu(ui_filter_e filter); - -void ui_show_filter_menu(GtkWidget **menu, ui_filter_t *filter); - -#endif /* UI_FILTERS_H_ */ diff --git a/common/utils/itti_analyzer/libui/ui_interface.c b/common/utils/itti_analyzer/libui/ui_interface.c deleted file mode 100644 index 56139a8c6b..0000000000 --- a/common/utils/itti_analyzer/libui/ui_interface.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include - -#define G_LOG_DOMAIN ("UI_INTER") - -#include - -#include "ui_interface.h" - -#include "ui_tree_view.h" -#include "ui_notifications.h" -#include "ui_signal_dissect_view.h" - -#include "socket.h" -#include "xml_parse.h" - -static -gboolean ui_callback_on_pipe_notification( - GIOChannel *source, GIOCondition condition, gpointer user_data) -{ - pipe_input_t *pipe_input = (pipe_input_t *)user_data; - - /* avoid reentrancy problems and stack overflow */ - g_source_remove(pipe_input->pipe_input_id); - - g_debug("Received new data on pipe %d", pipe_input->pipe_input_id); - - if (pipe_input->input_cb(pipe_input->source_fd, pipe_input->user_data)) { - /* restore pipe handler */ - pipe_input->pipe_input_id = g_io_add_watch_full(pipe_input->pipe_channel, - G_PRIORITY_HIGH, - (GIOCondition)(G_IO_IN|G_IO_ERR|G_IO_HUP), - ui_callback_on_pipe_notification, - pipe_input, - NULL); - } - return TRUE; -} - -int ui_pipe_new(int pipe_fd[2], pipe_input_cb_t input_cb, gpointer user_data) -{ - static pipe_input_t pipe_input; - - g_assert(pipe_fd != NULL); - - /* Create a pipe between GUI and a thread or a process */ - if (socketpair(AF_UNIX, SOCK_DGRAM, 0, pipe_fd) < 0) { - g_warning("Failed to create socketpair %s", g_strerror(errno)); - return RC_FAIL; - } - - /* Source taken from wireshark SVN repository */ - - pipe_input.source_fd = pipe_fd[0]; - pipe_input.input_cb = input_cb; - pipe_input.user_data = user_data; - - pipe_input.pipe_channel = g_io_channel_unix_new(pipe_fd[0]); - g_io_channel_set_encoding(pipe_input.pipe_channel, NULL, NULL); - pipe_input.pipe_input_id = g_io_add_watch_full(pipe_input.pipe_channel, - G_PRIORITY_HIGH, - G_IO_IN | G_IO_ERR | G_IO_HUP, - ui_callback_on_pipe_notification, - &pipe_input, - NULL); - - return RC_OK; -} - -int ui_pipe_write_message(int pipe_fd, const uint16_t message_type, - const void * const message, const uint16_t message_size) -{ - int ret; - pipe_input_header_t pipe_input_header; - - pipe_input_header.message_size = message_size + sizeof(pipe_input_header); - pipe_input_header.message_type = message_type; - - if (message_size > 0 && message == NULL) { - g_error("message size = %u but message is NULL", message_size); - g_assert_not_reached(); - } - - ret = write(pipe_fd, &pipe_input_header, sizeof(pipe_input_header)); - if (ret < 0) { - g_warning("Failed to write header to pipe: %s", g_strerror(errno)); - return ret; - } - - /* Only write the message to pipe if valid data to transmit */ - if (message_size > 0) { - ret = write(pipe_fd, message, message_size); - if (ret < 0) { - g_warning("Failed to write message of size %u at 0x%p to pipe: %s", - message_size, message, g_strerror(errno)); - return ret; - } - } - return 0; -} diff --git a/common/utils/itti_analyzer/libui/ui_interface.h b/common/utils/itti_analyzer/libui/ui_interface.h deleted file mode 100644 index f77ec144d1..0000000000 --- a/common/utils/itti_analyzer/libui/ui_interface.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 - */ - -#include - -#ifndef UI_INTERFACE_H_ -#define UI_INTERFACE_H_ - -/******************************************************************************* - * Functions used between dissectors and GUI to update signal dissection - ******************************************************************************/ - -typedef gboolean (*ui_set_signal_text_cb_t) (gpointer user_data, gchar *text, gint length); - -/******************************************************************************* - * Pipe interface between GUI thread and other thread - ******************************************************************************/ - -typedef gboolean (*pipe_input_cb_t) (gint source, gpointer user_data); - -typedef struct { - int source_fd; - guint pipe_input_id; - GIOChannel *pipe_channel; - - pipe_input_cb_t input_cb; - gpointer user_data; -} pipe_input_t; - -int ui_pipe_new(int pipe_fd[2], pipe_input_cb_t input_cb, gpointer user_data); - -int ui_pipe_write_message(int pipe_fd, const uint16_t message_type, - const void * const message, const uint16_t message_size); - -typedef struct { - uint16_t message_size; - uint16_t message_type; -} pipe_input_header_t; - -enum ui_pipe_messages_id_e { - /* Other thread -> GUI interface ids */ - UI_PIPE_CONNECTION_FAILED, - UI_PIPE_CONNECTION_LOST, - UI_PIPE_XML_DEFINITION, - UI_PIPE_UPDATE_SIGNAL_LIST, - - /* GUI -> other threads */ - UI_PIPE_DISCONNECT_EVT -}; - -typedef struct { - char *xml_definition; - size_t xml_definition_length; -} pipe_xml_definition_message_t; - -typedef struct { - GList *signal_list; -} pipe_new_signals_list_message_t; - -#endif /* UI_INTERFACE_H_ */ diff --git a/common/utils/itti_analyzer/libui/ui_main_screen.c b/common/utils/itti_analyzer/libui/ui_main_screen.c deleted file mode 100644 index 3d6ea266be..0000000000 --- a/common/utils/itti_analyzer/libui/ui_main_screen.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * 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 - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include -#include - -#define G_LOG_DOMAIN ("UI") - -#include - -#include "logs.h" -#include "rc.h" - -#include "ui_callbacks.h" -#include "ui_interface.h" -#include "ui_main_screen.h" -#include "ui_menu_bar.h" -#include "ui_tree_view.h" -#include "ui_notebook.h" -#include "ui_notifications.h" -#include "ui_filters.h" - -ui_main_data_t ui_main_data; - -static void ui_help(void) -{ - printf ("Usage: itti_analyser [options]\n\n" - "Options:\n" - " -d DISSECT write DISSECT file with message types parse details\n" - " -f FILTERS read filters from FILTERS file\n" - " -h display this help and exit\n" - " -i IP set ip address to IP\n" - " -l LEVEL set log level to LEVEL in the range of 2 to 7\n" - " -m MESSAGES read messages from MESSAGES file\n" - " -p PORT set port to PORT\n"); -} - -void ui_gtk_parse_arg(int argc, char *argv[]) -{ - char c; - - /* Clear of ui_main_data not needed */ - // memset (&ui_main_data, 0, sizeof(ui_main_data_t)); - - /* Set some default initialization value for the IP address */ - ui_main_data.ip_entry_init = "127.0.0.1"; - ui_main_data.port_entry_init = "10006"; - - /* Set default log level to at least warning level messages */ - ui_main_data.log_flags = (G_LOG_LEVEL_MASK & (~(G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG))); - - while ((c = getopt (argc, argv, "d:f:hi:l:m:p:")) != -1) - { - switch (c) - { - case 'd': - ui_main_data.dissect_file_name = malloc (strlen (optarg) + 1); - if (ui_main_data.dissect_file_name != NULL) - { - strcpy (ui_main_data.dissect_file_name, optarg); - } - break; - - case 'f': - ui_main_data.filters_file_name = malloc (strlen (optarg) + 1); - if (ui_main_data.filters_file_name != NULL) - { - strcpy (ui_main_data.filters_file_name, optarg); - } - break; - - case 'h': - ui_help (); - exit (0); - break; - - case 'i': - ui_main_data.ip_entry_init = optarg; - break; - - case 'l': - { - GLogLevelFlags log_flag; - - log_flag = 1 << atoi(optarg); - if (log_flag < G_LOG_LEVEL_ERROR) - { - log_flag = G_LOG_LEVEL_ERROR; - } - else - { - if (log_flag > G_LOG_LEVEL_DEBUG) - { - log_flag = G_LOG_LEVEL_DEBUG; - } - } - ui_main_data.log_flags = ((log_flag << 1) - 1) & G_LOG_LEVEL_MASK; - break; - } - - case 'm': - ui_main_data.messages_file_name = malloc (strlen (optarg) + 1); - if (ui_main_data.messages_file_name != NULL) - { - strcpy (ui_main_data.messages_file_name, optarg); - } - break; - - case 'p': - ui_main_data.port_entry_init = optarg; - break; - - default: - ui_help (); - exit (-1); - break; - } - } -} - -static int ui_idle_callback(gpointer data) -{ - g_info("Entering idle state"); - - gtk_window_set_focus (GTK_WINDOW(ui_main_data.window), ui_main_data.messages_list); - - /* Read filters file */ - if (ui_main_data.filters_file_name != NULL) - { - ui_filters_read(ui_main_data.filters_file_name); - } - - /* Read messages file */ - if (ui_main_data.messages_file_name != NULL) - { - ui_messages_read (ui_main_data.messages_file_name); - } - - /* One shot execution */ - return FALSE; -} - -void ui_set_title(const char *fmt, ...) -{ - va_list args; - char *name; - char buffer[200]; - char title[220]; - -#if defined(PACKAGE_STRING) - name = PACKAGE_NAME; -#else - name = "itti_analyzer"; -#endif - - va_start(args, fmt); - - vsnprintf (buffer, sizeof(buffer), fmt, args); - snprintf (title, sizeof(title), "%s %s", name, buffer); - va_end (args); - - gtk_window_set_title (GTK_WINDOW(ui_main_data.window), title); -} - -void ui_main_window_destroy (void) -{ - ui_callback_dialogbox_connect_destroy(); - ui_progressbar_window_destroy(); - gtk_main_quit(); -} - -int ui_gtk_initialize(int argc, char *argv[]) -{ - GtkWidget *vbox; - - /* Create the main window */ - ui_main_data.window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - ui_init_filters (TRUE, FALSE); - - // gtk_window_set_default_icon_from_file ("../analyzer.png", NULL); - gtk_window_set_default_icon_name (GTK_STOCK_FIND); - - gtk_window_set_position (GTK_WINDOW(ui_main_data.window), GTK_WIN_POS_CENTER); - gtk_window_set_default_size (GTK_WINDOW(ui_main_data.window), 1024, 800); - ui_set_title(""); - gtk_window_set_resizable (GTK_WINDOW(ui_main_data.window), TRUE); - - vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - - CHECK_FCT(ui_menu_bar_create(vbox)); - CHECK_FCT(ui_toolbar_create(vbox)); - CHECK_FCT(ui_notebook_create(vbox)); - - gtk_container_add (GTK_CONTAINER(ui_main_data.window), vbox); - - /* Assign the destroy event */ - g_signal_connect(ui_main_data.window, "destroy", ui_main_window_destroy, NULL); - - /* Show the application window */ - gtk_widget_show_all (ui_main_data.window); - - g_idle_add (ui_idle_callback, NULL); - - return RC_OK; -} - -void ui_gtk_flush_events(void) -{ - while (gtk_events_pending ()) - { - gtk_main_iteration(); - } -} diff --git a/common/utils/itti_analyzer/libui/ui_main_screen.h b/common/utils/itti_analyzer/libui/ui_main_screen.h deleted file mode 100644 index 0411d687be..0000000000 --- a/common/utils/itti_analyzer/libui/ui_main_screen.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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 - */ - -#ifndef UI_MAIN_SCREEN_H_ -#define UI_MAIN_SCREEN_H_ - -#include - -#include "ui_signal_dissect_view.h" - -typedef struct { - GtkWidget *window; - GtkWidget *ip_entry; - char *ip_entry_init; - GtkWidget *port_entry; - char *port_entry_init; - - GtkWidget *progressbar_window; - GtkWidget *progressbar; - GtkWidget *messages_list; - ui_text_view_t *text_view; - - /* Buttons */ - GtkToolItem *filters_enabled; - GtkToolItem *open_filters_file; - GtkToolItem *refresh_filters_file; - GtkToolItem *save_filters_file; - - GtkToolItem *open_replay_file; - GtkToolItem *refresh_replay_file; - GtkToolItem *stop_loading; - GtkToolItem *save_replay_file; - GtkToolItem *save_replay_file_filtered; - - GtkToolItem *auto_reconnect; - GtkToolItem *connect; - GtkToolItem *disconnect; - - /* Signal list buttons */ - /* Clear signals button */ - GtkWidget *signals_go_to_entry; - GtkToolItem *signals_go_to_last_button; - GtkToolItem *signals_go_to_first_button; - gboolean display_message_header; - gboolean display_brace; - - GtkTreeSelection *selection; - gboolean follow_last; - - /* Nb of messages received */ - guint nb_message_received; - - GLogLevelFlags log_flags; - char *dissect_file_name; - char *filters_file_name; - char *messages_file_name; - - GtkWidget *menu_filter_messages; - GtkWidget *menu_filter_origin_tasks; - GtkWidget *menu_filter_destination_tasks; - GtkWidget *menu_filter_instances; - - int pipe_fd[2]; -} ui_main_data_t; - -extern ui_main_data_t ui_main_data; - -void ui_gtk_parse_arg(int argc, char *argv[]); - -void ui_set_title(const char *fmt, ...); - -void ui_main_window_destroy (void); - -int ui_gtk_initialize(int argc, char *argv[]); - -void ui_gtk_flush_events(void); - -#endif /* UI_MAIN_SCREEN_H_ */ diff --git a/common/utils/itti_analyzer/libui/ui_menu_bar.c b/common/utils/itti_analyzer/libui/ui_menu_bar.c deleted file mode 100644 index 62b51b3b9f..0000000000 --- a/common/utils/itti_analyzer/libui/ui_menu_bar.c +++ /dev/null @@ -1,503 +0,0 @@ -/* - * 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 - */ - -#define G_LOG_DOMAIN ("UI") - -#include -#include - -#include "rc.h" -#include "ui_main_screen.h" -#include "ui_menu_bar.h" -#include "ui_callbacks.h" -#include "ui_notifications.h" - -static const guint BUTTON_SPACE = 0; -static const guint LABEL_SPACE = 5; -static const guint SEPARATOR_SPACE = 5; - -void ui_set_sensitive_move_buttons(gboolean enable) -{ - gtk_widget_set_sensitive(GTK_WIDGET(ui_main_data.signals_go_to_last_button), enable); - gtk_widget_set_sensitive(GTK_WIDGET(ui_main_data.signals_go_to_first_button), enable); -} - -void ui_set_sensitive_save_message_buttons(gboolean enable) -{ - if (ui_main_data.nb_message_received == 0) - { - enable = FALSE; - } - gtk_widget_set_sensitive(GTK_WIDGET(ui_main_data.save_replay_file), enable); - gtk_widget_set_sensitive(GTK_WIDGET(ui_main_data.save_replay_file_filtered), enable); -} - -int ui_menu_bar_create(GtkWidget *vbox) -{ - GtkAccelGroup *accel_group; - GtkWidget *menu_bar; - - GtkWidget *system_menu; - GtkWidget *system; - GtkWidget *quit; - - GtkWidget *filters_menu; - GtkWidget *filters; - GtkWidget *open_filters; - GtkWidget *reload_filters; - GtkWidget *save_filters; - GtkWidget *enable_filters; - - GtkWidget *messages_menu; - GtkWidget *messages; - GtkWidget *open_messages; - GtkWidget *reload_messages; - GtkWidget *stop_loading; - GtkWidget *save_messages; - GtkWidget *save_messages_filtered; - GtkWidget *goto_first_messages; - GtkWidget *goto_messages; - GtkWidget *goto_last_messages; - GtkWidget *display_message_header; - GtkWidget *display_brace; - - GtkWidget *connect_menu; - GtkWidget *connect; - GtkWidget *auto_reconnect; - GtkWidget *connect_to; - GtkWidget *disconnect; - - GtkWidget *help_menu; - GtkWidget *help; - GtkWidget *about; - - if (!vbox) - return RC_BAD_PARAM; - - accel_group = gtk_accel_group_new(); - gtk_window_add_accel_group(GTK_WINDOW(ui_main_data.window), accel_group); - - menu_bar = gtk_menu_bar_new(); - - /* Create the System sub-menu */ - { - system = gtk_menu_item_new_with_mnemonic ("_System"); - gtk_menu_shell_append (GTK_MENU_SHELL(menu_bar), system); - - system_menu = gtk_menu_new (); - gtk_menu_item_set_submenu (GTK_MENU_ITEM(system), system_menu); - - /* Create the Filters menu items */ - { - quit = gtk_menu_item_new_with_mnemonic ("_Quit"); - gtk_widget_add_accelerator (quit, "activate", accel_group, GDK_KEY_q, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(system_menu), quit); - g_signal_connect(G_OBJECT(quit), "activate", ui_main_window_destroy, NULL); - } - } - - /* Create the Filters sub-menu */ - { - filters = gtk_menu_item_new_with_mnemonic ("_Filters"); - gtk_menu_shell_append (GTK_MENU_SHELL(menu_bar), filters); - - filters_menu = gtk_menu_new (); - gtk_menu_item_set_submenu (GTK_MENU_ITEM(filters), filters_menu); - - /* Create the Filters menu items */ - { - open_filters = gtk_menu_item_new_with_mnemonic ("_Open filters file"); - gtk_widget_add_accelerator (open_filters, "activate", accel_group, GDK_KEY_p, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(filters_menu), open_filters); - g_signal_connect(G_OBJECT(open_filters), "activate", G_CALLBACK(ui_callback_on_open_filters), (gpointer) FALSE); - - reload_filters = gtk_menu_item_new_with_mnemonic ("_Reload filters file"); - gtk_widget_add_accelerator (reload_filters, "activate", accel_group, GDK_KEY_d, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_widget_add_accelerator (reload_filters, "activate", accel_group, GDK_KEY_F4, 0, GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(filters_menu), reload_filters); - g_signal_connect(G_OBJECT(reload_filters), "activate", G_CALLBACK(ui_callback_on_open_filters), - (gpointer) TRUE); - - save_filters = gtk_menu_item_new_with_mnemonic ("_Save filters file"); - gtk_widget_add_accelerator (save_filters, "activate", accel_group, GDK_KEY_v, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(filters_menu), save_filters); - g_signal_connect(G_OBJECT(save_filters), "activate", G_CALLBACK(ui_callback_on_save_filters), NULL); - - gtk_menu_shell_append (GTK_MENU_SHELL(filters_menu), gtk_menu_item_new ()); // Separator - - enable_filters = gtk_menu_item_new_with_mnemonic ("_Enable filtering"); - gtk_widget_add_accelerator (enable_filters, "activate", accel_group, GDK_KEY_e, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(filters_menu), enable_filters); - g_signal_connect(G_OBJECT(enable_filters), "activate", G_CALLBACK(ui_callback_on_enable_filters), NULL); - } - } - - /* Create the Messages sub-menu */ - { - messages = gtk_menu_item_new_with_mnemonic ("_Messages"); - gtk_menu_shell_append (GTK_MENU_SHELL(menu_bar), messages); - - messages_menu = gtk_menu_new (); - gtk_menu_item_set_submenu (GTK_MENU_ITEM(messages), messages_menu); - - /* Crate the Messages menu items */ - { - open_messages = gtk_menu_item_new_with_mnemonic ("_Open messages file"); - gtk_widget_add_accelerator (open_messages, "activate", accel_group, GDK_KEY_o, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(messages_menu), open_messages); - g_signal_connect(G_OBJECT(open_messages), "activate", G_CALLBACK(ui_callback_on_open_messages), - (gpointer) FALSE); - - reload_messages = gtk_menu_item_new_with_mnemonic ("_Reload messages file"); - gtk_widget_add_accelerator (reload_messages, "activate", accel_group, GDK_KEY_r, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_widget_add_accelerator (reload_messages, "activate", accel_group, GDK_KEY_F5, 0, GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(messages_menu), reload_messages); - g_signal_connect(G_OBJECT(reload_messages), "activate", G_CALLBACK(ui_callback_on_open_messages), - (gpointer) TRUE); - - stop_loading = gtk_menu_item_new_with_mnemonic ("S_top loading messages file"); - gtk_widget_add_accelerator (stop_loading, "activate", accel_group, GDK_KEY_x, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(messages_menu), stop_loading); - g_signal_connect(G_OBJECT(stop_loading), "activate", G_CALLBACK(ui_progressbar_window_destroy), - NULL); - - save_messages = gtk_menu_item_new_with_mnemonic ("S_ave messages file (all)"); - gtk_widget_add_accelerator (save_messages, "activate", accel_group, GDK_KEY_a, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(messages_menu), save_messages); - g_signal_connect(G_OBJECT(save_messages), "activate", G_CALLBACK(ui_callback_on_save_messages), - (gpointer) FALSE); - - save_messages_filtered = gtk_menu_item_new_with_mnemonic ("_Save messages file (filtered)"); - gtk_widget_add_accelerator (save_messages_filtered, "activate", accel_group, GDK_KEY_s, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(messages_menu), save_messages_filtered); - g_signal_connect(G_OBJECT(save_messages_filtered), "activate", G_CALLBACK(ui_callback_on_save_messages), - (gpointer) TRUE); - - gtk_menu_shell_append (GTK_MENU_SHELL(messages_menu), gtk_menu_item_new ()); // Separator - - goto_first_messages = gtk_menu_item_new_with_mnemonic ("Go to _first message"); - gtk_widget_add_accelerator (goto_first_messages, "activate", accel_group, GDK_KEY_f, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(messages_menu), goto_first_messages); - g_signal_connect(G_OBJECT(goto_first_messages), "activate", G_CALLBACK(ui_callback_signal_go_to_first), - NULL); - - goto_messages = gtk_menu_item_new_with_mnemonic ("_Go to message ..."); - gtk_widget_add_accelerator (goto_messages, "activate", accel_group, GDK_KEY_g, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(messages_menu), goto_messages); - g_signal_connect(G_OBJECT(goto_messages), "activate", G_CALLBACK(ui_callback_signal_go_to), NULL); - - goto_last_messages = gtk_menu_item_new_with_mnemonic ("Go to _last message"); - gtk_widget_add_accelerator (goto_last_messages, "activate", accel_group, GDK_KEY_l, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(messages_menu), goto_last_messages); - g_signal_connect(G_OBJECT(goto_last_messages), "activate", G_CALLBACK(ui_callback_signal_go_to_last), (gpointer) TRUE); - - gtk_menu_shell_append (GTK_MENU_SHELL(messages_menu), gtk_menu_item_new ()); // Separator - - display_message_header = gtk_menu_item_new_with_mnemonic ("Display message _header"); - gtk_widget_add_accelerator (display_message_header, "activate", accel_group, GDK_KEY_h, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(messages_menu), display_message_header); - g_signal_connect(G_OBJECT(display_message_header), "activate", - G_CALLBACK(ui_callback_display_message_header), NULL); - - display_brace = gtk_menu_item_new_with_mnemonic ("Display _brace"); - gtk_widget_add_accelerator (display_brace, "activate", accel_group, GDK_KEY_b, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(messages_menu), display_brace); - g_signal_connect(G_OBJECT(display_brace), "activate", G_CALLBACK(ui_callback_display_brace), NULL); - } - } - - /* Create the Connect sub-menu */ - { - connect = gtk_menu_item_new_with_mnemonic ("_Connect"); - gtk_menu_shell_append (GTK_MENU_SHELL(menu_bar), connect); - - connect_menu = gtk_menu_new (); - gtk_menu_item_set_submenu (GTK_MENU_ITEM(connect), connect_menu); - - /* Create the Help menu item */ - { - auto_reconnect = gtk_menu_item_new_with_mnemonic ("_Automatic reconnection"); - gtk_widget_add_accelerator (auto_reconnect, "activate", accel_group, GDK_KEY_t, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(connect_menu), auto_reconnect); - g_signal_connect(G_OBJECT(auto_reconnect), "activate", G_CALLBACK(ui_callback_on_auto_reconnect), (gpointer) TRUE); - - connect_to = gtk_menu_item_new_with_mnemonic ("_Connect"); - gtk_widget_add_accelerator (connect_to, "activate", accel_group, GDK_KEY_c, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(connect_menu), connect_to); - g_signal_connect(G_OBJECT(connect_to), "activate", G_CALLBACK(ui_callback_on_connect), (gpointer) TRUE); - - disconnect = gtk_menu_item_new_with_mnemonic ("_Disconnect"); - gtk_widget_add_accelerator (disconnect, "activate", accel_group, GDK_KEY_u, GDK_CONTROL_MASK, - GTK_ACCEL_VISIBLE); - gtk_menu_shell_append (GTK_MENU_SHELL(connect_menu), disconnect); - g_signal_connect(G_OBJECT(disconnect), "activate", G_CALLBACK(ui_callback_on_disconnect), NULL); - } - } - - /* Create the Help sub-menu */ - { - help = gtk_menu_item_new_with_mnemonic ("_Help"); - gtk_menu_shell_append (GTK_MENU_SHELL(menu_bar), help); - - help_menu = gtk_menu_new (); - gtk_menu_item_set_submenu (GTK_MENU_ITEM(help), help_menu); - - /* Create the Help menu item */ - { - about = gtk_menu_item_new_with_mnemonic ("_About"); - gtk_menu_shell_append (GTK_MENU_SHELL(help_menu), about); - g_signal_connect(G_OBJECT(about), "activate", G_CALLBACK(ui_callback_on_about), NULL); - } - } - - /* Add the menubar to the vbox */ - gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 3); - - return RC_OK; -} - -int ui_toolbar_create(GtkWidget *vbox) -{ - GtkWidget *hbox; - GtkWidget *messages_label; - GtkWidget *ip_label; - GtkWidget *port_label; - - if (!vbox) - return RC_BAD_PARAM; - - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - - messages_label = gtk_label_new("Messages"); - - /* Button to Enable filtering */ - { - ui_main_data.filters_enabled = gtk_toggle_tool_button_new(); - gtk_tool_button_set_label (GTK_TOOL_BUTTON(ui_main_data.filters_enabled), "Filters"); - g_signal_connect(G_OBJECT(ui_main_data.filters_enabled), "clicked", - G_CALLBACK(ui_callback_on_filters_enabled), NULL); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.filters_enabled), TRUE); - } - - /* Button to open filters file */ - { - ui_main_data.open_filters_file = gtk_tool_button_new_from_stock(GTK_STOCK_OPEN); - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.open_filters_file), "Open filters file"); - - g_signal_connect(G_OBJECT(ui_main_data.open_filters_file), "clicked", - G_CALLBACK(ui_callback_on_open_filters), (gpointer) FALSE); - } - - /* Button to refresh filters file */ - { - ui_main_data.refresh_filters_file = gtk_tool_button_new_from_stock(GTK_STOCK_REFRESH); - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.refresh_filters_file), "Reload filters file"); - - g_signal_connect(G_OBJECT(ui_main_data.refresh_filters_file), "clicked", - G_CALLBACK(ui_callback_on_open_filters), (gpointer) TRUE); - } - - /* Button to save filters file */ - { - ui_main_data.save_filters_file = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE); - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.save_filters_file), "Save filters file"); - - g_signal_connect(G_OBJECT(ui_main_data.save_filters_file), "clicked", - G_CALLBACK(ui_callback_on_save_filters), NULL); - } - - /* Button to open messages file */ - { - ui_main_data.open_replay_file = gtk_tool_button_new_from_stock(GTK_STOCK_OPEN); - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.open_replay_file), "Open messages file"); - - g_signal_connect(G_OBJECT(ui_main_data.open_replay_file), "clicked", - G_CALLBACK(ui_callback_on_open_messages), (gpointer) FALSE); - } - - /* Button to refresh messages file */ - { - ui_main_data.refresh_replay_file = gtk_tool_button_new_from_stock(GTK_STOCK_REFRESH); - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.refresh_replay_file), "Reload messages file"); - - g_signal_connect(G_OBJECT(ui_main_data.refresh_replay_file), "clicked", - G_CALLBACK(ui_callback_on_open_messages), (gpointer) TRUE); - } - - /* Stop reading messages file */ - { - ui_main_data.stop_loading = gtk_tool_button_new_from_stock(GTK_STOCK_STOP); - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.stop_loading), "Stop loading messages file"); - - g_signal_connect(G_OBJECT(ui_main_data.stop_loading), "clicked", - ui_progressbar_window_destroy, NULL); - } - - /* Button to save messages file */ - { - ui_main_data.save_replay_file = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE); - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.save_replay_file), "Save messages file (all)"); - - g_signal_connect(G_OBJECT(ui_main_data.save_replay_file), "clicked", - G_CALLBACK(ui_callback_on_save_messages), (gpointer) FALSE); - } - - /* Button to save messages file */ - { - ui_main_data.save_replay_file_filtered = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE_AS); - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.save_replay_file_filtered), "Save messages file (filtered)"); - - g_signal_connect(G_OBJECT(ui_main_data.save_replay_file_filtered), "clicked", - G_CALLBACK(ui_callback_on_save_messages), (gpointer) TRUE); - } - - /* Button to go to first signal in list */ - { - ui_main_data.signals_go_to_first_button = gtk_tool_button_new_from_stock(GTK_STOCK_GOTO_FIRST); - /* Set the tooltip text */ - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.signals_go_to_first_button), "Goto first signal"); - - gtk_widget_set_sensitive(GTK_WIDGET(ui_main_data.signals_go_to_first_button), FALSE); - - g_signal_connect(G_OBJECT(ui_main_data.signals_go_to_first_button), "clicked", - G_CALLBACK(ui_callback_signal_go_to_first), NULL); - } - - /* Entry to go to given signal number */ - { - ui_main_data.signals_go_to_entry = gtk_entry_new (); - gtk_entry_set_width_chars (GTK_ENTRY(ui_main_data.signals_go_to_entry), 10); - // gtk_entry_set_input_purpose (GTK_ENTRY(ui_main_data.signals_go_to_entry), GTK_INPUT_PURPOSE_DIGITS); - - g_signal_connect(G_OBJECT(ui_main_data.signals_go_to_entry), "activate", - G_CALLBACK(ui_callback_signal_go_to_entry), NULL); - } - - /* Button to go to last signal in list */ - { - ui_main_data.signals_go_to_last_button = gtk_toggle_tool_button_new_from_stock(GTK_STOCK_GOTO_LAST); - /* Set the tooltip text */ - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.signals_go_to_last_button), "Goto last signal"); - - gtk_widget_set_sensitive(GTK_WIDGET(ui_main_data.signals_go_to_last_button), FALSE); - - g_signal_connect(G_OBJECT(ui_main_data.signals_go_to_last_button), "clicked", - G_CALLBACK(ui_callback_signal_go_to_last), (gpointer) FALSE); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.signals_go_to_last_button), TRUE); - } - - /* Button to automatically try to reconnect */ - { - ui_main_data.auto_reconnect = gtk_toggle_tool_button_new(); - gtk_tool_button_set_label (GTK_TOOL_BUTTON(ui_main_data.auto_reconnect), "Auto"); - g_signal_connect(G_OBJECT(ui_main_data.auto_reconnect), "clicked", - G_CALLBACK(ui_callback_on_auto_reconnect), (gpointer) FALSE); - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON(ui_main_data.auto_reconnect), FALSE); - } - - /* Button to connect to remote */ - { - ui_main_data.connect = gtk_tool_button_new_from_stock(GTK_STOCK_CONNECT); - /* Set the tooltip text */ - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.connect), "Connect to remote host"); - - g_signal_connect(G_OBJECT(ui_main_data.connect), "clicked", - G_CALLBACK(ui_callback_on_connect), (gpointer) TRUE); - } - - /* Button to disconnect from remote */ - { - ui_main_data.disconnect = gtk_tool_button_new_from_stock(GTK_STOCK_DISCONNECT); - /* Set the tooltip text */ - gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(ui_main_data.disconnect), "Disconnect from remote host"); - - /* Disabled at startup. Will be activated when a connection is established */ - gtk_widget_set_sensitive(GTK_WIDGET(ui_main_data.disconnect), FALSE); - - g_signal_connect(G_OBJECT(ui_main_data.disconnect), "clicked", - G_CALLBACK(ui_callback_on_disconnect), NULL); - } - - ip_label = gtk_label_new("ip:"); - port_label = gtk_label_new("port:"); - - ui_main_data.ip_entry = gtk_entry_new(); - /* Width of 15 characters for port number (ipv4 address) */ - gtk_entry_set_width_chars(GTK_ENTRY(ui_main_data.ip_entry), 15); - gtk_entry_set_text(GTK_ENTRY(ui_main_data.ip_entry), ui_main_data.ip_entry_init); - - ui_main_data.port_entry = gtk_entry_new(); - /* Width of 5 characters for port number (uint16_t) */ - gtk_entry_set_width_chars(GTK_ENTRY(ui_main_data.port_entry), 5); - gtk_entry_set_text(GTK_ENTRY(ui_main_data.port_entry), ui_main_data.port_entry_init); - - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.filters_enabled), FALSE, FALSE, LABEL_SPACE); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.open_filters_file), FALSE, FALSE, BUTTON_SPACE); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.refresh_filters_file), FALSE, FALSE, BUTTON_SPACE); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.save_filters_file), FALSE, FALSE, BUTTON_SPACE); - - gtk_box_pack_start(GTK_BOX(hbox), gtk_separator_new(GTK_ORIENTATION_VERTICAL), FALSE, FALSE, SEPARATOR_SPACE); - - gtk_box_pack_start(GTK_BOX(hbox), messages_label, FALSE, FALSE, LABEL_SPACE); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.open_replay_file), FALSE, FALSE, BUTTON_SPACE); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.refresh_replay_file), FALSE, FALSE, BUTTON_SPACE); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.stop_loading), FALSE, FALSE, BUTTON_SPACE); - gtk_widget_set_sensitive(GTK_WIDGET(ui_main_data.stop_loading), FALSE); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.save_replay_file), FALSE, FALSE, BUTTON_SPACE); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.save_replay_file_filtered), FALSE, FALSE, BUTTON_SPACE); - ui_set_sensitive_save_message_buttons(FALSE); - - gtk_box_pack_start(GTK_BOX(hbox), gtk_separator_new(GTK_ORIENTATION_VERTICAL), FALSE, FALSE, SEPARATOR_SPACE); - - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.signals_go_to_first_button), FALSE, FALSE, BUTTON_SPACE); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.signals_go_to_entry), FALSE, FALSE, BUTTON_SPACE); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.signals_go_to_last_button), FALSE, FALSE, BUTTON_SPACE); - - gtk_box_pack_start(GTK_BOX(hbox), gtk_separator_new(GTK_ORIENTATION_VERTICAL), FALSE, FALSE, SEPARATOR_SPACE); - - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.auto_reconnect), FALSE, FALSE, LABEL_SPACE); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.connect), FALSE, FALSE, BUTTON_SPACE); - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(ui_main_data.disconnect), FALSE, FALSE, BUTTON_SPACE); - gtk_box_pack_start(GTK_BOX(hbox), ip_label, FALSE, FALSE, LABEL_SPACE); - gtk_box_pack_start(GTK_BOX(hbox), ui_main_data.ip_entry, FALSE, FALSE, BUTTON_SPACE); - gtk_box_pack_start(GTK_BOX(hbox), port_label, FALSE, FALSE, LABEL_SPACE); - gtk_box_pack_start(GTK_BOX(hbox), ui_main_data.port_entry, FALSE, FALSE, BUTTON_SPACE); - - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - - return RC_OK; -} diff --git a/common/utils/itti_analyzer/libui/ui_menu_bar.h b/common/utils/itti_analyzer/libui/ui_menu_bar.h deleted file mode 100644 index 037dc5edca..0000000000 --- a/common/utils/itti_analyzer/libui/ui_menu_bar.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 - */ - -#ifndef UI_MENU_BAR_H_ -#define UI_MENU_BAR_H_ - -void ui_set_sensitive_move_buttons(gboolean enable); - -void ui_set_sensitive_save_message_buttons(gboolean enable); - -int ui_menu_bar_create(GtkWidget *vbox); - -int ui_toolbar_create(GtkWidget *vbox); - -#endif /* UI_MENU_BAR_H_ */ diff --git a/common/utils/itti_analyzer/libui/ui_notebook.c b/common/utils/itti_analyzer/libui/ui_notebook.c deleted file mode 100644 index 93a439335f..0000000000 --- a/common/utils/itti_analyzer/libui/ui_notebook.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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 - */ - -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#define G_LOG_DOMAIN ("UI") - -#include - -#include "rc.h" - -#include "ui_notebook.h" -#include "ui_tree_view.h" -#include "ui_signal_dissect_view.h" - -static ui_text_view_t *terminal_view; - -void ui_notebook_terminal_clear(void) -{ - ui_signal_dissect_clear_view(terminal_view); -} - -void ui_notebook_terminal_append_data(gchar *text, gint length) -{ - ui_signal_set_text(terminal_view, text, length); -} - -int ui_notebook_create(GtkWidget *vbox) -{ - GtkWidget *notebook; - GtkWidget *vbox_notebook, *vbox_terminal; - - if (!vbox) - return RC_BAD_PARAM; - - notebook = gtk_notebook_new(); - - vbox_notebook = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - ui_tree_view_create(NULL, vbox_notebook); - - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox_notebook, NULL); - gtk_notebook_set_tab_label_text (GTK_NOTEBOOK(notebook), vbox_notebook, "Messages list"); - -#if defined (FILTERS_TAB) - vbox_notebook = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox_notebook, NULL); - gtk_notebook_set_tab_label_text (GTK_NOTEBOOK(notebook), vbox_notebook, "Filters"); -#endif - - vbox_notebook = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox_notebook, NULL); - gtk_notebook_set_tab_label_text (GTK_NOTEBOOK(notebook), vbox_notebook, "Terminal"); - - vbox_terminal = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); - - terminal_view = ui_signal_dissect_new(vbox_terminal); - - gtk_box_pack_start (GTK_BOX(vbox_notebook), vbox_terminal, TRUE, TRUE, 5); - - /* Add the notebook to the vbox of the main window */ - gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); - - return RC_OK; -} diff --git a/common/utils/itti_analyzer/libui/ui_notebook.h b/common/utils/itti_analyzer/libui/ui_notebook.h deleted file mode 100644 index 6f87856e84..0000000000 --- a/common/utils/itti_analyzer/libui/ui_notebook.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 - */ - -#ifndef UI_NOTEBOOK_H_ -#define UI_NOTEBOOK_H_ - -void ui_notebook_terminal_clear(void); - -int ui_notebook_create(GtkWidget *vbox); - -void ui_notebook_terminal_append_data(gchar *text, gint length); - -#endif /* UI_NOTEBOOK_H_ */ diff --git a/common/utils/itti_analyzer/libui/ui_notif_dlg.c b/common/utils/itti_analyzer/libui/ui_notif_dlg.c deleted file mode 100644 index 4be4aa52cf..0000000000 --- a/common/utils/itti_analyzer/libui/ui_notif_dlg.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 - */ - -#define G_LOG_DOMAIN ("UI") - -#include "rc.h" - -#include "ui_notif_dlg.h" -#include "ui_main_screen.h" - -static const char * const gtk_response_strings[] = - {"GTK_RESPONSE_NONE", "GTK_RESPONSE_REJECT", "GTK_RESPONSE_ACCEPT", "GTK_RESPONSE_DELETE_EVENT", "GTK_RESPONSE_OK", - "GTK_RESPONSE_CANCEL", "GTK_RESPONSE_CLOSE", "GTK_RESPONSE_YES", "GTK_RESPONSE_NO", "GTK_RESPONSE_APPLY", "GTK_RESPONSE_HELP"}; - -static const char * const title_type_strings[] = - {"Info", "Warning", "Question", "Error", "Other"}; - -const char * gtk_get_respose_string (gint response) -{ - gint response_index = - response - 1; - - if ((0 <= response_index) && (response_index < (sizeof (gtk_response_strings) / sizeof (gtk_response_strings[0])))) - { - return (gtk_response_strings[response_index]); - } - else - { - return ("Invalid response value!"); - } -} -int ui_notification_dialog(GtkMessageType type, gboolean cancel, const char *title, const char *fmt, ...) -{ - va_list args; - GtkWidget *dialogbox; - char buffer[200]; - int result = RC_OK; - - va_start(args, fmt); - - vsnprintf (buffer, sizeof(buffer), fmt, args); - - g_warning("%s", buffer); - - dialogbox = gtk_message_dialog_new (GTK_WINDOW(ui_main_data.window), GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, type, - cancel ? GTK_BUTTONS_OK_CANCEL : GTK_BUTTONS_OK, "%s", - buffer); - /* Set the window at center of main window */ - gtk_window_set_position (GTK_WINDOW(dialogbox), GTK_WIN_POS_CENTER_ON_PARENT); - - gtk_dialog_set_default_response (GTK_DIALOG(dialogbox), GTK_RESPONSE_OK); - - snprintf (buffer, sizeof(buffer), "%s: %s", title_type_strings[type], title); - gtk_window_set_title (GTK_WINDOW(dialogbox), buffer); - - if (gtk_dialog_run (GTK_DIALOG (dialogbox)) == GTK_RESPONSE_CANCEL) - { - result = RC_FAIL; - } - - gtk_widget_destroy (dialogbox); - - va_end(args); - - return result; -} diff --git a/common/utils/itti_analyzer/libui/ui_notif_dlg.h b/common/utils/itti_analyzer/libui/ui_notif_dlg.h deleted file mode 100644 index 361ec81850..0000000000 --- a/common/utils/itti_analyzer/libui/ui_notif_dlg.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 - */ - -#include - -#ifndef UI_NOTIF_DLG_H_ -#define UI_NOTIF_DLG_H_ - -const char *gtk_get_respose_string (gint response); - -extern int ui_notification_dialog(GtkMessageType type, gboolean cancel, const char *title, const char *fmt, ...); - -#endif /* UI_NOTIF_DLG_H_ */ diff --git a/common/utils/itti_analyzer/libui/ui_notifications.c b/common/utils/itti_analyzer/libui/ui_notifications.c deleted file mode 100644 index 6e7897c850..0000000000 --- a/common/utils/itti_analyzer/libui/ui_notifications.c +++ /dev/null @@ -1,636 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include - -#define G_LOG_DOMAIN ("UI") - -#include - -#include - -#include "logs.h" -#include "itti_types.h" -#include "rc.h" - -#include "ui_interface.h" -#include "ui_main_screen.h" -#include "ui_menu_bar.h" -#include "ui_notifications.h" -#include "ui_notif_dlg.h" -#include "ui_callbacks.h" -#include "ui_filters.h" -#include "ui_tree_view.h" - -#include "locate_root.h" -#include "xml_parse.h" -#include "socket.h" - -static const itti_message_types_t itti_dump_xml_definition_end = ITTI_DUMP_XML_DEFINITION_END; -static const itti_message_types_t itti_dump_message_type_end = ITTI_DUMP_MESSAGE_TYPE_END; - -static FILE *messages_file; -static uint32_t message_number; -static gboolean ui_abort; - -int ui_disable_connect_button(void) -{ - /* Disable Connect button and enable disconnect button */ - gtk_widget_set_sensitive (GTK_WIDGET (ui_main_data.connect), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (ui_main_data.disconnect), TRUE); - socket_abort_connection = FALSE; - - return RC_OK; -} - -int ui_enable_connect_button(void) -{ - /* Disable Disconnect button and enable connect button */ - gtk_widget_set_sensitive (GTK_WIDGET (ui_main_data.connect), TRUE); - gtk_widget_set_sensitive (GTK_WIDGET (ui_main_data.disconnect), FALSE); - socket_abort_connection = TRUE; - ui_set_sensitive_save_message_buttons (TRUE); - ui_set_title (""); - - return RC_OK; -} - -static void ui_change_cursor(gboolean busy) -{ - static GdkWindow *window; - - if (busy) - { - GdkDisplay *display; - GdkCursor *cursor; - // gint x, y; - - cursor = gdk_cursor_new (GDK_WATCH); - display = gdk_display_get_default (); - window = gtk_widget_get_window (GTK_WIDGET(ui_main_data.window)); - // window = gdk_display_get_window_at_pointer(display, &x, &y); - - gdk_window_set_cursor (window, cursor); - gdk_display_sync (display); - g_object_unref (cursor); - // gtk_widget_set_sensitive (ui_main_data.window, FALSE); - ui_gtk_flush_events (); - } - else - { - gdk_window_set_cursor (window, NULL); - // gtk_widget_set_sensitive (ui_main_data.window, TRUE); - ui_gtk_flush_events (); - } -} - -static void gtk_filter_add(GtkWidget *file_chooser, const gchar *title, const gchar *pattern) -{ - GtkFileFilter *file_filter = gtk_file_filter_new (); - - gtk_file_filter_set_name (file_filter, title); - gtk_file_filter_add_pattern (file_filter, pattern); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(file_chooser), file_filter); -} - -int ui_messages_read(char *file_name) -{ - int result = RC_OK; - int source; - int read_data = 0; - void *input_data = NULL; - size_t input_data_length = 0; - int read_messages = 0; - - ui_change_cursor (TRUE); - - source = open (file_name, O_RDONLY); - if (source < 0) - { - ui_notification_dialog (GTK_MESSAGE_ERROR, FALSE, "open messages", "Failed to open file \"%s\": %s", file_name, - g_strerror (errno)); - result = RC_FAIL; - } - else - { - itti_socket_header_t message_header; - struct stat st; - int size; - double read_fraction = 0.f; - - if (stat (file_name, &st) < 0) - { - ui_notification_dialog (GTK_MESSAGE_ERROR, FALSE, "get file length", - "Failed to retrieve length for file \"%s\": %s", file_name, g_strerror (errno)); - result = RC_FAIL; - } - size = st.st_size; - - ui_callback_signal_clear_list (NULL, NULL); - - /* Initialize the progress bar */ - ui_abort = FALSE; - ui_progress_bar_set_fraction (0); - - do - { - read_data = read (source, &message_header, sizeof(itti_socket_header_t)); - - if (read_data == -1) - { - ui_notification_dialog (GTK_MESSAGE_ERROR, FALSE, "open messages", "Failed to read from file \"%s\": %s", - file_name, g_strerror (errno)); - result = RC_FAIL; - break; - } - - if (read_data == 0) - { - break; - } - - if (read_data < sizeof(itti_socket_header_t)) - { - if (ui_notification_dialog (GTK_MESSAGE_WARNING, TRUE, "open messages", - "Failed to read a complete message header from file \"%s\": %s", file_name, g_strerror (errno)) == RC_FAIL) - { - read_data = 0; - } - } - else - { - read_fraction += (double) read_data / size; - - input_data_length = message_header.message_size - sizeof(itti_socket_header_t); - - g_debug("%x, %x, %zd", message_header.message_type, message_header.message_size, input_data_length); - - /* Checking for non-header part */ - if (input_data_length > 0) - { - input_data = malloc (input_data_length); - - read_data = read (source, input_data, input_data_length); - if (read_data < input_data_length) - { - if (ui_notification_dialog (GTK_MESSAGE_WARNING, TRUE, "open messages", - "Failed to read a complete message from file \"%s\": %s", file_name, g_strerror (errno)) == RC_FAIL) - { - read_data = 0; - } - break; - } - - read_fraction += (double) input_data_length / size; - } - - switch (message_header.message_type) - { - case ITTI_DUMP_XML_DEFINITION: - ui_gtk_flush_events (); - if (memcmp (&(((char *) input_data)[input_data_length - sizeof (itti_message_types_t)]), - &itti_dump_xml_definition_end, sizeof (itti_message_types_t)) == 0) - { - result = xml_parse_buffer (input_data, input_data_length - sizeof (itti_message_types_t)); - if (result != RC_OK) - { - ui_notification_dialog (GTK_MESSAGE_ERROR, FALSE, "open messages", - "Error in parsing XML definitions in file \"%s\": %s", file_name, - rc_strings[-result]); - read_data = 0; - } - ui_gtk_flush_events (); - g_message("Parsed XML definition from file \"%s\"", file_name); - } - else - { - ui_notification_dialog (GTK_MESSAGE_ERROR, FALSE, "open messages", - "Error in parsing XML definitions in file \"%s\", end mark is missing", file_name); - } - /* Data input buffer is kept in case user when to save the log file later */ - break; - - case ITTI_DUMP_MESSAGE_TYPE: - { - itti_signal_header_t *itti_signal_header = input_data; - buffer_t *buffer; - - if (memcmp (&(((char *) input_data)[input_data_length - sizeof (itti_message_types_t)]), - &itti_dump_message_type_end, sizeof (itti_message_types_t)) == 0) - { - /* Create the new buffer */ - if (buffer_new_from_data (&buffer, input_data + sizeof(itti_signal_header_t), - input_data_length - sizeof(itti_signal_header_t) - sizeof(itti_message_types_t), 0) != RC_OK) - { - g_error("Failed to create new buffer"); - g_assert_not_reached (); - } - - sscanf (itti_signal_header->message_number_char, MESSAGE_NUMBER_CHAR_FORMAT, &buffer->message_number); - - ui_signal_add_to_list (buffer, ((read_messages % 1000) == 0) ? (gpointer) 1 : NULL); - - if ((read_messages % 100) == 0) - { - ui_progress_bar_set_fraction (read_fraction); - ui_gtk_flush_events (); - } - - read_messages++; - } - else - { - if (ui_notification_dialog (GTK_MESSAGE_WARNING, TRUE, "open messages", - "Failed to read a message from file \"%s\", end mark is missing", file_name) == RC_FAIL) - { - read_data = 0; - } - break; - } - - free (input_data); - break; - } - - case ITTI_STATISTIC_MESSAGE_TYPE: - default: - if (ui_notification_dialog (GTK_MESSAGE_WARNING, TRUE, "open messages", - "Unknown (or not implemented) record type: %d in file \"%s\"", - message_header.message_type, file_name) == RC_FAIL) - { - read_data = 0; - } - - free (input_data); - break; - } - } - } while ((ui_abort == FALSE) && (read_data > 0)); - - if (read_messages > 0) - { - char *basename; - - /* Enable buttons to move in the list of signals */ - ui_set_sensitive_move_buttons (TRUE); - - if (ui_main_data.follow_last) - { - /* Advance to the last signal */ - ui_tree_view_select_row (ui_tree_view_get_filtered_number () - 1); - } - - basename = g_path_get_basename (file_name); - ui_set_title ("\"%s\"", basename); - } - else - { - result = RC_FAIL; - } - - ui_progress_bar_terminate (); - - g_message("Read %d messages (%d to display) from file \"%s\"\n", read_messages, ui_tree_view_get_filtered_number(), file_name); - - close (source); - } - - ui_change_cursor (FALSE); - - return result; -} - -static void ui_message_write_callback(const gpointer buffer, const gchar *signal_name) -{ - buffer_t *signal_buffer = (buffer_t *) buffer; - itti_socket_header_t message_header; - itti_signal_header_t itti_signal_header; - uint32_t message_size; - - message_size = signal_buffer->size_bytes; - - message_header.message_size = sizeof(itti_socket_header_t) + sizeof(itti_signal_header) + message_size + sizeof(itti_message_types_t); - message_header.message_type = ITTI_DUMP_MESSAGE_TYPE; - - sprintf(itti_signal_header.message_number_char, MESSAGE_NUMBER_CHAR_FORMAT, message_number); - itti_signal_header.message_number_char[sizeof(itti_signal_header.message_number_char) - 1] = '\n'; - message_number++; - - fwrite (&message_header, sizeof(message_header), 1, messages_file); - fwrite (&itti_signal_header, sizeof(itti_signal_header), 1, messages_file); - fwrite (signal_buffer->data, message_size, 1, messages_file); - fwrite (&itti_dump_message_type_end, sizeof(itti_message_types_t), 1, messages_file); -} - -static int ui_messages_file_write(char *file_name, gboolean filtered) -{ - if (file_name == NULL) - { - g_warning("No name for log file"); - return RC_FAIL; - } - - messages_file = fopen (file_name, "w"); - if (messages_file == NULL) - { - ui_notification_dialog (GTK_MESSAGE_ERROR, FALSE, "Failed to open file \"%s\": %s", file_name, g_strerror (errno)); - return RC_FAIL; - } - - /* Write XML definitions */ - { - itti_socket_header_t message_header; - - message_header.message_size = sizeof(itti_socket_header_t) + xml_raw_data_size + sizeof(itti_message_types_t); - message_header.message_type = ITTI_DUMP_XML_DEFINITION; - - fwrite (&message_header, sizeof(message_header), 1, messages_file); - fwrite (xml_raw_data, xml_raw_data_size, 1, messages_file); - fwrite (&itti_dump_xml_definition_end, sizeof(itti_message_types_t), 1, messages_file); - } - - /* Write messages */ - { - message_number = 1; - ui_tree_view_foreach_message (ui_message_write_callback, filtered); - } - - fclose (messages_file); - - return RC_OK; -} - -int ui_messages_open_file_chooser(void) -{ - int result = RC_OK; - - GtkWidget *filechooser; - gboolean response_accept; - char *filename; - - filechooser = gtk_file_chooser_dialog_new ("Select file", GTK_WINDOW (ui_main_data.window), - GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, - GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - gtk_filter_add (filechooser, "Log files", "*.log"); - gtk_filter_add (filechooser, "All files", "*"); - - /* Process the response */ - response_accept = gtk_dialog_run (GTK_DIALOG (filechooser)) == GTK_RESPONSE_ACCEPT; - - if (response_accept) - { - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filechooser)); - } - gtk_widget_destroy (filechooser); - if (response_accept) - { - ui_set_sensitive_save_message_buttons (FALSE); - - result = ui_messages_read (filename); - if (result == RC_OK) - { - /* Update messages file name for future use */ - if (ui_main_data.messages_file_name != NULL) - { - g_free (ui_main_data.messages_file_name); - } - ui_main_data.messages_file_name = filename; - - ui_set_sensitive_save_message_buttons (TRUE); - } - else - { - g_free (filename); - } - } - return result; -} - -int ui_messages_save_file_chooser(gboolean filtered) -{ - int result = RC_OK; - GtkWidget *filechooser; - - /* Check if there is something to save */ - if (xml_raw_data_size > 0) - { - static const char *title[] = - { - "Save file (all messages)", - "Save file (filtered messages)", - }; - - filechooser = gtk_file_chooser_dialog_new (title[filtered], GTK_WINDOW (ui_main_data.window), - GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, - GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - gtk_filter_add (filechooser, "Log files", "*.log"); - gtk_filter_add (filechooser, "All files", "*"); - - gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (filechooser), TRUE); - - if (ui_main_data.messages_file_name != NULL) - { - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filechooser), ui_main_data.messages_file_name); - } - else - { - gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (filechooser), "messages.log"); - } - - /* Process the response */ - if (gtk_dialog_run (GTK_DIALOG (filechooser)) == GTK_RESPONSE_ACCEPT) - { - char *filename; - - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filechooser)); - result = ui_messages_file_write (filename, filtered); - if (result == RC_OK) - { - /* Update filters file name for future use */ - if (ui_main_data.messages_file_name != NULL) - { - g_free (ui_main_data.messages_file_name); - } - ui_main_data.messages_file_name = filename; - } - else - { - g_free (filename); - } - } - gtk_widget_destroy (filechooser); - } - - return result; -} - -int ui_filters_open_file_chooser(void) -{ - int result = RC_OK; - GtkWidget *filechooser; - gboolean response_accept; - char *filename; - - filechooser = gtk_file_chooser_dialog_new ("Select file", GTK_WINDOW (ui_main_data.window), - GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, - GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - gtk_filter_add (filechooser, "Filters files", "*.xml"); - gtk_filter_add (filechooser, "All files", "*"); - - /* Process the response */ - response_accept = gtk_dialog_run (GTK_DIALOG (filechooser)) == GTK_RESPONSE_ACCEPT; - - if (response_accept) - { - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filechooser)); - } - gtk_widget_destroy (filechooser); - if (response_accept) - { - result = ui_filters_read (filename); - if (result == RC_OK) - { - /* Update filters file name for future use */ - if (ui_main_data.filters_file_name != NULL) - { - g_free (ui_main_data.filters_file_name); - } - ui_main_data.filters_file_name = filename; - } - else - { - g_free (filename); - } - } - - return result; -} - -int ui_filters_save_file_chooser(void) -{ - int result = RC_OK; - GtkWidget *filechooser; - - filechooser = gtk_file_chooser_dialog_new ("Save file", GTK_WINDOW (ui_main_data.window), - GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - gtk_filter_add (filechooser, "Filters files", "*.xml"); - gtk_filter_add (filechooser, "All files", "*"); - - gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (filechooser), TRUE); - - if (ui_main_data.filters_file_name != NULL) - { - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filechooser), ui_main_data.filters_file_name); - } - else - { - gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (filechooser), "filters.xml"); - } - - /* Process the response */ - if (gtk_dialog_run (GTK_DIALOG (filechooser)) == GTK_RESPONSE_ACCEPT) - { - char *filename; - - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filechooser)); - result = ui_filters_file_write (filename); - if (result == RC_OK) - { - /* Update filters file name for future use */ - if (ui_main_data.filters_file_name != NULL) - { - g_free (ui_main_data.filters_file_name); - } - ui_main_data.filters_file_name = filename; - } - else - { - g_free (filename); - } - } - gtk_widget_destroy (filechooser); - - return result; -} - -void ui_progressbar_window_destroy (void) -{ - ui_abort = TRUE; - ui_progress_bar_terminate(); -} - -int ui_progress_bar_set_fraction(double fraction) -{ - if (ui_abort == FALSE) - { - /* If not exist instantiate */ - if (!ui_main_data.progressbar && !ui_main_data.progressbar_window) - { - ui_main_data.progressbar_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - /* Keep progress bar window on top of main window */ - gtk_window_set_transient_for (GTK_WINDOW(ui_main_data.progressbar_window), GTK_WINDOW(ui_main_data.window)); - - /* Set the window at center of main window */ - gtk_window_set_position (GTK_WINDOW(ui_main_data.progressbar_window), GTK_WIN_POS_CENTER_ON_PARENT); - gtk_window_set_title (GTK_WINDOW(ui_main_data.progressbar_window), "Processing"); - - gtk_container_set_border_width (GTK_CONTAINER (ui_main_data.progressbar_window), 10); - - ui_main_data.progressbar = gtk_progress_bar_new (); - - gtk_container_add (GTK_CONTAINER (ui_main_data.progressbar_window), ui_main_data.progressbar); - - /* Assign the destroy event */ - g_signal_connect(ui_main_data.progressbar_window, "destroy", ui_progressbar_window_destroy, NULL); - - gtk_widget_show_all (ui_main_data.progressbar_window); - - gtk_widget_set_sensitive(GTK_WIDGET(ui_main_data.stop_loading), TRUE); - } - - gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(ui_main_data.progressbar), fraction); - -// ui_gtk_flush_events(); - } - - return RC_OK; -} - -int ui_progress_bar_terminate(void) -{ - if (ui_main_data.progressbar) - { - gtk_widget_destroy (ui_main_data.progressbar); - ui_main_data.progressbar = NULL; - } - if (ui_main_data.progressbar_window) - { - gtk_widget_destroy (ui_main_data.progressbar_window); - ui_main_data.progressbar_window = NULL; - } - gtk_widget_set_sensitive(GTK_WIDGET(ui_main_data.stop_loading), FALSE); - - return RC_OK; -} diff --git a/common/utils/itti_analyzer/libui/ui_notifications.h b/common/utils/itti_analyzer/libui/ui_notifications.h deleted file mode 100644 index 33ef0ff5c0..0000000000 --- a/common/utils/itti_analyzer/libui/ui_notifications.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 - */ - -#ifndef UI_NOTIFICATIONS_H_ -#define UI_NOTIFICATIONS_H_ - -typedef void (*message_write_callback_t) (const gpointer buffer, const gchar *signal_name); - -int ui_disable_connect_button(void); - -int ui_enable_connect_button(void); - -int ui_messages_read(char *filename); - -int ui_messages_open_file_chooser(void); - -int ui_messages_save_file_chooser(gboolean filtered); - -int ui_filters_open_file_chooser(void); - -int ui_filters_save_file_chooser(void); - -void ui_progressbar_window_destroy(void); - -int ui_progress_bar_set_fraction(double fraction); - -int ui_progress_bar_terminate(void); - -#endif /* UI_NOTIFICATIONS_H_ */ diff --git a/common/utils/itti_analyzer/libui/ui_signal_dissect_view.c b/common/utils/itti_analyzer/libui/ui_signal_dissect_view.c deleted file mode 100644 index 859eb66b03..0000000000 --- a/common/utils/itti_analyzer/libui/ui_signal_dissect_view.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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 - */ - -#include - -#define G_LOG_DOMAIN ("UI") - -#include - -#include "rc.h" - -#include "ui_main_screen.h" -#include "ui_menu_bar.h" -#include "ui_signal_dissect_view.h" - -ui_text_view_t *ui_signal_dissect_new(GtkWidget *hbox) -{ - GtkWidget *scrolled_window; - ui_text_view_t *new_text_view; - - new_text_view = malloc(sizeof(ui_text_view_t)); - - new_text_view->text_view = gtk_text_view_new(); - scrolled_window = gtk_scrolled_window_new(NULL, NULL); - - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), - GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); - - /* Change the font of the widget */ - new_text_view->text_view_font = pango_font_description_new(); - - g_debug("Default family is: %s\n", pango_font_description_get_family(new_text_view->text_view_font)); - - pango_font_description_set_family(new_text_view->text_view_font, "Monospace"); - pango_font_description_set_absolute_size(new_text_view->text_view_font, 10 * PANGO_SCALE); - - g_debug("Font family has been set to: %s\n", pango_font_description_get_family(new_text_view->text_view_font)); - - gtk_widget_override_font(new_text_view->text_view, new_text_view->text_view_font); - - /* Disable editable attribute */ - gtk_text_view_set_editable(GTK_TEXT_VIEW(new_text_view->text_view), FALSE); - - gtk_container_add(GTK_CONTAINER(scrolled_window), new_text_view->text_view); - - gtk_paned_pack2 (GTK_PANED (hbox), scrolled_window, TRUE, FALSE); - - return new_text_view; -} - -int ui_signal_dissect_clear_view(ui_text_view_t *text_view) -{ - GtkTextBuffer *text_buffer; - - g_assert(text_view != NULL); - - if (text_view->text_view != NULL) - { - /* Create an empty text buffer */ - text_buffer = gtk_text_buffer_new(NULL); - gtk_text_buffer_set_text(text_buffer, "", 0); - - gtk_text_view_set_buffer(GTK_TEXT_VIEW(text_view->text_view), text_buffer); - } - - return RC_OK; -} - -gboolean ui_signal_set_text(gpointer user_data, gchar *text, gint length) -{ - GtkTextBuffer *text_buffer; - ui_text_view_t *text_view; - - if (length < 0) - return FALSE; - - text_view = (ui_text_view_t *)user_data; - - g_assert(text != NULL); - g_assert(text_view != NULL); - g_assert(text_view->text_view != NULL); - - g_assert(GTK_IS_TEXT_VIEW(GTK_TEXT_VIEW(text_view->text_view))); - - text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_view->text_view)); - - if (text_buffer) { - /* We already have a text buffer, use it */ - gtk_text_buffer_insert_at_cursor(text_buffer, text, length); - } else { - /* No buffer currently in use, create a new one */ - text_buffer = gtk_text_buffer_new(NULL); - gtk_text_buffer_set_text(text_buffer, text, length); - gtk_text_view_set_buffer(GTK_TEXT_VIEW(text_view->text_view), - text_buffer); - } - - return TRUE; -} diff --git a/common/utils/itti_analyzer/libui/ui_signal_dissect_view.h b/common/utils/itti_analyzer/libui/ui_signal_dissect_view.h deleted file mode 100644 index a5ccf6a9eb..0000000000 --- a/common/utils/itti_analyzer/libui/ui_signal_dissect_view.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 - */ - -#ifndef UI_SIGNAL_DISSECT_VIEW_H_ -#define UI_SIGNAL_DISSECT_VIEW_H_ - -typedef struct { - GtkWidget *text_view; - PangoFontDescription *text_view_font; -} ui_text_view_t; - -ui_text_view_t *ui_signal_dissect_new(GtkWidget *hbox); - -int ui_signal_dissect_clear_view(ui_text_view_t *text_view); - -gboolean ui_signal_set_text(gpointer user_data, gchar *text, gint length); - -#endif /*UI_SIGNAL_DISSECT_VIEW_H_ */ diff --git a/common/utils/itti_analyzer/libui/ui_tree_view.c b/common/utils/itti_analyzer/libui/ui_tree_view.c deleted file mode 100644 index 0396e24819..0000000000 --- a/common/utils/itti_analyzer/libui/ui_tree_view.c +++ /dev/null @@ -1,610 +0,0 @@ -/* - * 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 - */ - -#include -#include - -#define G_LOG_DOMAIN ("UI_TREE") - -#include - -#include "logs.h" -#include "rc.h" - -#include "buffers.h" - -#include "ui_main_screen.h" -#include "ui_tree_view.h" -#include "ui_callbacks.h" -#include "ui_filters.h" - -#include "ui_signal_dissect_view.h" - -typedef struct -{ - GtkListStore *store; - GtkTreeModelFilter *filtered; - uint32_t filtered_last_msg; - uint32_t filtered_msg_number; - uint32_t instance_number; -} ui_store_t; - -static ui_store_t ui_store; - -GtkWidget *ui_tree_view_menu; -ui_tree_view_menu_enable_t ui_tree_view_menu_enable[NUM_MENU_TYPE]; - -GdkEventButton *ui_tree_view_last_event; - -static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter, ui_store_t *store) -{ - uint32_t msg_number; - uint32_t message_id; - uint32_t origin_task_id; - uint32_t destination_task_id; - uint32_t instance; - - gboolean enabled = TRUE; - - if (ui_filters.filters_enabled) - { - gtk_tree_model_get (model, iter, COL_MSG_NUM, &msg_number, COL_MESSAGE_ID, &message_id, COL_FROM_TASK_ID, - &origin_task_id, COL_TO_TASK_ID, &destination_task_id, COL_INSTANCE_ID, &instance, -1); - if (msg_number != 0) - { - enabled = ui_filters_message_enabled (message_id, origin_task_id, destination_task_id, instance); - - if ((enabled) && (store->filtered_last_msg < msg_number)) - { - store->filtered_last_msg = msg_number; - store->filtered_msg_number++; - } - g_debug("ui_tree_filter_messages: %p %p %d m:%d o:%d d:%d i:%d %d %d", model, iter, msg_number, message_id, origin_task_id, destination_task_id, instance, enabled, store->filtered_msg_number); - } - } - - return enabled; -} - -static gboolean onButtonPressed(GtkWidget *treeview, GdkEventButton *event, gpointer userdata) -{ - g_info("onButtonPressed %p %p %p %d %d", treeview, event, userdata, event->type, event->button); - ui_tree_view_last_event = event; - - return FALSE; -} - -/* - static gboolean onButtonRelease(GtkWidget *treeview, GdkEventButton *event, gpointer userdata) - { - g_info("onButtonRelease %p %p %p %d %d", treeview, event, userdata, event->type, event->button); - // last_event = event; - - return FALSE; - } - */ - -static void ui_tree_view_init_list(GtkWidget *list) -{ - GtkCellRenderer *renderer_left; - GtkCellRenderer *renderer_right; - GtkTreeViewColumn *column; - - renderer_left = gtk_cell_renderer_text_new (); - gtk_cell_renderer_set_padding (renderer_left, 5, 0); - - renderer_right = gtk_cell_renderer_text_new (); - gtk_cell_renderer_set_alignment (renderer_right, 1, 0.5); - gtk_cell_renderer_set_padding (renderer_right, 5, 0); - - column = gtk_tree_view_column_new_with_attributes ("MN", renderer_right, "text", COL_MSG_NUM, "foreground", - COL_FOREGROUND, "background", COL_BACKGROUND, NULL); - gtk_tree_view_column_set_resizable (column, TRUE); - gtk_tree_view_column_set_alignment (column, 0.5); - gtk_tree_view_append_column (GTK_TREE_VIEW(list), column); - - column = gtk_tree_view_column_new_with_attributes ("LTE Time", renderer_right, "text", COL_LTE_TIME, NULL); - gtk_tree_view_column_set_resizable (column, TRUE); - gtk_tree_view_column_set_alignment (column, 0.5); - gtk_tree_view_append_column (GTK_TREE_VIEW(list), column); - - column = gtk_tree_view_column_new_with_attributes ("Message", renderer_left, "text", COL_MESSAGE, "foreground", - COL_FOREGROUND, "background", COL_BACKGROUND, "strikethrough", - COL_STRIKETHROUGH, "style", COL_STYLE, "weight", COL_WEIGHT, "underline", COL_UNDERLINE, NULL); - gtk_tree_view_column_set_resizable (column, TRUE); - gtk_tree_view_column_set_alignment (column, 0.5); - gtk_tree_view_append_column (GTK_TREE_VIEW(list), column); - g_signal_connect(G_OBJECT(column), "clicked", G_CALLBACK(ui_callback_on_tree_column_header_click), - (gpointer) COL_MESSAGE); - - column = gtk_tree_view_column_new_with_attributes ("From", renderer_left, "text", COL_FROM_TASK, NULL); - gtk_tree_view_column_set_alignment (column, 0.5); - gtk_tree_view_column_set_resizable (column, TRUE); - gtk_tree_view_append_column (GTK_TREE_VIEW(list), column); - g_signal_connect(G_OBJECT(column), "clicked", G_CALLBACK(ui_callback_on_tree_column_header_click), - (gpointer) COL_FROM_TASK); - - column = gtk_tree_view_column_new_with_attributes ("To", renderer_left, "text", COL_TO_TASK, NULL); - gtk_tree_view_column_set_alignment (column, 0.5); - gtk_tree_view_column_set_resizable (column, TRUE); - gtk_tree_view_append_column (GTK_TREE_VIEW(list), column); - g_signal_connect(G_OBJECT(column), "clicked", G_CALLBACK(ui_callback_on_tree_column_header_click), - (gpointer) COL_TO_TASK); - - column = gtk_tree_view_column_new_with_attributes ("Ins", renderer_right, "text", COL_INSTANCE, NULL); - gtk_tree_view_column_set_alignment (column, 0.5); - gtk_tree_view_append_column (GTK_TREE_VIEW(list), column); - g_signal_connect(G_OBJECT(column), "clicked", G_CALLBACK(ui_callback_on_tree_column_header_click), - (gpointer) COL_INSTANCE); - - ui_store.store = gtk_list_store_new (NUM_COLS, // Number of columns - // Displayed columns - G_TYPE_UINT, // COL_MSG_NUM - G_TYPE_STRING, // COL_LTE_TIME - G_TYPE_STRING, // COL_MESSAGE - G_TYPE_STRING, // COL_FROM_TASK - G_TYPE_STRING, // COL_TO_TASK - G_TYPE_STRING, // COL_INSTANCE - // Not displayed columns - // Id of some message fields to speed-up filtering - G_TYPE_UINT, // COL_MESSAGE_ID - G_TYPE_UINT, // COL_FROM_TASK_ID - G_TYPE_UINT, // COL_TO_TASK_ID - G_TYPE_UINT, // COL_INSTANCE_ID - G_TYPE_STRING, // COL_FOREGROUND - G_TYPE_STRING, // COL_BACKGROUND - G_TYPE_BOOLEAN, // COL_STRIKETHROUGH - G_TYPE_UINT, - G_TYPE_UINT, - G_TYPE_UINT, - // Reference to the buffer here to avoid maintaining multiple lists. - G_TYPE_POINTER); - - if (ui_store.store == NULL) - { - g_error("gtk_list_store_new failed"); - } - - ui_store.filtered = GTK_TREE_MODEL_FILTER (gtk_tree_model_filter_new (GTK_TREE_MODEL (ui_store.store), NULL)); - gtk_tree_model_filter_set_visible_func (ui_store.filtered, (GtkTreeModelFilterVisibleFunc) ui_tree_filter_messages, - &ui_store, NULL); - - gtk_tree_view_set_model (GTK_TREE_VIEW(list), GTK_TREE_MODEL(ui_store.filtered)); - - gtk_tree_view_columns_autosize (GTK_TREE_VIEW(list)); -} - -static void ui_tree_view_add_to_list(GtkWidget *list, const gchar *lte_time, const uint32_t message_number, - const uint32_t message_id, const gchar *signal_name, const uint32_t origin_task_id, - const char *origin_task_name, const uint32_t destination_task_id, - const char *destination_task_name, uint32_t instance_id, const char *instance_name, gpointer buffer) -{ - static int counter = 0; - - GtkTreeIter iter; - gboolean enabled; - int message_index; - - g_info("ui_tree_view_add_to_list: %d %d %d %d %d", message_number, message_id, origin_task_id, destination_task_id, instance_id); - - enabled = ui_filters_message_enabled (message_id, origin_task_id, destination_task_id, instance_id); - message_index = ui_filters_search_id (&ui_filters.messages, message_id); - - g_info("ui_tree_view_add_to_list: %d %d", enabled, message_index); - - gtk_list_store_append (ui_store.store, &iter); - gtk_list_store_set (ui_store.store, &iter, - /* Columns */ - COL_MSG_NUM, - message_number, COL_LTE_TIME, lte_time, COL_MESSAGE, signal_name, COL_FROM_TASK, origin_task_name, - COL_TO_TASK, destination_task_name, COL_INSTANCE, instance_name, COL_MESSAGE_ID, message_id, - COL_FROM_TASK_ID, origin_task_id, COL_TO_TASK_ID, destination_task_id, COL_INSTANCE_ID, instance_id, - COL_BUFFER, buffer, COL_FOREGROUND, ui_filters.messages.items[message_index].foreground, COL_BACKGROUND, - ui_filters.messages.items[message_index].background, COL_STRIKETHROUGH, !enabled, -// COL_STYLE, (counter % 2) == 0 ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL, -// COL_WEIGHT, ((counter + 2) % 4) < 2 ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, -// COL_UNDERLINE, ((counter + 4) % 8) < 4 ?PANGO_UNDERLINE_SINGLE : PANGO_UNDERLINE_NONE, - COL_STYLE, PANGO_STYLE_NORMAL, - COL_WEIGHT, PANGO_WEIGHT_NORMAL, - COL_UNDERLINE, PANGO_UNDERLINE_NONE, - /* End of columns */ - -1); - counter++; -} - -void ui_tree_view_destroy_list(GtkWidget *list) -{ - g_assert(list != NULL); - - gtk_list_store_clear (ui_store.store); - ui_store.filtered_last_msg = 0; - ui_store.filtered_msg_number = 0; - ui_store.instance_number = 0; - - /* Reset number of messages */ - ui_main_data.nb_message_received = 0; -} - -/* Search for the message with its message number equal to the given value or the previous one */ -static gboolean ui_tree_view_search(GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, - gpointer search_data) -{ - uint32_t msg_number; - uint32_t key_value = atoi (key); - - gtk_tree_model_get (model, iter, column, &msg_number, -1); - - g_debug("ui_tree_view_search %d %d", key_value, msg_number); - - if (key_value == msg_number) - { - /* Value found, use this message */ - return 0; - } - - { - GtkTreeIter iter_next = *iter; - - if (gtk_tree_model_iter_next (model, &iter_next)) - { - gtk_tree_model_get (model, &iter_next, column, &msg_number, -1); - - if (key_value < msg_number) - { - /* Next value will be greater, use this message */ - return 0; - } - } - else - { - /* Last value, use this message */ - return 0; - } - } - return 1; -} - -static void ui_tree_view_create_menu(GtkWidget **menu) -{ - GtkWidget *menu_items; - - *menu = gtk_menu_new (); - - /* Create the "Message enable" menu-item */ - { - /* Create a new menu-item */ - menu_items = gtk_check_menu_item_new (); - ui_tree_view_menu_enable[MENU_MESSAGE].menu_enable = menu_items; - - /* Add it to the menu. */ - gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items); - g_signal_connect(G_OBJECT(menu_items), "activate", G_CALLBACK(ui_callback_on_menu_enable), - &ui_tree_view_menu_enable[MENU_MESSAGE]); - - /* Show the widget */ - gtk_widget_show (menu_items); - } - - /* Create the "Destination task enable" menu-item */ - { - /* Create a new menu-item */ - menu_items = gtk_check_menu_item_new (); - ui_tree_view_menu_enable[MENU_FROM_TASK].menu_enable = menu_items; - - /* Add it to the menu. */ - gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items); - g_signal_connect(G_OBJECT(menu_items), "activate", G_CALLBACK(ui_callback_on_menu_enable), - &ui_tree_view_menu_enable[MENU_FROM_TASK]); - - /* Show the widget */ - gtk_widget_show (menu_items); - } - - /* Create the "Origin task enable" menu-item */ - { - /* Create a new menu-item */ - menu_items = gtk_check_menu_item_new (); - ui_tree_view_menu_enable[MENU_TO_TASK].menu_enable = menu_items; - - /* Add it to the menu. */ - gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items); - g_signal_connect(G_OBJECT(menu_items), "activate", G_CALLBACK(ui_callback_on_menu_enable), - &ui_tree_view_menu_enable[MENU_TO_TASK]); - - /* Show the widget */ - gtk_widget_show (menu_items); - } - - /* Create the "Instance enable" menu-item */ - { - /* Create a new menu-item */ - menu_items = gtk_check_menu_item_new (); - ui_tree_view_menu_enable[MENU_INSTANCE].menu_enable = menu_items; - - /* Add it to the menu. */ - gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items); - g_signal_connect(G_OBJECT(menu_items), "activate", G_CALLBACK(ui_callback_on_menu_enable), - &ui_tree_view_menu_enable[MENU_INSTANCE]); - - /* Show the widget */ - gtk_widget_show (menu_items); - } - - /* Create the "Foreground color" menu-item */ - { - static ui_tree_view_menu_color_t menu_color_foreground = - {TRUE, &ui_tree_view_menu_enable[MENU_MESSAGE]}; - - /* Create a new menu-item with a name */ - menu_items = gtk_menu_item_new_with_label ("Select message foreground color"); - - /* Add it to the menu. */ - gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items); - g_signal_connect(G_OBJECT(menu_items), "activate", G_CALLBACK(ui_callback_on_menu_color), - &menu_color_foreground); - - /* Show the widget */ - gtk_widget_show (menu_items); - } - - /* Create the "Background color" menu-item */ - { - static ui_tree_view_menu_color_t menu_color_background = - {FALSE, &ui_tree_view_menu_enable[MENU_MESSAGE]}; - - /* Create a new menu-item with a name */ - menu_items = gtk_menu_item_new_with_label ("Select message background color"); - - /* Add it to the menu. */ - gtk_menu_shell_append (GTK_MENU_SHELL(*menu), menu_items); - g_signal_connect(G_OBJECT(menu_items), "activate", G_CALLBACK(ui_callback_on_menu_color), - &menu_color_background); - - /* Show the widget */ - gtk_widget_show (menu_items); - } -} - -int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox) -{ - GtkWidget *hbox; - GtkTreeSelection *selection; - GtkWidget *scrolled_window; - - scrolled_window = gtk_scrolled_window_new (NULL, NULL); - - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); - - ui_main_data.messages_list = gtk_tree_view_new (); - gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(ui_main_data.messages_list), TRUE); - gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW(ui_main_data.messages_list), ui_tree_view_search, NULL, NULL); - gtk_tree_view_set_search_entry (GTK_TREE_VIEW(ui_main_data.messages_list), - GTK_ENTRY(ui_main_data.signals_go_to_entry)); - - /* Disable multiple selection */ - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(ui_main_data.messages_list)); - gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE); - - hbox = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); - - gtk_container_add (GTK_CONTAINER(scrolled_window), ui_main_data.messages_list); - - ui_tree_view_init_list (ui_main_data.messages_list); - gtk_tree_view_set_headers_clickable (GTK_TREE_VIEW(ui_main_data.messages_list), TRUE); - - gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW(scrolled_window), 680); - gtk_paned_pack1 (GTK_PANED (hbox), scrolled_window, FALSE, TRUE); - ui_main_data.text_view = ui_signal_dissect_new (hbox); - - gtk_box_pack_start (GTK_BOX(vbox), hbox, TRUE, TRUE, 5); - - g_signal_connect(G_OBJECT(ui_main_data.messages_list), "button-press-event", G_CALLBACK (onButtonPressed), NULL); - // g_signal_connect(G_OBJECT(ui_main_data.signalslist), "button-release-event", G_CALLBACK (onButtonRelease), NULL); - - /* Connect callback on row selection */ - gtk_tree_selection_set_select_function (selection, ui_callback_on_select_signal, ui_main_data.text_view, NULL); - - ui_store.filtered_last_msg = 0; - ui_store.filtered_msg_number = 0; - ui_store.instance_number = 0; - - ui_main_data.selection = selection; - - ui_tree_view_create_menu (&ui_tree_view_menu); - - return 0; -} - -int ui_tree_view_new_signal_ind(const uint32_t message_number, const gchar *lte_time, const uint32_t message_id, - const char *message_name, const uint32_t origin_task_id, const char *origin_task_name, - const uint32_t destination_task_id, const char *destination_task_name, uint32_t instance_id, - gpointer buffer) -{ - char *instance_name = NULL; - char instance_name_buffer[10]; - - if (((instance_t) instance_id) < INSTANCE_DEFAULT) - { - if (ui_store.instance_number < (instance_id + 1)) - { - int i; - - for (i = ui_store.instance_number; i <= instance_id; i++) - { - sprintf (instance_name_buffer, "%d", i); - ui_filters_add (FILTER_INSTANCES, i, instance_name_buffer, ENTRY_ENABLED_TRUE, NULL, NULL); - } - ui_store.instance_number = (instance_id + 1); - ui_destroy_filter_menu (FILTER_INSTANCES); - } - - sprintf (instance_name_buffer, "%d", instance_id); - instance_name = instance_name_buffer; - } - else - { - switch ((instance_t) instance_id) - { - case INSTANCE_DEFAULT: - instance_name = "DEF"; - break; - - case INSTANCE_ALL: - instance_name = "ALL"; - break; - - default: - break; - } - - if ((instance_name != NULL) && (ui_filters_search_id (&ui_filters.instances, instance_id) < 0)) - { - ui_filters_add (FILTER_INSTANCES, instance_id, instance_name, ENTRY_ENABLED_TRUE, NULL, NULL); - } - } - - ui_tree_view_add_to_list (ui_main_data.messages_list, lte_time, message_number, message_id, message_name, - origin_task_id, origin_task_name, destination_task_id, destination_task_name, instance_id, instance_name, - buffer); - - return RC_OK; -} - -void ui_tree_view_select_row(gint row) -{ - GtkTreePath *path_row; - - if (row >= 0) - { - path_row = gtk_tree_path_new_from_indices (row, -1); - - if ((ui_main_data.messages_list != NULL) && (path_row != NULL)) - { - g_info("Select row %d", row); - - /* Select the message in requested row */ - gtk_tree_view_set_cursor (GTK_TREE_VIEW(ui_main_data.messages_list), path_row, NULL, FALSE); - /* Center the message in the middle of the list if possible */ - gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(ui_main_data.messages_list), path_row, NULL, TRUE, 0.5, 0.0); - } - } -} - -static gboolean updateColors(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) -{ - uint32_t message_id; - uint32_t origin_task_id; - uint32_t destination_task_id; - uint32_t instance; - - gboolean enabled = FALSE; - int message_index; - - gtk_tree_model_get (model, iter, COL_MESSAGE_ID, &message_id, COL_FROM_TASK_ID, &origin_task_id, COL_TO_TASK_ID, - &destination_task_id, COL_INSTANCE_ID, &instance, -1); - enabled = ui_filters_message_enabled (message_id, origin_task_id, destination_task_id, instance); - message_index = ui_filters_search_id (&ui_filters.messages, message_id); - - gtk_list_store_set (GTK_LIST_STORE(model), iter, COL_FOREGROUND, - ui_filters.messages.items[message_index].foreground, COL_BACKGROUND, - ui_filters.messages.items[message_index].background, COL_STRIKETHROUGH, !enabled, -1); - - return FALSE; -} - -void ui_tree_view_refilter() -{ - ui_store.filtered_last_msg = 0; - ui_store.filtered_msg_number = 0; - - /* Update foreground color of messages, this will also update filtered model */ - if (ui_store.store != NULL) - { - gtk_tree_model_foreach (GTK_TREE_MODEL(ui_store.store), updateColors, NULL); - - if (ui_main_data.messages_list != NULL) - { - GtkTreePath *path_row; - - /* Get the currently selected message */ - gtk_tree_view_get_cursor (GTK_TREE_VIEW(ui_main_data.messages_list), &path_row, NULL); - if (path_row != NULL) - { - /* Center the message in the middle of the list if possible */ - gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(ui_main_data.messages_list), path_row, NULL, TRUE, 0.5, - 0.0); - g_info("ui_tree_view_refilter: center on message"); - } - } - } - - g_info("ui_tree_view_refilter: last message %d, %d messages displayed", ui_store.filtered_last_msg, ui_store.filtered_msg_number); -} - -typedef struct foreach_message_params_s -{ - message_write_callback_t callback; - gboolean filter; -} foreach_message_params_t; - -static gboolean foreach_message(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) -{ - foreach_message_params_t *params = (foreach_message_params_t *) data; - const gchar *signal_name; - uint32_t message_id; - uint32_t origin_task_id; - uint32_t destination_task_id; - uint32_t instance; - gpointer buffer = NULL; - - gtk_tree_model_get (model, iter, COL_MESSAGE, &signal_name, COL_MESSAGE_ID, &message_id, COL_FROM_TASK_ID, &origin_task_id, COL_TO_TASK_ID, - &destination_task_id, COL_INSTANCE_ID, &instance, COL_BUFFER, &buffer, -1); - - if (params->filter == TRUE) - { - gboolean enabled = FALSE; - - enabled = ui_filters_message_enabled (message_id, origin_task_id, destination_task_id, instance); - if (enabled == FALSE) - { - buffer = NULL; - } - } - - if (buffer != NULL) - { - params->callback(buffer, signal_name); - } - - return FALSE; -} - -void ui_tree_view_foreach_message(message_write_callback_t callback, gboolean filter) -{ - foreach_message_params_t params = {callback, filter}; - - gtk_tree_model_foreach (GTK_TREE_MODEL(ui_store.store), foreach_message, (void *) ¶ms); -} - -guint ui_tree_view_get_filtered_number(void) -{ - return ui_store.filtered_msg_number; -} diff --git a/common/utils/itti_analyzer/libui/ui_tree_view.h b/common/utils/itti_analyzer/libui/ui_tree_view.h deleted file mode 100644 index 88ab2fce71..0000000000 --- a/common/utils/itti_analyzer/libui/ui_tree_view.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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 - */ - -#ifndef UI_TREE_VIEW_H_ -#define UI_TREE_VIEW_H_ - -#include "ui_filters.h" -#include "ui_notifications.h" - -typedef enum col_type_e -{ - COL_MSG_NUM = 0, - COL_LTE_TIME, - COL_MESSAGE, - COL_FROM_TASK, - COL_TO_TASK, - COL_INSTANCE, - - COL_MESSAGE_ID, - COL_FROM_TASK_ID, - COL_TO_TASK_ID, - COL_INSTANCE_ID, - COL_FOREGROUND, - COL_BACKGROUND, - COL_STRIKETHROUGH, - COL_STYLE, - COL_WEIGHT, - COL_UNDERLINE, - - COL_BUFFER, - NUM_COLS -} col_type_t; - -typedef enum ui_tree_view_menu_type_e -{ - MENU_MESSAGE = 0, - MENU_FROM_TASK, - MENU_TO_TASK, - MENU_INSTANCE, - NUM_MENU_TYPE, -} ui_tree_view_menu_type_t; - -typedef struct ui_tree_view_menu_enable_s -{ - GtkWidget *menu_enable; - ui_filter_item_t *filter_item; -} ui_tree_view_menu_enable_t; - -typedef struct ui_tree_view_menu_color_s -{ - gboolean foreground; - ui_tree_view_menu_enable_t *menu_enable; -} ui_tree_view_menu_color_t; - -extern GtkWidget *ui_tree_view_menu; -extern ui_tree_view_menu_enable_t ui_tree_view_menu_enable[NUM_MENU_TYPE]; - -extern GdkEventButton *ui_tree_view_last_event; - -int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox); - -int ui_tree_view_new_signal_ind(const uint32_t message_number, const gchar *lte_time, - const uint32_t message_id, const char *message_name, - const uint32_t origin_task_id, const char *origin_task, - const uint32_t destination_task_id, const char *to_task, - uint32_t instance, gpointer buffer); - -void ui_tree_view_destroy_list(GtkWidget *list); - -void ui_tree_view_select_row(gint row); - -void ui_tree_view_refilter(void); - -void ui_tree_view_foreach_message(message_write_callback_t callback, gboolean filter); - -guint ui_tree_view_get_filtered_number(void); - -#endif /* UI_TREE_VIEW_H_ */ diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c index ae87a8e326..7cc5f79f90 100644 --- a/common/utils/msc/msc.c +++ b/common/utils/msc/msc.c @@ -88,7 +88,7 @@ void *msc_task(void *args_p) if (received_message_p != NULL) { // msg_name = ITTI_MSG_NAME (received_message_p); - // instance = ITTI_MSG_INSTANCE (received_message_p); + // instance = ITTI_MSG_DESTINATION_INSTANCE (received_message_p); switch (ITTI_MSG_ID(received_message_p)) { case TIMER_HAS_EXPIRED: { msc_flush_messages(); diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index e81851c273..d66ea027c9 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -30,30 +30,32 @@ extern "C" { #include #include -typedef struct timer_elm_s { - timer_type_t type; ///< Timer type - long instance; - long duration; - uint64_t timeout; - void *timer_arg; ///< Optional argument that will be passed when timer expires -} timer_elm_t ; + typedef struct timer_elm_s { + timer_type_t type; ///< Timer type + long instance; + long duration; + uint64_t timeout; + void *timer_arg; ///< Optional argument that will be passed when timer expires + } timer_elm_t ; -typedef struct task_list_s { - task_info_t admin; - pthread_t thread; - pthread_mutex_t queue_cond_lock; - std::vector message_queue; - std::map timer_map; - uint64_t next_timer=UINT64_MAX; - struct epoll_event *events =NULL; - int nb_fd_epoll=0; - int nb_events=0; - int epoll_fd=-1; - int sem_fd=-1; -} task_list_t; + typedef struct task_list_s { + task_info_t admin; + pthread_t thread; + pthread_mutex_t queue_cond_lock; + std::vector message_queue; + std::map timer_map; + uint64_t next_timer=UINT64_MAX; + struct epoll_event *events =NULL; + int nb_fd_epoll=0; + int nb_events=0; + int epoll_fd=-1; + int sem_fd=-1; + } task_list_t; -int timer_expired(int fd); -task_list_t tasks[TASK_MAX]; + int timer_expired(int fd); + task_list_t *tasks; + static int nb_queues=0; + static pthread_mutex_t lock_nb_queues; void *pool_buffer_init (void) { return 0; @@ -99,7 +101,7 @@ task_list_t tasks[TASK_MAX]; // #define S1AP_REGISTER_ENB_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_register_enb_req // would become // #define S1AP_REGISTER_ENB_REQ(mSGpTR) (s1ap_register_enb_req) mSGpTR)->ittiMsg - MessageDef *itti_alloc_new_message_sized(task_id_t origin_task_id, MessagesIds message_id, MessageHeaderSize size) { + MessageDef *itti_alloc_new_message_sized(task_id_t origin_task_id, instance_t originInstance, MessagesIds message_id, MessageHeaderSize size) { MessageDef *temp = (MessageDef *)itti_malloc (origin_task_id, TASK_UNKNOWN, sizeof(MessageHeader) +32 + size); temp->ittiMsgHeader.messageId = message_id; temp->ittiMsgHeader.originTaskId = origin_task_id; @@ -107,23 +109,24 @@ task_list_t tasks[TASK_MAX]; return temp; } - MessageDef *itti_alloc_new_message(task_id_t origin_task_id, MessagesIds message_id) { + MessageDef *itti_alloc_new_message(task_id_t origin_task_id, instance_t originInstance, MessagesIds message_id) { int size=sizeof(MessageHeader) + 32 + messages_info[message_id].size; MessageDef *temp = (MessageDef *)itti_malloc (origin_task_id, TASK_UNKNOWN, size); temp->ittiMsgHeader.messageId = message_id; temp->ittiMsgHeader.originTaskId = origin_task_id; temp->ittiMsgHeader.ittiMsgSize = size; temp->ittiMsgHeader.destinationTaskId=TASK_UNKNOWN; - temp->ittiMsgHeader.instance=0; - temp->ittiMsgHeader.lte_time={0}; + temp->ittiMsgHeader.originInstance=originInstance; + temp->ittiMsgHeader.destinationInstance=0; + temp->ittiMsgHeader.lte_time= {0}; return temp; //return itti_alloc_new_message_sized(origin_task_id, message_id, messages_info[message_id].size); } - static inline int itti_send_msg_to_task_locked(task_id_t destination_task_id, instance_t instance, MessageDef *message) { + static inline int itti_send_msg_to_task_locked(task_id_t destination_task_id, instance_t destinationInstance, MessageDef *message) { task_list_t *t=tasks+destination_task_id; message->ittiMsgHeader.destinationTaskId = destination_task_id; - message->ittiMsgHeader.instance = instance; + message->ittiMsgHeader.destinationInstance = destinationInstance; message->ittiMsgHeader.lte_time.frame = 0; message->ittiMsgHeader.lte_time.slot = 0; int message_id = message->ittiMsgHeader.messageId; @@ -142,18 +145,20 @@ task_list_t tasks[TASK_MAX]; return 0; } - int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, MessageDef *message) { + int itti_send_msg_to_task(task_id_t destination_task_id, instance_t destinationInstance, MessageDef *message) { task_list_t *t=&tasks[destination_task_id]; pthread_mutex_lock (&t->queue_cond_lock); - int ret=itti_send_msg_to_task_locked(destination_task_id, instance, message); + int ret=itti_send_msg_to_task_locked(destination_task_id, destinationInstance, message); while ( t->message_queue.size()>0 && t->admin.func != NULL ) { if (t->message_queue.size()>1) - LOG_W(TMR,"queue in no thread mode is %ld\n", t->message_queue.size()); + LOG_W(TMR,"queue in no thread mode is %ld\n", t->message_queue.size()); + pthread_mutex_unlock (&t->queue_cond_lock); t->admin.func(NULL); pthread_mutex_lock (&t->queue_cond_lock); } + pthread_mutex_unlock (&t->queue_cond_lock); return ret; } @@ -194,10 +199,11 @@ task_list_t tasks[TASK_MAX]; t->next_timer=UINT64_MAX; // Proceed expired timer - for ( auto it=t->timer_map.begin() , next_it = it; it != t->timer_map.end() ; it = next_it ) { + for ( auto it=t->timer_map.begin(), next_it = it; it != t->timer_map.end() ; it = next_it ) { ++next_it; + if ( it->second.timeout < current_time ) { - MessageDef *message = itti_alloc_new_message(TASK_TIMER, TIMER_HAS_EXPIRED); + MessageDef *message = itti_alloc_new_message(TASK_TIMER, it->second.instance,TIMER_HAS_EXPIRED); message->ittiMsg.timer_has_expired.timer_id=it->first; message->ittiMsg.timer_has_expired.arg=it->second.timer_arg; @@ -229,8 +235,9 @@ task_list_t tasks[TASK_MAX]; pthread_mutex_unlock(&t->queue_cond_lock); LOG_D(TMR,"enter blocking wait for %s\n", itti_get_task_name(task_id)); t->nb_events = epoll_wait(t->epoll_fd,t->events,t->nb_fd_epoll, epoll_timeout); + if ( t->nb_events < 0 && (errno == EINTR || errno == EAGAIN ) ) - pthread_mutex_lock(&t->queue_cond_lock); + pthread_mutex_lock(&t->queue_cond_lock); } while (t->nb_events < 0 && (errno == EINTR || errno == EAGAIN ) ); AssertFatal (t->nb_events >=0, @@ -295,8 +302,7 @@ task_list_t tasks[TASK_MAX]; pthread_mutex_unlock (&t->queue_cond_lock); } - void itti_poll_msg(task_id_t task_id, MessageDef **received_msg) - { + void itti_poll_msg(task_id_t task_id, MessageDef **received_msg) { //reception of one message, non-blocking task_list_t *t=&tasks[task_id]; pthread_mutex_lock(&t->queue_cond_lock); @@ -312,11 +318,10 @@ task_list_t tasks[TASK_MAX]; } int itti_create_task(task_id_t task_id, - void *(*start_routine)(void *), - void *args_p) - { + void *(*start_routine)(void *), + void *args_p) { task_list_t *t=&tasks[task_id]; - threadCreate (&t->thread, start_routine, args_p, (char*)itti_get_task_name(task_id),-1,OAI_PRIORITY_RT); + threadCreate (&t->thread, start_routine, args_p, (char *)itti_get_task_name(task_id),-1,OAI_PRIORITY_RT); LOG_I(TMR,"Created Posix thread %s\n", itti_get_task_name(task_id) ); return 0; } @@ -325,31 +330,38 @@ task_list_t tasks[TASK_MAX]; pthread_exit (NULL); } - void itti_terminate_tasks(task_id_t task_id) - { + void itti_terminate_tasks(task_id_t task_id) { // Sends Terminate signals to all tasks. itti_send_terminate_message (task_id); usleep(100*1000); // Allow the tasks to receive the message before going returning to main thread } + void itti_create_queue(const task_info_t *task_info) { + pthread_mutex_lock (&lock_nb_queues); + int newQueue=nb_queues; + nb_queues++; + AssertFatal(reallocarray(tasks, nb_queues, sizeof(*tasks)),"no memory"); + pthread_mutex_unlock (&lock_nb_queues); + LOG_I(TMR,"Starting itti queue: %s as task %d\n", tasks_info->name, newQueue); + pthread_mutex_init(&tasks[newQueue].queue_cond_lock, NULL); + memcpy(&tasks[newQueue].admin, tasks_info, sizeof(task_info_t)); + AssertFatal( ( tasks[newQueue].epoll_fd = epoll_create1(0) ) >=0, ""); + AssertFatal( ( tasks[newQueue].sem_fd = eventfd(0, EFD_SEMAPHORE) ) >=0, ""); + itti_subscribe_event_fd((task_id_t)newQueue, tasks[newQueue].sem_fd); + + if (tasks[newQueue].admin.threadFunc != NULL) + itti_create_task((task_id_t)newQueue, tasks[newQueue].admin.threadFunc, NULL); + } + int itti_init(task_id_t task_max, - thread_id_t thread_max, - MessagesIds messages_id_max, - const task_info_t *tasks_info, - const message_info_t *messages_info) - { - AssertFatal(TASK_MAX=0, ""); - AssertFatal( ( tasks[i].sem_fd = eventfd(0, EFD_SEMAPHORE) ) >=0, ""); - itti_subscribe_event_fd((task_id_t)i, tasks[i].sem_fd); - - if (tasks[i].admin.threadFunc != NULL) - itti_create_task((task_id_t)i, tasks[i].admin.threadFunc, NULL); + itti_create_queue(&tasks_info[i]); } return 0; @@ -359,11 +371,10 @@ task_list_t tasks[TASK_MAX]; uint32_t interval_sec, uint32_t interval_us, task_id_t task_id, - int32_t instance, + instance_t instance, timer_type_t type, void *timer_arg, - long *timer_id) - { + long *timer_id) { task_list_t *t=&tasks[task_id]; do { @@ -397,8 +408,7 @@ task_list_t tasks[TASK_MAX]; return 0; } - int timer_remove(long timer_id) - { + int timer_remove(long timer_id) { task_id_t task_id=(task_id_t)(timer_id&0xffff); int ret; pthread_mutex_lock (&tasks[task_id].queue_cond_lock); @@ -439,5 +449,7 @@ task_list_t tasks[TASK_MAX]; void itti_wait_ready(int wait_tasks) { // Stupid function, kept for compatibility (the parameter is meaningless!!!) } - int signal_mask(void) { return 0;} + int signal_mask(void) { + return 0; + } } diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h index a40660eb9e..53d76b7a77 100644 --- a/common/utils/ocp_itti/intertask_interface.h +++ b/common/utils/ocp_itti/intertask_interface.h @@ -45,7 +45,7 @@ typedef struct { uint32_t interval_sec; uint32_t interval_us; long task_id; - int32_t instance; + instance_t instance; timer_type_t type; void *timer_arg; long timer_id; @@ -403,7 +403,8 @@ typedef struct MessageHeader_s { MessagesIds messageId; /**< Unique message id as referenced in enum MessagesIds */ task_id_t originTaskId; /**< ID of the sender task */ task_id_t destinationTaskId; /**< ID of the destination task */ - instance_t instance; /**< Task instance for virtualization */ + instance_t originInstance; + instance_t destinationInstance; itti_lte_time_t lte_time; MessageHeaderSize ittiMsgSize; /**< Message size (not including header size) */ } MessageHeader; @@ -433,11 +434,11 @@ typedef struct MessageDef_s { /* Extract the instance from a message */ -#define ITTI_MESSAGE_GET_INSTANCE(mESSAGE) ((mESSAGE)->ittiMsgHeader.instance) #define ITTI_MSG_ID(mSGpTR) ((mSGpTR)->ittiMsgHeader.messageId) #define ITTI_MSG_ORIGIN_ID(mSGpTR) ((mSGpTR)->ittiMsgHeader.originTaskId) #define ITTI_MSG_DESTINATION_ID(mSGpTR) ((mSGpTR)->ittiMsgHeader.destinationTaskId) -#define ITTI_MSG_INSTANCE(mSGpTR) ((mSGpTR)->ittiMsgHeader.instance) +#define ITTI_MSG_ORIGIN_INSTANCE(mSGpTR) ((mSGpTR)->ittiMsgHeader.originInstance) +#define ITTI_MSG_DESTINATION_INSTANCE(mSGpTR) ((mSGpTR)->ittiMsgHeader.destinationInstance) #define ITTI_MSG_NAME(mSGpTR) itti_get_message_name(ITTI_MSG_ID(mSGpTR)) #define ITTI_MSG_ORIGIN_NAME(mSGpTR) itti_get_task_name(ITTI_MSG_ORIGIN_ID(mSGpTR)) #define ITTI_MSG_DESTINATION_NAME(mSGpTR) itti_get_task_name(ITTI_MSG_DESTINATION_ID(mSGpTR)) @@ -530,6 +531,7 @@ const char *itti_get_task_name(task_id_t task_id); **/ MessageDef *itti_alloc_new_message( task_id_t origin_task_id, + instance_t originInstance, MessagesIds message_id); /** \brief Alloc and memset(0) a new itti message. @@ -540,6 +542,7 @@ MessageDef *itti_alloc_new_message( **/ MessageDef *itti_alloc_new_message_sized( task_id_t origin_task_id, + instance_t originInstance, MessagesIds message_id, MessageHeaderSize size); @@ -547,7 +550,7 @@ MessageDef *itti_alloc_new_message_sized( This function should be called from the main thread after having created all ITTI tasks. **/ void itti_wait_tasks_end(void); -#define THREAD_MAX 0 //for compatibility +#define ADDED_QUEUES_MAX 10 // Fix me: MSC component too hard to understand, we keep room for 10 queues created dynamically void itti_set_task_real_time(task_id_t task_id); /** \brief Send a termination message to all tasks. @@ -561,13 +564,13 @@ void *malloc_or_fail(size_t size); int memory_read(const char *datafile, void *data, size_t size); int itti_free(task_id_t task_id, void *ptr); -int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_id_max, const task_info_t *tasks_info, +int itti_init(task_id_t task_max, MessagesIds messages_id_max, const task_info_t *tasks_info, const message_info_t *messages_info); int timer_setup( uint32_t interval_sec, uint32_t interval_us, task_id_t task_id, - int32_t instance, + instance_t instance, timer_type_t type, void *timer_arg, long *timer_id); diff --git a/executables/main-ocp.c b/executables/main-ocp.c index 6e5857d6d1..f464bbd7bc 100644 --- a/executables/main-ocp.c +++ b/executables/main-ocp.c @@ -1056,7 +1056,7 @@ void terminate_task(module_id_t mod_id, task_id_t from, task_id_t to) { LOG_I(ENB_APP, "sending TERMINATE_MESSAGE from task %s (%d) to task %s (%d)\n", itti_get_task_name(from), from, itti_get_task_name(to), to); MessageDef *msg; - msg = itti_alloc_new_message (from, TERMINATE_MESSAGE); + msg = itti_alloc_new_message (from, 0, TERMINATE_MESSAGE); itti_send_msg_to_task (to, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg); } @@ -1107,7 +1107,7 @@ int restart_L1L2(module_id_t enb_id) { itti_mark_task_ready(TASK_RRC_ENB); /* pass a reconfiguration request which will configure everything down to * RC.eNB[i][j]->frame_parms, too */ - msg_p = itti_alloc_new_message(TASK_ENB_APP, RRC_CONFIGURATION_REQ); + msg_p = itti_alloc_new_message(TASK_ENB_APP, 0, RRC_CONFIGURATION_REQ); RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration; itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); init_eNB_afterRU(); @@ -1141,7 +1141,7 @@ int main ( int argc, char **argv ) { if (opp_enabled ==1) reset_opp_meas(); - itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); init_opt(); #ifndef PACKAGE_VERSION # define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL" @@ -1196,7 +1196,7 @@ int main ( int argc, char **argv ) { AssertFatal(create_tasks(1)==0,"cannot create ITTI tasks\n"); for (int enb_id = 0; enb_id < RC.nb_inst; enb_id++) { - MessageDef *msg_p = itti_alloc_new_message (TASK_ENB_APP, RRC_CONFIGURATION_REQ); + MessageDef *msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, RRC_CONFIGURATION_REQ); RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration; itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); } diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index fb757a9f47..c3bfd09eb0 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -679,7 +679,7 @@ void wait_gNBs(void) { void terminate_task(task_id_t task_id, module_id_t mod_id) { LOG_I(GNB_APP, "sending TERMINATE_MESSAGE to task %s (%d)\n", itti_get_task_name(task_id), task_id); MessageDef *msg; - msg = itti_alloc_new_message (ENB_APP, TERMINATE_MESSAGE); + msg = itti_alloc_new_message (ENB_APP, 0, TERMINATE_MESSAGE); itti_send_msg_to_task (task_id, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg); } @@ -762,7 +762,7 @@ int restart_L1L2(module_id_t gnb_id) { /* pass a reconfiguration request which will configure everything down to * RC.eNB[i][j]->frame_parms, too */ - msg_p = itti_alloc_new_message(TASK_ENB_APP, RRC_CONFIGURATION_REQ); + msg_p = itti_alloc_new_message(TASK_ENB_APP, 0, RRC_CONFIGURATION_REQ); RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[gnb_id]->configuration; itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); /* TODO XForms might need to be restarted, but it is currently (09/02/18) @@ -863,9 +863,9 @@ int main( int argc, char **argv ) } cpuf=get_cpu_freq_GHz(); - itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); // initialize mscgen log after ITTI - MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX); + MSC_INIT(MSC_E_UTRAN, ADDED_QUEUES_MAX+TASK_MAX); init_opt(); diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 1d3288862d..e25b103860 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -514,7 +514,7 @@ int main( int argc, char **argv ) { initTpool(params_dl, Tpool_dl, false); #endif cpuf=get_cpu_freq_GHz(); - itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); init_opt() ; load_nrLDPClib(); diff --git a/executables/ocp-gnb.c b/executables/ocp-gnb.c index 67f68f43e3..ff8d8840e9 100644 --- a/executables/ocp-gnb.c +++ b/executables/ocp-gnb.c @@ -348,9 +348,9 @@ void init_main_gNB(void) { LOG_I(PHY, "%s() RC.nb_nr_inst:%d RC.nrrrc:%p\n", __FUNCTION__, RC.nb_nr_inst, RC.nrrrc); int gnb_id=0; // only 1 gnb per process, index 0 for now RC.nrrrc[gnb_id] = (gNB_RRC_INST *)calloc(sizeof(gNB_RRC_INST),1); - MessageDef *msg_p = itti_alloc_new_message (TASK_GNB_APP, NRRRC_CONFIGURATION_REQ); + MessageDef *msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NRRRC_CONFIGURATION_REQ); RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]); - openair_rrc_gNB_configuration(GNB_INSTANCE_TO_MODULE_ID(ITTI_MSG_INSTANCE(msg_p)), &NRRRC_CONFIGURATION_REQ(msg_p)); + openair_rrc_gNB_configuration(GNB_INSTANCE_TO_MODULE_ID(ITTI_MSG_DESTINATION_INSTANCE(msg_p)), &NRRRC_CONFIGURATION_REQ(msg_p)); //AssertFatal(itti_create_task(TASK_GNB_APP, gNB_app_task, NULL) >= 0, ""); AssertFatal(itti_create_task(TASK_RRC_GNB, rrc_gnb_task, NULL) >= 0, ""); //AssertFatal(itti_create_task(TASK_X2AP, x2ap_task, NULL) >= 0, ""); @@ -928,7 +928,7 @@ int main( int argc, char **argv ) { get_common_options(SOFTMODEM_GNB_BIT ); AssertFatal(!CONFIG_ISFLAGSET(CONFIG_ABORT),"Getting configuration failed\n"); cpuf=get_cpu_freq_GHz(); - itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); set_taus_seed (0); init_opt(); init_pdcp(); diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index 3215718f8e..5f8269c513 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -4948,7 +4948,7 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue, break; default: - LOG_E(PHY, "[UE %d] Received unexpected message %s\n", ITTI_MSG_INSTANCE (msg_p), ITTI_MSG_NAME (msg_p)); + LOG_E(PHY, "[UE %ld] Received unexpected message %s\n", ITTI_MSG_DESTINATION_INSTANCE (msg_p), ITTI_MSG_NAME (msg_p)); break; } diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index d3f55785c9..87489353d3 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -905,7 +905,7 @@ int main(int argc, char **argv) { // moreover you need to init itti with the following line // however itti will catch all signals, so ctrl-c won't work anymore // alternatively you can disable ITTI completely in CMakeLists.txt - //itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); + //itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); T_stdout = 1; if (common_flag == 0) { diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c index 2176e272c8..8a646bb9d5 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c @@ -689,7 +689,7 @@ int main(int argc, char **argv) // moreover you need to init itti with the following line // however itti will catch all signals, so ctrl-c won't work anymore // alternatively you can disable ITTI completely in CMakeLists.txt - //itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); + //itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); if (common_flag == 0) { switch (N_RB_DL) { diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c index 5073be24f5..8a2f10df3e 100644 --- a/openair1/SIMULATION/LTE_PHY/mbmssim.c +++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c @@ -997,7 +997,7 @@ int main(int argc, char **argv) { // moreover you need to init itti with the following line // however itti will catch all signals, so ctrl-c won't work anymore // alternatively you can disable ITTI completely in CMakeLists.txt - //itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); + //itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); if (common_flag == 0) { switch (N_RB_DL) { diff --git a/openair1/SIMULATION/LTE_PHY/pucchsim.c b/openair1/SIMULATION/LTE_PHY/pucchsim.c index a58f844945..396fce7a91 100644 --- a/openair1/SIMULATION/LTE_PHY/pucchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pucchsim.c @@ -283,7 +283,7 @@ int main(int argc, char **argv) { } logInit(); - //itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); + //itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); g_log->log_component[PHY].level = LOG_DEBUG; g_log->log_component[PHY].flag = LOG_HIGH; diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 0443cde738..344425fa62 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -409,7 +409,7 @@ int main(int argc, char **argv) { // enable these lines if you need debug info // however itti will catch all signals, so ctrl-c won't work anymore // alternatively you can disable ITTI completely in CMakeLists.txt - // itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); + // itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); // set_comp_log(PHY,LOG_DEBUG,LOG_HIGH,1); // set_glog(LOG_DEBUG,LOG_HIGH); //hapZEbm:n:Y:X:x:s:w:e:q:d:D:O:c:r:i:f:y:c:oA:C:R:g:N:l:S:T:QB:PI:LF diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h index 75e5b99222..12d90a3d06 100644 --- a/openair2/COMMON/platform_types.h +++ b/openair2/COMMON/platform_types.h @@ -229,9 +229,7 @@ typedef uint8_t ebi_t; // eps bearer id // //----------------------------------------------------------------------------- // may be ITTI not enabled, but type instance is useful also for OTG, -#if !defined(instance_t) - typedef uint16_t instance_t; -#endif +typedef int64_t instance_t; typedef struct protocol_ctxt_s { module_id_t module_id; /*!< \brief Virtualized module identifier */ eNB_flag_t enb_flag; /*!< \brief Flag to indicate eNB (1) or UE (0) */ @@ -292,7 +290,8 @@ typedef struct protocol_ctxt_s { (Ctxt_Pp)->subframe = sUBfRAME; \ PROTOCOL_CTXT_COMPUTE_MODULE_ID(Ctxt_Pp) -#define PROTOCOL_CTXT_FMT "[FRAME %05u][%s][MOD %02u][RNTI %" PRIx16 "]" +#define PROTOCOL_CTXT_FMT "[FRAME %05u][%s][MOD %02d][RNTI %" PRIx16 "]" +#define PROTOCOL_CTXT_FMTL "[FRAME %05u][%s][MOD %08ld][RNTI %" PRIx16 "]" #define PROTOCOL_CTXT_ARGS(CTXT_Pp) \ (CTXT_Pp)->frame, \ ((CTXT_Pp)->enb_flag == ENB_FLAG_YES) ? "eNB":" UE", \ diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 1d001022d2..5080157c3f 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -70,7 +70,7 @@ extern RAN_CONTEXT_t RC; // for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { // { // -// //msg_p = itti_alloc_new_message (TASK_ENB_APP, S1AP_REGISTER_ENB_REQ); +// //msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, S1AP_REGISTER_ENB_REQ); // //RCconfig_S1(msg_p, enb_id); // // if (enb_id == 0) RCconfig_gtpu(); @@ -93,14 +93,14 @@ static uint32_t eNB_app_register_m2(uint32_t enb_id_start, uint32_t enb_id_end) MessageDef *msg_p; uint32_t register_enb_m2_pending = 0; -// msg_p = itti_alloc_new_message (TASK_ENB_APP,MESSAGE_TEST ); +// msg_p = itti_alloc_new_message (TASK_ENB_APP, 0,MESSAGE_TEST ); // itti_send_msg_to_task (TASK_M2AP_MCE, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); LOG_D(ENB_APP,"Register ...\n"); for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { { - msg_p = itti_alloc_new_message (TASK_ENB_APP, M2AP_REGISTER_ENB_REQ); + msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, M2AP_REGISTER_ENB_REQ); RCconfig_M2(msg_p, enb_id); itti_send_msg_to_task (TASK_M2AP_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); register_enb_m2_pending++; @@ -115,28 +115,28 @@ static uint32_t eNB_app_register_m2(uint32_t enb_id_start, uint32_t enb_id_end) static uint32_t eNB_app_handle_m2ap_mbms_scheduling_information(instance_t instance){ //uint32_t mce_id=0; MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_ENB_APP, M2AP_MBMS_SCHEDULING_INFORMATION_RESP); + msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, M2AP_MBMS_SCHEDULING_INFORMATION_RESP); itti_send_msg_to_task (TASK_M2AP_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); return 0; } static uint32_t eNB_app_handle_m2ap_mbms_session_start_req(instance_t instance){ //uint32_t mce_id=0; MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_ENB_APP, M2AP_MBMS_SESSION_START_RESP); + msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, M2AP_MBMS_SESSION_START_RESP); itti_send_msg_to_task (TASK_M2AP_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); return 0; } static uint32_t eNB_app_handle_m2ap_mbms_session_stop_req(instance_t instance){ //uint32_t mce_id=0; MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_ENB_APP, M2AP_MBMS_SESSION_STOP_RESP); + msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, M2AP_MBMS_SESSION_STOP_RESP); itti_send_msg_to_task (TASK_M2AP_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); return 0; } static uint32_t eNB_app_handle_m2ap_mbms_session_update_req(instance_t instance){ //uint32_t mce_id=0; MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_ENB_APP, M2AP_MBMS_SESSION_UPDATE_RESP); + msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, M2AP_MBMS_SESSION_UPDATE_RESP); itti_send_msg_to_task (TASK_M2AP_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); return 0; } @@ -155,7 +155,7 @@ static uint32_t eNB_app_register(ngran_node_t node_type,uint32_t enb_id_start, u if (NODE_IS_DU(node_type)) { // F1AP registration // configure F1AP here for F1C LOG_I(ENB_APP,"ngran_eNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n"); - msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SETUP_REQ); + msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, F1AP_SETUP_REQ); RCconfig_DU_F1(msg_p, enb_id); LOG_I(ENB_APP,"[eNB %d] eNB_app_register via F1AP for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); @@ -164,7 +164,7 @@ static uint32_t eNB_app_register(ngran_node_t node_type,uint32_t enb_id_start, u } else { // S1AP registration /* note: there is an implicit relationship between the data structure and the message name */ - msg_p = itti_alloc_new_message (TASK_ENB_APP, S1AP_REGISTER_ENB_REQ); + msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, S1AP_REGISTER_ENB_REQ); RCconfig_S1(msg_p, enb_id); if (enb_id == 0) RCconfig_gtpu(); @@ -191,7 +191,7 @@ static uint32_t eNB_app_register_x2(uint32_t enb_id_start, uint32_t enb_id_end) for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { { - msg_p = itti_alloc_new_message (TASK_ENB_APP, X2AP_REGISTER_ENB_REQ); + msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, X2AP_REGISTER_ENB_REQ); RCconfig_X2(msg_p, enb_id); itti_send_msg_to_task (TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); register_enb_x2_pending++; @@ -247,7 +247,7 @@ void *eNB_app_task(void *args_p) { do { // Wait for a message itti_receive_msg (TASK_ENB_APP, &msg_p); - instance = ITTI_MSG_INSTANCE (msg_p); + instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); switch (ITTI_MSG_ID(msg_p)) { case TERMINATE_MESSAGE: @@ -266,7 +266,7 @@ void *eNB_app_task(void *args_p) { case S1AP_REGISTER_ENB_CNF: AssertFatal(!NODE_IS_DU(RC.rrc[0]->node_type), "Should not have received S1AP_REGISTER_ENB_CNF\n"); if (EPC_MODE_ENABLED) { - LOG_I(ENB_APP, "[eNB %d] Received %s: associated MME %d\n", instance, ITTI_MSG_NAME (msg_p), + LOG_I(ENB_APP, "[eNB %ld] Received %s: associated MME %d\n", instance, ITTI_MSG_NAME (msg_p), S1AP_REGISTER_ENB_CNF(msg_p).nb_mme); register_enb_pending--; @@ -280,7 +280,7 @@ void *eNB_app_task(void *args_p) { if (registered_enb == enb_nb) { /* If all eNB are registered, start L2L1 task */ MessageDef *msg_init_p; - msg_init_p = itti_alloc_new_message (TASK_ENB_APP, INITIALIZE_MESSAGE); + msg_init_p = itti_alloc_new_message (TASK_ENB_APP, 0, INITIALIZE_MESSAGE); itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p); } else { LOG_W(ENB_APP, " %d eNB not associated with a MME, retrying registration in %d seconds ...\n", @@ -323,7 +323,7 @@ void *eNB_app_task(void *args_p) { /* If all eNB cells are registered, start L2L1 task */ MessageDef *msg_init_p; - msg_init_p = itti_alloc_new_message (TASK_ENB_APP, INITIALIZE_MESSAGE); + msg_init_p = itti_alloc_new_message (TASK_ENB_APP, 0, INITIALIZE_MESSAGE); itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p); } else { @@ -347,7 +347,7 @@ void *eNB_app_task(void *args_p) { case S1AP_DEREGISTERED_ENB_IND: if (EPC_MODE_ENABLED) { - LOG_W(ENB_APP, "[eNB %d] Received %s: associated MME %d\n", instance, ITTI_MSG_NAME (msg_p), + LOG_W(ENB_APP, "[eNB %ld] Received %s: associated MME %d\n", instance, ITTI_MSG_NAME (msg_p), S1AP_DEREGISTERED_ENB_IND(msg_p).nb_mme); /* TODO handle recovering of registration */ } @@ -380,13 +380,13 @@ void *eNB_app_task(void *args_p) { break; case X2AP_DEREGISTERED_ENB_IND: - LOG_W(ENB_APP, "[eNB %d] Received %s: associated eNB %d\n", instance, ITTI_MSG_NAME (msg_p), + LOG_W(ENB_APP, "[eNB %ld] Received %s: associated eNB %d\n", instance, ITTI_MSG_NAME (msg_p), X2AP_DEREGISTERED_ENB_IND(msg_p).nb_x2); /* TODO handle recovering of registration */ break; case X2AP_REGISTER_ENB_CNF: - LOG_I(ENB_APP, "[eNB %d] Received %s: associated eNB %d\n", instance, ITTI_MSG_NAME (msg_p), + LOG_I(ENB_APP, "[eNB %ld] Received %s: associated eNB %d\n", instance, ITTI_MSG_NAME (msg_p), X2AP_REGISTER_ENB_CNF(msg_p).nb_x2); DevAssert(x2_register_enb_pending > 0); x2_register_enb_pending--; @@ -422,13 +422,13 @@ void *eNB_app_task(void *args_p) { break; case M2AP_DEREGISTERED_ENB_IND: - LOG_W(ENB_APP, "[eNB %d] Received %s: associated eNB %d\n", instance, ITTI_MSG_NAME (msg_p), + LOG_W(ENB_APP, "[eNB %ld] Received %s: associated eNB %d\n", instance, ITTI_MSG_NAME (msg_p), M2AP_DEREGISTERED_ENB_IND(msg_p).nb_m2); /* TODO handle recovering of registration */ break; case M2AP_REGISTER_ENB_CNF: - LOG_W(ENB_APP, "[eNB %d] Received %s: associated eNB %d\n", instance, ITTI_MSG_NAME (msg_p), + LOG_W(ENB_APP, "[eNB %ld] Received %s: associated eNB %d\n", instance, ITTI_MSG_NAME (msg_p), M2AP_REGISTER_ENB_CNF(msg_p).nb_m2); DevAssert(m2_register_enb_pending > 0); m2_register_enb_pending--; @@ -485,7 +485,7 @@ void *eNB_app_task(void *args_p) { // /* If all eNB cells are registered, start L2L1 task */ // MessageDef *msg_init_p; - // msg_init_p = itti_alloc_new_message (TASK_ENB_APP, INITIALIZE_MESSAGE); + // msg_init_p = itti_alloc_new_message (TASK_ENB_APP, 0, INITIALIZE_MESSAGE); // itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p); // } else { @@ -508,15 +508,15 @@ void *eNB_app_task(void *args_p) { case M2AP_MBMS_SCHEDULING_INFORMATION: LOG_I(ENB_APP,"M2AP_SCHEDULING_INFORMATION received\n"); - eNB_app_handle_m2ap_mbms_scheduling_information(ITTI_MESSAGE_GET_INSTANCE(msg_p)); + eNB_app_handle_m2ap_mbms_scheduling_information(ITTI_MSG_DESTINATION_INSTANCE(msg_p)); break; case M2AP_MBMS_SESSION_START_REQ: LOG_I(ENB_APP,"M2AP_MBMS_SESSION_START_REQ received\n"); - eNB_app_handle_m2ap_mbms_session_start_req(ITTI_MESSAGE_GET_INSTANCE(msg_p)); + eNB_app_handle_m2ap_mbms_session_start_req(ITTI_MSG_DESTINATION_INSTANCE(msg_p)); break; case M2AP_MBMS_SESSION_STOP_REQ: LOG_I(ENB_APP,"M2AP_MBMS_SESSION_STOP_REQ received\n"); - eNB_app_handle_m2ap_mbms_session_stop_req(ITTI_MESSAGE_GET_INSTANCE(msg_p)); + eNB_app_handle_m2ap_mbms_session_stop_req(ITTI_MSG_DESTINATION_INSTANCE(msg_p)); break; case M2AP_RESET: LOG_I(ENB_APP,"M2AP_RESET received\n"); @@ -529,7 +529,7 @@ void *eNB_app_task(void *args_p) { break; case M2AP_ERROR_INDICATION: LOG_I(ENB_APP,"M2AP_MBMS_SESSION_UPDATE_REQ\n"); - eNB_app_handle_m2ap_mbms_session_update_req(ITTI_MESSAGE_GET_INSTANCE(msg_p)); + eNB_app_handle_m2ap_mbms_session_update_req(ITTI_MSG_DESTINATION_INSTANCE(msg_p)); break; case M2AP_MBMS_SERVICE_COUNTING_REQ: LOG_I(ENB_APP,"M2AP_MBMS_SERVICE_COUNTING_REQ\n"); diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index de77d783c7..7a01d35d48 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -287,7 +287,7 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) { int32_t offsetMaxLimit = 0; int32_t cycleNb = 0; - MessageDef *msg_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_CONFIGURATION_REQ); + MessageDef *msg_p = itti_alloc_new_message(TASK_RRC_ENB, 0, RRC_CONFIGURATION_REQ); ccparams_lte_t ccparams_lte; ccparams_sidelink_t SLconfig; ccparams_eMTC_t eMTCconfig; @@ -2051,7 +2051,7 @@ int RCconfig_gtpu(void ) { if (address) { MessageDef *message; - AssertFatal((message = itti_alloc_new_message(TASK_ENB_APP, GTPV1U_ENB_S1_REQ))!=NULL,""); + AssertFatal((message = itti_alloc_new_message(TASK_ENB_APP, 0, GTPV1U_ENB_S1_REQ))!=NULL,""); IPV4_STR_ADDR_TO_INT_NWBO ( address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up); GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = enb_port_for_S1U; diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index 7d4546815f..33182f3593 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -251,7 +251,7 @@ int flexran_agent_start(mid_t mod_id) pthread_mutex_unlock(&flexran->mutex_node_ctrl); /* reconfigure RRC again, the agent might have changed the configuration */ - MessageDef *msg_p = itti_alloc_new_message(TASK_ENB_APP, RRC_CONFIGURATION_REQ); + MessageDef *msg_p = itti_alloc_new_message(TASK_ENB_APP, 0, RRC_CONFIGURATION_REQ); RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[mod_id]->configuration; itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg_p); } diff --git a/openair2/ENB_APP/flexran_agent_common_internal.c b/openair2/ENB_APP/flexran_agent_common_internal.c index 9091753f9a..a893982824 100644 --- a/openair2/ENB_APP/flexran_agent_common_internal.c +++ b/openair2/ENB_APP/flexran_agent_common_internal.c @@ -565,6 +565,6 @@ void initiate_soft_restart(module_id_t mod_id, Protocol__FlexCellConfig *c) } MessageDef *msg; - msg = itti_alloc_new_message(TASK_FLEXRAN_AGENT, SOFT_RESTART_MESSAGE); + msg = itti_alloc_new_message(TASK_FLEXRAN_AGENT, 0, SOFT_RESTART_MESSAGE); itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg); } diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index d126012737..bb945f5908 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -3465,7 +3465,7 @@ int flexran_add_s1ap_mme(mid_t mod_id, size_t n_mme, char **mme_ipv4) { if (!rrc_is_present(mod_id)) return -2; /* Reconstruct S1AP_REGISTER_ENB_REQ */ - MessageDef *m = itti_alloc_new_message(TASK_FLEXRAN_AGENT, S1AP_REGISTER_ENB_REQ); + MessageDef *m = itti_alloc_new_message(TASK_FLEXRAN_AGENT, 0, S1AP_REGISTER_ENB_REQ); RCconfig_S1(m, mod_id); const int CC_id = 0; @@ -3525,7 +3525,7 @@ int flexran_remove_s1ap_mme(mid_t mod_id, size_t n_mme, char **mme_ipv4) { if (!mme) return -2; - MessageDef *m = itti_alloc_new_message(TASK_FLEXRAN_AGENT, SCTP_CLOSE_ASSOCIATION); + MessageDef *m = itti_alloc_new_message(TASK_FLEXRAN_AGENT, 0, SCTP_CLOSE_ASSOCIATION); SCTP_CLOSE_ASSOCIATION(m).assoc_id = mme->assoc_id; itti_send_msg_to_task (TASK_SCTP, ENB_MODULE_ID_TO_INSTANCE(mod_id), m); diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 48c5c2de11..01cd4aa9e0 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -102,7 +102,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, assoc_id, stream); } - message_p = itti_alloc_new_message(TASK_RRC_ENB, F1AP_SETUP_REQ); + message_p = itti_alloc_new_message(TASK_RRC_ENB, 0, F1AP_SETUP_REQ); /* assoc_id */ F1AP_SETUP_REQ(message_p).assoc_id = assoc_id; diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 9bd04cc5e8..306a1fe14b 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -116,7 +116,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_ProtocolIE_ID_id_RRCContainer, true); // create an ITTI message and copy SDU - message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_MAC_CCCH_DATA_IND); memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); ccch_sdu_len = ie->value.choice.RRCContainer.size; memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, @@ -197,7 +197,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_inst[instance], f1ap_dl_rrc->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - LOG_I(F1AP, "Setting GNB_CU_UE_F1AP_ID %llu associated with UE RNTI %x (instance %d)\n", + LOG_I(F1AP, "Setting GNB_CU_UE_F1AP_ID %llu associated with UE RNTI %x (instance %ld)\n", (unsigned long long int)ie->value.choice.GNB_CU_UE_F1AP_ID, f1ap_dl_rrc->rnti, instance); @@ -350,7 +350,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, // create an ITTI message and copy SDU /* - message_p = itti_alloc_new_message (TASK_CU_F1, RRC_DCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_DCCH_DATA_IND); RRC_DCCH_DATA_IND (message_p).sdu_p = malloc(ie->value.choice.RRCContainer.size); diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 9ab84e6bc9..d2f4c3a56b 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -52,7 +52,7 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat DevAssert(sctp_new_association_resp != NULL); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", + LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", sctp_new_association_resp->sctp_state, instance, sctp_new_association_resp->ulp_cnx_id); @@ -78,7 +78,7 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat .remote_port = RC.rrc[instance]->eth_params_s.remote_portd }; AssertFatal(proto_agent_start(instance, ¶ms) == 0, - "could not start PROTO_AGENT for F1U on instance %d!\n", instance); + "could not start PROTO_AGENT for F1U on instance %ld!\n", instance); } void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) { @@ -101,7 +101,7 @@ void cu_task_send_sctp_init_req(instance_t enb_id) { LOG_I(F1AP, "F1AP_CU_SCTP_REQ(create socket)\n"); MessageDef *message_p = NULL; - message_p = itti_alloc_new_message (TASK_CU_F1, SCTP_INIT_MSG); + message_p = itti_alloc_new_message (TASK_CU_F1, 0, SCTP_INIT_MSG); message_p->ittiMsg.sctp_init.port = F1AP_PORT_NUMBER; message_p->ittiMsg.sctp_init.ppid = F1AP_SCTP_PPID; message_p->ittiMsg.sctp_init.ipv4 = 1; @@ -138,43 +138,43 @@ void *F1AP_CU_task(void *arg) { switch (ITTI_MSG_ID(received_msg)) { case SCTP_NEW_ASSOCIATION_IND: - LOG_I(F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_IND for instance %d\n", - ITTI_MESSAGE_GET_INSTANCE(received_msg)); - cu_task_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + LOG_I(F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_IND for instance %ld\n", + ITTI_MSG_DESTINATION_INSTANCE(received_msg)); + cu_task_handle_sctp_association_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_ind); break; case SCTP_NEW_ASSOCIATION_RESP: - LOG_I(F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_RESP for instance %d\n", - ITTI_MESSAGE_GET_INSTANCE(received_msg)); - cu_task_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + LOG_I(F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_RESP for instance %ld\n", + ITTI_MSG_DESTINATION_INSTANCE(received_msg)); + cu_task_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_DATA_IND: - LOG_I(F1AP, "CU Task Received SCTP_DATA_IND for Instance %d\n", - ITTI_MESSAGE_GET_INSTANCE(received_msg)); - cu_task_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + LOG_I(F1AP, "CU Task Received SCTP_DATA_IND for Instance %ld\n", + ITTI_MSG_DESTINATION_INSTANCE(received_msg)); + cu_task_handle_sctp_data_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_data_ind); break; case F1AP_SETUP_RESP: // from rrc LOG_I(F1AP, "CU Task Received F1AP_SETUP_RESP\n"); - // CU_send_f1setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + // CU_send_f1setup_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &F1AP_SETUP_RESP(received_msg)); - CU_send_F1_SETUP_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + CU_send_F1_SETUP_RESPONSE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_SETUP_RESP(received_msg)); break; case F1AP_DL_RRC_MESSAGE: // from rrc LOG_I(F1AP, "CU Task Received F1AP_DL_RRC_MESSAGE\n"); - CU_send_DL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), + CU_send_DL_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_DL_RRC_MESSAGE(received_msg)); break; case F1AP_UE_CONTEXT_RELEASE_CMD: // from rrc LOG_I(F1AP, "CU Task Received F1AP_UE_CONTEXT_RELEASE_CMD\n"); - CU_send_UE_CONTEXT_RELEASE_COMMAND(ITTI_MESSAGE_GET_INSTANCE(received_msg), + CU_send_UE_CONTEXT_RELEASE_COMMAND(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_UE_CONTEXT_RELEASE_CMD(received_msg)); break; diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 341c050f55..86b5b1cb77 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -444,7 +444,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, int num_cells_to_activate = 0; F1AP_Cells_to_be_Activated_List_Item_t *cell; - MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, F1AP_SETUP_RESP); + MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, 0, F1AP_SETUP_RESP); LOG_D(F1AP, "F1AP: F1Setup-Resp: protocolIEs.list.count %d\n", in->protocolIEs.list.count); diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 6953588818..ee096337dd 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -143,7 +143,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, // BK: need check // create an ITTI message and copy SDU - // message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); + // message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_MAC_CCCH_DATA_IND); // memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); rrc_dl_sdu_len = ie->value.choice.RRCContainer.size; // memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, @@ -402,7 +402,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, MessageDef *message_p = NULL; /* Send DRX configuration to MAC task to configure timers of local UE context */ - message_p = itti_alloc_new_message(TASK_DU_F1, RRC_MAC_DRX_CONFIG_REQ); + message_p = itti_alloc_new_message(TASK_DU_F1, 0, RRC_MAC_DRX_CONFIG_REQ); RRC_MAC_DRX_CONFIG_REQ(message_p).rnti = ctxt.rnti; RRC_MAC_DRX_CONFIG_REQ(message_p).drx_Configuration = mac_MainConfig->drx_Config; itti_send_msg_to_task(TASK_MAC_ENB, ctxt.module_id, message_p); @@ -599,7 +599,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t len; - LOG_I(F1AP, "[DU %d] %s: size %d UE RNTI %x in SRB %d\n", + LOG_I(F1AP, "[DU %ld] %s: size %d UE RNTI %x in SRB %d\n", instance, __func__, msg->rrc_container_length, rnti, msg->srb_id); //LOG_I(F1AP, "%s() RRCContainer size %d: ", __func__, msg->rrc_container_length); diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 566391ac7a..b66141250b 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -50,7 +50,7 @@ void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1 MessageDef *message_p = NULL; sctp_new_association_req_t *sctp_new_association_req_p = NULL; - message_p = itti_alloc_new_message(TASK_DU_F1, SCTP_NEW_ASSOCIATION_REQ); + message_p = itti_alloc_new_message(TASK_DU_F1, 0, SCTP_NEW_ASSOCIATION_REQ); sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; sctp_new_association_req_p->ulp_cnx_id = instance; @@ -86,7 +86,7 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat DevAssert(sctp_new_association_resp != NULL); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", + LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", sctp_new_association_resp->sctp_state, instance, sctp_new_association_resp->ulp_cnx_id); @@ -109,7 +109,7 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat .remote_port = RC.mac[instance]->eth_params_n.remote_portd }; AssertFatal(proto_agent_start(instance, ¶ms) == 0, - "could not start PROTO_AGENT for F1U on instance %d!\n", instance); + "could not start PROTO_AGENT for F1U on instance %ld!\n", instance); DU_send_F1_SETUP_REQUEST(instance); } @@ -156,7 +156,7 @@ void *F1AP_DU_task(void *arg) { // 2. store the message in f1ap context, that is also stored in RC // 2. send a sctp_association req LOG_I(F1AP, "DU Task Received F1AP_SETUP_REQ\n"); - du_task_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + du_task_send_sctp_association_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_SETUP_REQ(received_msg)); break; @@ -164,26 +164,26 @@ void *F1AP_DU_task(void *arg) { // 1. store the respon // 2. send the f1setup_req LOG_I(F1AP, "DU Task Received SCTP_NEW_ASSOCIATION_RESP\n"); - du_task_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + du_task_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_DATA_IND: // ex: any F1 incoming message for DU ends here LOG_I(F1AP, "DU Task Received SCTP_DATA_IND\n"); - du_task_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + du_task_handle_sctp_data_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_data_ind); break; case F1AP_UL_RRC_MESSAGE: // to rrc LOG_I(F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n"); - DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), + DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_UL_RRC_MESSAGE(received_msg)); break; case F1AP_UE_CONTEXT_RELEASE_REQ: // from MAC LOG_I(F1AP, "DU Task Received F1AP_UE_CONTEXT_RELEASE_REQ\n"); - DU_send_UE_CONTEXT_RELEASE_REQUEST(ITTI_MESSAGE_GET_INSTANCE(received_msg), + DU_send_UE_CONTEXT_RELEASE_REQUEST(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_UE_CONTEXT_RELEASE_REQ(received_msg)); break; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index bae59a509e..841c77eef5 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -59,7 +59,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, F1AP_UEContextSetupRequestIEs_t *ie; int i; DevAssert(pdu); - msg_p = itti_alloc_new_message(TASK_DU_F1, F1AP_UE_CONTEXT_SETUP_REQ); + msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_UE_CONTEXT_SETUP_REQ); f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req; f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); container = &pdu->choice.initiatingMessage->value.choice.UEContextSetupRequest; diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 12aba18a9d..45f76d3dab 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -119,7 +119,7 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, } /* Calling the right handler */ - LOG_I(F1AP, "Calling handler with instance %d\n",instance); + LOG_I(F1AP, "Calling handler with instance %ld\n",instance); ret = (*f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1]) (instance, assoc_id, stream, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); diff --git a/openair2/F1AP/f1ap_itti_messaging.c b/openair2/F1AP/f1ap_itti_messaging.c index fa8951536a..443357a45e 100644 --- a/openair2/F1AP/f1ap_itti_messaging.c +++ b/openair2/F1AP/f1ap_itti_messaging.c @@ -28,7 +28,7 @@ void cu_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint MessageDef *message_p; sctp_data_req_t *sctp_data_req; - message_p = itti_alloc_new_message(TASK_CU_F1, SCTP_DATA_REQ); + message_p = itti_alloc_new_message(TASK_CU_F1, 0, SCTP_DATA_REQ); sctp_data_req = &message_p->ittiMsg.sctp_data_req; @@ -46,7 +46,7 @@ void du_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint MessageDef *message_p; sctp_data_req_t *sctp_data_req; - message_p = itti_alloc_new_message(TASK_DU_F1, SCTP_DATA_REQ); + message_p = itti_alloc_new_message(TASK_DU_F1, 0, SCTP_DATA_REQ); sctp_data_req = &message_p->ittiMsg.sctp_data_req; @@ -64,7 +64,7 @@ void f1ap_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_CLOSE_ASSOCIATION); + message_p = itti_alloc_new_message(TASK_S1AP, 0, SCTP_CLOSE_ASSOCIATION); sctp_close_association_p = &message_p->ittiMsg.sctp_close_association; sctp_close_association_p->assoc_id = assoc_id; diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 01d7a3b833..77e4564632 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -56,7 +56,7 @@ static void configure_nr_rrc(uint32_t gnb_id) MessageDef *msg_p = NULL; // int CC_id; - msg_p = itti_alloc_new_message (TASK_GNB_APP, NRRRC_CONFIGURATION_REQ); + msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NRRRC_CONFIGURATION_REQ); if (RC.nrrrc[gnb_id]) { RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]); @@ -84,7 +84,7 @@ static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, ngap_register_gnb_req_t *ngap_register_gNB; //Type Temporarily reuse // note: there is an implicit relationship between the data structure and the message name - msg_p = itti_alloc_new_message (TASK_GNB_APP, NGAP_REGISTER_GNB_REQ); //Message Temporarily reuse + msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NGAP_REGISTER_GNB_REQ); //Message Temporarily reuse RCconfig_NR_NG(msg_p, gnb_id); @@ -115,7 +115,7 @@ static uint32_t gNB_app_register_x2(uint32_t gnb_id_start, uint32_t gnb_id_end) for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) { { - msg_p = itti_alloc_new_message (TASK_GNB_APP, X2AP_REGISTER_ENB_REQ); + msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, X2AP_REGISTER_ENB_REQ); LOG_I(X2AP, "GNB_ID: %d \n", gnb_id); RCconfig_NR_X2(msg_p, gnb_id); itti_send_msg_to_task (TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); @@ -182,7 +182,7 @@ void *gNB_app_task(void *args_p) __attribute__((unused)) uint32_t register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end);//, gnb_properties_p); } else { /* Start L2L1 task */ - msg_p = itti_alloc_new_message(TASK_GNB_APP, INITIALIZE_MESSAGE); + msg_p = itti_alloc_new_message(TASK_GNB_APP, 0, INITIALIZE_MESSAGE); itti_send_msg_to_task(TASK_L2L1, INSTANCE_DEFAULT, msg_p); } @@ -191,7 +191,7 @@ void *gNB_app_task(void *args_p) itti_receive_msg (TASK_GNB_APP, &msg_p); msg_name = ITTI_MSG_NAME (msg_p); - instance = ITTI_MSG_INSTANCE (msg_p); + instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); switch (ITTI_MSG_ID(msg_p)) { case TERMINATE_MESSAGE: @@ -206,7 +206,7 @@ void *gNB_app_task(void *args_p) case NGAP_REGISTER_GNB_CNF: - LOG_I(GNB_APP, "[gNB %d] Received %s: associated AMF %d\n", instance, msg_name, + LOG_I(GNB_APP, "[gNB %ld] Received %s: associated AMF %d\n", instance, msg_name, NGAP_REGISTER_GNB_CNF(msg_p).nb_amf); /* DevAssert(register_gnb_pending > 0); @@ -223,7 +223,7 @@ void *gNB_app_task(void *args_p) // If all gNB are registered, start L2L1 task MessageDef *msg_init_p; - msg_init_p = itti_alloc_new_message (TASK_GNB_APP, INITIALIZE_MESSAGE); + msg_init_p = itti_alloc_new_message (TASK_GNB_APP, 0, INITIALIZE_MESSAGE); itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p); } else { @@ -248,7 +248,7 @@ void *gNB_app_task(void *args_p) break; case NGAP_DEREGISTERED_GNB_IND: - LOG_W(GNB_APP, "[gNB %d] Received %s: associated AMF %d\n", instance, msg_name, + LOG_W(GNB_APP, "[gNB %ld] Received %s: associated AMF %d\n", instance, msg_name, NGAP_DEREGISTERED_GNB_IND(msg_p).nb_amf); /* TODO handle recovering of registration */ diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 9e7048247b..7862597b90 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -715,7 +715,7 @@ int RCconfig_nr_gtpu(void ) { if (address) { MessageDef *message; - AssertFatal((message = itti_alloc_new_message(TASK_GNB_APP, GTPV1U_ENB_S1_REQ))!=NULL,""); + AssertFatal((message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_ENB_S1_REQ))!=NULL,""); // IPV4_STR_ADDR_TO_INT_NWBO ( address, RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); // LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up); diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 9a00fa1184..b4b9a3175a 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -473,7 +473,7 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id, if (UE_info->UE_sched_ctrl[UE_id].ul_failure_timer > 4000) { // note: probably ul_failure_timer should be less than UE radio link failure time(see T310/N310/N311) if (NODE_IS_DU(RC.rrc[module_idP]->node_type)) { - MessageDef *m = itti_alloc_new_message(TASK_MAC_ENB, F1AP_UE_CONTEXT_RELEASE_REQ); + MessageDef *m = itti_alloc_new_message(TASK_MAC_ENB, 0, F1AP_UE_CONTEXT_RELEASE_REQ); F1AP_UE_CONTEXT_RELEASE_REQ(m).rnti = rnti; F1AP_UE_CONTEXT_RELEASE_REQ(m).cause = F1AP_CAUSE_RADIO_NETWORK; F1AP_UE_CONTEXT_RELEASE_REQ(m).cause_value = 1; // 1 = F1AP_CauseRadioNetwork_rl_failure diff --git a/openair2/LAYER2/MAC/main.c b/openair2/LAYER2/MAC/main.c index af6d1a7ac3..59554425cc 100644 --- a/openair2/LAYER2/MAC/main.c +++ b/openair2/LAYER2/MAC/main.c @@ -219,7 +219,7 @@ void *mac_enb_task(void *arg) case RRC_MAC_DRX_CONFIG_REQ: LOG_I(MAC, "MAC Task Received RRC_MAC_DRX_CONFIG_REQ\n"); /* Set timers and thresholds values in local MAC context of UE */ - eNB_Config_Local_DRX(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.rrc_mac_drx_config_req); + eNB_Config_Local_DRX(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.rrc_mac_drx_config_req); break; case TERMINATE_MESSAGE: diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 8c4ee72380..0dedacb11f 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -3064,8 +3064,8 @@ ue_scheduler(const module_id_t module_idP, switch (ITTI_MSG_ID(msg_p)) { case RRC_MAC_CCCH_DATA_REQ: LOG_I(MAC, - "Received %s from %s: instance %d, frameP %d, eNB_index %d\n", - ITTI_MSG_NAME(msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), ITTI_MSG_INSTANCE(msg_p), + "Received %s from %s: instance %ld, frameP %d, eNB_index %d\n", + ITTI_MSG_NAME(msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), ITTI_MSG_DESTINATION_INSTANCE(msg_p), RRC_MAC_CCCH_DATA_REQ(msg_p).frame, RRC_MAC_CCCH_DATA_REQ(msg_p).enb_index); // TODO process CCCH data req. diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 9b6de7c168..8196d2b1fc 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -394,7 +394,7 @@ boolean_t pdcp_data_req( // DL transfer MessageDef *message_p; // Note: the acyual task must be TASK_PDCP_ENB, but this task is not created - message_p = itti_alloc_new_message (TASK_PDCP_ENB, F1AP_DL_RRC_MESSAGE); + message_p = itti_alloc_new_message (TASK_PDCP_ENB, 0, F1AP_DL_RRC_MESSAGE); F1AP_DL_RRC_MESSAGE (message_p).rrc_container = &pdcp_pdu_p->data[0] ; F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = pdcp_pdu_size; F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; @@ -930,7 +930,7 @@ pdcp_data_ind( sdu_buffer_sizeP - payload_offset + GTPU_HEADER_OVERHEAD_MAX); AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY"); memcpy(>pu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], &sdu_buffer_pP->data[payload_offset], sdu_buffer_sizeP - payload_offset); - message_p = itti_alloc_new_message(TASK_PDCP_ENB, GTPV1U_ENB_TUNNEL_DATA_REQ); + message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ); AssertFatal(message_p != NULL, "OUT OF MEMORY"); GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).length = sdu_buffer_sizeP - payload_offset; @@ -1139,11 +1139,11 @@ pdcp_run ( RRC_DCCH_DATA_REQ (msg_p).frame, 0, RRC_DCCH_DATA_REQ (msg_p).eNB_index); - LOG_D(PDCP, PROTOCOL_CTXT_FMT"Received %s from %s: instance %d, rb_id %ld, muiP %d, confirmP %d, mode %d\n", + LOG_D(PDCP, PROTOCOL_CTXT_FMT"Received %s from %s: instance %ld, rb_id %ld, muiP %d, confirmP %d, mode %d\n", PROTOCOL_CTXT_ARGS(&ctxt), ITTI_MSG_NAME (msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), - ITTI_MSG_INSTANCE (msg_p), + ITTI_MSG_DESTINATION_INSTANCE (msg_p), RRC_DCCH_DATA_REQ (msg_p).rb_id, RRC_DCCH_DATA_REQ (msg_p).muip, RRC_DCCH_DATA_REQ (msg_p).confirmp, @@ -1265,7 +1265,7 @@ pdcp_mbms_run ( // PROTOCOL_CTXT_ARGS(&ctxt), // ITTI_MSG_NAME (msg_p), // ITTI_MSG_ORIGIN_NAME(msg_p), -// ITTI_MSG_INSTANCE (msg_p), +// ITTI_MSG_DESTINATION_INSTANCE (msg_p), // RRC_DCCH_DATA_REQ (msg_p).rb_id, // RRC_DCCH_DATA_REQ (msg_p).muip, // RRC_DCCH_DATA_REQ (msg_p).confirmp, diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 04b9e188e6..687d7b1bfe 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -237,9 +237,9 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) { ctxt.module_id, ctxt.rnti, ctxt.enb_flag); if (h_rc == HASH_TABLE_OK) { - LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %ld \n", + LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %ld: Received socket with length %d on Rab %ld \n", ctxt.frame, ctxt.instance, len, rab_id); - LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04x][RB %ld]\n", + LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %ld][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04x][RB %ld]\n", ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id, ctxt.rnti, rab_id); @@ -258,7 +258,7 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) { ); } else { LOG_D(PDCP, - "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %04x][RB %ld] TUN NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n", + "[FRAME %5u][UE][IP][INSTANCE %ld][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %04x][RB %ld] TUN NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n", ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id, ctxt.rnti, rab_id, key); } @@ -305,9 +305,9 @@ int pdcp_fifo_read_input_mbms_sdus_fromtun (const protocol_ctxt_t *const ctxt_p ctxt.module_id, ctxt.rnti, ctxt.enb_flag); if (h_rc == HASH_TABLE_OK) { - LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %ld \n", + LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %ld: Received socket with length %d on Rab %ld \n", ctxt.frame, ctxt.instance, len, rab_id); - LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04x][RB %ld]\n", + LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %ld][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04x][RB %ld]\n", ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id, ctxt.rnti, rab_id); MSC_LOG_RX_MESSAGE((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, @@ -344,7 +344,7 @@ int pdcp_fifo_read_input_mbms_sdus_fromtun (const protocol_ctxt_t *const ctxt_p MSC_AS_TIME_ARGS(ctxt_pP), ctxt.instance, rab_id, rab_id, len); LOG_D(PDCP, - "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %04x][RB %ld] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n", + "[FRAME %5u][UE][IP][INSTANCE %ld][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %04x][RB %ld] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n", ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id, ctxt.rnti, rab_id, key); //if (!UE_NAS_USE_TUN) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 6e343343cd..bf6579955b 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -535,7 +535,7 @@ int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Proto // if (xid == 1) // pdcp_data_ind_wifi((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, pdcp_pdu_size, pdcp_pdu_p); // else if (xid == 0) // FIXME: USE a preprocessed definition - LOG_D(PROTO_AGENT, "[inst %d] Received PDCP PDU with size %d for UE RNTI %x RB %ld, Calling pdcp_data_ind\n", ctxt_pP.instance, pdcp_pdu_size,ctxt_pP.rnti,rb_idP); + LOG_D(PROTO_AGENT, "[inst %ld] Received PDCP PDU with size %d for UE RNTI %x RB %ld, Calling pdcp_data_ind\n", ctxt_pP.instance, pdcp_pdu_size,ctxt_pP.rnti,rb_idP); result = pdcp_data_ind(&ctxt_pP, srb_flagP, flag_MBMS, diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 9b33b2715d..0e6fd614a0 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -432,7 +432,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, size + GTPU_HEADER_OVERHEAD_MAX); AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY"); memcpy(>pu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], buf, size); - message_p = itti_alloc_new_message(TASK_PDCP_ENB, GTPV1U_ENB_TUNNEL_DATA_REQ); + message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ); AssertFatal(message_p != NULL, "OUT OF MEMORY"); GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).length = size; diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 2f0d46afac..d3503742ad 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -877,7 +877,7 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt if (/*ctxt_pP->enb_flag != 1 ||*/ ctxt_pP->module_id != 0 /*|| ctxt_pP->instance != 0 || ctxt_pP->eNB_index != 0 || ctxt_pP->configured != 1 || ctxt_pP->brOption != 0 */) { - LOG_E(RLC, "%s: ctxt_pP not handled (%d %d %d %d %d %d)\n", __FUNCTION__, + LOG_E(RLC, "%s: ctxt_pP not handled (%d %d %ld %d %d %d)\n", __FUNCTION__, ctxt_pP->enb_flag , ctxt_pP->module_id, ctxt_pP->instance, ctxt_pP->eNB_index, ctxt_pP->configured, ctxt_pP->brOption); exit(1); diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index b3aaff742f..919d577a18 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -427,7 +427,7 @@ rb_found: "Can't be CU, bad node type %d\n", type); if (NODE_IS_DU(type) && is_srb == 1) { - MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, F1AP_UL_RRC_MESSAGE); + MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE); F1AP_UL_RRC_MESSAGE(msg).rnti = ue->rnti; F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; F1AP_UL_RRC_MESSAGE(msg).rrc_container = (unsigned char *)buf; @@ -490,7 +490,7 @@ rb_found: if (!is_enb) return; - msg = itti_alloc_new_message(TASK_RLC_ENB, RLC_SDU_INDICATION); + msg = itti_alloc_new_message(TASK_RLC_ENB, 0, RLC_SDU_INDICATION); RLC_SDU_INDICATION(msg).rnti = ue->rnti; RLC_SDU_INDICATION(msg).is_successful = 1; RLC_SDU_INDICATION(msg).srb_id = rb_id; @@ -543,7 +543,7 @@ rb_found: if (!is_enb) return; - msg = itti_alloc_new_message(TASK_RLC_ENB, RLC_SDU_INDICATION); + msg = itti_alloc_new_message(TASK_RLC_ENB, 0, RLC_SDU_INDICATION); RLC_SDU_INDICATION(msg).rnti = ue->rnti; RLC_SDU_INDICATION(msg).is_successful = 0; RLC_SDU_INDICATION(msg).srb_id = rb_id; @@ -834,7 +834,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP if (0 /*|| ctxt_pP->instance != 0 || ctxt_pP->eNB_index != 0 || ctxt_pP->configured != 1 || ctxt_pP->brOption != 0 */) { - LOG_E(RLC, "%s: ctxt_pP not handled (%d %d %d %d %d %d)\n", __FUNCTION__, + LOG_E(RLC, "%s: ctxt_pP not handled (%d %d %ld %d %d %d)\n", __FUNCTION__, ctxt_pP->enb_flag , ctxt_pP->module_id, ctxt_pP->instance, ctxt_pP->eNB_index, ctxt_pP->configured, ctxt_pP->brOption); exit(1); diff --git a/openair2/M2AP/m2ap_MCE.c b/openair2/M2AP/m2ap_MCE.c index 096f3cabee..f163aa453a 100644 --- a/openair2/M2AP/m2ap_MCE.c +++ b/openair2/M2AP/m2ap_MCE.c @@ -105,7 +105,7 @@ void m2ap_MCE_handle_sctp_association_resp(instance_t instance, sctp_new_associa DevAssert(sctp_new_association_resp != NULL); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - LOG_W(M2AP, "Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", + LOG_W(M2AP, "Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", sctp_new_association_resp->sctp_state, instance, sctp_new_association_resp->ulp_cnx_id); @@ -233,7 +233,7 @@ int m2ap_MCE_init_sctp (m2ap_MCE_instance_t *instance_p, sctp_init_t *sctp_init = NULL; DevAssert(instance_p != NULL); DevAssert(local_ip_addr != NULL); - message = itti_alloc_new_message (TASK_M2AP_MCE, SCTP_INIT_MSG_MULTI_REQ); + message = itti_alloc_new_message (TASK_M2AP_MCE, 0, SCTP_INIT_MSG_MULTI_REQ); sctp_init = &message->ittiMsg.sctp_init_multi; sctp_init->port = mce_port_for_M2C; sctp_init->ppid = M2AP_SCTP_PPID; @@ -267,7 +267,7 @@ static void m2ap_MCE_register_MCE(m2ap_MCE_instance_t *instance_p, m2ap_MCE_data_t *m2ap_mce_data = NULL; DevAssert(instance_p != NULL); DevAssert(target_MCE_ip_address != NULL); - message = itti_alloc_new_message(TASK_M2AP_MCE, SCTP_NEW_ASSOCIATION_REQ_MULTI); + message = itti_alloc_new_message(TASK_M2AP_MCE, 0, SCTP_NEW_ASSOCIATION_REQ_MULTI); sctp_new_association_req = &message->ittiMsg.sctp_new_association_req_multi; sctp_new_association_req->port = mce_port_for_M2C; sctp_new_association_req->ppid = M2AP_SCTP_PPID; @@ -312,7 +312,7 @@ void m2ap_MCE_handle_register_MCE(instance_t instance, DevCheck(new_instance->tac == m2ap_register_MCE->tac, new_instance->tac, m2ap_register_MCE->tac, 0); DevCheck(new_instance->mcc == m2ap_register_MCE->mcc, new_instance->mcc, m2ap_register_MCE->mcc, 0); DevCheck(new_instance->mnc == m2ap_register_MCE->mnc, new_instance->mnc, m2ap_register_MCE->mnc, 0); - M2AP_WARN("MCE[%d] already registered\n", instance); + M2AP_WARN("MCE[%ld] already registered\n", instance); } else { new_instance = calloc(1, sizeof(m2ap_MCE_instance_t)); DevAssert(new_instance != NULL); @@ -356,7 +356,7 @@ void m2ap_MCE_handle_register_MCE(instance_t instance, new_instance->mce_port_for_M2C = m2ap_register_MCE->mce_port_for_M2C; /* Add the new instance to the list of MCE (meaningfull in virtual mode) */ m2ap_MCE_insert_new_instance(new_instance); - M2AP_INFO("Registered new MCE[%d] and %s MCE id %u\n", + M2AP_INFO("Registered new MCE[%ld] and %s MCE id %u\n", instance, m2ap_register_MCE->cell_type == CELL_MACRO_ENB ? "macro" : "home", m2ap_register_MCE->MCE_id); @@ -367,7 +367,7 @@ void m2ap_MCE_handle_register_MCE(instance_t instance, return; } - M2AP_INFO("MCE[%d] MCE id %u acting as a listner (server)\n", + M2AP_INFO("MCE[%ld] MCE id %u acting as a listner (server)\n", instance, m2ap_register_MCE->MCE_id); } } @@ -394,7 +394,7 @@ void m2ap_MCE_handle_sctp_init_msg_multi_cnf( /* Trying to connect to the provided list of MCE ip address */ for (index = 0; index < instance->nb_m2; index++) { - M2AP_INFO("MCE[%d] MCE id %u acting as an initiator (client)\n", + M2AP_INFO("MCE[%ld] MCE id %u acting as an initiator (client)\n", instance_id, instance->MCE_id); m2ap_MCE_register_MCE(instance, &instance->target_mce_m2_ip_address[index], @@ -507,7 +507,7 @@ void MCE_task_send_sctp_init_req(instance_t enb_id, m2ap_mce_sctp_req_t * m2ap_m LOG_I(M2AP, "M2AP_SCTP_REQ(create socket)\n"); MessageDef *message_p = NULL; - message_p = itti_alloc_new_message (TASK_M2AP_MCE, SCTP_INIT_MSG); + message_p = itti_alloc_new_message (TASK_M2AP_MCE, 0, SCTP_INIT_MSG); // if( m2ap_mce_sctp_req == NULL ){ // message_p->ittiMsg.sctp_init.port = M2AP_PORT_NUMBER; @@ -558,7 +558,7 @@ void *m2ap_MCE_task(void *arg) { switch (ITTI_MSG_ID(received_msg)) { case MESSAGE_TEST: LOG_W(M2AP,"MCE Received MESSAGE_TEST Message\n"); - //MessageDef * message_p = itti_alloc_new_message(TASK_M2AP_MCE, MESSAGE_TEST); + //MessageDef * message_p = itti_alloc_new_message(TASK_M2AP_MCE, 0, MESSAGE_TEST); //itti_send_msg_to_task(TASK_M3AP, 1/*ctxt_pP->module_id*/, message_p); break; case TERMINATE_MESSAGE: @@ -567,29 +567,29 @@ void *m2ap_MCE_task(void *arg) { break; case M2AP_MCE_SCTP_REQ: - MCE_task_send_sctp_init_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + MCE_task_send_sctp_init_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_MCE_SCTP_REQ(received_msg)); break; case M2AP_SUBFRAME_PROCESS: - m2ap_check_timers(ITTI_MESSAGE_GET_INSTANCE(received_msg)); + m2ap_check_timers(ITTI_MSG_DESTINATION_INSTANCE(received_msg)); break; case M2AP_REGISTER_MCE_REQ: LOG_I(M2AP,"MCE Received M2AP_REGISTER_MCE_REQ Message\n"); - m2ap_MCE_handle_register_MCE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m2ap_MCE_handle_register_MCE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_REGISTER_MCE_REQ(received_msg)); break; case M2AP_SETUP_RESP: LOG_I(M2AP,"MCE Received M2AP_SETUP_RESP Message\n"); - MCE_send_M2_SETUP_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + MCE_send_M2_SETUP_RESPONSE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_SETUP_RESP(received_msg)); break; case M2AP_SETUP_FAILURE: LOG_I(M2AP,"MCE Received M2AP_SETUP_FAILURE Message\n"); - MCE_send_M2_SETUP_FAILURE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + MCE_send_M2_SETUP_FAILURE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_SETUP_FAILURE(received_msg)); break; @@ -644,41 +644,41 @@ void *m2ap_MCE_task(void *arg) { // case M2AP_HANDOVER_REQ: -// m2ap_MCE_handle_handover_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), +// m2ap_MCE_handle_handover_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M2AP_HANDOVER_REQ(received_msg)); // break; // // case M2AP_HANDOVER_REQ_ACK: -// m2ap_MCE_handle_handover_req_ack(ITTI_MESSAGE_GET_INSTANCE(received_msg), +// m2ap_MCE_handle_handover_req_ack(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M2AP_HANDOVER_REQ_ACK(received_msg)); // break; // // case M2AP_UE_CONTEXT_RELEASE: -// m2ap_MCE_ue_context_release(ITTI_MESSAGE_GET_INSTANCE(received_msg), +// m2ap_MCE_ue_context_release(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M2AP_UE_CONTEXT_RELEASE(received_msg)); // break; // case SCTP_INIT_MSG_MULTI_CNF: LOG_D(M2AP,"MCE Received SCTP_INIT_MSG_MULTI_CNF Message\n"); - m2ap_MCE_handle_sctp_init_msg_multi_cnf(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m2ap_MCE_handle_sctp_init_msg_multi_cnf(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_init_msg_multi_cnf); break; case SCTP_NEW_ASSOCIATION_RESP: LOG_D(M2AP,"MCE Received SCTP_NEW_ASSOCIATION_RESP Message\n"); - m2ap_MCE_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m2ap_MCE_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_NEW_ASSOCIATION_IND: LOG_D(M2AP,"MCE Received SCTP_NEW_ASSOCIATION Message\n"); - m2ap_MCE_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m2ap_MCE_handle_sctp_association_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_ind); break; case SCTP_DATA_IND: LOG_D(M2AP,"MCE Received SCTP_DATA_IND Message\n"); - m2ap_MCE_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m2ap_MCE_handle_sctp_data_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_data_ind); break; diff --git a/openair2/M2AP/m2ap_MCE_handler.c b/openair2/M2AP/m2ap_MCE_handler.c index 85e342f996..5a0e303218 100644 --- a/openair2/M2AP/m2ap_MCE_handler.c +++ b/openair2/M2AP/m2ap_MCE_handler.c @@ -113,7 +113,7 @@ int m2ap_MCE_handle_message(instance_t instance, uint32_t assoc_id, int32_t stre } /* Calling the right handler */ - LOG_I(M2AP, "Calling handler with instance %d\n",instance); + LOG_I(M2AP, "Calling handler with instance %ld\n",instance); ret = (*m2ap_MCE_messages_callback[pdu.choice.initiatingMessage.procedureCode][pdu.present - 1]) (instance, assoc_id, stream, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_M2AP_M2AP_PDU, &pdu); diff --git a/openair2/M2AP/m2ap_MCE_interface_management.c b/openair2/M2AP/m2ap_MCE_interface_management.c index e162c9a5de..3b12f41cbe 100644 --- a/openair2/M2AP/m2ap_MCE_interface_management.c +++ b/openair2/M2AP/m2ap_MCE_interface_management.c @@ -179,7 +179,7 @@ int MCE_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, int ENB_MBMS_M2AP_ID=-1; - MessageDef *msg_g = itti_alloc_new_message(TASK_M2AP_MCE,M2AP_MBMS_SESSION_START_RESP); //TODO + MessageDef *msg_g = itti_alloc_new_message(TASK_M2AP_MCE, 0,M2AP_MBMS_SESSION_START_RESP); //TODO LOG_D(M2AP, "M2AP: SessionStart-Resp: protocolIEs.list.count %d\n", in->protocolIEs.list.count); @@ -317,7 +317,7 @@ int MCE_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, int ENB_MBMS_M2AP_ID=-1; - MessageDef *msg_g = itti_alloc_new_message(TASK_M2AP_MCE,M2AP_MBMS_SESSION_STOP_RESP); //TODO + MessageDef *msg_g = itti_alloc_new_message(TASK_M2AP_MCE, 0,M2AP_MBMS_SESSION_STOP_RESP); //TODO LOG_D(M2AP, "M2AP: SessionStop-Resp: protocolIEs.list.count %d\n", in->protocolIEs.list.count); @@ -616,7 +616,7 @@ int MCE_handle_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, //int ENB_MBMS_M2AP_ID=-1; - MessageDef *msg_g = itti_alloc_new_message(TASK_M2AP_MCE,M2AP_MBMS_SCHEDULING_INFORMATION_RESP); //TODO + MessageDef *msg_g = itti_alloc_new_message(TASK_M2AP_MCE, 0,M2AP_MBMS_SCHEDULING_INFORMATION_RESP); //TODO // LOG_D(M2AP, "M2AP: SessionStop-Resp: protocolIEs.list.count %d\n", // in->protocolIEs.list.count); @@ -720,7 +720,7 @@ int MCE_handle_M2_SETUP_REQUEST(instance_t instance, assoc_id, stream); } - message_p = itti_alloc_new_message(TASK_MCE_APP, M2AP_SETUP_REQ); + message_p = itti_alloc_new_message(TASK_MCE_APP, 0, M2AP_SETUP_REQ); /* assoc_id */ M2AP_SETUP_REQ(message_p).assoc_id = assoc_id; @@ -1193,7 +1193,7 @@ int MCE_handle_MCE_CONFIGURATION_UPDATE_FAILURE(instance_t instance, //M2AP_MCEConfigurationUpdateFailure_Ies_t *ie; - MessageDef *msg_p = itti_alloc_new_message (TASK_M2AP_MCE, M2AP_MCE_CONFIGURATION_UPDATE_FAILURE); + MessageDef *msg_p = itti_alloc_new_message (TASK_M2AP_MCE, 0, M2AP_MCE_CONFIGURATION_UPDATE_FAILURE); LOG_D(M2AP, "M2AP: MCEConfigurationUpdate-Failure: protocolIEs.list.count %d\n", in->protocolIEs.list.count); @@ -1258,7 +1258,7 @@ int MCE_handle_MCE_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, assoc_id, stream); } - message_p = itti_alloc_new_message (TASK_M2AP_MCE, M2AP_MCE_CONFIGURATION_UPDATE_ACK); + message_p = itti_alloc_new_message (TASK_M2AP_MCE, 0, M2AP_MCE_CONFIGURATION_UPDATE_ACK); itti_send_msg_to_task(TASK_MCE_APP, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); @@ -1295,7 +1295,7 @@ int MCE_handle_ENB_CONFIGURATION_UPDATE(instance_t instance, assoc_id, stream); } - message_p = itti_alloc_new_message (TASK_M2AP_MCE, M2AP_MCE_CONFIGURATION_UPDATE_ACK); + message_p = itti_alloc_new_message (TASK_M2AP_MCE, 0, M2AP_MCE_CONFIGURATION_UPDATE_ACK); itti_send_msg_to_task(TASK_MCE_APP, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); @@ -1399,7 +1399,7 @@ int MCE_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance, //int ENB_MBMS_M2AP_ID=-1; - MessageDef *msg_g = itti_alloc_new_message(TASK_M2AP_MCE,M2AP_MBMS_SERVICE_COUNTING_RESP); //TODO + MessageDef *msg_g = itti_alloc_new_message(TASK_M2AP_MCE, 0,M2AP_MBMS_SERVICE_COUNTING_RESP); //TODO LOG_D(M2AP, "M2AP: MbmsServiceCounting-Resp: protocolIEs.list.count %d\n", in->protocolIEs.list.count); diff --git a/openair2/M2AP/m2ap_eNB.c b/openair2/M2AP/m2ap_eNB.c index 39c769a43d..c72eda7d8c 100644 --- a/openair2/M2AP/m2ap_eNB.c +++ b/openair2/M2AP/m2ap_eNB.c @@ -136,7 +136,7 @@ void m2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa //dump_trees_m2(); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - M2AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", + M2AP_WARN("Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", sctp_new_association_resp->sctp_state, instance, sctp_new_association_resp->ulp_cnx_id); @@ -233,7 +233,7 @@ int m2ap_eNB_init_sctp (m2ap_eNB_instance_t *instance_p, sctp_init_t *sctp_init = NULL; DevAssert(instance_p != NULL); DevAssert(local_ip_addr != NULL); - message = itti_alloc_new_message (TASK_M2AP_ENB, SCTP_INIT_MSG_MULTI_REQ); + message = itti_alloc_new_message (TASK_M2AP_ENB, 0, SCTP_INIT_MSG_MULTI_REQ); sctp_init = &message->ittiMsg.sctp_init_multi; sctp_init->port = enb_port_for_M2C; sctp_init->ppid = M2AP_SCTP_PPID; @@ -267,7 +267,7 @@ static void m2ap_eNB_register_eNB(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *m2ap_enb_data = NULL; DevAssert(instance_p != NULL); DevAssert(target_eNB_ip_address != NULL); - message = itti_alloc_new_message(TASK_M2AP_ENB, SCTP_NEW_ASSOCIATION_REQ_MULTI); + message = itti_alloc_new_message(TASK_M2AP_ENB, 0, SCTP_NEW_ASSOCIATION_REQ_MULTI); sctp_new_association_req = &message->ittiMsg.sctp_new_association_req_multi; sctp_new_association_req->port = enb_port_for_M2C; sctp_new_association_req->ppid = M2AP_SCTP_PPID; @@ -319,7 +319,7 @@ void m2ap_eNB_handle_register_eNB(instance_t instance, DevCheck(new_instance->tac == m2ap_register_eNB->tac, new_instance->tac, m2ap_register_eNB->tac, 0); DevCheck(new_instance->mcc == m2ap_register_eNB->mcc, new_instance->mcc, m2ap_register_eNB->mcc, 0); DevCheck(new_instance->mnc == m2ap_register_eNB->mnc, new_instance->mnc, m2ap_register_eNB->mnc, 0); - M2AP_WARN("eNB[%d] already registered\n", instance); + M2AP_WARN("eNB[%ld] already registered\n", instance); } else { @@ -376,7 +376,7 @@ void m2ap_eNB_handle_register_eNB(instance_t instance, /* Add the new instance to the list of eNB (meaningfull in virtual mode) */ m2ap_eNB_insert_new_instance(new_instance); - M2AP_INFO("Registered new eNB[%d] and %s eNB id %u\n", + M2AP_INFO("Registered new eNB[%ld] and %s eNB id %u\n", instance, m2ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home", m2ap_register_eNB->eNB_id); @@ -387,7 +387,7 @@ void m2ap_eNB_handle_register_eNB(instance_t instance, return; } - M2AP_INFO("eNB[%d] eNB id %u acting as a listner (server)\n", + M2AP_INFO("eNB[%ld] eNB id %u acting as a listner (server)\n", instance, m2ap_register_eNB->eNB_id); } } @@ -414,7 +414,7 @@ void m2ap_eNB_handle_sctp_init_msg_multi_cnf( /* Trying to connect to the provided list of eNB ip address */ for (index = 0; index < instance->nb_m2; index++) { - M2AP_INFO("eNB[%d] eNB id %u acting as an initiator (client)\n", + M2AP_INFO("eNB[%ld] eNB id %u acting as an initiator (client)\n", instance_id, instance->eNB_id); m2ap_eNB_register_eNB(instance, &instance->target_mce_m2_ip_address[index], @@ -527,7 +527,7 @@ void m2ap_eNB_handle_sctp_init_msg_multi_cnf( // LOG_I(M2AP, "M2AP_SCTP_REQ(create socket)\n"); // MessageDef *message_p = NULL; // -// message_p = itti_alloc_new_message (M2AP, SCTP_INIT_MSG); +// message_p = itti_alloc_new_message (M2AP, 0, SCTP_INIT_MSG); // message_p->ittiMsg.sctp_init.port = M2AP_PORT_NUMBER; // message_p->ittiMsg.sctp_init.ppid = M2AP_SCTP_PPID; // message_p->ittiMsg.sctp_init.ipv4 = 1; @@ -561,7 +561,7 @@ void *m2ap_eNB_task(void *arg) { switch (ITTI_MSG_ID(received_msg)) { case MESSAGE_TEST: LOG_D(M2AP,"eNB Received MESSAGE_TEST Message %s\n",itti_get_task_name(ITTI_MSG_ORIGIN_ID(received_msg))); - //MessageDef * message_p = itti_alloc_new_message(TASK_M2AP_ENB, MESSAGE_TEST); + //MessageDef * message_p = itti_alloc_new_message(TASK_M2AP_ENB, 0, MESSAGE_TEST); //itti_send_msg_to_task(TASK_M3AP, 1/*ctxt_pP->module_id*/, message_p); break; case TERMINATE_MESSAGE: @@ -570,104 +570,104 @@ void *m2ap_eNB_task(void *arg) { break; case M2AP_SUBFRAME_PROCESS: - m2ap_check_timers(ITTI_MESSAGE_GET_INSTANCE(received_msg)); + m2ap_check_timers(ITTI_MSG_DESTINATION_INSTANCE(received_msg)); break; case M2AP_REGISTER_ENB_REQ: LOG_I(M2AP,"eNB Received M2AP_REGISTER_ENB_REQ Message\n"); - m2ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m2ap_eNB_handle_register_eNB(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_REGISTER_ENB_REQ(received_msg)); break; case M2AP_MBMS_SCHEDULING_INFORMATION_RESP: LOG_I(M2AP,"eNB M2AP_MBMS_SCHEDULING_INFORMATION_RESP Message\n"); - eNB_send_MBMS_SCHEDULING_INFORMATION_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + eNB_send_MBMS_SCHEDULING_INFORMATION_RESPONSE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_MBMS_SCHEDULING_INFORMATION_RESP(received_msg)); break; case M2AP_MBMS_SESSION_START_RESP: LOG_I(M2AP,"eNB M2AP_MBMS_SESSION_START_RESP Message\n"); - eNB_send_MBMS_SESSION_START_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + eNB_send_MBMS_SESSION_START_RESPONSE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_MBMS_SESSION_START_RESP(received_msg)); break; case M2AP_MBMS_SESSION_START_FAILURE: LOG_I(M2AP,"eNB M2AP_MBMS_SESSION_START_FAILURE Message\n"); - eNB_send_MBMS_SESSION_START_FAILURE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + eNB_send_MBMS_SESSION_START_FAILURE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_MBMS_SESSION_START_FAILURE(received_msg)); break; case M2AP_MBMS_SESSION_STOP_RESP: LOG_I(M2AP,"eNB M2AP_MBMS_SESSION_STOP_RESP Message\n"); - eNB_send_MBMS_SESSION_STOP_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + eNB_send_MBMS_SESSION_STOP_RESPONSE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_MBMS_SESSION_STOP_RESP(received_msg)); break; case M2AP_ENB_CONFIGURATION_UPDATE: LOG_I(M2AP,"eNB M2AP_ENB_CONFIGURATION_UPDATE Message\n"); - eNB_send_eNB_CONFIGURATION_UPDATE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + eNB_send_eNB_CONFIGURATION_UPDATE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_ENB_CONFIGURATION_UPDATE(received_msg)); break; case M2AP_MCE_CONFIGURATION_UPDATE_ACK: LOG_I(M2AP,"eNB M2AP_MCE_CONFIGURATION_UPDATE_ACK Message\n"); - //eNB_send_MCE_CONFIGURATION_UPDATE_ACKNOWLEDGE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + //eNB_send_MCE_CONFIGURATION_UPDATE_ACKNOWLEDGE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M2AP_MCE_CONFIGURATION_UPDATE_ACK(received_msg)); break; case M2AP_MCE_CONFIGURATION_UPDATE_FAILURE: LOG_I(M2AP,"eNB M2AP_MCE_CONFIGURATION_UPDATE_FAILURE Message\n"); - //(ITTI_MESSAGE_GET_INSTANCE(received_msg), + //(ITTI_MSG_DESTINATION_INSTANCE(received_msg), //&M2AP_MCE_CONFIGURATION_UPDATE_FAILURE(received_msg)); break; case M2AP_MBMS_SESSION_UPDATE_RESP: LOG_I(M2AP,"eNB M2AP_MBMS_SESSION_UPDATE_RESP Message\n"); - eNB_send_MBMS_SESSION_UPDATE_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + eNB_send_MBMS_SESSION_UPDATE_RESPONSE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_MBMS_SESSION_UPDATE_RESP(received_msg)); break; case M2AP_MBMS_SESSION_UPDATE_FAILURE: LOG_I(M2AP,"eNB M2AP_MBMS_SESSION_UPDATE_FAILURE Message\n"); - eNB_send_MBMS_SESSION_UPDATE_FAILURE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + eNB_send_MBMS_SESSION_UPDATE_FAILURE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_MBMS_SESSION_UPDATE_FAILURE(received_msg)); break; case M2AP_MBMS_SERVICE_COUNTING_REPORT: LOG_I(M2AP,"eNB M2AP_MBMS_SERVICE_COUNTING_REPORT Message\n"); - eNB_send_MBMS_SERVICE_COUNTING_REPORT(ITTI_MESSAGE_GET_INSTANCE(received_msg), + eNB_send_MBMS_SERVICE_COUNTING_REPORT(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_MBMS_SERVICE_COUNTING_REPORT(received_msg)); break; case M2AP_MBMS_OVERLOAD_NOTIFICATION: LOG_I(M2AP,"eNB M2AP_MBMS_OVERLOAD_NOTIFICATION Message\n"); - eNB_send_MBMS_OVERLOAD_NOTIFICATION(ITTI_MESSAGE_GET_INSTANCE(received_msg), + eNB_send_MBMS_OVERLOAD_NOTIFICATION(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_MBMS_OVERLOAD_NOTIFICATION(received_msg)); break; case M2AP_MBMS_SERVICE_COUNTING_RESP: LOG_I(M2AP,"eNB M2AP_MBMS_SERVICE_COUNTING_RESP Message\n"); - eNB_send_MBMS_SERVICE_COUNTING_RESP(ITTI_MESSAGE_GET_INSTANCE(received_msg), + eNB_send_MBMS_SERVICE_COUNTING_RESP(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_MBMS_SERVICE_COUNTING_RESP(received_msg)); break; case M2AP_MBMS_SERVICE_COUNTING_FAILURE: LOG_I(M2AP,"eNB Message\n"); - eNB_send_MBMS_SERVICE_COUNTING_FAILURE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + eNB_send_MBMS_SERVICE_COUNTING_FAILURE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M2AP_MBMS_SERVICE_COUNTING_FAILURE(received_msg)); break; case SCTP_INIT_MSG_MULTI_CNF: LOG_I(M2AP,"eNB Received SCTP_INIT_MSG_MULTI_CNF Message\n"); - m2ap_eNB_handle_sctp_init_msg_multi_cnf(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m2ap_eNB_handle_sctp_init_msg_multi_cnf(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_init_msg_multi_cnf); break; case SCTP_NEW_ASSOCIATION_RESP: LOG_I(M2AP,"eNB Received SCTP_NEW_ASSOCIATION_RESP Message\n"); - m2ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m2ap_eNB_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_NEW_ASSOCIATION_IND: LOG_I(M2AP,"eNB Received SCTP_NEW_ASSOCIATION Message\n"); - m2ap_eNB_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m2ap_eNB_handle_sctp_association_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_ind); break; case SCTP_DATA_IND: LOG_I(M2AP,"eNB Received SCTP_DATA_IND Message\n"); - m2ap_eNB_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m2ap_eNB_handle_sctp_data_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_data_ind); break; diff --git a/openair2/M2AP/m2ap_eNB_handler.c b/openair2/M2AP/m2ap_eNB_handler.c index fe0059f0a5..9abc337408 100644 --- a/openair2/M2AP/m2ap_eNB_handler.c +++ b/openair2/M2AP/m2ap_eNB_handler.c @@ -113,7 +113,7 @@ int m2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stre } /* Calling the right handler */ - LOG_I(M2AP, "Calling handler with instance %d\n",instance); + LOG_I(M2AP, "Calling handler with instance %ld\n",instance); ret = (*m2ap_eNB_messages_callback[pdu.choice.initiatingMessage.procedureCode][pdu.present - 1]) (instance, assoc_id, stream, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_M2AP_M2AP_PDU, &pdu); diff --git a/openair2/M2AP/m2ap_eNB_interface_management.c b/openair2/M2AP/m2ap_eNB_interface_management.c index 9649d919c3..486e382e69 100644 --- a/openair2/M2AP/m2ap_eNB_interface_management.c +++ b/openair2/M2AP/m2ap_eNB_interface_management.c @@ -85,8 +85,8 @@ int eNB_handle_MBMS_SCHEDULING_INFORMATION(instance_t instance, assoc_id, stream); } - message_p = itti_alloc_new_message (TASK_M2AP_ENB, M2AP_MBMS_SCHEDULING_INFORMATION); - //message_p2 = itti_alloc_new_message (TASK_M2AP_ENB, M2AP_MBMS_SCHEDULING_INFORMATION); + message_p = itti_alloc_new_message (TASK_M2AP_ENB, 0, M2AP_MBMS_SCHEDULING_INFORMATION); + //message_p2 = itti_alloc_new_message (TASK_M2AP_ENB, 0, M2AP_MBMS_SCHEDULING_INFORMATION); @@ -292,7 +292,7 @@ int eNB_handle_MBMS_SESSION_START_REQUEST(instance_t instance, assoc_id, stream); } - message_p = itti_alloc_new_message (TASK_M2AP_ENB, M2AP_MBMS_SESSION_START_REQ); + message_p = itti_alloc_new_message (TASK_M2AP_ENB, 0, M2AP_MBMS_SESSION_START_REQ); itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); @@ -463,7 +463,7 @@ int eNB_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, assoc_id, stream); } - message_p = itti_alloc_new_message (TASK_M2AP_ENB, M2AP_MBMS_SESSION_STOP_REQ); + message_p = itti_alloc_new_message (TASK_M2AP_ENB, 0, M2AP_MBMS_SESSION_STOP_REQ); itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); @@ -749,8 +749,8 @@ int eNB_handle_M2_SETUP_RESPONSE(instance_t instance, //M2AP_Cells_to_be_Activated_List_Item_t *cell; int i,j; - MessageDef *msg_p = itti_alloc_new_message (TASK_M2AP_ENB, M2AP_SETUP_RESP); - //MessageDef *msg_p2 = itti_alloc_new_message (TASK_M2AP_ENB, M2AP_SETUP_RESP); + MessageDef *msg_p = itti_alloc_new_message (TASK_M2AP_ENB, 0, M2AP_SETUP_RESP); + //MessageDef *msg_p2 = itti_alloc_new_message (TASK_M2AP_ENB, 0, M2AP_SETUP_RESP); LOG_D(M2AP, "M2AP: M2Setup-Resp: protocolIEs.list.count %d\n", in->protocolIEs.list.count); @@ -856,7 +856,7 @@ int eNB_handle_M2_SETUP_FAILURE(instance_t instance, M2AP_M2SetupFailure_Ies_t *ie; - MessageDef *msg_p = itti_alloc_new_message (TASK_M2AP_ENB, M2AP_SETUP_FAILURE); + MessageDef *msg_p = itti_alloc_new_message (TASK_M2AP_ENB, 0, M2AP_SETUP_FAILURE); LOG_D(M2AP, "M2AP: M2Setup-Failure: protocolIEs.list.count %d\n", in->protocolIEs.list.count); @@ -1062,7 +1062,7 @@ int eNB_handle_eNB_CONFIGURATION_UPDATE_FAILURE(instance_t instance, //M2AP_ENBConfigurationUpdateFailure_Ies_t *ie; - MessageDef *msg_p = itti_alloc_new_message (TASK_M2AP_ENB, M2AP_ENB_CONFIGURATION_UPDATE_FAILURE); + MessageDef *msg_p = itti_alloc_new_message (TASK_M2AP_ENB, 0, M2AP_ENB_CONFIGURATION_UPDATE_FAILURE); LOG_D(M2AP, "M2AP: ENBConfigurationUpdate-Failure: protocolIEs.list.count %d\n", in->protocolIEs.list.count); @@ -1127,7 +1127,7 @@ int eNB_handle_eNB_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, assoc_id, stream); } - message_p = itti_alloc_new_message (TASK_M2AP_ENB, M2AP_ENB_CONFIGURATION_UPDATE_ACK); + message_p = itti_alloc_new_message (TASK_M2AP_ENB, 0, M2AP_ENB_CONFIGURATION_UPDATE_ACK); itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); @@ -1162,7 +1162,7 @@ int eNB_handle_MCE_CONFIGURATION_UPDATE(instance_t instance, assoc_id, stream); } - message_p = itti_alloc_new_message (TASK_M2AP_ENB, M2AP_MCE_CONFIGURATION_UPDATE); + message_p = itti_alloc_new_message (TASK_M2AP_ENB, 0, M2AP_MCE_CONFIGURATION_UPDATE); itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); @@ -1233,7 +1233,7 @@ int eNB_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, assoc_id, stream); } - message_p = itti_alloc_new_message (TASK_M2AP_ENB, M2AP_MBMS_SESSION_UPDATE_REQ); + message_p = itti_alloc_new_message (TASK_M2AP_ENB, 0, M2AP_MBMS_SESSION_UPDATE_REQ); itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); @@ -1321,7 +1321,7 @@ int eNB_handle_MBMS_SERVICE_COUNTING_REQ(instance_t instance, - //message_p = itti_alloc_new_message (TASK_M2AP_ENB, M2AP_MBMS_SERVICE_COUNTING_REQ); + //message_p = itti_alloc_new_message (TASK_M2AP_ENB, 0, M2AP_MBMS_SERVICE_COUNTING_REQ); return 0; diff --git a/openair2/M2AP/m2ap_eNB_management_procedures.c b/openair2/M2AP/m2ap_eNB_management_procedures.c index b3ada92fa8..59d91afb74 100644 --- a/openair2/M2AP/m2ap_eNB_management_procedures.c +++ b/openair2/M2AP/m2ap_eNB_management_procedures.c @@ -116,7 +116,7 @@ void dump_trees_m2(void) m2ap_eNB_instance_t *zz; STAILQ_FOREACH(zz, &m2ap_eNB_internal_data.m2ap_eNB_instances_head, m2ap_eNB_entries) { -printf("here comes the tree (instance %d):\n---------------------------------------------\n", zz->instance); +printf("here comes the tree (instance %ld):\n---------------------------------------------\n", zz->instance); dump_tree_m2(zz->m2ap_enb_head.rbh_root); printf("---------------------------------------------\n"); } diff --git a/openair2/M2AP/m2ap_itti_messaging.c b/openair2/M2AP/m2ap_itti_messaging.c index b9cfd32901..e0dcc27175 100644 --- a/openair2/M2AP/m2ap_itti_messaging.c +++ b/openair2/M2AP/m2ap_itti_messaging.c @@ -36,7 +36,7 @@ void m2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin MessageDef *message_p; sctp_data_req_t *sctp_data_req; - message_p = itti_alloc_new_message(TASK_M2AP_ENB, SCTP_DATA_REQ); + message_p = itti_alloc_new_message(TASK_M2AP_ENB, 0, SCTP_DATA_REQ); sctp_data_req = &message_p->ittiMsg.sctp_data_req; @@ -56,7 +56,7 @@ void m2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t asso MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; - message_p = itti_alloc_new_message(TASK_M2AP_ENB, SCTP_CLOSE_ASSOCIATION); + message_p = itti_alloc_new_message(TASK_M2AP_ENB, 0, SCTP_CLOSE_ASSOCIATION); sctp_close_association_p = &message_p->ittiMsg.sctp_close_association; sctp_close_association_p->assoc_id = assoc_id; @@ -70,7 +70,7 @@ void m2ap_MCE_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin MessageDef *message_p; sctp_data_req_t *sctp_data_req; - message_p = itti_alloc_new_message(TASK_M2AP_MCE, SCTP_DATA_REQ); + message_p = itti_alloc_new_message(TASK_M2AP_MCE, 0, SCTP_DATA_REQ); sctp_data_req = &message_p->ittiMsg.sctp_data_req; @@ -88,7 +88,7 @@ void m2ap_MCE_itti_send_sctp_close_association(instance_t instance, int32_t asso MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; - message_p = itti_alloc_new_message(TASK_M2AP_MCE, SCTP_CLOSE_ASSOCIATION); + message_p = itti_alloc_new_message(TASK_M2AP_MCE, 0, SCTP_CLOSE_ASSOCIATION); sctp_close_association_p = &message_p->ittiMsg.sctp_close_association; sctp_close_association_p->assoc_id = assoc_id; diff --git a/openair2/MCE_APP/mce_app.c b/openair2/MCE_APP/mce_app.c index 817c863f7b..3572de215c 100644 --- a/openair2/MCE_APP/mce_app.c +++ b/openair2/MCE_APP/mce_app.c @@ -78,7 +78,7 @@ static uint32_t MCE_app_register(ngran_node_t node_type,uint32_t mce_id_start, u { // M3AP registration /* note: there is an implicit relationship between the data structure and the message name */ - msg_p = itti_alloc_new_message (TASK_MCE_APP, M3AP_REGISTER_MCE_REQ); + msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, M3AP_REGISTER_MCE_REQ); //RCconfig_S1(msg_p, mce_id); //if (mce_id == 0) @@ -92,7 +92,7 @@ static uint32_t MCE_app_register(ngran_node_t node_type,uint32_t mce_id_start, u //if (NODE_IS_DU(node_type)) { // F1AP registration // // configure F1AP here for F1C // LOG_I(ENB_APP,"ngran_eNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n"); - // msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SETUP_REQ); + // msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, F1AP_SETUP_REQ); // RCconfig_DU_F1(msg_p, enb_id); // LOG_I(ENB_APP,"[eNB %d] eNB_app_register via F1AP for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); @@ -101,7 +101,7 @@ static uint32_t MCE_app_register(ngran_node_t node_type,uint32_t mce_id_start, u //} //else { // S1AP registration // /* note: there is an implicit relationship between the data structure and the message name */ - // msg_p = itti_alloc_new_message (TASK_ENB_APP, S1AP_REGISTER_ENB_REQ); + // msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, S1AP_REGISTER_ENB_REQ); // RCconfig_S1(msg_p, enb_id); // if (enb_id == 0) RCconfig_gtpu(); @@ -128,7 +128,7 @@ static uint32_t MCE_app_register(ngran_node_t node_type,uint32_t mce_id_start, u // // for (mce_id = mce_id_start; (mce_id < mce_id_end) ; mce_id++) { // { -// msg_p = itti_alloc_new_message (TASK_ENB_APP, X2AP_REGISTER_ENB_REQ); +// msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, X2AP_REGISTER_ENB_REQ); // RCconfig_X2(msg_p, mce_id); // itti_send_msg_to_task (TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(mce_id), msg_p); // register_mce_x2_pending++; @@ -148,7 +148,7 @@ static uint32_t MCE_app_register(ngran_node_t node_type,uint32_t mce_id_start, u // for (mce_id = mce_id_start; (mce_id < mce_id_end) ; mce_id++) { // { // // LOG_W(MCE_APP,"Register commes inside ...\n"); -// msg_p = itti_alloc_new_message (TASK_MCE_APP, M2AP_REGISTER_MCE_REQ); +// msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, M2AP_REGISTER_MCE_REQ); // //RCconfig_M2_MCE(msg_p, mce_id); // itti_send_msg_to_task (TASK_M2AP_MCE, ENB_MODULE_ID_TO_INSTANCE(mce_id), msg_p); // // LOG_W(MCE_APP,"Register sent ...\n"); @@ -169,7 +169,7 @@ static uint32_t MCE_app_register_m3(uint32_t mce_id_start, uint32_t mce_id_end) for (mce_id = mce_id_start; (mce_id < mce_id_end) ; mce_id++) { { // LOG_W(MCE_APP,"Register commes inside ...\n"); - msg_p = itti_alloc_new_message (TASK_MCE_APP, M3AP_REGISTER_MCE_REQ); + msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, M3AP_REGISTER_MCE_REQ); RCconfig_M3(msg_p, mce_id); itti_send_msg_to_task (TASK_M3AP_MCE, ENB_MODULE_ID_TO_INSTANCE(mce_id), msg_p); LOG_D(MCE_APP,"Register sent ...\n"); @@ -184,7 +184,7 @@ static uint32_t MCE_app_register_m3(uint32_t mce_id_start, uint32_t mce_id_end) //static uint32_t MCE_app_handle_m3ap_mbms_session_start_req(instance_t instance){ // //uint32_t mce_id=0; // // MessageDef *msg_p; -// // msg_p = itti_alloc_new_message (TASK_MCE_APP, M3AP_MBMS_SESSION_START_RESP); +// // msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, M3AP_MBMS_SESSION_START_RESP); // // itti_send_msg_to_task (TASK_M3AP_MCE, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); // // @@ -194,7 +194,7 @@ static uint32_t MCE_app_register_m3(uint32_t mce_id_start, uint32_t mce_id_end) static uint32_t MCE_app_handle_m3ap_mbms_session_stop_req(instance_t instance){ //uint32_t mce_id=0; MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_MCE_APP, M3AP_MBMS_SESSION_STOP_RESP); + msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, M3AP_MBMS_SESSION_STOP_RESP); itti_send_msg_to_task (TASK_M3AP_MCE, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); return 0; @@ -203,7 +203,7 @@ static uint32_t MCE_app_handle_m3ap_mbms_session_stop_req(instance_t instance){ static uint32_t MCE_app_handle_m3ap_mbms_session_update_req(instance_t instance){ //uint32_t mce_id=0; MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_MCE_APP, M3AP_MBMS_SESSION_UPDATE_RESP); + msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, M3AP_MBMS_SESSION_UPDATE_RESP); itti_send_msg_to_task (TASK_M3AP_MCE, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); return 0; @@ -216,7 +216,7 @@ static uint32_t MCE_app_handle_m2ap_setup_req(instance_t instance){ //uint32_t mce_id=0; MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_MCE_APP, M2AP_SETUP_RESP); + msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, M2AP_SETUP_RESP); if(m2ap_setup_resp_local) memcpy(&M2AP_SETUP_RESP(msg_p),m2ap_setup_resp_local,sizeof(m2ap_setup_resp_t)); else @@ -230,7 +230,7 @@ static uint32_t MCE_app_handle_m2ap_setup_req(instance_t instance){ static uint32_t MCE_app_handle_m2ap_mbms_session_start_resp(instance_t instance){ MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_MCE_APP, M3AP_MBMS_SESSION_START_RESP); + msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, M3AP_MBMS_SESSION_START_RESP); itti_send_msg_to_task (TASK_M3AP_MCE, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); return 0; } @@ -243,7 +243,7 @@ static uint32_t MCE_app_send_m2ap_mbms_scheduling_information(instance_t instanc //uint32_t mce_id=0; MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_MCE_APP, M2AP_MBMS_SCHEDULING_INFORMATION); + msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, M2AP_MBMS_SCHEDULING_INFORMATION); if(m2ap_mbms_scheduling_information_local) memcpy(&M2AP_MBMS_SCHEDULING_INFORMATION(msg_p),m2ap_mbms_scheduling_information_local,sizeof(m2ap_mbms_scheduling_information_t)); else @@ -257,7 +257,7 @@ static uint32_t MCE_app_send_m2ap_session_start_req(instance_t instance){ //uint32_t mce_id=0; MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_MCE_APP, M2AP_MBMS_SESSION_START_REQ); + msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, M2AP_MBMS_SESSION_START_REQ); itti_send_msg_to_task (TASK_M2AP_MCE, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); return 0; @@ -266,7 +266,7 @@ static uint32_t MCE_app_send_m2ap_session_start_req(instance_t instance){ // // //uint32_t mce_id=0; // MessageDef *msg_p; -// msg_p = itti_alloc_new_message (TASK_MCE_APP, M2AP_MBMS_SESSION_STOP_REQ); +// msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, M2AP_MBMS_SESSION_STOP_REQ); // itti_send_msg_to_task (TASK_M2AP_MCE, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); // // return 0; @@ -275,7 +275,7 @@ static uint32_t MCE_app_send_m2ap_session_start_req(instance_t instance){ // // //uint32_t mce_id=0; // MessageDef *msg_p; -// msg_p = itti_alloc_new_message (TASK_MCE_APP, M2AP_MCE_CONFIGURATION_UPDATE); +// msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, M2AP_MCE_CONFIGURATION_UPDATE); // itti_send_msg_to_task (TASK_M2AP_MCE, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); // // return 0; @@ -284,7 +284,7 @@ static uint32_t MCE_app_send_m2ap_session_start_req(instance_t instance){ // // //uint32_t mce_id=0; // MessageDef *msg_p; -// msg_p = itti_alloc_new_message (TASK_MCE_APP, M2AP_ENB_CONFIGURATION_UPDATE_ACK); +// msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, M2AP_ENB_CONFIGURATION_UPDATE_ACK); // itti_send_msg_to_task (TASK_M2AP_MCE, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); // // return 0; @@ -293,7 +293,7 @@ static uint32_t MCE_app_send_m2ap_session_start_req(instance_t instance){ // // //uint32_t mce_id=0; // MessageDef *msg_p; -// msg_p = itti_alloc_new_message (TASK_MCE_APP, M2AP_ENB_CONFIGURATION_UPDATE_FAILURE); +// msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, M2AP_ENB_CONFIGURATION_UPDATE_FAILURE); // itti_send_msg_to_task (TASK_M2AP_MCE, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); // // return 0; @@ -303,7 +303,7 @@ static uint32_t MCE_app_send_m2ap_session_start_req(instance_t instance){ // // //uint32_t mce_id=0; // MessageDef *msg_p; -// msg_p = itti_alloc_new_message (TASK_MCE_APP, MESSAGE_TEST); +// msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, MESSAGE_TEST); // itti_send_msg_to_task (TASK_MME_APP, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); // // return 0; @@ -313,7 +313,7 @@ static uint32_t MCE_app_send_m2ap_session_start_req(instance_t instance){ // // //uint32_t mce_id=0; // MessageDef *msg_p; -// msg_p = itti_alloc_new_message (TASK_MCE_APP, MESSAGE_TEST); +// msg_p = itti_alloc_new_message (TASK_MCE_APP, 0, MESSAGE_TEST); // itti_send_msg_to_task (TASK_M3AP_MCE, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); // // return 0; @@ -379,7 +379,7 @@ void *MCE_app_task(void *args_p) { do { // Wait for a message itti_receive_msg (TASK_MCE_APP, &msg_p); - instance = ITTI_MSG_INSTANCE (msg_p); + instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); switch (ITTI_MSG_ID(msg_p)) { case TERMINATE_MESSAGE: @@ -397,7 +397,7 @@ void *MCE_app_task(void *args_p) { case M3AP_REGISTER_MCE_CNF: //AssertFatal(!NODE_IS_DU(RC.rrc[0]->node_type), "Should not have received S1AP_REGISTER_ENB_CNF\n"); - LOG_I(MCE_APP, "[MCE %d] Received %s: associated MME %d\n", instance, ITTI_MSG_NAME (msg_p), + LOG_I(MCE_APP, "[MCE %ld] Received %s: associated MME %d\n", instance, ITTI_MSG_NAME (msg_p), M3AP_REGISTER_MCE_CNF(msg_p).nb_mme); DevAssert(register_mce_pending > 0); register_mce_pending--; @@ -412,7 +412,7 @@ void *MCE_app_task(void *args_p) { if (registered_mce == mce_nb) { /* If all MCE are registered, start L2L1 task */ // MessageDef *msg_init_p; - // msg_init_p = itti_alloc_new_message (TASK_ENB_APP, INITIALIZE_MESSAGE); + // msg_init_p = itti_alloc_new_message (TASK_ENB_APP, 0, INITIALIZE_MESSAGE); // itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p); } else { LOG_W(MCE_APP, " %d MCE not associated with a MME, retrying registration in %d seconds ...\n", @@ -434,7 +434,7 @@ void *MCE_app_task(void *args_p) { case M3AP_MBMS_SESSION_START_REQ: LOG_I(MCE_APP, "Received M3AP_MBMS_SESSION_START_REQ message %s\n", ITTI_MSG_NAME (msg_p)); - //MCE_app_handle_m3ap_mbms_session_start_req(ITTI_MESSAGE_GET_INSTANCE(msg_p)); + //MCE_app_handle_m3ap_mbms_session_start_req(ITTI_MSG_DESTINATION_INSTANCE(msg_p)); if(m2ap_setup_req_local) if (timer_setup (2, 0, TASK_MCE_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT, NULL, &mce_scheduling_info_timer_id) < 0) { @@ -445,12 +445,12 @@ void *MCE_app_task(void *args_p) { case M3AP_MBMS_SESSION_STOP_REQ: LOG_I(MCE_APP, "Received M3AP_MBMS_SESSION_STOP_REQ message %s\n", ITTI_MSG_NAME (msg_p)); - MCE_app_handle_m3ap_mbms_session_stop_req(ITTI_MESSAGE_GET_INSTANCE(msg_p)); + MCE_app_handle_m3ap_mbms_session_stop_req(ITTI_MSG_DESTINATION_INSTANCE(msg_p)); break; case M3AP_MBMS_SESSION_UPDATE_REQ: LOG_I(MCE_APP, "Received M3AP_MBMS_SESSION_UPDATE_REQ message %s\n", ITTI_MSG_NAME (msg_p)); - MCE_app_handle_m3ap_mbms_session_update_req(ITTI_MESSAGE_GET_INSTANCE(msg_p)); + MCE_app_handle_m3ap_mbms_session_update_req(ITTI_MSG_DESTINATION_INSTANCE(msg_p)); break; @@ -479,7 +479,7 @@ void *MCE_app_task(void *args_p) { // /* If all MCE cells are registered, start L2L1 task */ // MessageDef *msg_init_p; - // //msg_init_p = itti_alloc_new_message (TASK_MCE_APP, INITIALIZE_MESSAGE); + // //msg_init_p = itti_alloc_new_message (TASK_MCE_APP, 0, INITIALIZE_MESSAGE); // //itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p); // } else { @@ -503,7 +503,7 @@ void *MCE_app_task(void *args_p) { case M3AP_DEREGISTERED_MCE_IND: if (EPC_MODE_ENABLED) { - LOG_W(MCE_APP, "[MCE %d] Received %s: associated MME %d\n", instance, ITTI_MSG_NAME (msg_p), + LOG_W(MCE_APP, "[MCE %ld] Received %s: associated MME %d\n", instance, ITTI_MSG_NAME (msg_p), M3AP_DEREGISTERED_MCE_IND(msg_p).nb_mme); /* TODO handle recovering of registration */ } @@ -621,7 +621,7 @@ void *MCE_app_task(void *args_p) { m2ap_setup_req_local = (m2ap_setup_req_t*)calloc(1,sizeof(m2ap_setup_req_t)); if(m2ap_setup_req_local) memcpy(m2ap_setup_req_local,&M2AP_SETUP_REQ(msg_p),sizeof(m2ap_setup_req_t)); - MCE_app_handle_m2ap_setup_req(ITTI_MESSAGE_GET_INSTANCE(msg_p)); + MCE_app_handle_m2ap_setup_req(ITTI_MSG_DESTINATION_INSTANCE(msg_p)); //MCE_app_send_m2ap_mbms_scheduling_information(0); //if (timer_setup (2, 0, TASK_MCE_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT, // NULL, &mce_scheduling_info_timer_id) < 0) { diff --git a/openair2/MCE_APP/mce_config.c b/openair2/MCE_APP/mce_config.c index 975f524ebd..439f2d2061 100644 --- a/openair2/MCE_APP/mce_config.c +++ b/openair2/MCE_APP/mce_config.c @@ -108,7 +108,7 @@ int RCconfig_MCE(void ) { if (address) { MessageDef *message; - AssertFatal((message = itti_alloc_new_message(TASK_MCE_APP, M2AP_MCE_SCTP_REQ))!=NULL,""); + AssertFatal((message = itti_alloc_new_message(TASK_MCE_APP, 0, M2AP_MCE_SCTP_REQ))!=NULL,""); //IPV4_STR_ADDR_TO_INT_NWBO ( address, M2AP_MCE_SCTP_REQ(message).mce_m2_ip_address, "BAD IP ADDRESS FORMAT FOR MCE M2_C !\n" ); M2AP_MCE_SCTP_REQ (message).mce_m2_ip_address.ipv6 = 0; M2AP_MCE_SCTP_REQ (message).mce_m2_ip_address.ipv4 = 1; diff --git a/openair2/RRC/LTE/L2_interface_common.c b/openair2/RRC/LTE/L2_interface_common.c index fa332b5be1..f70cc68550 100644 --- a/openair2/RRC/LTE/L2_interface_common.c +++ b/openair2/RRC/LTE/L2_interface_common.c @@ -80,7 +80,7 @@ rrc_data_req( ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, sdu_sizeP); memcpy (message_buffer, buffer_pP, sdu_sizeP); - message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ); + message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, 0, RRC_DCCH_DATA_REQ); RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame; RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag; RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP; @@ -139,7 +139,7 @@ rrc_data_ind( uint8_t *message_buffer; message_buffer = itti_malloc (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, sdu_sizeP); memcpy (message_buffer, buffer_pP, sdu_sizeP); - message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, RRC_DCCH_DATA_IND); + message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, 0, RRC_DCCH_DATA_IND); RRC_DCCH_DATA_IND (message_p).frame = ctxt_pP->frame; RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index; RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_sizeP; diff --git a/openair2/RRC/LTE/L2_interface_ue.c b/openair2/RRC/LTE/L2_interface_ue.c index 8c55dbaeb5..5c1800cdd4 100644 --- a/openair2/RRC/LTE/L2_interface_ue.c +++ b/openair2/RRC/LTE/L2_interface_ue.c @@ -94,7 +94,7 @@ mac_rrc_data_req_ue( ccch_size = sdu_size; } - message_p = itti_alloc_new_message (TASK_RRC_UE, RRC_MAC_CCCH_DATA_REQ); + message_p = itti_alloc_new_message (TASK_RRC_UE, 0, 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); @@ -155,7 +155,7 @@ mac_rrc_data_ind_ue( sdu_size = sdu_lenP; } - message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_BCCH_MBMS_DATA_IND); + message_p = itti_alloc_new_message (TASK_MAC_UE, 0, RRC_MAC_BCCH_MBMS_DATA_IND); memset (RRC_MAC_BCCH_MBMS_DATA_IND (message_p).sdu, 0, BCCH_SDU_MBMS_SIZE); RRC_MAC_BCCH_MBMS_DATA_IND (message_p).frame = frameP; RRC_MAC_BCCH_MBMS_DATA_IND (message_p).sub_frame = sub_frameP; @@ -181,7 +181,7 @@ mac_rrc_data_ind_ue( sdu_size = sdu_lenP; } - message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_BCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_MAC_UE, 0, RRC_MAC_BCCH_DATA_IND); memset (RRC_MAC_BCCH_DATA_IND (message_p).sdu, 0, BCCH_SDU_SIZE); RRC_MAC_BCCH_DATA_IND (message_p).frame = frameP; RRC_MAC_BCCH_DATA_IND (message_p).sub_frame = sub_frameP; @@ -213,7 +213,7 @@ mac_rrc_data_ind_ue( sdu_size = sdu_lenP; } - message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_MAC_UE, 0, RRC_MAC_CCCH_DATA_IND); 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); RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP; @@ -239,7 +239,7 @@ mac_rrc_data_ind_ue( sdu_size = msg_sdu_size; } - message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_MCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_MAC_UE, 0, RRC_MAC_MCCH_DATA_IND); RRC_MAC_MCCH_DATA_IND (message_p).frame = frameP; RRC_MAC_MCCH_DATA_IND (message_p).sub_frame = sub_frameP; RRC_MAC_MCCH_DATA_IND (message_p).sdu_size = sdu_lenP; @@ -293,7 +293,7 @@ rrc_data_req_ue( ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, sdu_sizeP); memcpy (message_buffer, buffer_pP, sdu_sizeP); - message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ); + message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, 0, RRC_DCCH_DATA_REQ); RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame; RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag; RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP; @@ -332,7 +332,7 @@ rrc_data_ind_ue( uint8_t *message_buffer; message_buffer = itti_malloc (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, sdu_sizeP); memcpy (message_buffer, buffer_pP, sdu_sizeP); - message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, RRC_DCCH_DATA_IND); + message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, 0, RRC_DCCH_DATA_IND); RRC_DCCH_DATA_IND (message_p).frame = ctxt_pP->frame; RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index; RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_sizeP; @@ -350,7 +350,7 @@ void rrc_in_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index) { { MessageDef *message_p; //LOG_I(RRC,"sending a message to task_mac_ue\n"); - message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_IN_SYNC_IND); + message_p = itti_alloc_new_message (TASK_MAC_UE, 0, RRC_MAC_IN_SYNC_IND); RRC_MAC_IN_SYNC_IND (message_p).frame = frameP; RRC_MAC_IN_SYNC_IND (message_p).enb_index = eNB_index; itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); @@ -370,7 +370,7 @@ void rrc_out_of_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index { MessageDef *message_p; - message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_OUT_OF_SYNC_IND); + message_p = itti_alloc_new_message (TASK_MAC_UE, 0, RRC_MAC_OUT_OF_SYNC_IND); RRC_MAC_OUT_OF_SYNC_IND (message_p).frame = frameP; RRC_MAC_OUT_OF_SYNC_IND (message_p).enb_index = eNB_index; itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); @@ -396,7 +396,7 @@ int mac_ue_ccch_success_ind(module_id_t Mod_idP, uint8_t eNB_index) { //-------------------------------------------------------------------------------------------// { MessageDef *message_p; - message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_CNF); + message_p = itti_alloc_new_message (TASK_MAC_UE, 0, RRC_MAC_CCCH_DATA_CNF); RRC_MAC_CCCH_DATA_CNF (message_p).enb_index = eNB_index; itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); } diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index c5aa2bc0f8..c57cec6ba5 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -1796,7 +1796,7 @@ rrc_ue_process_rrcConnectionReconfiguration( for (list_count = 0; list_count < rrcConnectionReconfiguration_r8->dedicatedInfoNASList->list.count; list_count++) { pdu_length = rrcConnectionReconfiguration_r8->dedicatedInfoNASList->list.array[list_count]->size; pdu_buffer = rrcConnectionReconfiguration_r8->dedicatedInfoNASList->list.array[list_count]->buf; - msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CONN_ESTABLI_CNF); + msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, NAS_CONN_ESTABLI_CNF); NAS_CONN_ESTABLI_CNF(msg_p).errCode = AS_SUCCESS; NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length = pdu_length; NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer; @@ -1811,7 +1811,7 @@ rrc_ue_process_rrcConnectionReconfiguration( MessageDef *message_ral_p = NULL; rrc_ral_connection_reestablishment_ind_t connection_reestablishment_ind; int i; - message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_CONNECTION_REESTABLISHMENT_IND); + message_ral_p = itti_alloc_new_message (TASK_RRC_UE, 0, RRC_RAL_CONNECTION_REESTABLISHMENT_IND); memset(&connection_reestablishment_ind, 0, sizeof(rrc_ral_connection_reestablishment_ind_t)); // TO DO ral_si_ind.plmn_id = 0; connection_reestablishment_ind.ue_id = ctxt_pP->rnti; @@ -2007,7 +2007,7 @@ rrc_ue_decode_dcch( MessageDef *msg_p; pdu_length = dedicatedInfoType->choice.dedicatedInfoNAS.size; pdu_buffer = dedicatedInfoType->choice.dedicatedInfoNAS.buf; - msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_DOWNLINK_DATA_IND); + msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, NAS_DOWNLINK_DATA_IND); NAS_DOWNLINK_DATA_IND(msg_p).UEid = ctxt_pP->module_id; // TODO set the UEid to something else ? NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = pdu_length; NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = pdu_buffer; @@ -2073,7 +2073,7 @@ rrc_ue_decode_dcch( MessageDef *message_ral_p = NULL; rrc_ral_connection_reconfiguration_ho_ind_t connection_reconfiguration_ho_ind; int i; - message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_CONNECTION_RECONFIGURATION_HO_IND); + message_ral_p = itti_alloc_new_message (TASK_RRC_UE, 0, RRC_RAL_CONNECTION_RECONFIGURATION_HO_IND); memset(&connection_reconfiguration_ho_ind, 0, sizeof(rrc_ral_connection_reconfiguration_ho_ind_t)); connection_reconfiguration_ho_ind.ue_id = ctxt_pP->module_id; @@ -2127,7 +2127,7 @@ rrc_ue_decode_dcch( MessageDef *message_ral_p = NULL; rrc_ral_connection_reconfiguration_ind_t connection_reconfiguration_ind; int i; - message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_CONNECTION_RECONFIGURATION_IND); + message_ral_p = itti_alloc_new_message (TASK_RRC_UE, 0, RRC_RAL_CONNECTION_RECONFIGURATION_IND); memset(&connection_reconfiguration_ind, 0, sizeof(rrc_ral_connection_reconfiguration_ind_t)); connection_reconfiguration_ind.ue_id = ctxt_pP->module_id; @@ -2189,7 +2189,7 @@ rrc_ue_decode_dcch( break; case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionRelease: - msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CONN_RELEASE_IND); + msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, NAS_CONN_RELEASE_IND); if ((dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.present == LTE_RRCConnectionRelease__criticalExtensions_PR_c1) @@ -2201,7 +2201,7 @@ rrc_ue_decode_dcch( itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); #if ENABLE_RAL - msg_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_CONNECTION_RELEASE_IND); + msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, RRC_RAL_CONNECTION_RELEASE_IND); RRC_RAL_CONNECTION_RELEASE_IND(msg_p).ue_id = ctxt_pP->module_id; itti_send_msg_to_task(TASK_RAL_UE, ctxt_pP->instance, msg_p); #endif @@ -2837,7 +2837,7 @@ int decode_SIB1_MBMS( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_in ) ) { MessageDef *msg_p; - msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CELL_SELECTION_CNF); + msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, NAS_CELL_SELECTION_CNF); NAS_CELL_SELECTION_CNF (msg_p).errCode = AS_SUCCESS; NAS_CELL_SELECTION_CNF (msg_p).cellID = BIT_STRING_to_uint32(&sib1->cellAccessRelatedInfo.cellIdentity); NAS_CELL_SELECTION_CNF (msg_p).tac = BIT_STRING_to_uint16(&sib1->cellAccessRelatedInfo.trackingAreaCode); @@ -2853,7 +2853,7 @@ int decode_SIB1_MBMS( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_in if (cell_valid == 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_NEXT_CELL_REQ); + msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, PHY_FIND_NEXT_CELL_REQ); itti_send_msg_to_task(TASK_PHY_UE, ctxt_pP->instance, msg_p); LOG_E(RRC, "Synched with a cell, but PLMN doesn't match our SIM, the message PHY_FIND_NEXT_CELL_REQ is sent but lost in current UE implementation! \n"); } @@ -3036,7 +3036,7 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, ) { /* PLMN match, send a confirmation to NAS */ MessageDef *msg_p; - msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CELL_SELECTION_CNF); + msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, NAS_CELL_SELECTION_CNF); NAS_CELL_SELECTION_CNF (msg_p).errCode = AS_SUCCESS; NAS_CELL_SELECTION_CNF (msg_p).cellID = BIT_STRING_to_uint32(&sib1->cellAccessRelatedInfo.cellIdentity); NAS_CELL_SELECTION_CNF (msg_p).tac = BIT_STRING_to_uint16(&sib1->cellAccessRelatedInfo.trackingAreaCode); @@ -3054,7 +3054,7 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, if (cell_valid == 0) { /* Cell can not be used, ask PHY to try the next one */ MessageDef *msg_p; - msg_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_NEXT_CELL_REQ); + msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, PHY_FIND_NEXT_CELL_REQ); itti_send_msg_to_task(TASK_PHY_UE, ctxt_pP->instance, msg_p); LOG_E(RRC, "Synched with a cell, but PLMN doesn't match our SIM " @@ -3672,7 +3672,7 @@ int decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index ) { { MessageDef *message_ral_p = NULL; rrc_ral_system_information_ind_t ral_si_ind; - message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_SYSTEM_INFORMATION_IND); + message_ral_p = itti_alloc_new_message (TASK_RRC_UE, 0, RRC_RAL_SYSTEM_INFORMATION_IND); memset(&ral_si_ind, 0, sizeof(rrc_ral_system_information_ind_t)); ral_si_ind.plmn_id.MCCdigit2 = '0'; ral_si_ind.plmn_id.MCCdigit1 = '2'; @@ -4456,7 +4456,7 @@ void *rrc_ue_task( void *args_p ) { while(1) { // Wait for a message itti_receive_msg (TASK_RRC_UE, &msg_p); - instance = ITTI_MSG_INSTANCE (msg_p); + instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); ue_mod_id = UE_INSTANCE_TO_MODULE_ID(instance); switch (ITTI_MSG_ID(msg_p)) { @@ -4645,7 +4645,7 @@ void *rrc_ue_task( void *args_p ) { case RRC_STATE_IDLE: { /* Ask to layer 1 to find a cell matching the criterion */ MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_CELL_REQ); + message_p = itti_alloc_new_message(TASK_RRC_UE, 0, PHY_FIND_CELL_REQ); PHY_FIND_CELL_REQ (message_p).earfcn_start = 1; PHY_FIND_CELL_REQ (message_p).earfcn_end = 1; itti_send_msg_to_task(TASK_PHY_UE, UE_MODULE_ID_TO_INSTANCE(ue_mod_id), message_p); @@ -4748,7 +4748,7 @@ void *rrc_ue_task( void *args_p ) { if (rrc_get_sub_state(ue_mod_id) != RRC_SUB_STATE_IDLE_SEARCHING) { /* Ask to layer 1 to find a cell matching the criterion */ MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_CELL_REQ); + message_p = itti_alloc_new_message(TASK_RRC_UE, 0, PHY_FIND_CELL_REQ); rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_SEARCHING); PHY_FIND_CELL_REQ (message_p).transaction_id = RRC_RAL_SCAN_REQ (msg_p).transaction_id; PHY_FIND_CELL_REQ (message_p).earfcn_start = 1; @@ -4780,7 +4780,7 @@ void *rrc_ue_task( void *args_p ) { case RRC_SUB_STATE_IDLE_SEARCHING: { MessageDef *message_p; int i; - message_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_SCAN_CONF); + message_p = itti_alloc_new_message(TASK_RRC_UE, 0, RRC_RAL_SCAN_CONF); RRC_RAL_SCAN_CONF (message_p).transaction_id = PHY_FIND_CELL_IND(msg_p).transaction_id; RRC_RAL_SCAN_CONF (message_p).num_scan_resp = PHY_FIND_CELL_IND(msg_p).cell_nb; @@ -4823,7 +4823,7 @@ void *rrc_ue_task( void *args_p ) { case PHY_MEAS_REPORT_IND: { LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p)); MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_MEASUREMENT_REPORT_IND); + message_p = itti_alloc_new_message(TASK_RRC_UE, 0, RRC_RAL_MEASUREMENT_REPORT_IND); memcpy(&RRC_RAL_MEASUREMENT_REPORT_IND (message_p).threshold, &PHY_MEAS_REPORT_IND(msg_p).threshold, sizeof(RRC_RAL_MEASUREMENT_REPORT_IND (message_p).threshold)); diff --git a/openair2/RRC/LTE/rrc_UE_ral.c b/openair2/RRC/LTE/rrc_UE_ral.c index d7ace8c242..1ebba43d8b 100644 --- a/openair2/RRC/LTE/rrc_UE_ral.c +++ b/openair2/RRC/LTE/rrc_UE_ral.c @@ -126,7 +126,7 @@ int rrc_ue_ral_handle_configure_threshold_request(unsigned int mod_idP, MessageD message_p = itti_alloc_new_message (TASK_RRC_UE, PHY_MEAS_THRESHOLD_REQ); PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_PHY_UE, ITTI_MSG_INSTANCE(msg_pP), message_p); + itti_send_msg_to_task (TASK_PHY_UE, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); break; default: @@ -147,7 +147,7 @@ int rrc_ue_ral_handle_configure_threshold_request(unsigned int mod_idP, MessageD message_p = itti_alloc_new_message (TASK_RRC_UE, PHY_MEAS_THRESHOLD_REQ); PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_MAC_UE, ITTI_MSG_INSTANCE(msg_pP), message_p); + itti_send_msg_to_task (TASK_MAC_UE, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); break; default: @@ -166,7 +166,7 @@ int rrc_ue_ral_handle_configure_threshold_request(unsigned int mod_idP, MessageD message_p = itti_alloc_new_message (TASK_RRC_UE, PHY_MEAS_THRESHOLD_REQ); PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_PHY_UE, ITTI_MSG_INSTANCE(msg_pP), message_p); + itti_send_msg_to_task (TASK_PHY_UE, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); break; case RAL_LINK_PARAM_LTE_AVAILABLE_BW: @@ -176,7 +176,7 @@ int rrc_ue_ral_handle_configure_threshold_request(unsigned int mod_idP, MessageD message_p = itti_alloc_new_message (TASK_RRC_UE, PHY_MEAS_THRESHOLD_REQ); PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_MAC_UE, ITTI_MSG_INSTANCE(msg_pP), message_p); + itti_send_msg_to_task (TASK_MAC_UE, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); break; case RAL_LINK_PARAM_LTE_MOBILE_NODE_CAPABILITIES: diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 18b7173a08..fc99ba946e 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -332,7 +332,7 @@ init_SI( if (carrier->MBMS_flag > 0) { for (i = 0; i < carrier->sib2->mbsfn_SubframeConfigList->list.count; i++) { // SIB 2 - // LOG_D(RRC, "[eNB %d] mbsfn_SubframeConfigList.list.count = %ld\n", enb_mod_idP, RC.rrc[enb_mod_idP].sib2->mbsfn_SubframeConfigList->list.count); + // LOG_D(RRC, "[eNB %ld] mbsfn_SubframeConfigList.list.count = %ld\n", enb_mod_idP, RC.rrc[enb_mod_idP].sib2->mbsfn_SubframeConfigList->list.count); LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN subframe allocation %d/%d(partial)\n", PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), i, @@ -1132,7 +1132,7 @@ void release_UE_in_freeList(module_id_t mod_id) { rrc_rlc_remove_ue(&ctxt); pdcp_remove_UE(&ctxt); } else { - MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD); + MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, 0, F1AP_UE_CONTEXT_RELEASE_CMD); F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = rnti; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release @@ -2173,7 +2173,7 @@ void rrc_generate_SgNBReleaseRequest( //----------------------------------------------------------------------------- { MessageDef *msg; - msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_ENDC_SGNB_RELEASE_REQ); + msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_ENDC_SGNB_RELEASE_REQ); memset(&(X2AP_ENDC_SGNB_RELEASE_REQ(msg)), 0, sizeof(x2ap_ENDC_sgnb_release_req_t)); // X2AP_ENDC_SGNB_RELEASE_REQ(msg).MeNB_ue_x2_id = ; // X2AP_ENDC_SGNB_RELEASE_REQ(msg).SgNB_ue_x2_id = ; @@ -2268,7 +2268,7 @@ rrc_eNB_generate_RRCConnectionRelease( pthread_mutex_unlock(&rrc_release_freelist); if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { - MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD); + MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, 0, F1AP_UE_CONTEXT_RELEASE_CMD); F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release @@ -3110,7 +3110,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t LOG_W(RRC, "drx_Configuration parameter is NULL, cannot configure local UE parameters or CDRX is deactivated\n"); } else { /* Send DRX configuration to MAC task to configure timers of local UE context */ - message_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_MAC_DRX_CONFIG_REQ); + message_p = itti_alloc_new_message(TASK_RRC_ENB, 0, RRC_MAC_DRX_CONFIG_REQ); RRC_MAC_DRX_CONFIG_REQ(message_p).rnti = rnti; RRC_MAC_DRX_CONFIG_REQ(message_p).drx_Configuration = mac_MainConfig->drx_Config; itti_send_msg_to_task(TASK_MAC_ENB, module_id, message_p); @@ -3883,7 +3883,7 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt LOG_W(RRC, "drx_Configuration parameter is NULL, cannot configure local UE parameters or CDRX is deactivated\n"); } else { /* Send DRX configuration to MAC task to configure timers of local UE context */ - message_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_MAC_DRX_CONFIG_REQ); + message_p = itti_alloc_new_message(TASK_RRC_ENB, 0, RRC_MAC_DRX_CONFIG_REQ); RRC_MAC_DRX_CONFIG_REQ(message_p).rnti = rnti; RRC_MAC_DRX_CONFIG_REQ(message_p).drx_Configuration = mac_MainConfig->drx_Config; itti_send_msg_to_task(TASK_MAC_ENB, module_id, message_p); @@ -4670,7 +4670,7 @@ rrc_eNB_process_MeasurementReport( if(encode_CG_ConfigInfo(enc_buf,sizeof(enc_buf),ue_context_pP,&enc_size) == RRC_OK) LOG_I(RRC,"CG-ConfigInfo encoded successfully\n"); - msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_ENDC_SGNB_ADDITION_REQ); + msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_ENDC_SGNB_ADDITION_REQ); memset(&(X2AP_ENDC_SGNB_ADDITION_REQ(msg)), 0, sizeof(x2ap_ENDC_sgnb_addition_req_t)); X2AP_ENDC_SGNB_ADDITION_REQ(msg).rnti = ctxt_pP->rnti; memcpy(X2AP_ENDC_SGNB_ADDITION_REQ(msg).rrc_buffer,enc_buf,enc_size); @@ -4766,7 +4766,7 @@ rrc_eNB_process_MeasurementReport( ue_context_pP->ue_context.Status = RRC_HO_EXECUTION; ue_context_pP->ue_context.handover_info->state = HO_REQUEST; /* HO Preparation message */ - msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_HANDOVER_REQ); + msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_HANDOVER_REQ); rrc_eNB_generate_HandoverPreparationInformation( ue_context_pP, X2AP_HANDOVER_REQ(msg).rrc_buffer, @@ -5015,11 +5015,11 @@ void rrc_eNB_handover_ue_context_release( //MessageDef *msg_release_p = NULL; MessageDef *msg_delete_tunnels_p = NULL; uint32_t eNB_ue_s1ap_id = ue_context_p->ue_context.eNB_ue_s1ap_id; - //msg_release_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE); + //msg_release_p = itti_alloc_new_message(TASK_RRC_ENB, 0, S1AP_UE_CONTEXT_RELEASE); //itti_send_msg_to_task(TASK_S1AP, ctxt_pP->module_id, msg_release_p); s1ap_ue_context_release(ctxt_pP->instance, ue_context_p->ue_context.eNB_ue_s1ap_id); //MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_GTPU_ENB, NULL,0, "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", eNB_ue_s1ap_id); - msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); + msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, 0, GTPV1U_ENB_DELETE_TUNNEL_REQ); memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).from_gnb = 0; @@ -5096,7 +5096,7 @@ flexran_rrc_eNB_trigger_handover (int mod_id, ue_context_pP->ue_context.Status = RRC_HO_EXECUTION; ue_context_pP->ue_context.handover_info->state = HO_REQUEST; /* HO Preparation message */ - msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_HANDOVER_REQ); + msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_HANDOVER_REQ); rrc_eNB_generate_HandoverPreparationInformation( ue_context_pP, X2AP_HANDOVER_REQ(msg).rrc_buffer, @@ -5183,7 +5183,7 @@ check_handovers( MessageDef *msg; // Configure target ue_context_p->ue_context.handover_info->state = HO_FORWARDING; - msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_HANDOVER_REQ_ACK); + msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_HANDOVER_REQ_ACK); rrc_eNB_generate_HO_RRCConnectionReconfiguration(ctxt_pP, ue_context_p, X2AP_HANDOVER_REQ_ACK(msg).rrc_buffer, &X2AP_HANDOVER_REQ_ACK(msg).rrc_buffer_size); rrc_eNB_configure_rbs_handover(ue_context_p,ctxt_pP); @@ -5227,11 +5227,11 @@ check_handovers( GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).frame, 0, GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).eNB_index); - LOG_D(RRC, PROTOCOL_CTXT_FMT"[check_handovers]Received %s from %s: instance %d, rb_id %ld, muiP %d, confirmP %d, mode %d\n", + LOG_D(RRC, PROTOCOL_CTXT_FMT"[check_handovers]Received %s from %s: instance %ld, rb_id %ld, muiP %d, confirmP %d, mode %d\n", PROTOCOL_CTXT_ARGS(&ctxt), ITTI_MSG_NAME (msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), - ITTI_MSG_INSTANCE (msg_p), + ITTI_MSG_DESTINATION_INSTANCE (msg_p), GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id, GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).muip, GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).confirmp, @@ -5295,11 +5295,11 @@ check_handovers( GTPV1U_ENB_END_MARKER_IND (msg_p).frame, 0, GTPV1U_ENB_END_MARKER_IND (msg_p).eNB_index); - LOG_I(RRC, PROTOCOL_CTXT_FMT"[check_handovers]Received %s from %s: instance %d, rb_id %ld, muiP %d, confirmP %d, mode %d\n", + LOG_I(RRC, PROTOCOL_CTXT_FMT"[check_handovers]Received %s from %s: instance %ld, rb_id %ld, muiP %d, confirmP %d, mode %d\n", PROTOCOL_CTXT_ARGS(&ctxt), ITTI_MSG_NAME (msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), - ITTI_MSG_INSTANCE (msg_p), + ITTI_MSG_DESTINATION_INSTANCE (msg_p), GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id, GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).muip, GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).confirmp, @@ -6860,7 +6860,7 @@ rrc_eNB_generate_RRCConnectionSetup( case ngran_gNB_CU : // create an ITTI message /* TODO: F1 IDs ar missing in RRC */ - message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_DL_RRC_MESSAGE); + message_p = itti_alloc_new_message (TASK_RRC_ENB, 0, F1AP_DL_RRC_MESSAGE); F1AP_DL_RRC_MESSAGE (message_p).rrc_container = (uint8_t *)ue_p->Srb0.Tx_buffer.Payload; F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size; F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; @@ -6972,7 +6972,7 @@ void rrc_eNB_process_reconfiguration_complete_endc(const protocol_ctxt_t *const { MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, X2AP_ENDC_SGNB_RECONF_COMPLETE); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, X2AP_ENDC_SGNB_RECONF_COMPLETE); /* MeNB_ue_x2_id is unknown, set to 0. * This is not correct but X2 id in the eNB is only 12 bits, @@ -7085,7 +7085,7 @@ char openair_rrc_eNB_configuration( LOG_W(RRC, "[inst %d] RRC->MCC/MSG->MCC %d/%d \n", ctxt.module_id, RC.rrc[ctxt.module_id]->mcc, rrc_configuration_req->mcc); */ if (NODE_IS_CU(RC.rrc[ctxt.module_id]->node_type)) - // msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SCTP_REQ); + // msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, F1AP_SCTP_REQ); // RCconfig_CU_F1(msg_p, enb_id); setup_ngran_CU(RC.rrc[ctxt.module_id]); @@ -7466,7 +7466,7 @@ rrc_eNB_decode_ccch( if (!NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); } else { - MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD); + MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, 0, F1AP_UE_CONTEXT_RELEASE_CMD); F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release @@ -7570,7 +7570,7 @@ rrc_eNB_decode_ccch( if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti); else if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { - MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD); + MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, 0, F1AP_UE_CONTEXT_RELEASE_CMD); F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release @@ -7954,7 +7954,7 @@ rrc_eNB_decode_dcch( xid = ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier; ue_context_p->ue_context.e_rab_release_command_flag = 0; //gtp tunnel delete - msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); + msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, 0, GTPV1U_ENB_DELETE_TUNNEL_REQ); memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).from_gnb = 0; @@ -8636,7 +8636,7 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { // prepare F1_SETUP_RESPONSE if (msg_p == NULL) { - msg_p = itti_alloc_new_message (TASK_CU_F1,F1AP_SETUP_RESP); + msg_p = itti_alloc_new_message (TASK_CU_F1, 0,F1AP_SETUP_RESP); } F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name; @@ -8672,7 +8672,7 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { if (found_cell==0) { AssertFatal(1==0,"No cell found\n"); - /*msg_p = itti_alloc_new_message (TASK_CU_F1,F1AP_SETUP_FAILURE); + /*msg_p = itti_alloc_new_message (TASK_CU_F1, 0,F1AP_SETUP_FAILURE); F1AP_SETUP_RESP (msg_p).cause = rrc->node_name; F1AP_SETUP_RESP (msg_p).time_to_wait = rrc->node_id; F1AP_SETUP_RESP (msg_p).criticality_diagnostics = rrc->node_name;*/ @@ -8861,7 +8861,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { if (RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_x2) { /* send a tick to x2ap */ - msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_SUBFRAME_PROCESS); + msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_SUBFRAME_PROCESS); itti_send_msg_to_task(TASK_X2AP, ctxt_pP->module_id, msg); check_handovers(ctxt_pP); // counter, get the value and aggregate } @@ -9053,7 +9053,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { if (ue_to_be_removed[cur_ue]->ue_context.Status == RRC_NR_NSA || ue_to_be_removed[cur_ue]->ue_context.Status == RRC_NR_NSA_RECONFIGURED) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_RRC_ENB, X2AP_ENDC_SGNB_RELEASE_REQUEST); + message_p = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_ENDC_SGNB_RELEASE_REQUEST); X2AP_ENDC_SGNB_RELEASE_REQUEST(message_p).rnti = ue_to_be_removed[cur_ue]->ue_context.gnb_rnti; X2AP_ENDC_SGNB_RELEASE_REQUEST(message_p).assoc_id = ue_to_be_removed[cur_ue]->ue_context.gnb_x2_assoc_id; X2AP_ENDC_SGNB_RELEASE_REQUEST(message_p).cause = X2AP_CAUSE_RADIO_CONNECTION_WITH_UE_LOST; @@ -9300,7 +9300,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { // Wait for a message itti_receive_msg(TASK_RRC_ENB, &msg_p); msg_name_p = ITTI_MSG_NAME(msg_p); - instance = ITTI_MSG_INSTANCE(msg_p); + instance = ITTI_MSG_DESTINATION_INSTANCE(msg_p); /* RRC_SUBFRAME_PROCESS is sent every subframe, do not log it */ if (ITTI_MSG_ID(msg_p) != RRC_SUBFRAME_PROCESS) @@ -9313,7 +9313,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { break; case MESSAGE_TEST: - LOG_I(RRC, "[eNB %d] Received %s\n", instance, msg_name_p); + LOG_I(RRC, "[eNB %ld] Received %s\n", instance, msg_name_p); break; /* Messages from MAC */ @@ -9324,7 +9324,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { RRC_MAC_CCCH_DATA_IND(msg_p).rnti, msg_p->ittiMsgHeader.lte_time.frame, msg_p->ittiMsgHeader.lte_time.slot); - LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", + LOG_I(RRC,"Decoding CCCH : inst %ld, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", instance, RRC_MAC_CCCH_DATA_IND(msg_p).CC_id, &ctxt, @@ -9382,13 +9382,13 @@ void *rrc_enb_process_itti_msg(void *notUsed) { break; case S1AP_PAGING_IND: - LOG_D(RRC, "[eNB %d] Received Paging message from S1AP: %s\n", instance, msg_name_p); + LOG_D(RRC, "[eNB %ld] Received Paging message from S1AP: %s\n", instance, msg_name_p); rrc_eNB_process_PAGING_IND(msg_p, msg_name_p, instance); break; case S1AP_E_RAB_SETUP_REQ: rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(msg_p, msg_name_p, instance); - LOG_D(RRC, "[eNB %d] Received the message %s\n", instance, msg_name_p); + LOG_D(RRC, "[eNB %ld] Received the message %s\n", instance, msg_name_p); break; case S1AP_E_RAB_MODIFY_REQ: @@ -9422,7 +9422,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { } case S1AP_PATH_SWITCH_REQ_ACK: - LOG_I(RRC, "[eNB %d] received path switch ack %s\n", instance, msg_name_p); + LOG_I(RRC, "[eNB %ld] received path switch ack %s\n", instance, msg_name_p); rrc_eNB_process_S1AP_PATH_SWITCH_REQ_ACK(msg_p, msg_name_p, instance); break; @@ -9435,7 +9435,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { break; case X2AP_HANDOVER_REQ: - LOG_I(RRC, "[eNB %d] target eNB Receives X2 HO Req %s\n", instance, msg_name_p); + LOG_I(RRC, "[eNB %ld] target eNB Receives X2 HO Req %s\n", instance, msg_name_p); rrc_eNB_process_handoverPreparationInformation(instance, &X2AP_HANDOVER_REQ(msg_p)); break; @@ -9453,7 +9453,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { exit(1); } - LOG_I(RRC, "[eNB %d] source eNB receives the X2 HO ACK %s\n", instance, msg_name_p); + LOG_I(RRC, "[eNB %ld] source eNB receives the X2 HO ACK %s\n", instance, msg_name_p); DevAssert(ue_context_p != NULL); if (ue_context_p->ue_context.handover_info->state != HO_REQUEST) abort(); @@ -9504,7 +9504,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { case X2AP_UE_CONTEXT_RELEASE: { struct rrc_eNB_ue_context_s *ue_context_p = NULL; ue_context_p = rrc_eNB_get_ue_context(RC.rrc[instance], X2AP_UE_CONTEXT_RELEASE(msg_p).rnti); - LOG_I(RRC, "[eNB %d] source eNB receives the X2 UE CONTEXT RELEASE %s\n", instance, msg_name_p); + LOG_I(RRC, "[eNB %ld] source eNB receives the X2 UE CONTEXT RELEASE %s\n", instance, msg_name_p); DevAssert(ue_context_p != NULL); if (ue_context_p->ue_context.handover_info->state != HO_COMPLETE) abort(); @@ -9535,7 +9535,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { if (ue_context_p != NULL && ue_context_p->ue_context.handover_info != NULL) { - LOG_I(RRC, "[eNB %d] eNB receives X2 HANDOVER CANCEL for rnti %x, cause %s [%s]\n", + LOG_I(RRC, "[eNB %ld] eNB receives X2 HANDOVER CANCEL for rnti %x, cause %s [%s]\n", instance, X2AP_HANDOVER_CANCEL(msg_p).rnti, cause, @@ -9560,7 +9560,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { else failure_cause = "UE not in handover"; - LOG_W(RRC, "[eNB %d] cannot process (%s) X2 HANDOVER CANCEL for rnti %x, cause %s, ignoring\n", + LOG_W(RRC, "[eNB %ld] cannot process (%s) X2 HANDOVER CANCEL for rnti %x, cause %s, ignoring\n", instance, failure_cause, X2AP_HANDOVER_CANCEL(msg_p).rnti, cause); } @@ -9588,7 +9588,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { /* Messages from eNB app */ case RRC_CONFIGURATION_REQ: - LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p, &RRC_CONFIGURATION_REQ(msg_p)); + LOG_I(RRC, "[eNB %ld] Received %s : %p\n", instance, msg_name_p, &RRC_CONFIGURATION_REQ(msg_p)); openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_CONFIGURATION_REQ(msg_p)); break; @@ -9596,7 +9596,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { case F1AP_SETUP_REQ: AssertFatal(NODE_IS_CU(RC.rrc[instance]->node_type), "should not receive F1AP_SETUP_REQUEST, need call by CU!\n"); - LOG_I(RRC,"[eNB %d] Received %s : %p\n", instance, msg_name_p, &F1AP_SETUP_REQ(msg_p)); + LOG_I(RRC,"[eNB %ld] Received %s : %p\n", instance, msg_name_p, &F1AP_SETUP_REQ(msg_p)); handle_f1_setup_req(&F1AP_SETUP_REQ(msg_p)); break; @@ -9649,7 +9649,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { break; default: - LOG_E(RRC, "[eNB %d] Received unexpected message %s\n", instance, msg_name_p); + LOG_E(RRC, "[eNB %ld] Received unexpected message %s\n", instance, msg_name_p); break; } @@ -10023,7 +10023,7 @@ rrc_rx_tx( //----------------------------------------------------------------------------- { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_SUBFRAME_PROCESS); + message_p = itti_alloc_new_message(TASK_RRC_ENB, 0, RRC_SUBFRAME_PROCESS); RRC_SUBFRAME_PROCESS(message_p).ctxt = *ctxt_pP; RRC_SUBFRAME_PROCESS(message_p).CC_id = CC_id; itti_send_msg_to_task(TASK_RRC_ENB, ctxt_pP->module_id, message_p); diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c index 5c25d2dbcf..e974a28f68 100644 --- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c +++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c @@ -126,7 +126,7 @@ gtpv_data_req( memcpy (message_buffer, buffer_pP, sdu_sizeP); - message_p = itti_alloc_new_message (TASK_GTPV1_U, GTPV1U_ENB_DATA_FORWARDING_IND); + message_p = itti_alloc_new_message (TASK_GTPV1_U, 0, GTPV1U_ENB_DATA_FORWARDING_IND); GTPV1U_ENB_DATA_FORWARDING_IND (message_p).frame = ctxt_pP->frame; GTPV1U_ENB_DATA_FORWARDING_IND (message_p).enb_flag = ctxt_pP->enb_flag; GTPV1U_ENB_DATA_FORWARDING_IND (message_p).rb_id = rb_idP; @@ -149,7 +149,7 @@ gtpv_data_req( memcpy (message_buffer, buffer_pP, sdu_sizeP); - message_p = itti_alloc_new_message (TASK_GTPV1_U, GTPV1U_ENB_END_MARKER_IND); + message_p = itti_alloc_new_message (TASK_GTPV1_U, 0, GTPV1U_ENB_END_MARKER_IND); GTPV1U_ENB_END_MARKER_IND (message_p).frame = ctxt_pP->frame; GTPV1U_ENB_END_MARKER_IND (message_p).enb_flag = ctxt_pP->enb_flag; GTPV1U_ENB_END_MARKER_IND (message_p).rb_id = rb_idP; @@ -186,7 +186,7 @@ void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ( "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", ue_context_pP->ue_context.eNB_ue_s1ap_id); - MessageDef *msg = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); + MessageDef *msg = itti_alloc_new_message(TASK_RRC_ENB, 0, GTPV1U_ENB_DELETE_TUNNEL_REQ); memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg))); GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).rnti = ue_context_pP->ue_context.rnti; GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).from_gnb = 0; diff --git a/openair2/RRC/LTE/rrc_eNB_M2AP.c b/openair2/RRC/LTE/rrc_eNB_M2AP.c index 98a72895a0..a9c65eae1a 100644 --- a/openair2/RRC/LTE/rrc_eNB_M2AP.c +++ b/openair2/RRC/LTE/rrc_eNB_M2AP.c @@ -1520,7 +1520,7 @@ rrc_eNB_process_M2AP_MBMS_SCHEDULING_INFORMATION( rrc_M2AP_openair_rrc_top_init_MBMS(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag); }*/ MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, M2AP_MBMS_SCHEDULING_INFORMATION_RESP); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, M2AP_MBMS_SCHEDULING_INFORMATION_RESP); itti_send_msg_to_task (TASK_M2AP_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); pthread_mutex_unlock(&RC.rrc[ctxt_pP->module_id]->cell_info_mutex); @@ -1560,7 +1560,7 @@ rrc_eNB_process_M2AP_MBMS_SESSION_START_REQ( pthread_mutex_unlock(&RC.rrc[ctxt_pP->module_id]->cell_info_mutex); MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, M2AP_MBMS_SESSION_START_RESP); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, M2AP_MBMS_SESSION_START_RESP); itti_send_msg_to_task (TASK_M2AP_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); return 0; @@ -1628,7 +1628,7 @@ void rrc_eNB_send_M2AP_MBMS_SCHEDULING_INFORMATION_RESP( ) { MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, M2AP_MBMS_SCHEDULING_INFORMATION_RESP); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, M2AP_MBMS_SCHEDULING_INFORMATION_RESP); itti_send_msg_to_task (TASK_M2AP_ENB, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->instance), msg_p); } @@ -1638,7 +1638,7 @@ void rrc_eNB_send_M2AP_MBMS_SESSION_START_RESP( ) { MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, M2AP_MBMS_SESSION_START_RESP); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, M2AP_MBMS_SESSION_START_RESP); itti_send_msg_to_task (TASK_M2AP_ENB, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->instance), msg_p); } @@ -1648,7 +1648,7 @@ void rrc_eNB_send_M2AP_MBMS_SESSION_STOP_RESP( ) { MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, M2AP_MBMS_SESSION_STOP_RESP); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, M2AP_MBMS_SESSION_STOP_RESP); itti_send_msg_to_task (TASK_M2AP_ENB, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->instance), msg_p); } @@ -1658,6 +1658,6 @@ void rrc_eNB_send_M2AP_MBMS_SESSION_UPDATE_RESP( ) { MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, M2AP_MBMS_SESSION_UPDATE_RESP); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, M2AP_MBMS_SESSION_UPDATE_RESP); itti_send_msg_to_task (TASK_M2AP_ENB, ENB_MODULE_ID_TO_INSTANCE(ctxt_pP->instance), msg_p); } diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 4be9a50b32..320004a361 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -241,7 +241,7 @@ rrc_eNB_S1AP_get_ue_ids( if (s1ap_eNB_instance_p != NULL) { ue_desc_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, eNB_ue_s1ap_id); // get s1ap_eNB_ue_context } else { - LOG_E(S1AP, "[eNB instance %d] Couldn't find the eNB S1AP context\n", + LOG_E(S1AP, "[eNB instance %ld] Couldn't find the eNB S1AP context\n", instance); return NULL; } @@ -588,7 +588,7 @@ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP( int e_rab; int e_rabs_done = 0; int e_rabs_failed = 0; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_INITIAL_CONTEXT_SETUP_RESP); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_INITIAL_CONTEXT_SETUP_RESP); S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; for (e_rab = 0; e_rab < ue_context_pP->ue_context.nb_of_e_rabs; e_rab++) { @@ -648,7 +648,7 @@ rrc_eNB_send_S1AP_UPLINK_NAS( MessageDef *msg_p; pdu_length = dedicatedInfoType->choice.dedicatedInfoNAS.size; pdu_buffer = dedicatedInfoType->choice.dedicatedInfoNAS.buf; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_UPLINK_NAS); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_UPLINK_NAS); S1AP_UPLINK_NAS (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; S1AP_UPLINK_NAS (msg_p).nas_pdu.length = pdu_length; S1AP_UPLINK_NAS (msg_p).nas_pdu.buffer = pdu_buffer; @@ -700,7 +700,7 @@ void rrc_eNB_send_S1AP_UE_CAPABILITIES_IND( if (ret.encoded == -1) abort(); MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_UE_CAPABILITIES_IND); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_UE_CAPABILITIES_IND); S1AP_UE_CAPABILITIES_IND (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; S1AP_UE_CAPABILITIES_IND (msg_p).ue_radio_cap.length = (ret.encoded+7)/8; S1AP_UE_CAPABILITIES_IND (msg_p).ue_radio_cap.buffer = buf2; @@ -724,7 +724,7 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ( MessageDef *message_p = NULL; rrc_ue_s1ap_ids_t *rrc_ue_s1ap_ids_p = NULL; hashtable_rc_t h_rc; - message_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_NAS_FIRST_REQ); + message_p = itti_alloc_new_message(TASK_RRC_ENB, 0, S1AP_NAS_FIRST_REQ); memset(&message_p->ittiMsg.s1ap_nas_first_req, 0, sizeof(s1ap_nas_first_req_t)); ue_context_pP->ue_context.ue_initial_id = get_next_ue_initial_id(ctxt_pP->module_id); S1AP_NAS_FIRST_REQ(message_p).ue_initial_id = ue_context_pP->ue_context.ue_initial_id; @@ -853,7 +853,7 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( ue_initial_id = S1AP_DOWNLINK_NAS (msg_p).ue_initial_id; eNB_ue_s1ap_id = S1AP_DOWNLINK_NAS (msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, ue_initial_id, eNB_ue_s1ap_id); - LOG_I(RRC, "[eNB %d] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d\n", + LOG_I(RRC, "[eNB %ld] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d\n", instance, msg_name, ue_initial_id, @@ -871,8 +871,8 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( eNB_ue_s1ap_id); /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p; - LOG_W(RRC, "[eNB %d] In S1AP_DOWNLINK_NAS: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_NAS_NON_DELIVERY_IND); + LOG_W(RRC, "[eNB %ld] In S1AP_DOWNLINK_NAS: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); + msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_NAS_NON_DELIVERY_IND); S1AP_NAS_NON_DELIVERY_IND (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; S1AP_NAS_NON_DELIVERY_IND (msg_fail_p).nas_pdu.length = S1AP_DOWNLINK_NAS (msg_p).nas_pdu.length; S1AP_NAS_NON_DELIVERY_IND (msg_fail_p).nas_pdu.buffer = S1AP_DOWNLINK_NAS (msg_p).nas_pdu.buffer; @@ -944,14 +944,14 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char ue_initial_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).ue_initial_id; eNB_ue_s1ap_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, ue_initial_id, eNB_ue_s1ap_id); - LOG_I(RRC, "[eNB %d] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d, nb_of_e_rabs %d\n", + LOG_I(RRC, "[eNB %ld] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d, nb_of_e_rabs %d\n", instance, msg_name, ue_initial_id, eNB_ue_s1ap_id, S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nb_of_e_rabs); if (ue_context_p == NULL) { /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p = NULL; - LOG_W(RRC, "[eNB %d] In S1AP_INITIAL_CONTEXT_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_INITIAL_CONTEXT_SETUP_FAIL); + LOG_W(RRC, "[eNB %ld] In S1AP_INITIAL_CONTEXT_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); + msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_INITIAL_CONTEXT_SETUP_FAIL); S1AP_INITIAL_CONTEXT_SETUP_FAIL (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; // TODO add failure cause when defined! itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); @@ -1057,7 +1057,7 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char (RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) || (RC.rrc[ctxt.module_id]->node_type == ngran_gNB_CU) ){ - message_p = itti_alloc_new_message (TASK_RRC_ENB, F1AP_UE_CONTEXT_SETUP_REQ); + message_p = itti_alloc_new_message (TASK_RRC_ENB, 0, F1AP_UE_CONTEXT_SETUP_REQ); F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container = ue_p->Srb0.Tx_buffer.Payload; F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size; @@ -1088,8 +1088,8 @@ int rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(MessageDef *msg_p, const char if (ue_context_p == NULL) { /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p; - LOG_W(RRC, "[eNB %d] In S1AP_UE_CTXT_MODIFICATION_REQ: unknown UE from eNB_ue_s1ap_id (%d)\n", instance, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_UE_CTXT_MODIFICATION_FAIL); + LOG_W(RRC, "[eNB %ld] In S1AP_UE_CTXT_MODIFICATION_REQ: unknown UE from eNB_ue_s1ap_id (%d)\n", instance, eNB_ue_s1ap_id); + msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_UE_CTXT_MODIFICATION_FAIL); S1AP_UE_CTXT_MODIFICATION_FAIL (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; // TODO add failure cause when defined! itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); @@ -1126,7 +1126,7 @@ int rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(MessageDef *msg_p, const char /* Send the response */ { MessageDef *msg_resp_p; - msg_resp_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CTXT_MODIFICATION_RESP); + msg_resp_p = itti_alloc_new_message(TASK_RRC_ENB, 0, S1AP_UE_CTXT_MODIFICATION_RESP); S1AP_UE_CTXT_MODIFICATION_RESP(msg_resp_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; itti_send_msg_to_task(TASK_S1AP, instance, msg_resp_p); } @@ -1144,10 +1144,10 @@ int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ (MessageDef *msg_p, const char * if (ue_context_p == NULL) { /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p; - LOG_W(RRC, "[eNB %d] In S1AP_UE_CONTEXT_RELEASE_REQ: unknown UE from eNB_ue_s1ap_id (%d)\n", + LOG_W(RRC, "[eNB %ld] In S1AP_UE_CONTEXT_RELEASE_REQ: unknown UE from eNB_ue_s1ap_id (%d)\n", instance, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_RESP); /* TODO change message ID. */ + msg_fail_p = itti_alloc_new_message(TASK_RRC_ENB, 0, S1AP_UE_CONTEXT_RELEASE_RESP); /* TODO change message ID. */ S1AP_UE_CONTEXT_RELEASE_RESP(msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; // TODO add failure cause when defined! itti_send_msg_to_task(TASK_S1AP, instance, msg_fail_p); @@ -1157,7 +1157,7 @@ int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ (MessageDef *msg_p, const char * /* Send the response */ { MessageDef *msg_resp_p; - msg_resp_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_RESP); + msg_resp_p = itti_alloc_new_message(TASK_RRC_ENB, 0, S1AP_UE_CONTEXT_RELEASE_RESP); S1AP_UE_CONTEXT_RELEASE_RESP(msg_resp_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; itti_send_msg_to_task(TASK_S1AP, instance, msg_resp_p); } @@ -1187,7 +1187,7 @@ rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ( "0 S1AP_UE_CONTEXT_RELEASE_REQ eNB_ue_s1ap_id 0x%06"PRIX32" ", ue_context_pP->ue_context.eNB_ue_s1ap_id); MessageDef *msg_context_release_req_p = NULL; - msg_context_release_req_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_REQ); + msg_context_release_req_p = itti_alloc_new_message(TASK_RRC_ENB, 0, S1AP_UE_CONTEXT_RELEASE_REQ); S1AP_UE_CONTEXT_RELEASE_REQ(msg_context_release_req_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; S1AP_UE_CONTEXT_RELEASE_REQ(msg_context_release_req_p).cause = causeP; S1AP_UE_CONTEXT_RELEASE_REQ(msg_context_release_req_p).cause_value = cause_valueP; @@ -1202,7 +1202,7 @@ void rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT( MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_S1AP_ENB, NULL, 0, "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", eNB_ue_s1ap_id); - MessageDef *msg = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE); + MessageDef *msg = itti_alloc_new_message(TASK_RRC_ENB, 0, S1AP_UE_CONTEXT_RELEASE_COMPLETE); S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg).eNB_ue_s1ap_id = eNB_ue_s1ap_id; itti_send_msg_to_task(TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_mod_idP), msg); } @@ -1229,7 +1229,7 @@ rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND( if (ue_context_p == NULL) { /* Can not associate this message to an UE index */ MessageDef *msg_complete_p = NULL; - LOG_W(RRC, "[eNB %d] In S1AP_UE_CONTEXT_RELEASE_COMMAND: unknown UE from eNB_ue_s1ap_id (%d)\n", + LOG_W(RRC, "[eNB %ld] In S1AP_UE_CONTEXT_RELEASE_COMMAND: unknown UE from eNB_ue_s1ap_id (%d)\n", instance, eNB_ue_s1ap_id); MSC_LOG_EVENT(MSC_RRC_ENB, "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" context not found", @@ -1240,7 +1240,7 @@ rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND( 0, "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", eNB_ue_s1ap_id); - msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE); + msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, 0, S1AP_UE_CONTEXT_RELEASE_COMPLETE); S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; itti_send_msg_to_task(TASK_S1AP, instance, msg_complete_p); rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(RC.rrc[instance], UE_INITIAL_ID_INVALID, eNB_ue_s1ap_id); @@ -1271,14 +1271,14 @@ int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name ue_initial_id = S1AP_E_RAB_SETUP_REQ (msg_p).ue_initial_id; eNB_ue_s1ap_id = S1AP_E_RAB_SETUP_REQ (msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, ue_initial_id, eNB_ue_s1ap_id); - LOG_I(RRC, "[eNB %d] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d, nb_of_e_rabs %d\n", + LOG_I(RRC, "[eNB %ld] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d, nb_of_e_rabs %d\n", instance, msg_name, ue_initial_id, eNB_ue_s1ap_id, S1AP_E_RAB_SETUP_REQ (msg_p).nb_e_rabs_tosetup); if (ue_context_p == NULL) { /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p = NULL; - LOG_W(RRC, "[eNB %d] In S1AP_E_RAB_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_SETUP_REQUEST_FAIL); + LOG_W(RRC, "[eNB %ld] In S1AP_E_RAB_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); + msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_E_RAB_SETUP_REQUEST_FAIL); S1AP_E_RAB_SETUP_REQ (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; // TODO add failure cause when defined! itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); @@ -1370,7 +1370,7 @@ int rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(const protocol_ctxt_t *const ctxt_pP, int e_rab; int e_rabs_done = 0; int e_rabs_failed = 0; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_SETUP_RESP); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_E_RAB_SETUP_RESP); S1AP_E_RAB_SETUP_RESP (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; for (e_rab = 0; e_rab < ue_context_pP->ue_context.setup_e_rabs ; e_rab++) { @@ -1446,15 +1446,15 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam ue_initial_id = S1AP_E_RAB_MODIFY_REQ (msg_p).ue_initial_id; eNB_ue_s1ap_id = S1AP_E_RAB_MODIFY_REQ (msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, ue_initial_id, eNB_ue_s1ap_id); - LOG_D(RRC, "[eNB %d] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d, nb_of_e_rabs %d\n", + LOG_D(RRC, "[eNB %ld] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d, nb_of_e_rabs %d\n", instance, msg_name, ue_initial_id, eNB_ue_s1ap_id, S1AP_E_RAB_MODIFY_REQ (msg_p).nb_e_rabs_tomodify); if (ue_context_p == NULL) { /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ - LOG_W(RRC, "[eNB %d] In S1AP_E_RAB_MODIFY_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); + LOG_W(RRC, "[eNB %ld] In S1AP_E_RAB_MODIFY_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); int nb_of_e_rabs_failed = 0; MessageDef *msg_fail_p = NULL; - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_MODIFY_RESP); + msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_E_RAB_MODIFY_RESP); S1AP_E_RAB_MODIFY_RESP (msg_fail_p).eNB_ue_s1ap_id = S1AP_E_RAB_MODIFY_REQ (msg_p).eNB_ue_s1ap_id; S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs = 0; @@ -1567,7 +1567,7 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam { int nb_of_e_rabs_failed = 0; MessageDef *msg_fail_p = NULL; - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_MODIFY_RESP); + msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_E_RAB_MODIFY_RESP); S1AP_E_RAB_MODIFY_RESP (msg_fail_p).eNB_ue_s1ap_id = S1AP_E_RAB_MODIFY_REQ (msg_p).eNB_ue_s1ap_id; // S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs[S1AP_MAX_E_RAB]; S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs = 0; @@ -1597,7 +1597,7 @@ int rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(const protocol_ctxt_t *const ctxt_pP, int e_rab; int e_rabs_done = 0; int e_rabs_failed = 0; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_MODIFY_RESP); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_E_RAB_MODIFY_RESP); S1AP_E_RAB_MODIFY_RESP (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; for (e_rab = 0; e_rab < ue_context_pP->ue_context.nb_of_modify_e_rabs; e_rab++) { @@ -1748,7 +1748,7 @@ int rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(MessageDef *msg_p, const char *ms rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release(&ctxt, ue_context_p, xid, S1AP_E_RAB_RELEASE_COMMAND (msg_p).nas_pdu.length, S1AP_E_RAB_RELEASE_COMMAND (msg_p).nas_pdu.buffer); } else { //gtp tunnel delete - msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); + msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, 0, GTPV1U_ENB_DELETE_TUNNEL_REQ); memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).from_gnb = 0; @@ -1779,7 +1779,7 @@ int rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(MessageDef *msg_p, const char *ms int rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(const protocol_ctxt_t *const ctxt_pP, rrc_eNB_ue_context_t *const ue_context_pP, uint8_t xid) { int e_rabs_released = 0; MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_RELEASE_RESPONSE); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_E_RAB_RELEASE_RESPONSE); S1AP_E_RAB_RELEASE_RESPONSE (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; for (int i = 0; i < NB_RB_MAX; i++) { @@ -1822,7 +1822,7 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance uint32_t T; /* DRX cycle */ for (uint16_t tai_size = 0; tai_size < S1AP_PAGING_IND(msg_p).tai_size; tai_size++) { - LOG_D(RRC,"[eNB %d] In S1AP_PAGING_IND: MCC %d, MNC %d, TAC %d\n", instance, S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc, + LOG_D(RRC,"[eNB %ld] In S1AP_PAGING_IND: MCC %d, MNC %d, TAC %d\n", instance, S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc, S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc, S1AP_PAGING_IND(msg_p).tac[tai_size]); for (uint8_t j = 0; j < RC.rrc[instance]->configuration.num_plmn; j++) { @@ -1884,7 +1884,7 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance default: /* pcch_nB error */ - LOG_E(RRC, "[eNB %d] In S1AP_PAGING_IND: pcch_nB error (pcch_nB %d) \n", + LOG_E(RRC, "[eNB %ld] In S1AP_PAGING_IND: pcch_nB error (pcch_nB %d) \n", instance, pcch_nB); return (-1); } @@ -1920,12 +1920,12 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance if (UE_PF_PO[CC_id][i].enable_flag == TRUE) { //paging exist UE log - LOG_D(RRC,"[eNB %d] CC_id %d In S1AP_PAGING_IND: Update exist UE %d, T %d, PF %d, PO %d\n", instance, CC_id, UE_PF_PO[CC_id][i].ue_index_value, T, UE_PF_PO[CC_id][i].PF_min, UE_PF_PO[CC_id][i].PO); + LOG_D(RRC,"[eNB %ld] CC_id %d In S1AP_PAGING_IND: Update exist UE %d, T %d, PF %d, PO %d\n", instance, CC_id, UE_PF_PO[CC_id][i].ue_index_value, T, UE_PF_PO[CC_id][i].PF_min, UE_PF_PO[CC_id][i].PO); } else { /* set enable_flag */ UE_PF_PO[CC_id][i].enable_flag = TRUE; //paging new UE log - LOG_D(RRC,"[eNB %d] CC_id %d In S1AP_PAGING_IND: Insert a new UE %d, T %d, PF %d, PO %d\n", instance, CC_id, UE_PF_PO[CC_id][i].ue_index_value, T, UE_PF_PO[CC_id][i].PF_min, UE_PF_PO[CC_id][i].PO); + LOG_D(RRC,"[eNB %ld] CC_id %d In S1AP_PAGING_IND: Insert a new UE %d, T %d, PF %d, PO %d\n", instance, CC_id, UE_PF_PO[CC_id][i].ue_index_value, T, UE_PF_PO[CC_id][i].PF_min, UE_PF_PO[CC_id][i].PO); } break; @@ -1938,7 +1938,7 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance uint8_t *message_buffer; /* Transfer data to PDCP */ MessageDef *message_p; - message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_PCCH_DATA_REQ); + message_p = itti_alloc_new_message (TASK_RRC_ENB, 0, RRC_PCCH_DATA_REQ); /* Create message for PDCP (DLInformationTransfer_t) */ length = do_Paging (instance, buffer, @@ -1959,7 +1959,7 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance RRC_PCCH_DATA_REQ (message_p).rnti = P_RNTI; RRC_PCCH_DATA_REQ (message_p).ue_index = i; RRC_PCCH_DATA_REQ (message_p).CC_id = CC_id; - LOG_D(RRC, "[eNB %d] CC_id %d In S1AP_PAGING_IND: send encdoed buffer to PDCP buffer_size %d\n", instance, CC_id, length); + LOG_D(RRC, "[eNB %ld] CC_id %d In S1AP_PAGING_IND: send encdoed buffer to PDCP buffer_size %d\n", instance, CC_id, length); itti_send_msg_to_task (TASK_PDCP_ENB, instance, message_p); } } @@ -1981,7 +1981,7 @@ int rrc_eNB_send_PATH_SWITCH_REQ(const protocol_ctxt_t *const ctxt_pP, gtpv1u_enb_create_tunnel_resp_t create_tunnel_resp; uint8_t inde_list[ue_context_pP->ue_context.nb_of_e_rabs]; memset(inde_list, 0, ue_context_pP->ue_context.nb_of_e_rabs*sizeof(uint8_t)); - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_PATH_SWITCH_REQ); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_PATH_SWITCH_REQ); ue_context_pP->ue_context.ue_initial_id = get_next_ue_initial_id (ctxt_pP->module_id); S1AP_PATH_SWITCH_REQ (msg_p).ue_initial_id = ue_context_pP->ue_context.ue_initial_id; rrc_ue_s1ap_ids_p = malloc(sizeof(*rrc_ue_s1ap_ids_p)); @@ -2084,7 +2084,7 @@ int rrc_eNB_process_X2AP_TUNNEL_SETUP_REQ(instance_t instance, rrc_eNB_ue_contex } else { /* Save e RAB information for later */ { - LOG_I(RRC, "[eNB %d] rrc_eNB_process_X2AP_TUNNEL_SETUP_REQ: rnti %u nb_of_e_rabs %d\n", + LOG_I(RRC, "[eNB %ld] rrc_eNB_process_X2AP_TUNNEL_SETUP_REQ: rnti %u nb_of_e_rabs %d\n", instance, ue_context_target_p->ue_context.rnti, ue_context_target_p->ue_context.nb_of_e_rabs); int i; memset(&create_tunnel_req, 0, sizeof(create_tunnel_req)); @@ -2144,14 +2144,14 @@ int rrc_eNB_process_S1AP_PATH_SWITCH_REQ_ACK (MessageDef *msg_p, ue_initial_id = S1AP_PATH_SWITCH_REQ_ACK (msg_p).ue_initial_id; eNB_ue_s1ap_id = S1AP_PATH_SWITCH_REQ_ACK (msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, ue_initial_id, eNB_ue_s1ap_id); - LOG_I(RRC, "[eNB %d] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d, nb_of_e_rabs %d\n", + LOG_I(RRC, "[eNB %ld] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d, nb_of_e_rabs %d\n", instance, msg_name, ue_initial_id, eNB_ue_s1ap_id, S1AP_E_RAB_SETUP_REQ (msg_p).nb_e_rabs_tosetup); if (ue_context_p == NULL) { /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ //MessageDef *msg_fail_p = NULL; - LOG_W(RRC, "[eNB %d] In S1AP_PATH_SWITCH_REQ_ACK: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); - //msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_PATH_SWITCH_REQ_ACK_FAIL); + LOG_W(RRC, "[eNB %ld] In S1AP_PATH_SWITCH_REQ_ACK: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); + //msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_PATH_SWITCH_REQ_ACK_FAIL); //S1AP_PATH_SWITCH_REQ_ACK (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; // TODO add failure cause when defined! //itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); @@ -2242,7 +2242,7 @@ int rrc_eNB_process_S1AP_PATH_SWITCH_REQ_ACK (MessageDef *msg_p, int rrc_eNB_send_X2AP_UE_CONTEXT_RELEASE(const protocol_ctxt_t *const ctxt_pP, rrc_eNB_ue_context_t *const ue_context_pP) { MessageDef *msg_p = NULL; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, X2AP_UE_CONTEXT_RELEASE); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, X2AP_UE_CONTEXT_RELEASE); X2AP_UE_CONTEXT_RELEASE (msg_p).rnti = ue_context_pP->ue_context.rnti; X2AP_UE_CONTEXT_RELEASE (msg_p).source_assoc_id = ue_context_pP->ue_context.handover_info->assoc_id; itti_send_msg_to_task (TASK_X2AP, ctxt_pP->instance, msg_p); @@ -2295,7 +2295,7 @@ int rrc_eNB_send_E_RAB_Modification_Indication(const protocol_ctxt_t *const ctxt uint8_t inde_list[ue_context_pP->ue_context.nb_of_e_rabs]; memset(inde_list, 0, ue_context_pP->ue_context.nb_of_e_rabs*sizeof(uint8_t)); - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_MODIFICATION_IND); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_E_RAB_MODIFICATION_IND); S1AP_E_RAB_MODIFICATION_IND (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; diff --git a/openair2/RRC/LTE/rrc_eNB_ral.c b/openair2/RRC/LTE/rrc_eNB_ral.c index 4820e84dc0..9e1486f6d8 100644 --- a/openair2/RRC/LTE/rrc_eNB_ral.c +++ b/openair2/RRC/LTE/rrc_eNB_ral.c @@ -126,7 +126,7 @@ int rrc_enb_ral_handle_configure_threshold_request(unsigned int mod_idP, Message message_p = itti_alloc_new_message (TASK_RRC_ENB, PHY_MEAS_THRESHOLD_REQ); PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_PHY_ENB, ITTI_MSG_INSTANCE(msg_pP), message_p); + itti_send_msg_to_task (TASK_PHY_ENB, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); break; default: @@ -147,7 +147,7 @@ int rrc_enb_ral_handle_configure_threshold_request(unsigned int mod_idP, Message message_p = itti_alloc_new_message (TASK_RRC_ENB, PHY_MEAS_THRESHOLD_REQ); PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_MAC_ENB, ITTI_MSG_INSTANCE(msg_pP), message_p); + itti_send_msg_to_task (TASK_MAC_ENB, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); break; default: @@ -166,7 +166,7 @@ int rrc_enb_ral_handle_configure_threshold_request(unsigned int mod_idP, Message message_p = itti_alloc_new_message (TASK_RRC_ENB, PHY_MEAS_THRESHOLD_REQ); PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_PHY_ENB, ITTI_MSG_INSTANCE(msg_pP), message_p); + itti_send_msg_to_task (TASK_PHY_ENB, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); break; case RAL_LINK_PARAM_LTE_AVAILABLE_BW: @@ -176,7 +176,7 @@ int rrc_enb_ral_handle_configure_threshold_request(unsigned int mod_idP, Message message_p = itti_alloc_new_message (TASK_RRC_ENB, PHY_MEAS_THRESHOLD_REQ); PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_MAC_ENB, ITTI_MSG_INSTANCE(msg_pP), message_p); + itti_send_msg_to_task (TASK_MAC_ENB, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); break; case RAL_LINK_PARAM_LTE_MOBILE_NODE_CAPABILITIES: diff --git a/openair2/RRC/LTE/rrm_2_rrc_msg.c b/openair2/RRC/LTE/rrm_2_rrc_msg.c deleted file mode 100644 index 84801a16be..0000000000 --- a/openair2/RRC/LTE/rrm_2_rrc_msg.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * 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 emul_interface.c - -\brief RRM interface emulation, it sends message to the RRM interface - - RRC -> RRM - - CMM -> RRM - -\author BURLOT Pascal - -\date 10/07/08 - - -\par Historique: - $Author$ $Date$ $Revision$ - $Id$ - $Log$ - -******************************************************************************* -*/ - -#include "defs.h" -#include "extern.h" - - - - -//#include "mac_lchan_interface.h" -//#include "openair_rrc_utils.h" -//#include "openair_rrc_main.h" -#ifdef PHY_EMUL - #include "SIMULATION/simulation_defs.h" - extern EMULATION_VARS *Emul_vars; - extern CH_MAC_INST *CH_mac_inst; - extern UE_MAC_INST *UE_mac_inst; -#endif - - - -/******************************************************************************/ -void fn_rrc (void) { - /******************************************************************************/ - msg_head_t *Header ; - char *Data; - L2_ID Mac_id; - - while(1) { - Header = (msg_head_t *) recv_msg(&S_rrc) ; - - if(Header==NULL) { - break; - } - - Data_to_read=Header->size; - - if (Data_to_read > 0 ) { - Data = (char *) (Header +1) ; - } - - msg("Got MSG of Type %d on Inst %d\n",Header->msg_type,Header->inst); - - switch ( Header->msg_type ) { - case RRM_INIT_CH_REQ: { - rrm_init_ch_req_t *p = (rrm_init_ch_req_t *) Data; - msg( "[RRM]>[RRC][Inst %d]:RRM_INIT_CH_REQ\n",Header->inst); - rrc_init_ch_req(Header->inst,p); - break; - } - - case RRCI_INIT_MR_REQ: { - rrci_init_mr_req_t *p = (rrci_init_mr_req_t *) Data; - msg( "[RRM]>[RRC][Inst %d]:RRCI_INIT_MR_REQ\n",Header->inst); - rrc_init_mr_req(Header->inst,p); - break; - } - - case RRM_RB_ESTABLISH_REQ: { - send_msg((void *)&S_rrc,msg_rrc_rb_establish_resp(Header->inst,Header->Trans_id)); - msg( "[RRM]>[RRC][Inst %d]:RRM_RB_ESTABLISH_REQ, size %d\n",Header->inst,sizeof(rrm_rb_establish_req_t)); - rrc_config_req(Header->inst,(void *)Data,Header->msg_type,Header->Trans_id); - break ; - } - - case RRM_RB_MODIFY_REQ: { - send_msg((void *)&S_rrc,msg_rrc_rb_modify_resp(Header->inst,Header->Trans_id)); - msg( "[RRM]>[RRC][Inst %d]:RRM_RB_MODIFY_REQ\n",Header->inst); - rrc_config_req(Header->inst,Data,Header->msg_type,Header->Trans_id); - } - - case RRM_RB_RELEASE_REQ: { - send_msg((void *)&S_rrc,msg_rrc_rb_release_resp(Header->inst,Header->Trans_id)); - msg( "[RRM]>[RRC][Inst %d]:RRM_RB_RELEASE_REQ\n",Header->inst); - rrc_config_req(Header->inst,Data,Header->msg_type,Header->Trans_id); - } - - case RRCI_CX_ESTABLISH_RESP: { - rrci_cx_establish_resp_t *p = (rrci_cx_establish_resp_t *) Data; - unsigned char i, CH_index = 0; - msg( "[RRCI]>[RRC][Inst %d]:RRCI_CX_ESTABLISH_RESP\n",Header->inst); - - for(i=0; iinst-NB_CH_INST].Info[i].CH_mac_id,&p->L2_id,sizeof(L2_ID))) { - CH_index=i; - break; - } - - if(i==NB_SIG_CNX_UE) { - msg("[RRC] FATAL: CH_INDEX NOT FOUND\n"); - return; - } - - UE_rrc_inst[Header->inst-NB_CH_INST].Srb2[CH_index].Srb_info.IP_addr_type=p->L3_info_t; - - if(p->L3_info_t == IPv4_ADDR) { - memcpy(&UE_rrc_inst[Header->inst-NB_CH_INST].Srb2[CH_index].Srb_info.IP_addr,p->L3_info,4); - } else { - memcpy(&UE_rrc_inst[Header->inst-NB_CH_INST].Srb2[CH_index].Srb_info.IP_addr,p->L3_info,16); - } - } - break ; - - case RRM_SENSING_MEAS_REQ: { - // rrm_sensing_meas_req_t *p = (rrm_sensing_meas_req_t *) sock_msg ; - send_msg((void *)&S_rrc,msg_rrc_sensing_meas_resp(Header->inst,Header->Trans_id)); - msg( "[RRM]>[RRC][Inst %d]:RRM_SENSING_MEAS_REQ\n",Header->inst); - // rrc_meas_req(header->inst,p,RRC_MEAS_ADD); - } - break ; - - case RRM_SENSING_MEAS_RESP: { - msg( "[RRM]>[RRC][Inst %d]:RRM_SENSING_MEAS_RESP\n",Header->inst); - //rrm_rrc_meas_resp(header->inst,header->Trans_id); - } - break ; - - case RRM_SCAN_ORD: - msg( "[RRM]>[RRC][Inst %d]:RRM_SCAN_ORD\n",Header->inst); - //memcpy(&CH_rrc_inst[0].Rrm_init_scan_req,(rrm_init_scan_req_t *) Data,sizeof(rrm_init_scan_req_t)); - //CH_rrc_inst[0].Last_scan_req=Rrc_xface->Frame_index; - ///send over air - break; - - case RRM_INIT_SCAN_REQ: - msg( "[RRM]>[RRC][Inst %d]:RRM_INIT_SCAN_REQ\n",Header->inst); - memcpy(&CH_rrc_inst[0].Rrm_init_scan_req,(rrm_init_scan_req_t *) Data,sizeof(rrm_init_scan_req_t)); - CH_rrc_inst[0].Last_scan_req=Rrc_xface->Frame_index; - ///send over air - break; - - case RRM_END_SCAN_REQ: - msg( "[RRM]>[RRC][Inst %d]:RRM_END_SCAN_REQ\n",Header->inst); - memcpy(&Mac_id.L2_id[0],Data,sizeof(L2_ID)); - unsigned char UE_index=Mac_id.L2_id[0]-NB_CH_MAX+1; - UE_rrc_inst[0].Srb2[UE_index].Srb_info.Tx_buffer.Payload[0]=100; - msg("SRB_ID %d\n",CH_rrc_inst[0].Srb2[UE_index].Srb_info.Srb_id); - Mac_rlc_xface->rrc_rlc_data_req(0,CH_rrc_inst[0].Srb2[UE_index].Srb_info.Srb_id,0,0,1,CH_rrc_inst[0].Srb2[UE_index].Srb_info.Tx_buffer.Payload); - //CH_rrc_inst[0].Last_scan_req=Rrc_xface->Frame_index; - ///send over air - break; - - default : - msg("[L3_xface]WARNING: msg unknown %d\n",Header->msg_type) ; - } - } -} diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 11c13eda32..41272edc95 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -86,7 +86,7 @@ nr_rrc_data_req( ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, sdu_sizeP); memcpy (message_buffer, buffer_pP, sdu_sizeP); - message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ); + message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, 0, RRC_DCCH_DATA_REQ); RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame; RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag; RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 9bc95b216b..b758af2fb0 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -408,7 +408,7 @@ rrc_gNB_generate_RRCSetup( message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM, ue_p->Srb0.Tx_buffer.payload_size); memcpy (message_buffer, (uint8_t*)ue_p->Srb0.Tx_buffer.Payload, ue_p->Srb0.Tx_buffer.payload_size); - message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_CCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, 0, GNB_RRC_CCCH_DATA_IND); GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer; GNB_RRC_CCCH_DATA_IND (message_p).size = ue_p->Srb0.Tx_buffer.payload_size; itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); @@ -450,7 +450,7 @@ rrc_gNB_generate_RRCReject( message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM, ue_p->Srb0.Tx_buffer.payload_size); memcpy (message_buffer, (uint8_t*)ue_p->Srb0.Tx_buffer.Payload, ue_p->Srb0.Tx_buffer.payload_size); - message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_CCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, 0, GNB_RRC_CCCH_DATA_IND); GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer; GNB_RRC_CCCH_DATA_IND (message_p).size = ue_p->Srb0.Tx_buffer.payload_size; itti_send_msg_to_task (TASK_RRC_UE_SIM, ctxt_pP->instance, message_p); @@ -528,7 +528,7 @@ rrc_gNB_generate_defaultRRCReconfiguration( uint8_t *message_buffer; message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM, size); memcpy (message_buffer, buffer, size); - message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_DCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, 0, GNB_RRC_DCCH_DATA_IND); GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; GNB_RRC_DCCH_DATA_IND (message_p).size = size; @@ -1254,7 +1254,7 @@ void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { /* send a tick to x2ap */ if (is_x2ap_enabled()){ - msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_SUBFRAME_PROCESS); + msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_SUBFRAME_PROCESS); itti_send_msg_to_task(TASK_X2AP, ctxt_pP->module_id, msg); } } @@ -1276,7 +1276,7 @@ void *rrc_gnb_task(void *args_p) { // Wait for a message itti_receive_msg(TASK_RRC_GNB, &msg_p); msg_name_p = ITTI_MSG_NAME(msg_p); - instance = ITTI_MSG_INSTANCE(msg_p); + instance = ITTI_MSG_DESTINATION_INSTANCE(msg_p); /* RRC_SUBFRAME_PROCESS is sent every subframe, do not log it */ if (ITTI_MSG_ID(msg_p) != RRC_SUBFRAME_PROCESS) @@ -1289,7 +1289,7 @@ void *rrc_gnb_task(void *args_p) { break; case MESSAGE_TEST: - LOG_I(NR_RRC, "[gNB %d] Received %s\n", instance, msg_name_p); + LOG_I(NR_RRC, "[gNB %ld] Received %s\n", instance, msg_name_p); break; case RRC_SUBFRAME_PROCESS: @@ -1304,7 +1304,7 @@ void *rrc_gnb_task(void *args_p) { // NR_RRC_MAC_CCCH_DATA_IND(msg_p).rnti, // msg_p->ittiMsgHeader.lte_time.frame, // msg_p->ittiMsgHeader.lte_time.slot); - LOG_I(NR_RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", + LOG_I(NR_RRC,"Decoding CCCH : inst %ld, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", instance, NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id, &ctxt, @@ -1397,7 +1397,7 @@ void *rrc_gnb_task(void *args_p) { */ /* Messages from gNB app */ case NRRRC_CONFIGURATION_REQ: - LOG_I(NR_RRC, "[gNB %d] Received %s : %p\n", instance, msg_name_p,&NRRRC_CONFIGURATION_REQ(msg_p)); + LOG_I(NR_RRC, "[gNB %ld] Received %s : %p\n", instance, msg_name_p,&NRRRC_CONFIGURATION_REQ(msg_p)); openair_rrc_gNB_configuration(GNB_INSTANCE_TO_MODULE_ID(instance), &NRRRC_CONFIGURATION_REQ(msg_p)); break; @@ -1429,7 +1429,7 @@ void *rrc_gnb_task(void *args_p) { break; default: - LOG_E(NR_RRC, "[gNB %d] Received unexpected message %s\n", instance, msg_name_p); + LOG_E(NR_RRC, "[gNB %ld] Received unexpected message %s\n", instance, msg_name_p); break; } @@ -1486,7 +1486,7 @@ rrc_gNB_generate_SecurityModeCommand( uint8_t *message_buffer; message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM,size); memcpy (message_buffer, buffer, size); - message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_DCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, 0, GNB_RRC_DCCH_DATA_IND); GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; GNB_RRC_DCCH_DATA_IND (message_p).size = size; @@ -1543,7 +1543,7 @@ rrc_gNB_generate_UECapabilityEnquiry( uint8_t *message_buffer; message_buffer = itti_malloc (TASK_RRC_GNB_SIM, TASK_RRC_UE_SIM, size); memcpy (message_buffer, buffer, size); - message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, GNB_RRC_DCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_RRC_GNB_SIM, 0, GNB_RRC_DCCH_DATA_IND); GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; GNB_RRC_DCCH_DATA_IND (message_p).size = size; @@ -1602,7 +1602,7 @@ rrc_gNB_generate_RRCConnectionRelease( size); if (NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)) { - MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, F1AP_UE_CONTEXT_RELEASE_CMD); + MessageDef *m = itti_alloc_new_message(TASK_RRC_ENB, 0, F1AP_UE_CONTEXT_RELEASE_CMD); F1AP_UE_CONTEXT_RELEASE_CMD(m).rnti = ctxt_pP->rnti; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause = F1AP_CAUSE_RADIO_NETWORK; F1AP_UE_CONTEXT_RELEASE_CMD(m).cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release @@ -1622,7 +1622,7 @@ rrc_gNB_generate_RRCConnectionRelease( void nr_rrc_trigger(protocol_ctxt_t *ctxt, int CC_id, int frame, int subframe) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_RRC_GNB, RRC_SUBFRAME_PROCESS); + message_p = itti_alloc_new_message(TASK_RRC_GNB, 0, RRC_SUBFRAME_PROCESS); RRC_SUBFRAME_PROCESS(message_p).ctxt = *ctxt; RRC_SUBFRAME_PROCESS(message_p).CC_id = CC_id; itti_send_msg_to_task(TASK_RRC_GNB, ctxt->module_id, message_p); diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 1d0cfef89c..7f6a58702a 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -205,7 +205,7 @@ rrc_gNB_send_NGAP_NAS_FIRST_REQ( rrc_ue_ngap_ids_t *rrc_ue_ngap_ids_p = NULL; // hashtable_rc_t h_rc; - message_p = itti_alloc_new_message(TASK_RRC_GNB, NGAP_NAS_FIRST_REQ); + message_p = itti_alloc_new_message(TASK_RRC_GNB, 0, NGAP_NAS_FIRST_REQ); memset(&message_p->ittiMsg.ngap_nas_first_req, 0, sizeof(ngap_nas_first_req_t)); ue_context_pP->ue_context.ue_initial_id = get_next_ue_initial_id(ctxt_pP->module_id); NGAP_NAS_FIRST_REQ(message_p).ue_initial_id = ue_context_pP->ue_context.ue_initial_id; @@ -325,14 +325,14 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ( gNB_ue_ngap_id = NGAP_INITIAL_CONTEXT_SETUP_REQ(msg_p).gNB_ue_ngap_id; ue_context_p = rrc_gNB_get_ue_context_from_ngap_ids(instance, ue_initial_id, gNB_ue_ngap_id); - LOG_I(NR_RRC, "[gNB %d] Received %s: ue_initial_id %d, gNB_ue_ngap_id %d \n", + LOG_I(NR_RRC, "[gNB %ld] Received %s: ue_initial_id %d, gNB_ue_ngap_id %d \n", instance, msg_name, ue_initial_id, gNB_ue_ngap_id); if (ue_context_p == NULL) { /* Can not associate this message to an UE index, send a failure to NGAP and discard it! */ MessageDef *msg_fail_p = NULL; - LOG_W(NR_RRC, "[gNB %d] In NGAP_INITIAL_CONTEXT_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, gNB_ue_ngap_id); - msg_fail_p = itti_alloc_new_message (TASK_RRC_GNB, NGAP_INITIAL_CONTEXT_SETUP_FAIL); + LOG_W(NR_RRC, "[gNB %ld] In NGAP_INITIAL_CONTEXT_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, gNB_ue_ngap_id); + msg_fail_p = itti_alloc_new_message (TASK_RRC_GNB, 0, NGAP_INITIAL_CONTEXT_SETUP_FAIL); NGAP_INITIAL_CONTEXT_SETUP_FAIL (msg_fail_p).gNB_ue_ngap_id = gNB_ue_ngap_id; // TODO add failure cause when defined! itti_send_msg_to_task (TASK_NGAP, instance, msg_fail_p); @@ -393,7 +393,7 @@ rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP( int e_rab; int e_rabs_done = 0; int e_rabs_failed = 0; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, NGAP_INITIAL_CONTEXT_SETUP_RESP); + msg_p = itti_alloc_new_message (TASK_RRC_ENB, 0, NGAP_INITIAL_CONTEXT_SETUP_RESP); NGAP_INITIAL_CONTEXT_SETUP_RESP (msg_p).gNB_ue_ngap_id = ue_context_pP->ue_context.gNB_ue_ngap_id; for (e_rab = 0; e_rab < ue_context_pP->ue_context.nb_of_e_rabs; e_rab++) { diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index a0d32c1339..aa9b9df8f2 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -148,7 +148,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ // generate nr-Config-r15 containers for LTE RRC : inside message for X2 EN-DC (CG-Config Message from 38.331) rrc_gNB_carrier_data_t *carrier=&rrc->carrier; MessageDef *msg; - msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_ENDC_SGNB_ADDITION_REQ_ACK); + msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_ENDC_SGNB_ADDITION_REQ_ACK); gtpv1u_enb_create_tunnel_req_t create_tunnel_req; gtpv1u_enb_create_tunnel_resp_t create_tunnel_resp; protocol_ctxt_t ctxt; @@ -326,7 +326,7 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { mac_remove_nr_ue(rrc->module_id, rnti); /* delete gtp tunnel */ - msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_GNB, GTPV1U_ENB_DELETE_TUNNEL_REQ); + msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_GNB, 0, GTPV1U_ENB_DELETE_TUNNEL_REQ); memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = rnti; GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).from_gnb = 1; diff --git a/openair2/RRC/NR_UE/L2_interface_ue.c b/openair2/RRC/NR_UE/L2_interface_ue.c index 44d50dd0ef..664f4ad000 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.c +++ b/openair2/RRC/NR_UE/L2_interface_ue.c @@ -88,7 +88,7 @@ rrc_data_req_ue( ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, sdu_sizeP); memcpy (message_buffer, buffer_pP, sdu_sizeP); - message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ); + message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, 0, RRC_DCCH_DATA_REQ); RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame; RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag; RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c old mode 100755 new mode 100644 index 4fcd0db1b5..d5d885c3bb --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -834,7 +834,7 @@ int nr_decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_index /* TODO { MessageDef *message_ral_p = NULL; rrc_ral_system_information_ind_t ral_si_ind; - message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_SYSTEM_INFORMATION_IND); + message_ral_p = itti_alloc_new_message (TASK_RRC_UE, 0, RRC_RAL_SYSTEM_INFORMATION_IND); memset(&ral_si_ind, 0, sizeof(rrc_ral_system_information_ind_t)); ral_si_ind.plmn_id.MCCdigit2 = '0'; ral_si_ind.plmn_id.MCCdigit1 = '2'; @@ -1162,7 +1162,7 @@ int nr_decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_inde ) { /* PLMN match, send a confirmation to NAS */ MessageDef *msg_p; - msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CELL_SELECTION_CNF); + msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, NAS_CELL_SELECTION_CNF); NAS_CELL_SELECTION_CNF (msg_p).errCode = AS_SUCCESS; NAS_CELL_SELECTION_CNF (msg_p).cellID = BIT_STRING_to_uint32(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->cellIdentity); NAS_CELL_SELECTION_CNF (msg_p).tac = BIT_STRING_to_uint16(sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->trackingAreaCode); @@ -1180,7 +1180,7 @@ int nr_decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t gNB_inde if (cell_valid == 0) { /* Cell can not be used, ask PHY to try the next one */ MessageDef *msg_p; - msg_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_NEXT_CELL_REQ); + msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, PHY_FIND_NEXT_CELL_REQ); itti_send_msg_to_task(TASK_PHY_UE, ctxt_pP->instance, msg_p); LOG_E(RRC, "Synched with a cell, but PLMN doesn't match our SIM " @@ -1385,7 +1385,7 @@ static void rrc_ue_generate_RRCSetupComplete( uint8_t *message_buffer; message_buffer = itti_malloc (TASK_RRC_UE_SIM, TASK_RRC_GNB_SIM, size); memcpy (message_buffer, buffer, size); - message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, UE_RRC_DCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, 0, UE_RRC_DCCH_DATA_IND); UE_RRC_DCCH_DATA_IND (message_p).rbid = 1; UE_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; UE_RRC_DCCH_DATA_IND (message_p).size = size; @@ -1516,7 +1516,7 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message( case NR_DL_DCCH_MessageType__c1_PR_NOTHING: case NR_DL_DCCH_MessageType__c1_PR_rrcResume: case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: - msg_p = itti_alloc_new_message(TASK_RRC_NRUE, NAS_CONN_RELEASE_IND); + msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_CONN_RELEASE_IND); if((nr_dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) && (nr_dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)){ nr_dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.choice.rrcRelease->deprioritisationReq->deprioritisationTimer = @@ -1717,7 +1717,7 @@ nr_rrc_ue_process_securityModeCommand( (enc_rval.encoded + 7) / 8); memcpy (message_buffer, buffer, (enc_rval.encoded + 7) / 8); - message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, UE_RRC_DCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, 0, UE_RRC_DCCH_DATA_IND); GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; GNB_RRC_DCCH_DATA_IND (message_p).size = (enc_rval.encoded + 7) / 8; @@ -1778,7 +1778,7 @@ void rrc_ue_generate_RRCSetupRequest( const protocol_ctxt_t *const ctxt_pP, cons NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size); memcpy (message_buffer, (uint8_t*)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload, NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size); - message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, UE_RRC_CCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, 0, UE_RRC_CCCH_DATA_IND); GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer; GNB_RRC_CCCH_DATA_IND (message_p).size = NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size; itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p); @@ -2191,7 +2191,7 @@ rrc_ue_process_rrcReconfiguration( for (list_count = 0; list_count < ie->nonCriticalExtension->dedicatedNAS_MessageList->list.count; list_count++) { pdu_length = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->size; pdu_buffer = ie->nonCriticalExtension->dedicatedNAS_MessageList->list.array[list_count]->buf; - msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CONN_ESTABLI_CNF); + msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, NAS_CONN_ESTABLI_CNF); NAS_CONN_ESTABLI_CNF(msg_p).errCode = AS_SUCCESS; NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length = pdu_length; NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer; @@ -2224,7 +2224,7 @@ void nr_rrc_ue_generate_RRCReconfigurationComplete( const protocol_ctxt_t *const message_buffer = itti_malloc (TASK_RRC_UE_SIM,TASK_RRC_GNB_SIM,size); memcpy (message_buffer, buffer, size); - message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, UE_RRC_DCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, 0, UE_RRC_DCCH_DATA_IND); UE_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; UE_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; UE_RRC_DCCH_DATA_IND (message_p).size = size; @@ -2300,7 +2300,7 @@ nr_rrc_ue_decode_dcch( case NR_DL_DCCH_MessageType__c1_PR_rrcResume: case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: - msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CONN_RELEASE_IND); + msg_p = itti_alloc_new_message(TASK_RRC_UE, 0, NAS_CONN_RELEASE_IND); if((dl_dcch_msg->message.choice.c1->choice.rrcRelease->criticalExtensions.present == NR_RRCRelease__criticalExtensions_PR_rrcRelease) && (dl_dcch_msg->message.choice.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcRelease)){ @@ -2359,7 +2359,7 @@ void *rrc_nrue_task( void *args_p ) { while(1) { // Wait for a message itti_receive_msg (TASK_RRC_NRUE, &msg_p); - instance = ITTI_MSG_INSTANCE (msg_p); + instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); ue_mod_id = UE_INSTANCE_TO_MODULE_ID(instance); switch (ITTI_MSG_ID(msg_p)) { @@ -2546,7 +2546,7 @@ nr_rrc_ue_process_ueCapabilityEnquiry( (enc_rval.encoded + 7) / 8); memcpy (message_buffer, buffer, (enc_rval.encoded + 7) / 8); - message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, UE_RRC_DCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_RRC_UE_SIM, 0, UE_RRC_DCCH_DATA_IND); GNB_RRC_DCCH_DATA_IND (message_p).rbid = DCCH; GNB_RRC_DCCH_DATA_IND (message_p).sdu = message_buffer; GNB_RRC_DCCH_DATA_IND (message_p).size = (enc_rval.encoded + 7) / 8; diff --git a/openair2/SIMULATION/NR_RRC/itti_sim.c b/openair2/SIMULATION/NR_RRC/itti_sim.c index d9352f2d0a..9f81aa1901 100644 --- a/openair2/SIMULATION/NR_RRC/itti_sim.c +++ b/openair2/SIMULATION/NR_RRC/itti_sim.c @@ -422,7 +422,7 @@ void *itti_sim_ue_rrc_task( void *args_p) { while(1) { // Wait for a message itti_receive_msg (TASK_RRC_UE_SIM, &msg_p); - instance = ITTI_MSG_INSTANCE (msg_p); + instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); ue_mod_id = UE_INSTANCE_TO_MODULE_ID(instance); switch (ITTI_MSG_ID(msg_p)) { @@ -479,7 +479,7 @@ void *itti_sim_gnb_rrc_task( void *args_p) { while(1) { // Wait for a message itti_receive_msg (TASK_RRC_GNB_SIM, &msg_p); - instance = ITTI_MSG_INSTANCE (msg_p); + instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); ue_mod_id = UE_INSTANCE_TO_MODULE_ID(instance); switch (ITTI_MSG_ID(msg_p)) { @@ -557,9 +557,9 @@ int main( int argc, char **argv ) } cpuf=get_cpu_freq_GHz(); - itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); // initialize mscgen log after ITTI - MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX); + MSC_INIT(MSC_E_UTRAN, ADDED_QUEUES_MAX+TASK_MAX); init_opt(); diff --git a/openair2/X2AP/x2ap_eNB.c b/openair2/X2AP/x2ap_eNB.c index 7e4f735705..58535646fd 100644 --- a/openair2/X2AP/x2ap_eNB.c +++ b/openair2/X2AP/x2ap_eNB.c @@ -133,7 +133,7 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa dump_trees(); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - X2AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", + X2AP_WARN("Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", sctp_new_association_resp->sctp_state, instance, sctp_new_association_resp->ulp_cnx_id); @@ -159,7 +159,7 @@ static void x2ap_eNB_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind) { x2ap_eNB_instance_t *instance_p; x2ap_eNB_data_t *x2ap_enb_data_p; - printf("x2ap_eNB_handle_sctp_association_ind at 1 (called for instance %d)\n", instance); + printf("x2ap_eNB_handle_sctp_association_ind at 1 (called for instance %ld)\n", instance); dump_trees(); DevAssert(sctp_new_association_ind != NULL); instance_p = x2ap_eNB_get_instance(instance); @@ -207,7 +207,7 @@ int x2ap_eNB_init_sctp (x2ap_eNB_instance_t *instance_p, sctp_init_t *sctp_init = NULL; DevAssert(instance_p != NULL); DevAssert(local_ip_addr != NULL); - message = itti_alloc_new_message (TASK_X2AP, SCTP_INIT_MSG_MULTI_REQ); + message = itti_alloc_new_message (TASK_X2AP, 0, SCTP_INIT_MSG_MULTI_REQ); sctp_init = &message->ittiMsg.sctp_init_multi; sctp_init->port = enb_port_for_X2C; sctp_init->ppid = X2AP_SCTP_PPID; @@ -241,7 +241,7 @@ static void x2ap_eNB_register_eNB(x2ap_eNB_instance_t *instance_p, x2ap_eNB_data_t *x2ap_enb_data = NULL; DevAssert(instance_p != NULL); DevAssert(target_eNB_ip_address != NULL); - message = itti_alloc_new_message(TASK_X2AP, SCTP_NEW_ASSOCIATION_REQ_MULTI); + message = itti_alloc_new_message(TASK_X2AP, 0, SCTP_NEW_ASSOCIATION_REQ_MULTI); sctp_new_association_req = &message->ittiMsg.sctp_new_association_req_multi; sctp_new_association_req->port = enb_port_for_X2C; sctp_new_association_req->ppid = X2AP_SCTP_PPID; @@ -286,7 +286,7 @@ void x2ap_eNB_handle_register_eNB(instance_t instance, DevCheck(new_instance->tac == x2ap_register_eNB->tac, new_instance->tac, x2ap_register_eNB->tac, 0); DevCheck(new_instance->mcc == x2ap_register_eNB->mcc, new_instance->mcc, x2ap_register_eNB->mcc, 0); DevCheck(new_instance->mnc == x2ap_register_eNB->mnc, new_instance->mnc, x2ap_register_eNB->mnc, 0); - X2AP_WARN("eNB[%d] already registered\n", instance); + X2AP_WARN("eNB[%ld] already registered\n", instance); } else { new_instance = calloc(1, sizeof(x2ap_eNB_instance_t)); DevAssert(new_instance != NULL); @@ -339,7 +339,7 @@ void x2ap_eNB_handle_register_eNB(instance_t instance, new_instance->enb_port_for_X2C = x2ap_register_eNB->enb_port_for_X2C; /* Add the new instance to the list of eNB (meaningfull in virtual mode) */ x2ap_eNB_insert_new_instance(new_instance); - X2AP_INFO("Registered new eNB[%d] and %s eNB id %u\n", + X2AP_INFO("Registered new eNB[%ld] and %s eNB id %u\n", instance, x2ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home", x2ap_register_eNB->eNB_id); @@ -350,7 +350,7 @@ void x2ap_eNB_handle_register_eNB(instance_t instance, return; } - X2AP_INFO("eNB[%d] eNB id %u acting as a listner (server)\n", + X2AP_INFO("eNB[%ld] eNB id %u acting as a listner (server)\n", instance, x2ap_register_eNB->eNB_id); } } @@ -377,7 +377,7 @@ void x2ap_eNB_handle_sctp_init_msg_multi_cnf( /* Trying to connect to the provided list of eNB ip address */ for (index = 0; index < instance->nb_x2; index++) { - X2AP_INFO("eNB[%d] eNB id %u acting as an initiator (client)\n", + X2AP_INFO("eNB[%ld] eNB id %u acting as an initiator (client)\n", instance_id, instance->eNB_id); x2ap_eNB_register_eNB(instance, &instance->target_enb_x2_ip_address[index], @@ -633,67 +633,67 @@ void *x2ap_task(void *arg) { break; case X2AP_SUBFRAME_PROCESS: - x2ap_check_timers(ITTI_MESSAGE_GET_INSTANCE(received_msg)); + x2ap_check_timers(ITTI_MSG_DESTINATION_INSTANCE(received_msg)); break; case X2AP_REGISTER_ENB_REQ: - x2ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg), + x2ap_eNB_handle_register_eNB(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &X2AP_REGISTER_ENB_REQ(received_msg)); break; case X2AP_HANDOVER_REQ: - x2ap_eNB_handle_handover_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + x2ap_eNB_handle_handover_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &X2AP_HANDOVER_REQ(received_msg)); break; case X2AP_HANDOVER_REQ_ACK: - x2ap_eNB_handle_handover_req_ack(ITTI_MESSAGE_GET_INSTANCE(received_msg), + x2ap_eNB_handle_handover_req_ack(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &X2AP_HANDOVER_REQ_ACK(received_msg)); break; case X2AP_UE_CONTEXT_RELEASE: - x2ap_eNB_ue_context_release(ITTI_MESSAGE_GET_INSTANCE(received_msg), + x2ap_eNB_ue_context_release(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &X2AP_UE_CONTEXT_RELEASE(received_msg)); break; case X2AP_ENDC_SGNB_ADDITION_REQ: - x2ap_eNB_handle_sgNB_add_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + x2ap_eNB_handle_sgNB_add_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &X2AP_ENDC_SGNB_ADDITION_REQ(received_msg)); break; case X2AP_ENDC_SGNB_ADDITION_REQ_ACK: - x2ap_gNB_trigger_sgNB_add_req_ack(ITTI_MESSAGE_GET_INSTANCE(received_msg), + x2ap_gNB_trigger_sgNB_add_req_ack(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &X2AP_ENDC_SGNB_ADDITION_REQ_ACK(received_msg)); LOG_I(X2AP, "Received elements for X2AP_ENDC_SGNB_ADDITION_REQ_ACK \n"); break; case X2AP_ENDC_SGNB_RECONF_COMPLETE: - x2ap_eNB_trigger_sgnb_reconfiguration_complete(ITTI_MESSAGE_GET_INSTANCE(received_msg), + x2ap_eNB_trigger_sgnb_reconfiguration_complete(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &X2AP_ENDC_SGNB_RECONF_COMPLETE(received_msg)); break; case X2AP_ENDC_SGNB_RELEASE_REQUEST: - x2ap_eNB_handle_sgNB_release_request(ITTI_MESSAGE_GET_INSTANCE(received_msg), + x2ap_eNB_handle_sgNB_release_request(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &X2AP_ENDC_SGNB_RELEASE_REQUEST(received_msg)); break; case SCTP_INIT_MSG_MULTI_CNF: - x2ap_eNB_handle_sctp_init_msg_multi_cnf(ITTI_MESSAGE_GET_INSTANCE(received_msg), + x2ap_eNB_handle_sctp_init_msg_multi_cnf(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_init_msg_multi_cnf); break; case SCTP_NEW_ASSOCIATION_RESP: - x2ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + x2ap_eNB_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_NEW_ASSOCIATION_IND: - x2ap_eNB_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + x2ap_eNB_handle_sctp_association_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_ind); break; case SCTP_DATA_IND: - x2ap_eNB_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + x2ap_eNB_handle_sctp_data_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_data_ind); break; diff --git a/openair2/X2AP/x2ap_eNB_handler.c b/openair2/X2AP/x2ap_eNB_handler.c index bbdeaf0ac8..f0e0fa9c23 100644 --- a/openair2/X2AP/x2ap_eNB_handler.c +++ b/openair2/X2AP/x2ap_eNB_handler.c @@ -230,7 +230,7 @@ void x2ap_handle_x2_setup_message(x2ap_eNB_instance_t *instance_p, x2ap_eNB_data if (instance_p->x2_target_enb_associated_nb == 0) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_X2AP, X2AP_DEREGISTERED_ENB_IND); + message_p = itti_alloc_new_message(TASK_X2AP, 0, X2AP_DEREGISTERED_ENB_IND); X2AP_DEREGISTERED_ENB_IND(message_p).nb_x2 = 0; itti_send_msg_to_task(TASK_ENB_APP, instance_p->instance, message_p); } @@ -250,7 +250,7 @@ void x2ap_handle_x2_setup_message(x2ap_eNB_instance_t *instance_p, x2ap_eNB_data if (instance_p->x2_target_enb_pending_nb == 0) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_X2AP, X2AP_REGISTER_ENB_CNF); + message_p = itti_alloc_new_message(TASK_X2AP, 0, X2AP_REGISTER_ENB_CNF); X2AP_REGISTER_ENB_CNF(message_p).nb_x2 = instance_p->x2_target_enb_associated_nb; itti_send_msg_to_task(TASK_ENB_APP, instance_p->instance, message_p); } @@ -480,7 +480,7 @@ x2ap_eNB_handle_x2_setup_request(instance_t instance, return -1; } - msg = itti_alloc_new_message(TASK_X2AP, X2AP_SETUP_REQ); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_SETUP_REQ); X2AP_SETUP_REQ(msg).num_cc = ie->value.choice.ServedCells.list.count; @@ -598,7 +598,7 @@ int x2ap_eNB_handle_x2_setup_response(instance_t instance, return -1; } - msg = itti_alloc_new_message(TASK_X2AP, X2AP_SETUP_RESP); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_SETUP_RESP); X2AP_SETUP_RESP(msg).num_cc = ie->value.choice.ServedCells.list.count; @@ -724,7 +724,7 @@ int x2ap_eNB_handle_handover_preparation (instance_t instance, instance_p = x2ap_eNB_get_instance(instance); DevAssert(instance_p != NULL); - msg = itti_alloc_new_message(TASK_X2AP, X2AP_HANDOVER_REQ); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_HANDOVER_REQ); X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_HandoverRequest_IEs_t, ie, x2HandoverRequest, X2AP_ProtocolIE_ID_id_Old_eNB_UE_X2AP_ID, true); @@ -865,7 +865,7 @@ int x2ap_eNB_handle_handover_response (instance_t instance, instance_p = x2ap_eNB_get_instance(instance); DevAssert(instance_p != NULL); - msg = itti_alloc_new_message(TASK_X2AP, X2AP_HANDOVER_REQ_ACK); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_HANDOVER_REQ_ACK); X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_HandoverRequestAcknowledge_IEs_t, ie, x2HandoverRequestAck, X2AP_ProtocolIE_ID_id_Old_eNB_UE_X2AP_ID, true); @@ -1005,7 +1005,7 @@ int x2ap_eNB_handle_ue_context_release (instance_t instance, instance_p = x2ap_eNB_get_instance(instance); DevAssert(instance_p != NULL); - msg = itti_alloc_new_message(TASK_X2AP, X2AP_UE_CONTEXT_RELEASE); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_UE_CONTEXT_RELEASE); X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_UEContextRelease_IEs_t, ie, x2UEContextRelease, X2AP_ProtocolIE_ID_id_Old_eNB_UE_X2AP_ID, true); @@ -1150,7 +1150,7 @@ int x2ap_eNB_handle_handover_cancel (instance_t instance, exit(1); } - msg = itti_alloc_new_message(TASK_X2AP, X2AP_HANDOVER_CANCEL); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_HANDOVER_CANCEL); X2AP_HANDOVER_CANCEL(msg).rnti = x2ap_id_get_rnti(&instance_p->id_manager, ue_id); X2AP_HANDOVER_CANCEL(msg).cause = cause; @@ -1199,7 +1199,7 @@ int x2ap_eNB_handle_senb_addition_request (instance_t instance, instance_p = x2ap_eNB_get_instance(instance); DevAssert(instance_p != NULL); - msg = itti_alloc_new_message(TASK_X2AP, X2AP_SENB_ADDITION_REQ); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_SENB_ADDITION_REQ); /*MeNB_UE_X2AP_ID */ X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SeNBAdditionRequest_IEs_t, ie, x2SeNBAdditionRequest, @@ -1410,7 +1410,7 @@ x2ap_eNB_handle_ENDC_x2_setup_request(instance_t instance, X2AP_ProtocolIE_ID_id_InitiatingNodeType_EndcX2Setup, true); - msg = itti_alloc_new_message(TASK_X2AP, X2AP_ENDC_SETUP_REQ); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_ENDC_SETUP_REQ); if (ie == NULL ) { X2AP_ERROR("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); @@ -1703,7 +1703,7 @@ int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, DevAssert(instance_p != NULL); //Allocate an ITTI X2AP_SGNB_ADDITION_REQ message instead - msg = itti_alloc_new_message(TASK_X2AP, X2AP_ENDC_SGNB_ADDITION_REQ); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_ENDC_SGNB_ADDITION_REQ); /* X2AP_ProtocolIE_ID_id_MeNB_UE_X2AP_ID */ X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBAdditionRequest_IEs_t, ie, x2SgNBAdditionRequest, @@ -1851,7 +1851,7 @@ int x2ap_eNB_handle_ENDC_sGNB_addition_response (instance_t instance, DevAssert(instance_p != NULL); //Allocate an ITTI X2AP_SGNB_ADDITION_REQ message instead - msg = itti_alloc_new_message(TASK_X2AP, X2AP_ENDC_SGNB_ADDITION_REQ_ACK); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_ENDC_SGNB_ADDITION_REQ_ACK); X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).gnb_x2_assoc_id = assoc_id; @@ -1997,7 +1997,7 @@ int x2ap_gNB_handle_ENDC_sGNB_reconfiguration_complete (instance_t instance, DevAssert(instance_p != NULL); //Allocate an ITTI X2AP_sGNB_reconfiguration_complete message - msg = itti_alloc_new_message(TASK_X2AP, X2AP_ENDC_SGNB_RECONF_COMPLETE); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_ENDC_SGNB_RECONF_COMPLETE); /* X2AP_ProtocolIE_ID_id_MeNB_UE_X2AP_ID */ X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_SgNBReconfigurationComplete_IEs_t, ie, x2SgNBReconfigurationComplete, @@ -2135,7 +2135,7 @@ int x2ap_gNB_handle_ENDC_sGNB_release_request(instance_t instance, } if (rnti != -1) { - msg = itti_alloc_new_message(TASK_X2AP, X2AP_ENDC_SGNB_RELEASE_REQUEST); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_ENDC_SGNB_RELEASE_REQUEST); X2AP_ENDC_SGNB_RELEASE_REQUEST(msg).rnti = rnti; @@ -2228,7 +2228,7 @@ int x2ap_gNB_handle_ENDC_sGNB_release_required(instance_t instance, gnb_rnti = id_target; - msg = itti_alloc_new_message(TASK_X2AP, X2AP_ENDC_SGNB_RELEASE_REQUIRED); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_ENDC_SGNB_RELEASE_REQUIRED); X2AP_ENDC_SGNB_RELEASE_REQUIRED(msg).gnb_rnti = gnb_rnti; itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg); diff --git a/openair2/X2AP/x2ap_eNB_itti_messaging.c b/openair2/X2AP/x2ap_eNB_itti_messaging.c index 7573d9be89..26e26ba411 100644 --- a/openair2/X2AP/x2ap_eNB_itti_messaging.c +++ b/openair2/X2AP/x2ap_eNB_itti_messaging.c @@ -36,7 +36,7 @@ void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin MessageDef *message_p; sctp_data_req_t *sctp_data_req; - message_p = itti_alloc_new_message(TASK_X2AP, SCTP_DATA_REQ); + message_p = itti_alloc_new_message(TASK_X2AP, 0, SCTP_DATA_REQ); sctp_data_req = &message_p->ittiMsg.sctp_data_req; @@ -54,7 +54,7 @@ void x2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t asso MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; - message_p = itti_alloc_new_message(TASK_X2AP, SCTP_CLOSE_ASSOCIATION); + message_p = itti_alloc_new_message(TASK_X2AP, 0, SCTP_CLOSE_ASSOCIATION); sctp_close_association_p = &message_p->ittiMsg.sctp_close_association; sctp_close_association_p->assoc_id = assoc_id; diff --git a/openair2/X2AP/x2ap_eNB_management_procedures.c b/openair2/X2AP/x2ap_eNB_management_procedures.c index 469a76a261..a0cc0d1124 100644 --- a/openair2/X2AP/x2ap_eNB_management_procedures.c +++ b/openair2/X2AP/x2ap_eNB_management_procedures.c @@ -116,7 +116,7 @@ void dump_trees(void) x2ap_eNB_instance_t *zz; STAILQ_FOREACH(zz, &x2ap_eNB_internal_data.x2ap_eNB_instances_head, x2ap_eNB_entries) { -printf("here comes the tree (instance %d):\n---------------------------------------------\n", zz->instance); +printf("here comes the tree (instance %ld):\n---------------------------------------------\n", zz->instance); dump_tree(zz->x2ap_enb_head.rbh_root); printf("---------------------------------------------\n"); } diff --git a/openair2/X2AP/x2ap_timers.c b/openair2/X2AP/x2ap_timers.c index 29e887504f..98674de51b 100644 --- a/openair2/X2AP/x2ap_timers.c +++ b/openair2/X2AP/x2ap_timers.c @@ -101,7 +101,7 @@ void x2ap_check_timers(instance_t instance) X2AP_CAUSE_T_DC_PREP_TIMEOUT); /* inform RRC of timeout */ - msg = itti_alloc_new_message(TASK_X2AP, X2AP_ENDC_DC_PREP_TIMEOUT); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_ENDC_DC_PREP_TIMEOUT); X2AP_ENDC_DC_PREP_TIMEOUT(msg).rnti = x2ap_id_get_rnti(m, i); itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg); @@ -125,7 +125,7 @@ void x2ap_check_timers(instance_t instance) id_source, id_target, X2AP_CAUSE_T_DC_OVERALL_TIMEOUT); /* inform RRC of timeout */ - msg = itti_alloc_new_message(TASK_X2AP, X2AP_ENDC_DC_OVERALL_TIMEOUT); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_ENDC_DC_OVERALL_TIMEOUT); X2AP_ENDC_DC_OVERALL_TIMEOUT(msg).rnti = x2ap_id_get_rnti(m, i); itti_send_msg_to_task(TASK_RRC_GNB, instance_p->instance, msg); @@ -144,7 +144,7 @@ lte_handover_timeout: x2ap_eNB_generate_x2_handover_cancel(instance_p, target, i, cause); /* inform RRC of cancellation */ - msg = itti_alloc_new_message(TASK_X2AP, X2AP_HANDOVER_CANCEL); + msg = itti_alloc_new_message(TASK_X2AP, 0, X2AP_HANDOVER_CANCEL); X2AP_HANDOVER_CANCEL(msg).rnti = x2ap_id_get_rnti(m, i); X2AP_HANDOVER_CANCEL(msg).cause = cause; itti_send_msg_to_task(TASK_RRC_ENB, instance_p->instance, msg); diff --git a/openair3/GTPV1-U/gtpv1u_eNB.c b/openair3/GTPV1-U/gtpv1u_eNB.c index 1e2954ba95..4769380d18 100644 --- a/openair3/GTPV1-U/gtpv1u_eNB.c +++ b/openair3/GTPV1-U/gtpv1u_eNB.c @@ -135,7 +135,7 @@ static int gtpv1u_eNB_send_init_udp(const Gtpv1uS1Req *req) { // Create and alloc new message MessageDef *message_p; struct in_addr addr= {0}; - message_p = itti_alloc_new_message(TASK_GTPV1_U, UDP_INIT); + message_p = itti_alloc_new_message(TASK_GTPV1_U, 0, UDP_INIT); if (message_p == NULL) { return -1; @@ -184,7 +184,7 @@ NwGtpv1uRcT gtpv1u_eNB_send_udp_msg( // Create and alloc new message MessageDef *message_p = NULL; udp_data_req_t *udp_data_req_p = NULL; - message_p = itti_alloc_new_message(TASK_GTPV1_U, UDP_DATA_REQ); + message_p = itti_alloc_new_message(TASK_GTPV1_U, 0, UDP_DATA_REQ); if (message_p) { #if defined(LOG_GTPU) && LOG_GTPU > 0 @@ -285,7 +285,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req( //ue_context_p->ue_context.handover_info->state = HO_END_MARKER; MessageDef *msg; // Configure end marker - msg = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_ENB_END_MARKER_REQ); + msg = itti_alloc_new_message(TASK_GTPV1_U, 0, GTPV1U_ENB_END_MARKER_REQ); GTPV1U_ENB_END_MARKER_REQ(msg).buffer = itti_malloc(TASK_GTPV1_U, TASK_GTPV1_U, GTPU_HEADER_OVERHEAD_MAX + buffer_len); memcpy(>PV1U_ENB_END_MARKER_REQ(msg).buffer[GTPU_HEADER_OVERHEAD_MAX], buffer, buffer_len); GTPV1U_ENB_END_MARKER_REQ(msg).length = buffer_len; @@ -358,7 +358,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req( if (ue_context_p->ue_context.handover_info->state == HO_COMPLETE) { MessageDef *msg; // Configure target - msg = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_ENB_DATA_FORWARDING_REQ); + msg = itti_alloc_new_message(TASK_GTPV1_U, 0, GTPV1U_ENB_DATA_FORWARDING_REQ); GTPV1U_ENB_DATA_FORWARDING_REQ(msg).buffer = itti_malloc(TASK_GTPV1_U, TASK_GTPV1_U, GTPU_HEADER_OVERHEAD_MAX + buffer_len); memcpy(>PV1U_ENB_DATA_FORWARDING_REQ(msg).buffer[GTPU_HEADER_OVERHEAD_MAX], buffer, buffer_len); GTPV1U_ENB_DATA_FORWARDING_REQ(msg).length = buffer_len; @@ -1122,7 +1122,7 @@ int gtpv1u_delete_s1u_tunnel( hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; teid_t teid_eNB = 0; int erab_index = 0; - message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_ENB_DELETE_TUNNEL_RESP); + message_p = itti_alloc_new_message(TASK_GTPV1_U, 0, GTPV1U_ENB_DELETE_TUNNEL_RESP); GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).rnti = req_pP->rnti; GTPV1U_ENB_DELETE_TUNNEL_RESP(message_p).status = 0; hash_rc = hashtable_get(RC.gtpv1u_data_g->ue_mapping, req_pP->rnti, (void **)>pv1u_ue_data_p); @@ -1289,7 +1289,7 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) { itti_receive_msg(TASK_GTPV1_U, &received_message_p); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_ENB_TASK, VCD_FUNCTION_IN); DevAssert(received_message_p != NULL); - instance = ITTI_MSG_INSTANCE(received_message_p); + instance = ITTI_MSG_DESTINATION_INSTANCE(received_message_p); //msg_name_p = ITTI_MSG_NAME(received_message_p); switch (ITTI_MSG_ID(received_message_p)) { diff --git a/openair3/M3AP/m3ap_MCE.c b/openair3/M3AP/m3ap_MCE.c index dec9b96897..9362c8fcb6 100644 --- a/openair3/M3AP/m3ap_MCE.c +++ b/openair3/M3AP/m3ap_MCE.c @@ -136,7 +136,7 @@ void m3ap_MCE_handle_sctp_association_resp(instance_t instance, sctp_new_associa //dump_trees_m3(); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - M3AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", + M3AP_WARN("Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", sctp_new_association_resp->sctp_state, instance, sctp_new_association_resp->ulp_cnx_id); @@ -229,7 +229,7 @@ int m3ap_MCE_init_sctp (m3ap_MCE_instance_t *instance_p, sctp_init_t *sctp_init = NULL; DevAssert(instance_p != NULL); DevAssert(local_ip_addr != NULL); - message = itti_alloc_new_message (TASK_M3AP_MCE, SCTP_INIT_MSG_MULTI_REQ); + message = itti_alloc_new_message (TASK_M3AP_MCE, 0, SCTP_INIT_MSG_MULTI_REQ); sctp_init = &message->ittiMsg.sctp_init_multi; sctp_init->port = mce_port_for_M3C; sctp_init->ppid = M3AP_SCTP_PPID; @@ -263,7 +263,7 @@ static void m3ap_MCE_register_MCE(m3ap_MCE_instance_t *instance_p, m3ap_MCE_data_t *m3ap_mce_data = NULL; DevAssert(instance_p != NULL); DevAssert(target_MCE_ip_address != NULL); - message = itti_alloc_new_message(TASK_M3AP_MCE, SCTP_NEW_ASSOCIATION_REQ_MULTI); + message = itti_alloc_new_message(TASK_M3AP_MCE, 0, SCTP_NEW_ASSOCIATION_REQ_MULTI); sctp_new_association_req = &message->ittiMsg.sctp_new_association_req_multi; sctp_new_association_req->port = mce_port_for_M3C; sctp_new_association_req->ppid = M3AP_SCTP_PPID; @@ -313,7 +313,7 @@ void m3ap_MCE_handle_register_MCE(instance_t instance, DevCheck(new_instance->tac == m3ap_register_MCE->tac, new_instance->tac, m3ap_register_MCE->tac, 0); DevCheck(new_instance->mcc == m3ap_register_MCE->mcc, new_instance->mcc, m3ap_register_MCE->mcc, 0); DevCheck(new_instance->mnc == m3ap_register_MCE->mnc, new_instance->mnc, m3ap_register_MCE->mnc, 0); - M3AP_WARN("MCE[%d] already registered\n", instance); + M3AP_WARN("MCE[%ld] already registered\n", instance); } else { new_instance = calloc(1, sizeof(m3ap_MCE_instance_t)); DevAssert(new_instance != NULL); @@ -357,7 +357,7 @@ void m3ap_MCE_handle_register_MCE(instance_t instance, new_instance->mce_port_for_M3C = m3ap_register_MCE->mme_port_for_M3C; /* Add the new instance to the list of MCE (meaningfull in virtual mode) */ m3ap_MCE_insert_new_instance(new_instance); - M3AP_INFO("Registered new MCE[%d] and %s MCE id %u\n", + M3AP_INFO("Registered new MCE[%ld] and %s MCE id %u\n", instance, m3ap_register_MCE->cell_type == CELL_MACRO_ENB ? "macro" : "home", m3ap_register_MCE->MCE_id); @@ -370,7 +370,7 @@ void m3ap_MCE_handle_register_MCE(instance_t instance, return; } - M3AP_INFO("MCE[%d] MCE id %u acting as a listner (server)\n", + M3AP_INFO("MCE[%ld] MCE id %u acting as a listner (server)\n", instance, m3ap_register_MCE->MCE_id); } } @@ -397,7 +397,7 @@ void m3ap_MCE_handle_sctp_init_msg_multi_cnf( /* Trying to connect to the provided list of MCE ip address */ for (index = 0; index < instance->nb_m3; index++) { - M3AP_INFO("MCE[%d] MCE id %u acting as an initiator (client)\n", + M3AP_INFO("MCE[%ld] MCE id %u acting as an initiator (client)\n", instance_id, instance->MCE_id); m3ap_MCE_register_MCE(instance, &instance->target_mme_m3_ip_address[index], @@ -537,7 +537,7 @@ void *m3ap_MCE_task(void *arg) { switch (ITTI_MSG_ID(received_msg)) { case MESSAGE_TEST: // LOG_W(M3AP,"MCE Received Test Message ... TODO\n"); -// //MessageDef * message_p = itti_alloc_new_message(TASK_M3AP, MESSAGE_TEST); +// //MessageDef * message_p = itti_alloc_new_message(TASK_M3AP, 0, MESSAGE_TEST); // //itti_send_msg_to_task(TASK_M2AP_ENB, 1/*ctxt_pP->module_id*/, message_p); // // asn_dec_rval_t dec_ret; @@ -577,78 +577,78 @@ void *m3ap_MCE_task(void *arg) { break; case M3AP_SUBFRAME_PROCESS: - m3ap_check_timers(ITTI_MESSAGE_GET_INSTANCE(received_msg)); + m3ap_check_timers(ITTI_MSG_DESTINATION_INSTANCE(received_msg)); break; case M3AP_REGISTER_MCE_REQ: LOG_I(M3AP,"MCE Received M3AP_REGISTER_MCE_REQ Message\n"); - m3ap_MCE_handle_register_MCE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m3ap_MCE_handle_register_MCE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M3AP_REGISTER_MCE_REQ(received_msg)); break; case M3AP_MBMS_SESSION_START_RESP: LOG_I(M3AP,"MCE M3AP_MBMS_SESSION_START_RESP Message\n"); - MCE_send_MBMS_SESSION_START_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + MCE_send_MBMS_SESSION_START_RESPONSE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M3AP_MBMS_SESSION_START_RESP(received_msg)); break; case M3AP_MBMS_SESSION_STOP_RESP: LOG_I(M3AP,"MCE M3AP_MBMS_SESSION_STOP_RESP Message\n"); - MCE_send_MBMS_SESSION_STOP_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + MCE_send_MBMS_SESSION_STOP_RESPONSE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M3AP_MBMS_SESSION_START_RESP(received_msg)); break; case M3AP_MBMS_SESSION_UPDATE_RESP: LOG_I(M3AP,"MCE M3AP_MBMS_SESSION_UPDATE_RESP Message\n"); - //MCE_send_MBMS_SESSION_UPDATE_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + //MCE_send_MBMS_SESSION_UPDATE_RESPONSE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), //&M3AP_MBMS_SESSION_START_RESP(received_msg)); break; // case M3AP_HANDOVER_REQ: -// m3ap_eNB_handle_handover_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), +// m3ap_eNB_handle_handover_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M3AP_HANDOVER_REQ(received_msg)); // break; // // case M3AP_HANDOVER_REQ_ACK: -// m3ap_eNB_handle_handover_req_ack(ITTI_MESSAGE_GET_INSTANCE(received_msg), +// m3ap_eNB_handle_handover_req_ack(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M3AP_HANDOVER_REQ_ACK(received_msg)); // break; // // case M3AP_UE_CONTEXT_RELEASE: -// m3ap_eNB_ue_context_release(ITTI_MESSAGE_GET_INSTANCE(received_msg), +// m3ap_eNB_ue_context_release(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M3AP_UE_CONTEXT_RELEASE(received_msg)); // break; // case SCTP_INIT_MSG_MULTI_CNF: LOG_D(M3AP,"MCE Received SCTP_INIT_MSG_MULTI_CNF Message\n"); - m3ap_MCE_handle_sctp_init_msg_multi_cnf(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m3ap_MCE_handle_sctp_init_msg_multi_cnf(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_init_msg_multi_cnf); break; case SCTP_NEW_ASSOCIATION_RESP: LOG_D(M3AP,"MCE Received SCTP_NEW_ASSOCIATION_RESP Message\n"); - m3ap_MCE_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m3ap_MCE_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_NEW_ASSOCIATION_IND: LOG_D(M3AP,"MCE Received SCTP_NEW_ASSOCIATION Message\n"); - m3ap_MCE_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m3ap_MCE_handle_sctp_association_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_ind); break; case SCTP_DATA_IND: LOG_D(M3AP,"MCE Received SCTP_DATA_IND Message\n"); - m3ap_MCE_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m3ap_MCE_handle_sctp_data_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_data_ind); break; diff --git a/openair3/M3AP/m3ap_MCE_handler.c b/openair3/M3AP/m3ap_MCE_handler.c index e733af28db..21d10d1b04 100644 --- a/openair3/M3AP/m3ap_MCE_handler.c +++ b/openair3/M3AP/m3ap_MCE_handler.c @@ -108,7 +108,7 @@ int m3ap_MCE_handle_message(instance_t instance, uint32_t assoc_id, int32_t stre } /* Calling the right handler */ - LOG_I(M3AP, "Calling handler with instance %d\n",instance); + LOG_I(M3AP, "Calling handler with instance %ld\n",instance); ret = (*m3ap_MCE_messages_callback[pdu.choice.initiatingMessage.procedureCode][pdu.present - 1]) (instance, assoc_id, stream, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_M3AP_M3AP_PDU, &pdu); diff --git a/openair3/M3AP/m3ap_MCE_interface_management.c b/openair3/M3AP/m3ap_MCE_interface_management.c index 2694846526..fb54579258 100644 --- a/openair3/M3AP/m3ap_MCE_interface_management.c +++ b/openair3/M3AP/m3ap_MCE_interface_management.c @@ -74,7 +74,7 @@ int MCE_handle_MBMS_SESSION_START_REQUEST(instance_t instance, // // container = &pdu->choice.initiatingMessage.value.choice.SessionStartRequest; - message_p = itti_alloc_new_message(TASK_M3AP_MCE, M3AP_MBMS_SESSION_START_REQ); + message_p = itti_alloc_new_message(TASK_M3AP_MCE, 0, M3AP_MBMS_SESSION_START_REQ); // // /* M3 Setup Request == Non UE-related procedure -> stream 0 */ @@ -248,7 +248,7 @@ int MCE_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, //MCE_send_MBMS_SESSION_STOP_RESPONSE(instance,assoc_id); //}else //MCE_send_MBMS_SESSION_STOP_FAILURE(instance,assoc_id); - message_p = itti_alloc_new_message(TASK_M3AP_MCE, M3AP_MBMS_SESSION_STOP_REQ); + message_p = itti_alloc_new_message(TASK_M3AP_MCE, 0, M3AP_MBMS_SESSION_STOP_REQ); // // /* M3 Setup Request == Non UE-related procedure -> stream 0 */ @@ -361,7 +361,7 @@ int MCE_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, //MCE_send_MBMS_SESSION_STOP_RESPONSE(instance,assoc_id); //}else //MCE_send_MBMS_SESSION_STOP_FAILURE(instance,assoc_id); - message_p = itti_alloc_new_message(TASK_M3AP_MCE, M3AP_MBMS_SESSION_UPDATE_REQ); + message_p = itti_alloc_new_message(TASK_M3AP_MCE, 0, M3AP_MBMS_SESSION_UPDATE_REQ); // // /* M3 Setup Request == Non UE-related procedure -> stream 0 */ @@ -711,7 +711,7 @@ int MCE_handle_M3_SETUP_RESPONSE(instance_t instance, //int num_cells_to_activate = 0; //M3AP_Cells_to_be_Activated_List_Item_t *cell; - MessageDef *msg_p = itti_alloc_new_message (TASK_M3AP_MCE, M3AP_SETUP_RESP); + MessageDef *msg_p = itti_alloc_new_message (TASK_M3AP_MCE, 0, M3AP_SETUP_RESP); // LOG_D(M3AP, "M3AP: M3Setup-Resp: protocolIEs.list.count %d\n", // in->protocolIEs.list.count); diff --git a/openair3/M3AP/m3ap_MCE_management_procedures.c b/openair3/M3AP/m3ap_MCE_management_procedures.c index 32901ca869..065d4b9616 100644 --- a/openair3/M3AP/m3ap_MCE_management_procedures.c +++ b/openair3/M3AP/m3ap_MCE_management_procedures.c @@ -116,7 +116,7 @@ void dump_trees_m3(void) m3ap_MCE_instance_t *zz; STAILQ_FOREACH(zz, &m3ap_MCE_internal_data.m3ap_MCE_instances_head, m3ap_MCE_entries) { -printf("here comes the tree (instance %d):\n---------------------------------------------\n", zz->instance); +printf("here comes the tree (instance %ld):\n---------------------------------------------\n", zz->instance); dump_tree_m3(zz->m3ap_mce_head.rbh_root); printf("---------------------------------------------\n"); } diff --git a/openair3/M3AP/m3ap_MME.c b/openair3/M3AP/m3ap_MME.c index fbfe6e1327..4d73caff23 100644 --- a/openair3/M3AP/m3ap_MME.c +++ b/openair3/M3AP/m3ap_MME.c @@ -105,7 +105,7 @@ void m3ap_MME_handle_sctp_association_resp(instance_t instance, sctp_new_associa DevAssert(sctp_new_association_resp != NULL); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - LOG_W(M3AP, "Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", + LOG_W(M3AP, "Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", sctp_new_association_resp->sctp_state, instance, sctp_new_association_resp->ulp_cnx_id); @@ -233,7 +233,7 @@ int m3ap_MME_init_sctp (m3ap_MME_instance_t *instance_p, sctp_init_t *sctp_init = NULL; DevAssert(instance_p != NULL); DevAssert(local_ip_addr != NULL); - message = itti_alloc_new_message (TASK_M3AP_MME, SCTP_INIT_MSG_MULTI_REQ); + message = itti_alloc_new_message (TASK_M3AP_MME, 0, SCTP_INIT_MSG_MULTI_REQ); sctp_init = &message->ittiMsg.sctp_init_multi; sctp_init->port = mme_port_for_M3C; sctp_init->ppid = M3AP_SCTP_PPID; @@ -267,7 +267,7 @@ static void m3ap_MME_register_MME(m3ap_MME_instance_t *instance_p, // m3ap_MME_data_t *m3ap_mme_data = NULL; // DevAssert(instance_p != NULL); // DevAssert(target_MME_ip_address != NULL); - // message = itti_alloc_new_message(TASK_M3AP_MME, SCTP_NEW_ASSOCIATION_REQ_MULTI); + // message = itti_alloc_new_message(TASK_M3AP_MME, 0, SCTP_NEW_ASSOCIATION_REQ_MULTI); // sctp_new_association_req = &message->ittiMsg.sctp_new_association_req_multi; // sctp_new_association_req->port = mme_port_for_M3C; // sctp_new_association_req->ppid = M3AP_SCTP_PPID; @@ -394,7 +394,7 @@ void m3ap_MME_handle_sctp_init_msg_multi_cnf( /* Trying to connect to the provided list of MME ip address */ for (index = 0; index < instance->nb_m3; index++) { - M3AP_INFO("MME[%d] MME id %u acting as an initiator (client)\n", + M3AP_INFO("MME[%ld] MME id %u acting as an initiator (client)\n", instance_id, instance->MME_id); m3ap_MME_register_MME(instance, &instance->target_mme_m3_ip_address[index], @@ -506,7 +506,7 @@ void MME_task_send_sctp_init_req(instance_t enb_id, m3ap_mme_sctp_req_t * m3ap_m MessageDef *message_p = NULL; - message_p = itti_alloc_new_message (TASK_M3AP_MME, SCTP_INIT_MSG); + message_p = itti_alloc_new_message (TASK_M3AP_MME, 0, SCTP_INIT_MSG); if(m3ap_mme_sctp_req==NULL) { LOG_I(M3AP, "M3AP_SCTP_REQ(create socket)\n"); message_p->ittiMsg.sctp_init.port = M3AP_PORT_NUMBER; @@ -555,7 +555,7 @@ void *m3ap_MME_task(void *arg) { switch (ITTI_MSG_ID(received_msg)) { case MESSAGE_TEST: LOG_W(M3AP,"MME Received MESSAGE_TEST Message\n"); - //MessageDef * message_p = itti_alloc_new_message(TASK_M3AP_MME, MESSAGE_TEST); + //MessageDef * message_p = itti_alloc_new_message(TASK_M3AP_MME, 0, MESSAGE_TEST); //itti_send_msg_to_task(TASK_M3AP, 1/*ctxt_pP->module_id*/, message_p); break; case TERMINATE_MESSAGE: @@ -564,31 +564,31 @@ void *m3ap_MME_task(void *arg) { break; // case M3AP_SUBFRAME_PROCESS: -// m3ap_check_timers(ITTI_MESSAGE_GET_INSTANCE(received_msg)); +// m3ap_check_timers(ITTI_MSG_DESTINATION_INSTANCE(received_msg)); // break; // // case M3AP_REGISTER_MME_REQ: // LOG_W(M3AP,"MME Received M3AP_REGISTER_MME_REQ Message\n"); -// m3ap_MME_handle_register_MME(ITTI_MESSAGE_GET_INSTANCE(received_msg), +// m3ap_MME_handle_register_MME(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M3AP_REGISTER_MME_REQ(received_msg)); // break; // case M3AP_MME_SCTP_REQ: - MME_task_send_sctp_init_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + MME_task_send_sctp_init_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M3AP_MME_SCTP_REQ(received_msg)); break; case M3AP_SETUP_RESP: LOG_I(M3AP,"MME Received M3AP_SETUP_RESP Message\n"); - MME_send_M3_SETUP_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), + MME_send_M3_SETUP_RESPONSE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M3AP_SETUP_RESP(received_msg)); break; // break; // // case M3AP_SETUP_FAILURE: // LOG_W(M3AP,"MME Received M3AP_SETUP_FAILURE Message\n"); -// MME_send_M2_SETUP_FAILURE(ITTI_MESSAGE_GET_INSTANCE(received_msg), +// MME_send_M2_SETUP_FAILURE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M3AP_SETUP_FAILURE(received_msg)); // break; // @@ -599,83 +599,83 @@ void *m3ap_MME_task(void *arg) { // case M3AP_MBMS_SESSION_START_REQ: LOG_I(M3AP,"MME Received M3AP_MBMS_SESSION_START_REQ Message\n"); - MME_send_MBMS_SESSION_START_REQUEST(ITTI_MESSAGE_GET_INSTANCE(received_msg), + MME_send_MBMS_SESSION_START_REQUEST(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M3AP_MBMS_SESSION_START_REQ(received_msg)); break; // case M3AP_MBMS_SESSION_STOP_REQ: LOG_I(M3AP,"MME Received M3AP_MBMS_SESSION_STOP_REQ Message\n"); - MME_send_MBMS_SESSION_STOP_REQUEST(ITTI_MESSAGE_GET_INSTANCE(received_msg), + MME_send_MBMS_SESSION_STOP_REQUEST(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &M3AP_MBMS_SESSION_STOP_REQ(received_msg)); break; // case M3AP_MBMS_SESSION_UPDATE_REQ: LOG_I(M3AP,"MME Received M3AP_MBMS_SESSION_UPDATE_REQ Message\n"); - // MME_send_MBMS_SESSION_UPDATE_REQUEST(ITTI_MESSAGE_GET_INSTANCE(received_msg), + // MME_send_MBMS_SESSION_UPDATE_REQUEST(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M3AP_MBMS_SESSION_UPDATE_REQ(received_msg)); break; // // case M3AP_RESET: // LOG_W(M3AP,"MME Received M3AP_RESET Message\n"); -// MME_send_RESET(ITTI_MESSAGE_GET_INSTANCE(received_msg), +// MME_send_RESET(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M3AP_RESET(received_msg)); // break; // // case M3AP_ENB_CONFIGURATION_UPDATE_ACK: // LOG_W(M3AP,"MME Received M3AP_ENB_CONFIGURATION_UPDATE_ACK Message\n"); -// MME_send_ENB_CONFIGURATION_UPDATE_ACKNOWLEDGE(ITTI_MESSAGE_GET_INSTANCE(received_msg), +// MME_send_ENB_CONFIGURATION_UPDATE_ACKNOWLEDGE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M3AP_ENB_CONFIGURATION_UPDATE_ACK(received_msg)); // break; // // case M3AP_ENB_CONFIGURATION_UPDATE_FAILURE: // LOG_W(M3AP,"MME Received M3AP_ENB_CONFIGURATION_UPDATE_FAILURE Message\n"); -// MME_send_ENB_CONFIGURATION_UPDATE_FAILURE(ITTI_MESSAGE_GET_INSTANCE(received_msg), +// MME_send_ENB_CONFIGURATION_UPDATE_FAILURE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M3AP_ENB_CONFIGURATION_UPDATE_FAILURE(received_msg))// break; // // // case M3AP_MME_CONFIGURATION_UPDATE: // LOG_W(M3AP,"MME Received M3AP_MME_CONFIGURATION_UPDATE Message\n"); -// MME_send_MME_CONFIGURATION_UPDATE(ITTI_MESSAGE_GET_INSTANCE(received_msg), +// MME_send_MME_CONFIGURATION_UPDATE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M3AP_MME_CONFIGURATION_UPDATE(received_msg)); // break; // // case M3AP_HANDOVER_REQ: -// m3ap_MME_handle_handover_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), +// m3ap_MME_handle_handover_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M3AP_HANDOVER_REQ(received_msg)); // break; // // case M3AP_HANDOVER_REQ_ACK: -// m3ap_MME_handle_handover_req_ack(ITTI_MESSAGE_GET_INSTANCE(received_msg), +// m3ap_MME_handle_handover_req_ack(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M3AP_HANDOVER_REQ_ACK(received_msg)); // break; // // case M3AP_UE_CONTEXT_RELEASE: -// m3ap_MME_ue_context_release(ITTI_MESSAGE_GET_INSTANCE(received_msg), +// m3ap_MME_ue_context_release(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &M3AP_UE_CONTEXT_RELEASE(received_msg)); // break; // case SCTP_INIT_MSG_MULTI_CNF: LOG_E(M3AP,"MME Received SCTP_INIT_MSG_MULTI_CNF Message ... shoudn't be happening ... it doesn't at leaast with M2AP_MCEC\n"); - m3ap_MME_handle_sctp_init_msg_multi_cnf(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m3ap_MME_handle_sctp_init_msg_multi_cnf(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_init_msg_multi_cnf); break; case SCTP_NEW_ASSOCIATION_RESP: LOG_D(M3AP,"MME Received SCTP_NEW_ASSOCIATION_RESP Message\n"); - m3ap_MME_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m3ap_MME_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_NEW_ASSOCIATION_IND: LOG_D(M3AP,"MME Received SCTP_NEW_ASSOCIATION Message\n"); - m3ap_MME_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m3ap_MME_handle_sctp_association_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_ind); break; case SCTP_DATA_IND: LOG_D(M3AP,"MME Received SCTP_DATA_IND Message\n"); - m3ap_MME_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + m3ap_MME_handle_sctp_data_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_data_ind); break; diff --git a/openair3/M3AP/m3ap_MME_handler.c b/openair3/M3AP/m3ap_MME_handler.c index 9af8cbe14f..688e3937e1 100644 --- a/openair3/M3AP/m3ap_MME_handler.c +++ b/openair3/M3AP/m3ap_MME_handler.c @@ -108,7 +108,7 @@ int m3ap_MME_handle_message(instance_t instance, uint32_t assoc_id, int32_t stre } /* Calling the right handler */ - LOG_I(M3AP, "Calling handler with instance %d\n",instance); + LOG_I(M3AP, "Calling handler with instance %ld\n",instance); ret = (*m3ap_MME_messages_callback[pdu.choice.initiatingMessage.procedureCode][pdu.present - 1]) (instance, assoc_id, stream, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_M3AP_M3AP_PDU, &pdu); diff --git a/openair3/M3AP/m3ap_MME_interface_management.c b/openair3/M3AP/m3ap_MME_interface_management.c index e5cb03cf26..ccdfa4fc5e 100644 --- a/openair3/M3AP/m3ap_MME_interface_management.c +++ b/openair3/M3AP/m3ap_MME_interface_management.c @@ -265,7 +265,7 @@ int MME_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, int MCE_MBMS_M3AP_ID=-1; - MessageDef *msg_g = itti_alloc_new_message(TASK_M3AP_MME,M3AP_MBMS_SESSION_START_RESP); //TODO + MessageDef *msg_g = itti_alloc_new_message(TASK_M3AP_MME, 0,M3AP_MBMS_SESSION_START_RESP); //TODO LOG_D(M3AP, "M3AP: SessionStart-Resp: protocolIEs.list.count %d\n", in->protocolIEs.list.count); @@ -403,7 +403,7 @@ int MME_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, int MCE_MBMS_M3AP_ID=-1; - MessageDef *msg_g = itti_alloc_new_message(TASK_M3AP_MME,M3AP_MBMS_SESSION_STOP_RESP); //TODO + MessageDef *msg_g = itti_alloc_new_message(TASK_M3AP_MME, 0,M3AP_MBMS_SESSION_STOP_RESP); //TODO LOG_D(M3AP, "M3AP: MBMSSessionStop-Resp: protocolIEs.list.count %d\n", in->protocolIEs.list.count); @@ -522,7 +522,7 @@ int MME_handle_M3_SETUP_REQUEST(instance_t instance, // assoc_id, stream); // } // - message_p = itti_alloc_new_message(TASK_M3AP_MME, M3AP_SETUP_REQ); + message_p = itti_alloc_new_message(TASK_M3AP_MME, 0, M3AP_SETUP_REQ); //printf("M3AP_SETUP_REQ(message_p).assoc_id %d\n",M3AP_SETUP_REQ(message_p).assoc_id); // // /* assoc_id */ @@ -1055,7 +1055,7 @@ int MME_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, int MCE_MBMS_M3AP_ID=-1; - MessageDef *msg_g = itti_alloc_new_message(TASK_M3AP_MME,M3AP_MBMS_SESSION_UPDATE_RESP); //TODO + MessageDef *msg_g = itti_alloc_new_message(TASK_M3AP_MME, 0,M3AP_MBMS_SESSION_UPDATE_RESP); //TODO LOG_D(M3AP, "M3AP: SessionUpdate-Resp: protocolIEs.list.count %d\n", in->protocolIEs.list.count); diff --git a/openair3/M3AP/m3ap_MME_management_procedures.c b/openair3/M3AP/m3ap_MME_management_procedures.c index 11d2924249..151aba04e4 100644 --- a/openair3/M3AP/m3ap_MME_management_procedures.c +++ b/openair3/M3AP/m3ap_MME_management_procedures.c @@ -116,7 +116,7 @@ void dump_mme_trees_m2(void) m3ap_MME_instance_t *zz; STAILQ_FOREACH(zz, &m3ap_MME_internal_data.m3ap_MME_instances_head, m3ap_MME_entries) { -printf("here comes the tree (instance %d):\n---------------------------------------------\n", zz->instance); +printf("here comes the tree (instance %ld):\n---------------------------------------------\n", zz->instance); dump_mme_tree_m2(zz->m3ap_mme_head.rbh_root); printf("---------------------------------------------\n"); } diff --git a/openair3/M3AP/m3ap_itti_messaging.c b/openair3/M3AP/m3ap_itti_messaging.c index b906747640..42e689343f 100644 --- a/openair3/M3AP/m3ap_itti_messaging.c +++ b/openair3/M3AP/m3ap_itti_messaging.c @@ -36,7 +36,7 @@ void m3ap_MCE_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin MessageDef *message_p; sctp_data_req_t *sctp_data_req; - message_p = itti_alloc_new_message(TASK_M3AP_MCE, SCTP_DATA_REQ); + message_p = itti_alloc_new_message(TASK_M3AP_MCE, 0, SCTP_DATA_REQ); sctp_data_req = &message_p->ittiMsg.sctp_data_req; @@ -56,7 +56,7 @@ void m3ap_MCE_itti_send_sctp_close_association(instance_t instance, int32_t asso MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; - message_p = itti_alloc_new_message(TASK_M3AP_MCE, SCTP_CLOSE_ASSOCIATION); + message_p = itti_alloc_new_message(TASK_M3AP_MCE, 0, SCTP_CLOSE_ASSOCIATION); sctp_close_association_p = &message_p->ittiMsg.sctp_close_association; sctp_close_association_p->assoc_id = assoc_id; @@ -70,7 +70,7 @@ void m3ap_MME_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin MessageDef *message_p; sctp_data_req_t *sctp_data_req; - message_p = itti_alloc_new_message(TASK_M3AP_MME, SCTP_DATA_REQ); + message_p = itti_alloc_new_message(TASK_M3AP_MME, 0, SCTP_DATA_REQ); sctp_data_req = &message_p->ittiMsg.sctp_data_req; @@ -88,7 +88,7 @@ void m3ap_MME_itti_send_sctp_close_association(instance_t instance, int32_t asso MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; - message_p = itti_alloc_new_message(TASK_M3AP_MME, SCTP_CLOSE_ASSOCIATION); + message_p = itti_alloc_new_message(TASK_M3AP_MME, 0, SCTP_CLOSE_ASSOCIATION); sctp_close_association_p = &message_p->ittiMsg.sctp_close_association; sctp_close_association_p->assoc_id = assoc_id; diff --git a/openair3/MME_APP/mme_app.c b/openair3/MME_APP/mme_app.c index 534aec8b34..5a32ddc98c 100644 --- a/openair3/MME_APP/mme_app.c +++ b/openair3/MME_APP/mme_app.c @@ -76,7 +76,7 @@ extern RAN_CONTEXT_t RC; // { // // M3AP registration // /* note: there is an implicit relationship between the data structure and the message name */ -// msg_p = itti_alloc_new_message (TASK_MME_APP, M3AP_REGISTER_MCE_REQ); +// msg_p = itti_alloc_new_message (TASK_MME_APP, 0, M3AP_REGISTER_MCE_REQ); // //RCconfig_S1(msg_p, mce_id); // // //if (mce_id == 0) @@ -90,7 +90,7 @@ extern RAN_CONTEXT_t RC; // //if (NODE_IS_DU(node_type)) { // F1AP registration // // // configure F1AP here for F1C // // LOG_I(ENB_APP,"ngran_eNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n"); -// // msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SETUP_REQ); +// // msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, F1AP_SETUP_REQ); // // RCconfig_DU_F1(msg_p, enb_id); // // // LOG_I(ENB_APP,"[eNB %d] eNB_app_register via F1AP for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); @@ -99,7 +99,7 @@ extern RAN_CONTEXT_t RC; // //} // //else { // S1AP registration // // /* note: there is an implicit relationship between the data structure and the message name */ -// // msg_p = itti_alloc_new_message (TASK_ENB_APP, S1AP_REGISTER_ENB_REQ); +// // msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, S1AP_REGISTER_ENB_REQ); // // RCconfig_S1(msg_p, enb_id); // // // if (enb_id == 0) RCconfig_gtpu(); @@ -126,7 +126,7 @@ extern RAN_CONTEXT_t RC; // // for (mce_id = mce_id_start; (mce_id < mce_id_end) ; mce_id++) { // { -// msg_p = itti_alloc_new_message (TASK_ENB_APP, X2AP_REGISTER_ENB_REQ); +// msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, X2AP_REGISTER_ENB_REQ); // RCconfig_X2(msg_p, mce_id); // itti_send_msg_to_task (TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(mce_id), msg_p); // register_mce_x2_pending++; @@ -146,7 +146,7 @@ extern RAN_CONTEXT_t RC; // for (mce_id = mce_id_start; (mce_id < mce_id_end) ; mce_id++) { // { // // LOG_W(MME_APP,"Register commes inside ...\n"); -// msg_p = itti_alloc_new_message (TASK_MME_APP, M2AP_REGISTER_MCE_REQ); +// msg_p = itti_alloc_new_message (TASK_MME_APP, 0, M2AP_REGISTER_MCE_REQ); // //RCconfig_M2_MCE(msg_p, mce_id); // itti_send_msg_to_task (TASK_M2AP_MCE, ENB_MODULE_ID_TO_INSTANCE(mce_id), msg_p); // // LOG_W(MME_APP,"Register sent ...\n"); @@ -163,7 +163,7 @@ static uint32_t MME_app_handle_m3ap_setup_req(instance_t instance){ //uint32_t mce_id=0; MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_MME_APP, M3AP_SETUP_RESP); + msg_p = itti_alloc_new_message (TASK_MME_APP, 0, M3AP_SETUP_RESP); itti_send_msg_to_task (TASK_M3AP_MME, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); return 0; @@ -187,7 +187,7 @@ static uint32_t MME_app_handle_m3ap_session_start_resp(instance_t instance){ // // uint32_t mce_id=0; // MessageDef *msg_p; -// msg_p = itti_alloc_new_message (TASK_MME_APP, M2AP_MBMS_SCHEDULING_INFORMATION); +// msg_p = itti_alloc_new_message (TASK_MME_APP, 0, M2AP_MBMS_SCHEDULING_INFORMATION); // itti_send_msg_to_task (TASK_M2AP_MCE, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); // // return 0; @@ -197,7 +197,7 @@ static uint32_t MME_app_send_m3ap_session_start_req(instance_t instance){ //uint32_t mce_id=0; MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_MME_APP, M3AP_MBMS_SESSION_START_REQ); + msg_p = itti_alloc_new_message (TASK_MME_APP, 0, M3AP_MBMS_SESSION_START_REQ); itti_send_msg_to_task (TASK_M3AP_MME, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); return 0; @@ -206,7 +206,7 @@ static uint32_t MME_app_send_m3ap_session_start_req(instance_t instance){ // // //uint32_t mce_id=0; // MessageDef *msg_p; -// msg_p = itti_alloc_new_message (TASK_MME_APP, M3AP_MBMS_SESSION_STOP_REQ); +// msg_p = itti_alloc_new_message (TASK_MME_APP, 0, M3AP_MBMS_SESSION_STOP_REQ); // itti_send_msg_to_task (TASK_M3AP_MME, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); // // return 0; @@ -215,7 +215,7 @@ static uint32_t MME_app_send_m3ap_session_update_req(instance_t instance){ //uint32_t mce_id=0; MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_MME_APP, M3AP_MBMS_SESSION_UPDATE_REQ); + msg_p = itti_alloc_new_message (TASK_MME_APP, 0, M3AP_MBMS_SESSION_UPDATE_REQ); itti_send_msg_to_task (TASK_M3AP_MME, ENB_MODULE_ID_TO_INSTANCE(instance), msg_p); return 0; @@ -263,7 +263,7 @@ void *MME_app_task(void *args_p) { do { // Wait for a message itti_receive_msg (TASK_MME_APP, &msg_p); - instance = ITTI_MSG_INSTANCE (msg_p); + instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); switch (ITTI_MSG_ID(msg_p)) { case TERMINATE_MESSAGE: @@ -297,7 +297,7 @@ void *MME_app_task(void *args_p) { // if (registered_mce == mce_nb) { // /* If all MCE are registered, start L2L1 task */ // // MessageDef *msg_init_p; - // // msg_init_p = itti_alloc_new_message (TASK_ENB_APP, INITIALIZE_MESSAGE); + // // msg_init_p = itti_alloc_new_message (TASK_ENB_APP, 0, INITIALIZE_MESSAGE); // // itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p); // } else { // LOG_W(MME_APP, " %d MCE not associated with a MME, retrying registration in %d seconds ...\n", @@ -341,7 +341,7 @@ void *MME_app_task(void *args_p) { // /* If all MCE cells are registered, start L2L1 task */ // MessageDef *msg_init_p; - // //msg_init_p = itti_alloc_new_message (TASK_MME_APP, INITIALIZE_MESSAGE); + // //msg_init_p = itti_alloc_new_message (TASK_MME_APP, 0, INITIALIZE_MESSAGE); // //itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p); // } else { @@ -365,7 +365,7 @@ void *MME_app_task(void *args_p) { case M3AP_DEREGISTERED_MCE_IND: //M3AP_DEREGISTERED_MCE_IND debería if (EPC_MODE_ENABLED) { - LOG_W(MME_APP, "[MCE %d] Received %s: associated MME %d\n", instance, ITTI_MSG_NAME (msg_p), + LOG_W(MME_APP, "[MCE %ld] Received %s: associated MME %d\n", instance, ITTI_MSG_NAME (msg_p), M3AP_DEREGISTERED_MCE_IND(msg_p).nb_mme); /* TODO handle recovering of registration */ } diff --git a/openair3/MME_APP/mme_config.c b/openair3/MME_APP/mme_config.c index 04dba67567..3b4074f553 100644 --- a/openair3/MME_APP/mme_config.c +++ b/openair3/MME_APP/mme_config.c @@ -94,7 +94,7 @@ int RCconfig_MME(void ) { if (address) { MessageDef *message; - AssertFatal((message = itti_alloc_new_message(TASK_MME_APP, M3AP_MME_SCTP_REQ))!=NULL,""); + AssertFatal((message = itti_alloc_new_message(TASK_MME_APP, 0, M3AP_MME_SCTP_REQ))!=NULL,""); M3AP_MME_SCTP_REQ (message).mme_m3_ip_address.ipv6 = 0; M3AP_MME_SCTP_REQ (message).mme_m3_ip_address.ipv4 = 1; strcpy( M3AP_MME_SCTP_REQ (message).mme_m3_ip_address.ipv4_address, address); diff --git a/openair3/NAS/UE/nas_itti_messaging.c b/openair3/NAS/UE/nas_itti_messaging.c index 885ebbdd81..8016e0d791 100644 --- a/openair3/NAS/UE/nas_itti_messaging.c +++ b/openair3/NAS/UE/nas_itti_messaging.c @@ -102,7 +102,7 @@ extern unsigned char NB_eNB_INST; int nas_itti_kenb_refresh_req(const Byte_t kenb[32], int user_id) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_NAS_UE, NAS_KENB_REFRESH_REQ); + message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_KENB_REFRESH_REQ); memcpy(NAS_KENB_REFRESH_REQ(message_p).kenb, kenb, sizeof(NAS_KENB_REFRESH_REQ(message_p).kenb)); MSC_LOG_TX_MESSAGE( MSC_NAS_UE, @@ -130,7 +130,7 @@ int nas_itti_kenb_refresh_req(const Byte_t kenb[32], int user_id) { int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat, int user_id) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_NAS_UE, NAS_CELL_SELECTION_REQ); + message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_CELL_SELECTION_REQ); NAS_CELL_SELECTION_REQ(message_p).plmnID = plmnID; NAS_CELL_SELECTION_REQ(message_p).rat = rat; MSC_LOG_TX_MESSAGE( @@ -145,7 +145,7 @@ int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat, int user_id) { int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t s_tmsi, plmn_t plmnID, Byte_t *data, uint32_t length, int user_id) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_NAS_UE, NAS_CONN_ESTABLI_REQ); + message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_CONN_ESTABLI_REQ); NAS_CONN_ESTABLI_REQ(message_p).cause = cause; NAS_CONN_ESTABLI_REQ(message_p).type = type; NAS_CONN_ESTABLI_REQ(message_p).s_tmsi = s_tmsi; @@ -165,7 +165,7 @@ int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t int nas_itti_ul_data_req(const uint32_t ue_id, void *const data, const uint32_t length, int user_id) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_NAS_UE, NAS_UPLINK_DATA_REQ); + message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_UPLINK_DATA_REQ); NAS_UPLINK_DATA_REQ(message_p).UEid = ue_id; NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = data; NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = length; @@ -174,7 +174,7 @@ int nas_itti_ul_data_req(const uint32_t ue_id, void *const data, const uint32_t int nas_itti_rab_establish_rsp(const as_stmsi_t s_tmsi, const as_rab_id_t rabID, const nas_error_code_t errCode, int user_id) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_NAS_UE, NAS_RAB_ESTABLI_RSP); + message_p = itti_alloc_new_message(TASK_NAS_UE, 0, NAS_RAB_ESTABLI_RSP); NAS_RAB_ESTABLI_RSP(message_p).s_tmsi = s_tmsi; NAS_RAB_ESTABLI_RSP(message_p).rabID = rabID; NAS_RAB_ESTABLI_RSP(message_p).errCode = errCode; diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c index d712a7b7f0..178f21a44a 100644 --- a/openair3/NAS/UE/nas_ue_task.c +++ b/openair3/NAS/UE/nas_ue_task.c @@ -136,7 +136,7 @@ void *nas_ue_task(void *args_p) for (instance = NB_eNB_INST; instance < (NB_eNB_INST + NB_UE_INST); instance++) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_NAS_UE, DEACTIVATE_MESSAGE); + message_p = itti_alloc_new_message(TASK_NAS_UE, 0, DEACTIVATE_MESSAGE); itti_send_msg_to_task(TASK_L2L1, instance, message_p); } @@ -145,7 +145,7 @@ void *nas_ue_task(void *args_p) itti_receive_msg (TASK_NAS_UE, &msg_p); if (msg_p != NULL) { - instance = ITTI_MSG_INSTANCE (msg_p); + instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); Mod_id = instance - NB_eNB_INST; if (instance == INSTANCE_DEFAULT) { printf("%s:%d: FATAL: instance is INSTANCE_DEFAULT, should not happen.\n", diff --git a/openair3/NGAP/ngap_gNB.c b/openair3/NGAP/ngap_gNB.c index 924f28c87f..2cf867d4d9 100644 --- a/openair3/NGAP/ngap_gNB.c +++ b/openair3/NGAP/ngap_gNB.c @@ -97,7 +97,7 @@ static void ngap_gNB_register_amf(ngap_gNB_instance_t *instance_p, ngap_gNB_amf_data_t *ngap_amf_data_p = NULL; DevAssert(instance_p != NULL); DevAssert(amf_ip_address != NULL); - message_p = itti_alloc_new_message(TASK_NGAP, SCTP_NEW_ASSOCIATION_REQ); + message_p = itti_alloc_new_message(TASK_NGAP, 0, SCTP_NEW_ASSOCIATION_REQ); sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; sctp_new_association_req_p->port = NGAP_PORT_NUMBER; sctp_new_association_req_p->ppid = NGAP_SCTP_PPID; @@ -109,7 +109,7 @@ static void ngap_gNB_register_amf(ngap_gNB_instance_t *instance_p, memcpy(&sctp_new_association_req_p->local_address, local_ip_addr, sizeof(*local_ip_addr)); - NGAP_INFO("[gNB %d] check the amf registration state\n",instance_p->instance); + NGAP_INFO("[gNB %ld] check the amf registration state\n",instance_p->instance); /* Create new AMF descriptor */ ngap_amf_data_p = calloc(1, sizeof(*ngap_amf_data_p)); @@ -190,7 +190,7 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_gnb_req_t * /* Add the new instance to the list of gNB (meaningfull in virtual mode) */ ngap_gNB_insert_new_instance(new_instance); - NGAP_INFO("Registered new gNB[%d] and %s gNB id %u\n", + NGAP_INFO("Registered new gNB[%ld] and %s gNB id %u\n", instance, ngap_register_gNB->cell_type == CELL_MACRO_GNB ? "macro" : "home", ngap_register_gNB->gNB_id); @@ -235,7 +235,7 @@ void ngap_gNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa DevAssert(ngap_amf_data_p != NULL); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - NGAP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", + NGAP_WARN("Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", sctp_new_association_resp->sctp_state, instance, sctp_new_association_resp->ulp_cnx_id); @@ -287,13 +287,13 @@ void *ngap_gNB_process_itti_msg(void *notUsed) { * Each gNB has to send an NGAP_REGISTER_GNB message with its * own parameters. */ - ngap_gNB_handle_register_gNB(ITTI_MESSAGE_GET_INSTANCE(received_msg), + ngap_gNB_handle_register_gNB(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &NGAP_REGISTER_GNB_REQ(received_msg)); } break; case SCTP_NEW_ASSOCIATION_RESP: { - ngap_gNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + ngap_gNB_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); } break; @@ -304,61 +304,61 @@ void *ngap_gNB_process_itti_msg(void *notUsed) { break; case NGAP_NAS_FIRST_REQ: { - ngap_gNB_handle_nas_first_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + ngap_gNB_handle_nas_first_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &NGAP_NAS_FIRST_REQ(received_msg)); } break; case NGAP_UPLINK_NAS: { - ngap_gNB_nas_uplink(ITTI_MESSAGE_GET_INSTANCE(received_msg), + ngap_gNB_nas_uplink(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &NGAP_UPLINK_NAS(received_msg)); } break; case NGAP_UE_CAPABILITIES_IND: { - ngap_gNB_ue_capabilities(ITTI_MESSAGE_GET_INSTANCE(received_msg), + ngap_gNB_ue_capabilities(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &NGAP_UE_CAPABILITIES_IND(received_msg)); } break; case NGAP_INITIAL_CONTEXT_SETUP_RESP: { - ngap_gNB_initial_ctxt_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + ngap_gNB_initial_ctxt_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &NGAP_INITIAL_CONTEXT_SETUP_RESP(received_msg)); } break; case NGAP_PDUSESSION_SETUP_RESP: { - ngap_gNB_pdusession_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + ngap_gNB_pdusession_setup_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &NGAP_PDUSESSION_SETUP_RESP(received_msg)); } break; case NGAP_PDUSESSION_MODIFY_RESP: { - ngap_gNB_pdusession_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + ngap_gNB_pdusession_modify_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &NGAP_PDUSESSION_MODIFY_RESP(received_msg)); } break; case NGAP_NAS_NON_DELIVERY_IND: { - ngap_gNB_nas_non_delivery_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + ngap_gNB_nas_non_delivery_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &NGAP_NAS_NON_DELIVERY_IND(received_msg)); } break; case NGAP_PATH_SWITCH_REQ: { - ngap_gNB_path_switch_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + ngap_gNB_path_switch_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &NGAP_PATH_SWITCH_REQ(received_msg)); } break; case NGAP_PDUSESSION_MODIFICATION_IND: { - ngap_gNB_generate_PDUSESSION_Modification_Indication(ITTI_MESSAGE_GET_INSTANCE(received_msg), + ngap_gNB_generate_PDUSESSION_Modification_Indication(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &NGAP_PDUSESSION_MODIFICATION_IND(received_msg)); } break; case NGAP_UE_CONTEXT_RELEASE_COMPLETE: { - ngap_ue_context_release_complete(ITTI_MESSAGE_GET_INSTANCE(received_msg), + ngap_ue_context_release_complete(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &NGAP_UE_CONTEXT_RELEASE_COMPLETE(received_msg)); } break; @@ -366,9 +366,9 @@ void *ngap_gNB_process_itti_msg(void *notUsed) { case NGAP_UE_CONTEXT_RELEASE_REQ: { ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; // test struct ngap_gNB_ue_context_s *ue_context_p = NULL; // test - ngap_ue_context_release_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + ngap_ue_context_release_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &NGAP_UE_CONTEXT_RELEASE_REQ(received_msg)); - ngap_gNB_instance_p = ngap_gNB_get_instance(ITTI_MESSAGE_GET_INSTANCE(received_msg)); // test + ngap_gNB_instance_p = ngap_gNB_get_instance(ITTI_MSG_DESTINATION_INSTANCE(received_msg)); // test DevAssert(ngap_gNB_instance_p != NULL); // test if ((ue_context_p = ngap_gNB_get_ue_context(ngap_gNB_instance_p, @@ -381,7 +381,7 @@ void *ngap_gNB_process_itti_msg(void *notUsed) { break; case NGAP_PDUSESSION_RELEASE_RESPONSE: { - ngap_gNB_pdusession_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + ngap_gNB_pdusession_release_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &NGAP_PDUSESSION_RELEASE_RESPONSE(received_msg)); } break; diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index b35741151f..eb87bce11a 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -191,7 +191,7 @@ void ngap_handle_ng_setup_message(ngap_gNB_amf_data_t *amf_desc_p, int sctp_shut /* If there are no more associated AMF, inform gNB app */ if (amf_desc_p->ngap_gNB_instance->ngap_amf_associated_nb == 0) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_NGAP, NGAP_DEREGISTERED_GNB_IND); + message_p = itti_alloc_new_message(TASK_NGAP, 0, NGAP_DEREGISTERED_GNB_IND); NGAP_DEREGISTERED_GNB_IND(message_p).nb_amf = 0; itti_send_msg_to_task(TASK_GNB_APP, amf_desc_p->ngap_gNB_instance->instance, message_p); } @@ -209,7 +209,7 @@ void ngap_handle_ng_setup_message(ngap_gNB_amf_data_t *amf_desc_p, int sctp_shut /* If there are no more pending messages, inform gNB app */ if (amf_desc_p->ngap_gNB_instance->ngap_amf_pending_nb == 0) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_NGAP, NGAP_REGISTER_GNB_CNF); + message_p = itti_alloc_new_message(TASK_NGAP, 0, NGAP_REGISTER_GNB_CNF); NGAP_REGISTER_GNB_CNF(message_p).nb_amf = amf_desc_p->ngap_gNB_instance->ngap_amf_associated_nb; itti_send_msg_to_task(TASK_GNB_APP, amf_desc_p->ngap_gNB_instance->instance, message_p); } @@ -891,7 +891,7 @@ int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, ue_desc_p->rx_stream = stream; ue_desc_p->amf_ue_ngap_id = amf_ue_ngap_id; - message_p = itti_alloc_new_message(TASK_NGAP, NGAP_INITIAL_CONTEXT_SETUP_REQ); + message_p = itti_alloc_new_message(TASK_NGAP, 0, NGAP_INITIAL_CONTEXT_SETUP_REQ); NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; ue_desc_p->ue_initial_id = 0; NGAP_INITIAL_CONTEXT_SETUP_REQ(message_p).gNB_ue_ngap_id = ue_desc_p->gNB_ue_ngap_id; @@ -1203,7 +1203,7 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, NULL,0, "0 NGAP_UE_CONTEXT_RELEASE_COMMAND/%d gNB_ue_ngap_id "NGAP_UE_ID_FMT" ", gnb_ue_ngap_id); - message_p = itti_alloc_new_message(TASK_NGAP, NGAP_UE_CONTEXT_RELEASE_COMMAND); + message_p = itti_alloc_new_message(TASK_NGAP, 0, NGAP_UE_CONTEXT_RELEASE_COMMAND); if (ue_desc_p->amf_ue_ngap_id == 0) { // case of Detach Request and switch off from RRC_IDLE mode ue_desc_p->amf_ue_ngap_id = amf_ue_ngap_id; @@ -1302,7 +1302,7 @@ int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id, (uint64_t)ue_desc_p->amf_ue_ngap_id, amf_ue_ngap_id); } - message_p = itti_alloc_new_message(TASK_NGAP, NGAP_PDUSESSION_SETUP_REQ); + message_p = itti_alloc_new_message(TASK_NGAP, 0, NGAP_PDUSESSION_SETUP_REQ); NGAP_PDUSESSION_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; ue_desc_p->ue_initial_id = 0; NGAP_PDUSESSION_SETUP_REQ(message_p).gNB_ue_ngap_id = ue_desc_p->gNB_ue_ngap_id; @@ -1474,7 +1474,7 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, return -1; } - message_p = itti_alloc_new_message(TASK_NGAP, NGAP_PAGING_IND); + message_p = itti_alloc_new_message(TASK_NGAP, 0, NGAP_PAGING_IND); /* convert NGAP_PagingIEs_t to ngap_paging_ind_t */ /* id-UEIdentityIndexValue : convert UE Identity Index value */ NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PagingIEs_t, ie, container, @@ -1608,7 +1608,7 @@ int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id, if (ue_desc_p->amf_ue_ngap_id != amf_ue_ngap_id) { NGAP_WARN("UE context amf_ue_ngap_id is different form that of the message (%ld != %ld)", (uint64_t)ue_desc_p->amf_ue_ngap_id, amf_ue_ngap_id); - message_p = itti_alloc_new_message (TASK_RRC_GNB, NGAP_PDUSESSION_MODIFY_RESP); + message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, NGAP_PDUSESSION_MODIFY_RESP); NGAP_PDUSESSION_MODIFY_RESP (message_p).gNB_ue_ngap_id = gnb_ue_ngap_id; NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PDUSessionResourceModifyRequestIEs_t, ie, container, NGAP_ProtocolIE_ID_id_PDUSessionResourceModifyListModReq, true); @@ -1634,7 +1634,7 @@ int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id, return -1; } - message_p = itti_alloc_new_message(TASK_NGAP, NGAP_PDUSESSION_MODIFY_REQ); + message_p = itti_alloc_new_message(TASK_NGAP, 0, NGAP_PDUSESSION_MODIFY_REQ); NGAP_PDUSESSION_MODIFY_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; NGAP_PDUSESSION_MODIFY_REQ(message_p).amf_ue_ngap_id = amf_ue_ngap_id; NGAP_PDUSESSION_MODIFY_REQ(message_p).gNB_ue_ngap_id = gnb_ue_ngap_id; @@ -1814,7 +1814,7 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id, NGAP_DEBUG("[SCTP %d] Received E-RAB release command for gNB_UE_NGAP_ID %lu amf_ue_ngap_id %lu\n", assoc_id, gnb_ue_ngap_id, amf_ue_ngap_id); - message_p = itti_alloc_new_message(TASK_NGAP, NGAP_PDUSESSION_RELEASE_COMMAND); + message_p = itti_alloc_new_message(TASK_NGAP, 0, NGAP_PDUSESSION_RELEASE_COMMAND); NGAP_PDUSESSION_RELEASE_COMMAND(message_p).gNB_ue_ngap_id = gnb_ue_ngap_id; NGAP_PDUSESSION_RELEASE_COMMAND(message_p).amf_ue_ngap_id = amf_ue_ngap_id; /* id-NAS-PDU */ diff --git a/openair3/NGAP/ngap_gNB_itti_messaging.c b/openair3/NGAP/ngap_gNB_itti_messaging.c index e423d7254d..ab10fa46e2 100644 --- a/openair3/NGAP/ngap_gNB_itti_messaging.c +++ b/openair3/NGAP/ngap_gNB_itti_messaging.c @@ -37,7 +37,7 @@ void ngap_gNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin MessageDef *message_p; sctp_data_req_t *sctp_data_req; - message_p = itti_alloc_new_message(TASK_NGAP, SCTP_DATA_REQ); + message_p = itti_alloc_new_message(TASK_NGAP, 0, SCTP_DATA_REQ); sctp_data_req = &message_p->ittiMsg.sctp_data_req; @@ -58,7 +58,7 @@ void ngap_gNB_itti_send_nas_downlink_ind(instance_t instance, MessageDef *message_p; ngap_downlink_nas_t *ngap_downlink_nas; - message_p = itti_alloc_new_message(TASK_NGAP, NGAP_DOWNLINK_NAS); + message_p = itti_alloc_new_message(TASK_NGAP, 0, NGAP_DOWNLINK_NAS); ngap_downlink_nas = &message_p->ittiMsg.ngap_downlink_nas; @@ -76,7 +76,7 @@ void ngap_gNB_itti_send_sctp_close_association(instance_t instance, int32_t asso MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; - message_p = itti_alloc_new_message(TASK_NGAP, SCTP_CLOSE_ASSOCIATION); + message_p = itti_alloc_new_message(TASK_NGAP, 0, SCTP_CLOSE_ASSOCIATION); sctp_close_association_p = &message_p->ittiMsg.sctp_close_association; sctp_close_association_p->assoc_id = assoc_id; diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.c b/openair3/NGAP/ngap_gNB_nas_procedures.c index 197cf88a52..96e5074ae9 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.c +++ b/openair3/NGAP/ngap_gNB_nas_procedures.c @@ -85,7 +85,7 @@ int ngap_gNB_handle_nas_first_req( ngap_nas_first_req_p->ue_identity.guami); if (amf_desc_p) { - NGAP_INFO("[gNB %d] Chose AMF '%s' (assoc_id %d) through GUAMI MCC %d MNC %d AMFRI %d AMFSI %d AMFPT %d\n", + NGAP_INFO("[gNB %ld] Chose AMF '%s' (assoc_id %d) through GUAMI MCC %d MNC %d AMFRI %d AMFSI %d AMFPT %d\n", instance, amf_desc_p->amf_name, amf_desc_p->assoc_id, @@ -108,7 +108,7 @@ int ngap_gNB_handle_nas_first_req( ngap_nas_first_req_p->ue_identity.s_tmsi.amf_set_id); if (amf_desc_p) { - NGAP_INFO("[gNB %d] Chose AMF '%s' (assoc_id %d) through S-TMSI AMFSI %d and selected PLMN Identity index %d MCC %d MNC %d\n", + NGAP_INFO("[gNB %ld] Chose AMF '%s' (assoc_id %d) through S-TMSI AMFSI %d and selected PLMN Identity index %d MCC %d MNC %d\n", instance, amf_desc_p->amf_name, amf_desc_p->assoc_id, @@ -130,7 +130,7 @@ int ngap_gNB_handle_nas_first_req( ngap_nas_first_req_p->selected_plmn_identity); if (amf_desc_p) { - NGAP_INFO("[gNB %d] Chose AMF '%s' (assoc_id %d) through selected PLMN Identity index %d MCC %d MNC %d\n", + NGAP_INFO("[gNB %ld] Chose AMF '%s' (assoc_id %d) through selected PLMN Identity index %d MCC %d MNC %d\n", instance, amf_desc_p->amf_name, amf_desc_p->assoc_id, @@ -151,7 +151,7 @@ int ngap_gNB_handle_nas_first_req( ngap_nas_first_req_p->establishment_cause); if (amf_desc_p) { - NGAP_INFO("[gNB %d] Chose AMF '%s' (assoc_id %d) through highest relative capacity\n", + NGAP_INFO("[gNB %ld] Chose AMF '%s' (assoc_id %d) through highest relative capacity\n", instance, amf_desc_p->amf_name, amf_desc_p->assoc_id); diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index 2a153acaa2..5bdb140ff5 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -101,7 +101,7 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, struct s1ap_eNB_mme_data_s *mme = NULL; DevAssert(instance_p != NULL); DevAssert(mme_ip_address != NULL); - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ); + message_p = itti_alloc_new_message(TASK_S1AP, 0, SCTP_NEW_ASSOCIATION_REQ); sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; sctp_new_association_req_p->port = mme_port; sctp_new_association_req_p->ppid = S1AP_SCTP_PPID; @@ -113,7 +113,7 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, memcpy(&sctp_new_association_req_p->local_address, local_ip_addr, sizeof(*local_ip_addr)); - S1AP_INFO("[eNB %d] check the mme registration state\n",instance_p->instance); + S1AP_INFO("[eNB %ld] check the mme registration state\n",instance_p->instance); mme = NULL; if ( mme == NULL ) { @@ -142,7 +142,7 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, } else if (mme->state == S1AP_ENB_STATE_WAITING) { instance_p->s1ap_mme_pending_nb ++; sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id; - S1AP_INFO("[eNB %d] MME already registered, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", + S1AP_INFO("[eNB %ld] MME already registered, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", instance_p->instance, mme->state, mme->cnx_id, instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb); @@ -153,7 +153,7 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, s1ap_mme_data_p->s1ap_eNB_instance = instance_p; */ } else { - S1AP_WARN("[eNB %d] MME already registered but not in the waiting state, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", + S1AP_WARN("[eNB %ld] MME already registered but not in the waiting state, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", instance_p->instance, mme->state, mme->cnx_id, instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb); @@ -210,7 +210,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * new_instance->default_drx = s1ap_register_eNB->default_drx; /* Add the new instance to the list of eNB (meaningfull in virtual mode) */ s1ap_eNB_insert_new_instance(new_instance); - S1AP_INFO("Registered new eNB[%d] and %s eNB id %u\n", + S1AP_INFO("Registered new eNB[%ld] and %s eNB id %u\n", instance, s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home", s1ap_register_eNB->eNB_id); @@ -257,7 +257,7 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa DevAssert(s1ap_mme_data_p != NULL); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - S1AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", + S1AP_WARN("Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", sctp_new_association_resp->sctp_state, instance, sctp_new_association_resp->ulp_cnx_id); @@ -312,13 +312,13 @@ void *s1ap_eNB_process_itti_msg(void *notUsed) { * Each eNB has to send an S1AP_REGISTER_ENB message with its * own parameters. */ - s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_eNB_handle_register_eNB(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &S1AP_REGISTER_ENB_REQ(received_msg)); } break; case SCTP_NEW_ASSOCIATION_RESP: { - s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_eNB_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); } break; @@ -329,61 +329,61 @@ void *s1ap_eNB_process_itti_msg(void *notUsed) { break; case S1AP_NAS_FIRST_REQ: { - s1ap_eNB_handle_nas_first_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_eNB_handle_nas_first_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &S1AP_NAS_FIRST_REQ(received_msg)); } break; case S1AP_UPLINK_NAS: { - s1ap_eNB_nas_uplink(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_eNB_nas_uplink(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &S1AP_UPLINK_NAS(received_msg)); } break; case S1AP_UE_CAPABILITIES_IND: { - s1ap_eNB_ue_capabilities(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_eNB_ue_capabilities(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &S1AP_UE_CAPABILITIES_IND(received_msg)); } break; case S1AP_INITIAL_CONTEXT_SETUP_RESP: { - s1ap_eNB_initial_ctxt_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_eNB_initial_ctxt_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &S1AP_INITIAL_CONTEXT_SETUP_RESP(received_msg)); } break; case S1AP_E_RAB_SETUP_RESP: { - s1ap_eNB_e_rab_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_eNB_e_rab_setup_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &S1AP_E_RAB_SETUP_RESP(received_msg)); } break; case S1AP_E_RAB_MODIFY_RESP: { - s1ap_eNB_e_rab_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_eNB_e_rab_modify_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &S1AP_E_RAB_MODIFY_RESP(received_msg)); } break; case S1AP_NAS_NON_DELIVERY_IND: { - s1ap_eNB_nas_non_delivery_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_eNB_nas_non_delivery_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &S1AP_NAS_NON_DELIVERY_IND(received_msg)); } break; case S1AP_PATH_SWITCH_REQ: { - s1ap_eNB_path_switch_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_eNB_path_switch_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &S1AP_PATH_SWITCH_REQ(received_msg)); } break; case S1AP_E_RAB_MODIFICATION_IND: { - s1ap_eNB_generate_E_RAB_Modification_Indication(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_eNB_generate_E_RAB_Modification_Indication(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &S1AP_E_RAB_MODIFICATION_IND(received_msg)); } break; case S1AP_UE_CONTEXT_RELEASE_COMPLETE: { - s1ap_ue_context_release_complete(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_ue_context_release_complete(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &S1AP_UE_CONTEXT_RELEASE_COMPLETE(received_msg)); } break; @@ -391,9 +391,9 @@ void *s1ap_eNB_process_itti_msg(void *notUsed) { case S1AP_UE_CONTEXT_RELEASE_REQ: { s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; // test struct s1ap_eNB_ue_context_s *ue_context_p = NULL; // test - s1ap_ue_context_release_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_ue_context_release_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &S1AP_UE_CONTEXT_RELEASE_REQ(received_msg)); - s1ap_eNB_instance_p = s1ap_eNB_get_instance(ITTI_MESSAGE_GET_INSTANCE(received_msg)); // test + s1ap_eNB_instance_p = s1ap_eNB_get_instance(ITTI_MSG_DESTINATION_INSTANCE(received_msg)); // test DevAssert(s1ap_eNB_instance_p != NULL); // test if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, @@ -406,7 +406,7 @@ void *s1ap_eNB_process_itti_msg(void *notUsed) { break; case S1AP_E_RAB_RELEASE_RESPONSE: { - s1ap_eNB_e_rab_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_eNB_e_rab_release_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &S1AP_E_RAB_RELEASE_RESPONSE(received_msg)); } break; diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c index 79501a1a09..7c233d9e14 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.c +++ b/openair3/S1AP/s1ap_eNB_handlers.c @@ -188,7 +188,7 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut /* If there are no more associated MME, inform eNB app */ if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb == 0) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_DEREGISTERED_ENB_IND); + message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_DEREGISTERED_ENB_IND); S1AP_DEREGISTERED_ENB_IND(message_p).nb_mme = 0; itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p); } @@ -206,7 +206,7 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut /* If there are no more pending messages, inform eNB app */ if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb == 0) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_REGISTER_ENB_CNF); + message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_REGISTER_ENB_CNF); S1AP_REGISTER_ENB_CNF(message_p).nb_mme = mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb; itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p); } @@ -791,7 +791,7 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, ue_desc_p->rx_stream = stream; ue_desc_p->mme_ue_s1ap_id = mme_ue_s1ap_id; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_INITIAL_CONTEXT_SETUP_REQ); + message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_INITIAL_CONTEXT_SETUP_REQ); S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; ue_desc_p->ue_initial_id = 0; S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).eNB_ue_s1ap_id = ue_desc_p->eNB_ue_s1ap_id; @@ -935,7 +935,7 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, NULL,0, "0 S1AP_UE_CONTEXT_RELEASE_COMMAND/%d eNB_ue_s1ap_id "S1AP_UE_ID_FMT" ", enb_ue_s1ap_id); - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_UE_CONTEXT_RELEASE_COMMAND); + message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_UE_CONTEXT_RELEASE_COMMAND); if (ue_desc_p->mme_ue_s1ap_id == 0) { // case of Detach Request and switch off from RRC_IDLE mode ue_desc_p->mme_ue_s1ap_id = mme_ue_s1ap_id; @@ -1032,7 +1032,7 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, ue_desc_p->mme_ue_s1ap_id, mme_ue_s1ap_id); } - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_SETUP_REQ); + message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_E_RAB_SETUP_REQ); S1AP_E_RAB_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; S1AP_E_RAB_SETUP_REQ(message_p).mme_ue_s1ap_id = mme_ue_s1ap_id; S1AP_E_RAB_SETUP_REQ(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; @@ -1126,7 +1126,7 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, return -1; } - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_PAGING_IND); + message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_PAGING_IND); /* convert S1AP_PagingIEs_t to s1ap_paging_ind_t */ /* id-UEIdentityIndexValue : convert UE Identity Index value */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_PagingIEs_t, ie, container, @@ -1322,7 +1322,7 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, if (ue_desc_p->mme_ue_s1ap_id != mme_ue_s1ap_id) { S1AP_WARN("UE context mme_ue_s1ap_id is different form that of the message (%d != %ld)", ue_desc_p->mme_ue_s1ap_id, mme_ue_s1ap_id); - message_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_MODIFY_RESP); + message_p = itti_alloc_new_message (TASK_RRC_ENB, 0, S1AP_E_RAB_MODIFY_RESP); S1AP_E_RAB_MODIFY_RESP (message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABModifyRequestIEs_t, ie, container, S1AP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModReq, true); @@ -1348,7 +1348,7 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, return -1; } - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_MODIFY_REQ); + message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_E_RAB_MODIFY_REQ); S1AP_E_RAB_MODIFY_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; S1AP_E_RAB_MODIFY_REQ(message_p).mme_ue_s1ap_id = mme_ue_s1ap_id; S1AP_E_RAB_MODIFY_REQ(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; @@ -1459,7 +1459,7 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, S1AP_DEBUG("[SCTP %d] Received E-RAB release command for eNB_UE_S1AP_ID %ld mme_ue_s1ap_id %ld\n", assoc_id, enb_ue_s1ap_id, mme_ue_s1ap_id); - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_RELEASE_COMMAND); + message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_E_RAB_RELEASE_COMMAND); S1AP_E_RAB_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; S1AP_E_RAB_RELEASE_COMMAND(message_p).mme_ue_s1ap_id = mme_ue_s1ap_id; /* id-NAS-PDU */ @@ -1529,7 +1529,7 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, } // send a message to RRC - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_PATH_SWITCH_REQ_ACK); + message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_PATH_SWITCH_REQ_ACK); /* mandatory */ S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_PathSwitchRequestAcknowledgeIEs_t, ie, pathSwitchRequestAcknowledge, S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, true); diff --git a/openair3/S1AP/s1ap_eNB_itti_messaging.c b/openair3/S1AP/s1ap_eNB_itti_messaging.c index f10c5bc623..8a6539a118 100644 --- a/openair3/S1AP/s1ap_eNB_itti_messaging.c +++ b/openair3/S1AP/s1ap_eNB_itti_messaging.c @@ -29,7 +29,7 @@ void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin MessageDef *message_p; sctp_data_req_t *sctp_data_req; - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_DATA_REQ); + message_p = itti_alloc_new_message(TASK_S1AP, 0, SCTP_DATA_REQ); sctp_data_req = &message_p->ittiMsg.sctp_data_req; @@ -50,7 +50,7 @@ void s1ap_eNB_itti_send_nas_downlink_ind(instance_t instance, MessageDef *message_p; s1ap_downlink_nas_t *s1ap_downlink_nas; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_DOWNLINK_NAS); + message_p = itti_alloc_new_message(TASK_S1AP, 0, S1AP_DOWNLINK_NAS); s1ap_downlink_nas = &message_p->ittiMsg.s1ap_downlink_nas; @@ -68,7 +68,7 @@ void s1ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t asso MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_CLOSE_ASSOCIATION); + message_p = itti_alloc_new_message(TASK_S1AP, 0, SCTP_CLOSE_ASSOCIATION); sctp_close_association_p = &message_p->ittiMsg.sctp_close_association; sctp_close_association_p->assoc_id = assoc_id; diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.c b/openair3/S1AP/s1ap_eNB_nas_procedures.c index d931e76bb6..919989897a 100644 --- a/openair3/S1AP/s1ap_eNB_nas_procedures.c +++ b/openair3/S1AP/s1ap_eNB_nas_procedures.c @@ -80,7 +80,7 @@ int s1ap_eNB_handle_nas_first_req( s1ap_nas_first_req_p->ue_identity.gummei); if (mme_desc_p) { - S1AP_INFO("[eNB %d] Chose MME '%s' (assoc_id %d) through GUMMEI MCC %d MNC %d MMEGI %d MMEC %d\n", + S1AP_INFO("[eNB %ld] Chose MME '%s' (assoc_id %d) through GUMMEI MCC %d MNC %d MMEGI %d MMEC %d\n", instance, mme_desc_p->mme_name, mme_desc_p->assoc_id, @@ -101,7 +101,7 @@ int s1ap_eNB_handle_nas_first_req( s1ap_nas_first_req_p->ue_identity.s_tmsi.mme_code); if (mme_desc_p) { - S1AP_INFO("[eNB %d] Chose MME '%s' (assoc_id %d) through S-TMSI MMEC %d and selected PLMN Identity index %d MCC %d MNC %d\n", + S1AP_INFO("[eNB %ld] Chose MME '%s' (assoc_id %d) through S-TMSI MMEC %d and selected PLMN Identity index %d MCC %d MNC %d\n", instance, mme_desc_p->mme_name, mme_desc_p->assoc_id, @@ -122,7 +122,7 @@ int s1ap_eNB_handle_nas_first_req( s1ap_nas_first_req_p->selected_plmn_identity); if (mme_desc_p) { - S1AP_INFO("[eNB %d] Chose MME '%s' (assoc_id %d) through selected PLMN Identity index %d MCC %d MNC %d\n", + S1AP_INFO("[eNB %ld] Chose MME '%s' (assoc_id %d) through selected PLMN Identity index %d MCC %d MNC %d\n", instance, mme_desc_p->mme_name, mme_desc_p->assoc_id, @@ -142,7 +142,7 @@ int s1ap_eNB_handle_nas_first_req( s1ap_nas_first_req_p->establishment_cause); if (mme_desc_p) { - S1AP_INFO("[eNB %d] Chose MME '%s' (assoc_id %d) through highest relative capacity\n", + S1AP_INFO("[eNB %ld] Chose MME '%s' (assoc_id %d) through highest relative capacity\n", instance, mme_desc_p->mme_name, mme_desc_p->assoc_id); diff --git a/openair3/SCTP/sctp_eNB_itti_messaging.c b/openair3/SCTP/sctp_eNB_itti_messaging.c index 789af3f8ed..c31d4ba9ed 100644 --- a/openair3/SCTP/sctp_eNB_itti_messaging.c +++ b/openair3/SCTP/sctp_eNB_itti_messaging.c @@ -29,7 +29,7 @@ int sctp_itti_send_init_msg_multi_cnf(task_id_t task_id, instance_t instance, in MessageDef *message_p; sctp_init_msg_multi_cnf_t *sctp_init_msg_multi_cnf_p; - message_p = itti_alloc_new_message(TASK_SCTP, SCTP_INIT_MSG_MULTI_CNF); + message_p = itti_alloc_new_message(TASK_SCTP, 0, SCTP_INIT_MSG_MULTI_CNF); sctp_init_msg_multi_cnf_p = &message_p->ittiMsg.sctp_init_msg_multi_cnf; @@ -45,7 +45,7 @@ int sctp_itti_send_new_message_ind(task_id_t task_id, instance_t instance, MessageDef *message_p; sctp_data_ind_t *sctp_data_ind_p; - message_p = itti_alloc_new_message(TASK_SCTP, SCTP_DATA_IND); + message_p = itti_alloc_new_message(TASK_SCTP, 0, SCTP_DATA_IND); sctp_data_ind_p = &message_p->ittiMsg.sctp_data_ind; @@ -69,7 +69,7 @@ int sctp_itti_send_association_resp(task_id_t task_id, instance_t instance, MessageDef *message_p; sctp_new_association_resp_t *sctp_new_association_resp_p; - message_p = itti_alloc_new_message(TASK_SCTP, SCTP_NEW_ASSOCIATION_RESP); + message_p = itti_alloc_new_message(TASK_SCTP, 0, SCTP_NEW_ASSOCIATION_RESP); sctp_new_association_resp_p = &message_p->ittiMsg.sctp_new_association_resp; @@ -89,7 +89,7 @@ int sctp_itti_send_association_ind(task_id_t task_id, instance_t instance, MessageDef *message_p; sctp_new_association_ind_t *sctp_new_association_ind_p; - message_p = itti_alloc_new_message(TASK_SCTP, SCTP_NEW_ASSOCIATION_IND); + message_p = itti_alloc_new_message(TASK_SCTP, 0, SCTP_NEW_ASSOCIATION_IND); sctp_new_association_ind_p = &message_p->ittiMsg.sctp_new_association_ind; diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index ee006338c5..0193c50e1d 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -1116,7 +1116,7 @@ void *sctp_eNB_process_itti_msg(void *notUsed) /* We received a new connection request */ if (sctp_create_new_listener( - ITTI_MESSAGE_GET_INSTANCE(received_msg), + ITTI_MSG_DESTINATION_INSTANCE(received_msg), ITTI_MSG_ORIGIN_ID(received_msg), &received_msg->ittiMsg.sctp_init,0) < 0) { /* SCTP socket creation or bind failed... */ @@ -1131,7 +1131,7 @@ void *sctp_eNB_process_itti_msg(void *notUsed) SCTP_DEBUG("Received SCTP_INIT_MSG_MULTI_REQ\n"); multi_sd = sctp_create_new_listener( - ITTI_MESSAGE_GET_INSTANCE(received_msg), + ITTI_MSG_DESTINATION_INSTANCE(received_msg), ITTI_MSG_ORIGIN_ID(received_msg), &received_msg->ittiMsg.sctp_init_multi,1); /* We received a new connection request */ @@ -1141,27 +1141,27 @@ void *sctp_eNB_process_itti_msg(void *notUsed) } sctp_itti_send_init_msg_multi_cnf( ITTI_MSG_ORIGIN_ID(received_msg), - ITTI_MESSAGE_GET_INSTANCE(received_msg), + ITTI_MSG_DESTINATION_INSTANCE(received_msg), multi_sd); } break; case SCTP_NEW_ASSOCIATION_REQ: { - sctp_handle_new_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + sctp_handle_new_association_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg), ITTI_MSG_ORIGIN_ID(received_msg), &received_msg->ittiMsg.sctp_new_association_req); } break; case SCTP_NEW_ASSOCIATION_REQ_MULTI: { - sctp_handle_new_association_req_multi(ITTI_MESSAGE_GET_INSTANCE(received_msg), + sctp_handle_new_association_req_multi(ITTI_MSG_DESTINATION_INSTANCE(received_msg), ITTI_MSG_ORIGIN_ID(received_msg), &received_msg->ittiMsg.sctp_new_association_req_multi); } break; case SCTP_CLOSE_ASSOCIATION: - sctp_close_association(ITTI_MESSAGE_GET_INSTANCE(received_msg), + sctp_close_association(ITTI_MSG_DESTINATION_INSTANCE(received_msg), ITTI_MSG_ORIGIN_ID(received_msg), &received_msg->ittiMsg.sctp_close_association); break; @@ -1172,7 +1172,7 @@ void *sctp_eNB_process_itti_msg(void *notUsed) break; case SCTP_DATA_REQ: { - sctp_send_data(ITTI_MESSAGE_GET_INSTANCE(received_msg), + sctp_send_data(ITTI_MSG_DESTINATION_INSTANCE(received_msg), ITTI_MSG_ORIGIN_ID(received_msg), &received_msg->ittiMsg.sctp_data_req); } diff --git a/openair3/SCTP/sctp_primitives_client.c b/openair3/SCTP/sctp_primitives_client.c deleted file mode 100644 index e19f20c957..0000000000 --- a/openair3/SCTP/sctp_primitives_client.c +++ /dev/null @@ -1,307 +0,0 @@ -/* - * 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 - */ - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -//WARNING: sctp requires libsctp-dev and -lsctp as linker option -#include -#include - -#include "assertions.h" -#include "sctp_eNB_defs.h" -#include "sctp_common.h" - -#include "sctp_primitives_client.h" - -#if defined(ENB_MODE) -# include "eNB_default_values.h" -#else -# include "mme_default_values.h" -#endif - -/* Send buffer to SCTP association */ -int sctp_send_msg(sctp_data_t *sctp_data_p, uint16_t ppid, uint16_t stream, - const uint8_t *buffer, const uint32_t length) -{ - DevAssert(buffer != NULL); - DevAssert(sctp_data_p != NULL); - - /* Send message on specified stream of the sd association - * NOTE: PPID should be defined in network order - */ - if (sctp_sendmsg(sctp_data_p->sd, (const void *)buffer, length, NULL, 0, - htonl(ppid), 0, stream, 0, 0) < 0) { - SCTP_ERROR("Sctp_sendmsg failed: %s\n", strerror(errno)); - return -1; - } - - SCTP_DEBUG("Successfully sent %d bytes to port %d on stream %d\n", - length, sctp_data_p->remote_port, stream); - - return 0; -} - -static -int sctp_handle_notifications(union sctp_notification *snp) -{ - if (SCTP_SHUTDOWN_EVENT == snp->sn_header.sn_type) { - /* Client deconnection */ - SCTP_DEBUG("Notification received: server deconnected\n"); - } else if (SCTP_ASSOC_CHANGE == snp->sn_header.sn_type) { - /* Association has changed */ - SCTP_DEBUG("Notification received: server association changed\n"); - } else { - SCTP_DEBUG("Notification received: %d TODO\n", snp->sn_header.sn_type); - } - - /* TODO: handle more notif here */ - return 0; -} - -int sctp_run(sctp_data_t *sctp_data_p) -{ - int ret, repeat = 1; - int total_size = 0; - int sd; - struct pollfd fds; - - DevAssert(sctp_data_p != NULL); - - sd = sctp_data_p->sd; - - memset(&fds, 0, sizeof(struct pollfd)); - - fds.fd = sd; - fds.events = POLLIN; - - while (repeat == 1) { - ret = poll(&fds, 1, 0); - - if (ret < 0) { - SCTP_ERROR("[SD %d] Poll has failed (%d:%s)\n", - sd, errno, strerror(errno)); - return errno; - } else if (ret == 0) { - /* No data to read, just leave the loop */ - SCTP_DEBUG("[SD %d] Poll: no data available\n", sd); - repeat = 0; - } else { - /* Socket has some data to read */ - uint8_t buffer[SCTP_RECV_BUFFER_SIZE]; - int flags = 0; - int n; - struct sockaddr_in addr; - struct sctp_sndrcvinfo sinfo; - - socklen_t from_len; - memset((void *)&addr, 0, sizeof(struct sockaddr_in)); - from_len = (socklen_t)sizeof(struct sockaddr_in); - memset((void *)&sinfo, 0, sizeof(struct sctp_sndrcvinfo)); - - n = sctp_recvmsg(sd, (void *)buffer, SCTP_RECV_BUFFER_SIZE, - (struct sockaddr *)&addr, &from_len, - &sinfo, &flags); - - if (n < 0) { - /* Other peer is deconnected */ - SCTP_ERROR("[SD %d] An error occured during read (%d:%s)\n", - sd, errno, strerror(errno)); - return 0; - } - - if (flags & MSG_NOTIFICATION) { - sctp_handle_notifications((union sctp_notification *)buffer); - } else { - struct sctp_queue_item_s *new_item_p; - - new_item_p = calloc(1, sizeof(struct sctp_queue_item_s)); - /* Normal data received */ - SCTP_DEBUG("[SD %d] Msg of length %d received from %s:%u on " - "stream %d, PPID %d, assoc_id %d\n", - sd, n, inet_ntoa(addr.sin_addr), - ntohs(addr.sin_port), sinfo.sinfo_stream, - sinfo.sinfo_ppid, sinfo.sinfo_assoc_id); - - new_item_p->local_stream = sinfo.sinfo_stream; - new_item_p->remote_port = ntohs(addr.sin_port); - new_item_p->remote_addr = addr.sin_addr.s_addr; - new_item_p->ppid = sinfo.sinfo_ppid; - new_item_p->assoc_id = sinfo.sinfo_assoc_id; - new_item_p->length = n; - new_item_p->buffer = malloc(sizeof(uint8_t) * n); - - memcpy(new_item_p->buffer, buffer, n); - - /* Insert the new packet at the tail of queue. */ - TAILQ_INSERT_TAIL(&sctp_data_p->sctp_queue, new_item_p, entry); - - /* Update queue related data */ - sctp_data_p->queue_size += n; - sctp_data_p->queue_length++; - total_size += n; - } - } - } - - return total_size; -} - -int sctp_connect_to_remote_host(char *local_ip_addr[], - int nb_local_addr, - char *remote_ip_addr, - uint16_t port, - int socket_type, - sctp_data_t *sctp_data_p) -{ - int sd = -1; - socklen_t i = 0; - - struct sctp_initmsg init; - struct sctp_event_subscribe events; - struct sockaddr *bindx_add_addr; - - DevAssert(sctp_data_p != NULL); - DevAssert(remote_ip_addr != NULL); - DevAssert(local_ip_addr != NULL); - DevCheck((socket_type == SOCK_STREAM), socket_type, 0, 0); - - SCTP_DEBUG("Creating socket type %d\n", socket_type); - - /* Create new socket */ - if ((sd = socket(AF_INET6, SOCK_STREAM, IPPROTO_SCTP)) < 0) { - SCTP_ERROR("Socket creation failed: %s\n", strerror(errno)); - return -1; - } - - /* Bind to provided IP adresses */ - bindx_add_addr = calloc(nb_local_addr, sizeof(struct sockaddr)); - - for (i = 0; i < nb_local_addr; i++) { - if (inet_pton(AF_INET, local_ip_addr[i], &((struct sockaddr_in*)&bindx_add_addr[i])->sin_addr.s_addr) != 1) { - if (inet_pton(AF_INET6, local_ip_addr[i], &((struct sockaddr_in6*)&bindx_add_addr[i])->sin6_addr.s6_addr) != 1) { - continue; - } else { - ((struct sockaddr_in6*)&bindx_add_addr[i])->sin6_port = 0; - bindx_add_addr[i].sa_family = AF_INET6; - } - } else { - ((struct sockaddr_in*)&bindx_add_addr[i])->sin_port = 0; - bindx_add_addr[i].sa_family = AF_INET; - } - } - - if (sctp_bindx(sd, bindx_add_addr, nb_local_addr, SCTP_BINDX_ADD_ADDR) < 0) { - SCTP_ERROR("Socket bind failed: %s\n", strerror(errno)); - return -1; - } - - memset((void *)&init, 0, sizeof(struct sctp_initmsg)); - - /* Request a number of in/out streams */ - init.sinit_num_ostreams = SCTP_OUT_STREAMS; - init.sinit_max_instreams = SCTP_IN_STREAMS; - init.sinit_max_attempts = SCTP_MAX_ATTEMPTS; - - SCTP_DEBUG("Requesting (%d %d) (in out) streams\n", init.sinit_num_ostreams, - init.sinit_max_instreams); - - if (setsockopt(sd, IPPROTO_SCTP, SCTP_INITMSG, - &init, (socklen_t)sizeof(struct sctp_initmsg)) < 0) { - SCTP_ERROR("Setsockopt IPPROTO_SCTP_INITMSG failed: %s\n", - strerror(errno)); - return -1; - } - - /* Subscribe to all events */ - events.sctp_data_io_event = 1; - events.sctp_association_event = 1; - events.sctp_address_event = 1; - events.sctp_send_failure_event = 1; - events.sctp_peer_error_event = 1; - events.sctp_shutdown_event = 1; - events.sctp_partial_delivery_event = 1; - - if (setsockopt(sd, IPPROTO_SCTP, SCTP_EVENTS, &events, - 8) < 0) { - SCTP_ERROR("Setsockopt IPPROTO_SCTP_EVENTS failed: %s\n", - strerror(errno)); - return -1; - } - - /* SOCK_STREAM socket type requires an explicit connect to the remote host - * address and port. - * Only use IPv4 for the first connection attempt - */ - { - struct sockaddr_in addr; - - memset(&addr, 0, sizeof(struct sockaddr_in)); - - if (inet_pton(AF_INET, remote_ip_addr, &addr.sin_addr.s_addr) != 1) { - SCTP_ERROR("Failed to convert ip address %s to network type\n", remote_ip_addr); - goto err; - } - - addr.sin_family = AF_INET; - addr.sin_port = htons(port); - - SCTP_DEBUG("[%d] Sending explicit connect to %s:%u\n", sd, remote_ip_addr, - port); - - /* Connect to remote host and port */ - if (sctp_connectx(sd, (struct sockaddr *)&addr, 1, NULL) < 0) { - SCTP_ERROR("Connect to %s:%u failed: %s\n", remote_ip_addr, - port, strerror(errno)); - goto err; - } - } - - /* Get SCTP status */ - sctp_get_sockinfo(sd, &sctp_data_p->instreams, &sctp_data_p->outstreams, - &sctp_data_p->assoc_id); - - sctp_data_p->sd = sd; - - sctp_get_peeraddresses(sd, &sctp_data_p->remote_ip_addresses, &sctp_data_p->nb_remote_addresses); - sctp_get_localaddresses(sd, NULL, NULL); - - TAILQ_INIT(&sctp_data_p->sctp_queue); - - return sd; - -err: - - if (sd != 0) { - close(sd); - } - - return -1; -} diff --git a/openair3/SCTP/sctp_primitives_client.h b/openair3/SCTP/sctp_primitives_client.h deleted file mode 100644 index bec4d3ed95..0000000000 --- a/openair3/SCTP/sctp_primitives_client.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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 - */ - -#include - -#include "sctp_eNB_defs.h" - -#ifndef SCTP_PRIMITIVES_CLIENT_H_ -#define SCTP_PRIMITIVES_CLIENT_H_ - -/** @defgroup _sctp_impl_ SCTP Layer Reference Implementation - * @ingroup _ref_implementation_ - * @{ - */ - -/** \brief SCTP recv callback prototype. Will be called every time a message is - * received on socket. - * \param assocId SCTP association ID - * \param stream SCTP stream on which data had been received - * \param buffer Pointer to data (should be freed by user) - * \param length Length of message received - * @return Execution result - */ -typedef int (*sctp_recv_callback)(uint32_t assocId, - uint32_t stream, - uint8_t *buffer, - uint32_t length); - -/** \brief SCTP connected callback prototype. Will be called once the - * association is ready. - * \param args argument provided by upper layer - * \param assocId SCTP association ID - * \param instreams Number of input streams negotiated with remote peer - * \param outstreams Number of output streams negotiated with remote peer - * @return Execution result - */ -typedef int (*sctp_connected_callback)(void *args, - uint32_t assocId, - uint32_t instreams, - uint32_t outstreams); - -/** \brief Perform association to a remote peer - * \param ip_addr Peer IPv4 address - * \param port Remote port to connect to - * \param args Upper layer args that will be provided to connected callback - * \param connected_callback Connected callback - * \param recv_callback Data received callback - * @return < 0 in case of failure - */ -int sctp_connect_to_remote_host(char *local_ip_addr[], - int nb_local_addr, - char *remote_ip_addr, - uint16_t port, - int socket_type, - sctp_data_t *sctp_data_p); - -/** \brief Send message over SCTP - * \param sctp_data_p Pointer to the SCTP desc - * \param ppid Payload Protocol Identifier - * \param stream SCTP stream on which data will be sent - * \param buffer Pointer to buffer - * \param length Buffer length - * @return < 0 in case of failure - */ -int sctp_send_msg(sctp_data_t *sctp_data_p, uint16_t ppid, uint16_t stream, - const uint8_t *buffer, const uint32_t length); - -/** \brief Flush the FIFO of messages from the socket - * \param sctp_data_p - * @return < 0 in case of failure - */ -int sctp_run(sctp_data_t *sctp_data_p); - -/** \brief Properly disconnect the peer - * \param assoc_id The SCTP association ID - * @return < 0 in case of failure - */ -void sctp_disconnect(uint32_t assoc_id); - -void sctp_terminate(void); - -/* @} */ -#endif /* SCTP_PRIMITIVES_CLIENT_H_ */ diff --git a/openair3/TEST/EPC_TEST/play_scenario.c b/openair3/TEST/EPC_TEST/play_scenario.c index 3af47f21a8..858448b815 100644 --- a/openair3/TEST/EPC_TEST/play_scenario.c +++ b/openair3/TEST/EPC_TEST/play_scenario.c @@ -729,7 +729,7 @@ void *et_eNB_app_task(void *args_p) itti_receive_msg (TASK_ENB_APP, &msg_p); msg_name = ITTI_MSG_NAME (msg_p); - instance = ITTI_MSG_INSTANCE (msg_p); + instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); switch (ITTI_MSG_ID(msg_p)) { case TERMINATE_MESSAGE: @@ -1204,7 +1204,7 @@ int main( int argc, char **argv ) logInit(); set_glog(LOG_TRACE, LOG_MED); - itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); set_comp_log(ENB_APP, LOG_TRACE, LOG_MED, 1); set_comp_log(S1AP, LOG_TRACE, LOG_MED, 1); diff --git a/openair3/TEST/EPC_TEST/play_scenario_s1ap.c b/openair3/TEST/EPC_TEST/play_scenario_s1ap.c index acc9b18f76..c4674e8901 100644 --- a/openair3/TEST/EPC_TEST/play_scenario_s1ap.c +++ b/openair3/TEST/EPC_TEST/play_scenario_s1ap.c @@ -1101,13 +1101,13 @@ void *et_s1ap_eNB_task(void *arg) * Each eNB has to send an S1AP_REGISTER_ENB message with its * own parameters. */ - et_s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg), + et_s1ap_eNB_handle_register_eNB(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &S1AP_REGISTER_ENB_REQ(received_msg)); } break; case SCTP_NEW_ASSOCIATION_RESP: { - et_s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + et_s1ap_eNB_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); } break; diff --git a/openair3/TEST/oaisim_mme_itti_test.c b/openair3/TEST/oaisim_mme_itti_test.c index 57cfd412ef..0b381a0415 100644 --- a/openair3/TEST/oaisim_mme_itti_test.c +++ b/openair3/TEST/oaisim_mme_itti_test.c @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) /* Calling each layer init function */ log_init(&mme_config); - itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); sctp_init(&mme_config); udp_init(&mme_config); s1ap_mme_init(&mme_config); diff --git a/openair3/TEST/oaisim_mme_test_s1c.c b/openair3/TEST/oaisim_mme_test_s1c.c index 52623463c6..53f8a1d5eb 100644 --- a/openair3/TEST/oaisim_mme_test_s1c.c +++ b/openair3/TEST/oaisim_mme_test_s1c.c @@ -193,7 +193,7 @@ static void *eNB_app_task(void *args_p) itti_receive_msg (TASK_ENB_APP, &msg_p); msg_name = ITTI_MSG_NAME (msg_p); - instance = ITTI_MSG_INSTANCE (msg_p); + instance = ITTI_MSG_DESTINATION_INSTANCE (msg_p); switch (ITTI_MSG_ID(msg_p)) { case TERMINATE_MESSAGE: @@ -309,7 +309,7 @@ int main( int argc, char **argv ) /* Read eNB configuration file */ enb_properties = enb_config_init(conf_config_file_name); - itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); itti_wait_ready(1); diff --git a/openair3/TEST/oaisim_mme_test_s1c_s1ap.c b/openair3/TEST/oaisim_mme_test_s1c_s1ap.c index 10d43d595d..60da125073 100644 --- a/openair3/TEST/oaisim_mme_test_s1c_s1ap.c +++ b/openair3/TEST/oaisim_mme_test_s1c_s1ap.c @@ -260,13 +260,13 @@ void *s1ap_eNB_task(void *arg) * Each eNB has to send an S1AP_REGISTER_ENB message with its * own parameters. */ - s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_eNB_handle_register_eNB(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &S1AP_REGISTER_ENB_REQ(received_msg)); } break; case SCTP_NEW_ASSOCIATION_RESP: { - s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + s1ap_eNB_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); } break; diff --git a/openair3/UDP/udp_eNB_task.c b/openair3/UDP/udp_eNB_task.c index 90ee87900d..515dd9a17f 100644 --- a/openair3/UDP/udp_eNB_task.c +++ b/openair3/UDP/udp_eNB_task.c @@ -257,7 +257,7 @@ void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP) forwarded_buffer = itti_malloc(TASK_UDP, udp_sock_pP->task_id, n*sizeof(uint8_t)); DevAssert(forwarded_buffer != NULL); memcpy(forwarded_buffer, l_buffer, n); - message_p = itti_alloc_new_message(TASK_UDP, UDP_DATA_IND); + message_p = itti_alloc_new_message(TASK_UDP, 0, UDP_DATA_IND); DevAssert(message_p != NULL); udp_data_ind_p = &message_p->ittiMsg.udp_data_ind; udp_data_ind_p->buffer = forwarded_buffer; @@ -318,7 +318,7 @@ void *udp_eNB_task(void *args_p) if (received_message_p != NULL) { //msg_name = ITTI_MSG_NAME (received_message_p); - //instance = ITTI_MSG_INSTANCE (received_message_p); + //instance = ITTI_MSG_DESTINATION_INSTANCE (received_message_p); switch (ITTI_MSG_ID(received_message_p)) { case UDP_INIT: { diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 0d0dde4ac4..cdafb1e3eb 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -386,7 +386,7 @@ void terminate_task(module_id_t mod_id, task_id_t from, task_id_t to) { LOG_I(ENB_APP, "sending TERMINATE_MESSAGE from task %s (%d) to task %s (%d)\n", itti_get_task_name(from), from, itti_get_task_name(to), to); MessageDef *msg; - msg = itti_alloc_new_message (from, TERMINATE_MESSAGE); + msg = itti_alloc_new_message (from, 0, TERMINATE_MESSAGE); itti_send_msg_to_task (to, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg); } @@ -453,7 +453,7 @@ int restart_L1L2(module_id_t enb_id) { /* pass a reconfiguration request which will configure everything down to * RC.eNB[i][j]->frame_parms, too */ - msg_p = itti_alloc_new_message(TASK_ENB_APP, RRC_CONFIGURATION_REQ); + msg_p = itti_alloc_new_message(TASK_ENB_APP, 0, RRC_CONFIGURATION_REQ); RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration; itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); /* TODO XForms might need to be restarted, but it is currently (09/02/18) @@ -544,14 +544,14 @@ int main ( int argc, char **argv ) cpuf=get_cpu_freq_GHz(); printf("ITTI init, useMME: %i\n",EPC_MODE_ENABLED); - itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); // allows to forward in wireshark L2 protocol for decoding // initialize mscgen log after ITTI if (get_softmodem_params()->start_msc) { load_module_shlib("msc",NULL,0,&msc_interface); } - MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX); + MSC_INIT(MSC_E_UTRAN, ADDED_QUEUES_MAX+TASK_MAX); init_opt(); // to make a graceful exit when ctrl-c is pressed set_softmodem_sighandler(); @@ -596,7 +596,7 @@ int main ( int argc, char **argv ) } for (int enb_id = 0; enb_id < RC.nb_inst; enb_id++) { - MessageDef *msg_p = itti_alloc_new_message (TASK_ENB_APP, RRC_CONFIGURATION_REQ); + MessageDef *msg_p = itti_alloc_new_message (TASK_ENB_APP, 0, RRC_CONFIGURATION_REQ); RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration; itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); } diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 0962bb6a2d..d690b13c2c 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1596,7 +1596,7 @@ void *UE_thread(void *arg) wait_sync("UE thread"); #ifdef NAS_UE MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_NAS_UE, INITIALIZE_MESSAGE); + message_p = itti_alloc_new_message(TASK_NAS_UE, 0, INITIALIZE_MESSAGE); itti_send_msg_to_task (TASK_NAS_UE, UE->Mod_id + NB_eNB_INST, message_p); #endif int sub_frame=-1; @@ -1976,7 +1976,7 @@ void init_UE_single_thread_stub(int nb_inst) if(NFAPI_MODE==NFAPI_UE_STUB_PNF) { #ifdef NAS_UE MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_NAS_UE, INITIALIZE_MESSAGE); + message_p = itti_alloc_new_message(TASK_NAS_UE, 0, INITIALIZE_MESSAGE); itti_send_msg_to_task (TASK_NAS_UE, i + NB_eNB_INST, message_p); #endif } diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 2bf2314f1b..dce7a20874 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -500,7 +500,7 @@ void init_openair0(LTE_DL_FRAME_PARMS *frame_parms,int rxgain) { void terminate_task(task_id_t task_id, module_id_t mod_id) { LOG_I(ENB_APP, "sending TERMINATE_MESSAGE to task %s (%d)\n", itti_get_task_name(task_id), task_id); MessageDef *msg; - msg = itti_alloc_new_message (ENB_APP, TERMINATE_MESSAGE); + msg = itti_alloc_new_message (ENB_APP, 0, TERMINATE_MESSAGE); itti_send_msg_to_task (task_id, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg); } @@ -601,14 +601,14 @@ int main( int argc, char **argv ) { pthread_mutex_init(&sync_mutex, NULL); printf("ITTI init\n"); - itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); // initialize mscgen log after ITTI if (get_softmodem_params()->start_msc) { load_module_shlib("msc",NULL,0,&msc_interface); } - MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX); + MSC_INIT(MSC_E_UTRAN, ADDED_QUEUES_MAX+TASK_MAX); init_opt(); init_pdcp(); //TTN for D2D From a432feda3e08ca9f559322e61e786ea464178c11 Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 23 Dec 2020 14:29:40 +0100 Subject: [PATCH 130/160] add external visibility for itti_create_queue --- common/utils/ocp_itti/intertask_interface.cpp | 3 ++- common/utils/ocp_itti/intertask_interface.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index d66ea027c9..a1455577d3 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -336,7 +336,7 @@ extern "C" { usleep(100*1000); // Allow the tasks to receive the message before going returning to main thread } - void itti_create_queue(const task_info_t *task_info) { + int itti_create_queue(const task_info_t *task_info) { pthread_mutex_lock (&lock_nb_queues); int newQueue=nb_queues; nb_queues++; @@ -351,6 +351,7 @@ extern "C" { if (tasks[newQueue].admin.threadFunc != NULL) itti_create_task((task_id_t)newQueue, tasks[newQueue].admin.threadFunc, NULL); + return newQueue; } int itti_init(task_id_t task_max, diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h index 53d76b7a77..beec767829 100644 --- a/common/utils/ocp_itti/intertask_interface.h +++ b/common/utils/ocp_itti/intertask_interface.h @@ -501,6 +501,8 @@ int itti_create_task(task_id_t task_id, void *(*start_routine) (void *), void *args_p); +int itti_create_queue(const task_info_t *task_info); + /** \brief Exit the current task. **/ void itti_exit_task(void); From 58309dd7301fb444720c790790c853c0480e72e2 Mon Sep 17 00:00:00 2001 From: frtabu Date: Wed, 23 Dec 2020 18:43:03 +0100 Subject: [PATCH 131/160] simplify nrue command line parameter processing --- common/utils/LOG/log.h | 1 + common/utils/threadPool/thread-pool.h | 2 +- executables/nr-uesoftmodem.c | 109 +++++++++--------- executables/nr-uesoftmodem.h | 102 ++++++++-------- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 19 +-- 5 files changed, 113 insertions(+), 120 deletions(-) diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index 240e89a0e7..d893708a8b 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -167,6 +167,7 @@ extern "C" { {"SECURITY", DEBUG_SECURITY},\ {"NAS", DEBUG_NAS},\ {"RLC", DEBUG_RLC},\ + {"DLSCH_DECOD", DEBUG_DLSCH_DECOD},\ {"UE_TIMING", UE_TIMING},\ {NULL,-1}\ } diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h index 0ed8715811..bd55203c7f 100644 --- a/common/utils/threadPool/thread-pool.h +++ b/common/utils/threadPool/thread-pool.h @@ -45,7 +45,7 @@ #define condwait(condition, mutex) AssertFatal(pthread_cond_wait(&condition, &mutex)==0,""); #define condbroadcast(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,""); #define condsignal(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,""); - +#define tpool_nbthreads(tpool) (tpool.nbThreads) typedef struct notifiedFIFO_elt_s { struct notifiedFIFO_elt_s *next; uint64_t key; //To filter out elements diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 82814cf106..9a8c4cb296 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -111,17 +111,10 @@ extern int16_t nr_dlsch_demod_shift; static int tx_max_power[MAX_NUM_CCs] = {0}; int single_thread_flag = 1; -int threequarter_fs = 0; -int UE_scan_carrier = 0; -int UE_fo_compensation = 0; -int UE_no_timing_correction = 0; -int N_RB_DL = 0; int tddflag = 0; int vcdflag = 0; -uint8_t nb_antenna_tx = 1; -uint8_t nb_antenna_rx = 1; + double rx_gain_off = 0.0; -uint32_t timing_advance = 0; char *usrp_args = NULL; char *rrc_config_path = NULL; int dumpframe = 0; @@ -147,8 +140,7 @@ int16_t node_synch_ref[MAX_NUM_CCs]; int otg_enabled; double cpuf; -runmode_t mode = normal_txrx; -int UE_scan = 0; + int chain_offset = 0; int card_offset = 0; uint64_t num_missed_slots = 0; // counter for the number of missed slots @@ -222,38 +214,21 @@ nrUE_params_t *get_nrUE_params(void) { } /* initialie thread pools used for NRUE processing paralleliation */ void init_tpools(uint8_t nun_dlsch_threads) { - - initTpool("-1,-1", &(nrUE_params.Tpool), false); - init_dlsch_tpool(nrUE_params.nr_dlsch_parallel); + char *params=calloc(1,(RX_NB_TH*2)+1); + for (int i=0; i 0) mode = debug_prach; - - if (cmdline_uemodeparams[CMDLINE_NOL2CONNECT_IDX].uptr) - if ( *(cmdline_uemodeparams[CMDLINE_NOL2CONNECT_IDX].uptr) > 0) mode = no_L2_connect; - - if (cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr) - if ( *(cmdline_uemodeparams[CMDLINE_CALIBPRACHTX_IDX].uptr) > 0) mode = calib_prach_tx; - - if ((cmdline_uemodeparams[CMDLINE_DUMPMEMORY_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) - mode = rx_dump_frame; if (vcdflag > 0) ouput_vcd = 1; @@ -270,6 +245,38 @@ static void get_options(void) { // set PHY vars from command line void set_options(int CC_id, PHY_VARS_NR_UE *UE){ + NR_DL_FRAME_PARMS *fp = &UE->frame_parms; + paramdef_t cmdline_params[] = CMDLINE_NRUE_PHYPARAMS_DESC ; + int numparams = sizeof(cmdline_params)/sizeof(paramdef_t); + + UE->mode = normal_txrx; + + config_process_cmdline( cmdline_params,numparams,NULL); + + int pindex = config_paramidx_fromname(cmdline_params,numparams, CALIBRX_OPT); + if ( (cmdline_params[pindex].paramflags & PARAMFLAG_PARAMSET) != 0) UE->mode = rx_calib_ue; + + pindex = config_paramidx_fromname(cmdline_params,numparams, CALIBRXMED_OPT); + if ( (cmdline_params[pindex].paramflags & PARAMFLAG_PARAMSET) != 0) UE->mode = rx_calib_ue_med; + + pindex = config_paramidx_fromname(cmdline_params,numparams, CALIBRXBYP_OPT); + if ( (cmdline_params[pindex].paramflags & PARAMFLAG_PARAMSET) != 0) UE->mode = rx_calib_ue_byp; + + pindex = config_paramidx_fromname(cmdline_params,numparams, DBGPRACH_OPT); + if (cmdline_params[pindex].uptr) + if ( *(cmdline_params[pindex].uptr) > 0) UE->mode = debug_prach; + + pindex = config_paramidx_fromname(cmdline_params,numparams,NOL2CONNECT_OPT ); + if (cmdline_params[pindex].uptr) + if ( *(cmdline_params[pindex].uptr) > 0) UE->mode = no_L2_connect; + + pindex = config_paramidx_fromname(cmdline_params,numparams,CALIBPRACH_OPT ); + if (cmdline_params[pindex].uptr) + if ( *(cmdline_params[pindex].uptr) > 0) UE->mode = calib_prach_tx; + + pindex = config_paramidx_fromname(cmdline_params,numparams,DUMPFRAME_OPT ); + if ((cmdline_params[pindex].paramflags & PARAMFLAG_PARAMSET) != 0) + UE->mode = rx_dump_frame; // Init power variables tx_max_power[CC_id] = tx_max_power[0]; @@ -277,35 +284,29 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){ tx_gain[0][CC_id] = tx_gain[0][0]; // Set UE variables - UE->UE_scan = UE_scan; - UE->UE_scan_carrier = UE_scan_carrier; - UE->UE_fo_compensation = UE_fo_compensation; - UE->no_timing_correction = UE_no_timing_correction; - UE->mode = mode; + UE->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off; UE->tx_total_gain_dB = (int)tx_gain[CC_id][0]; UE->tx_power_max_dBm = tx_max_power[CC_id]; UE->rf_map.card = card_offset; UE->rf_map.chain = CC_id + chain_offset; - UE->timing_advance = timing_advance; - LOG_I(PHY,"Set UE mode %d, UE_fo_compensation %d, UE_scan %d, UE_scan_carrier %d, UE_no_timing_correction %d \n", mode, UE_fo_compensation, UE_scan, UE_scan_carrier, UE_no_timing_correction); + + LOG_I(PHY,"Set UE mode %d, UE_fo_compensation %d, UE_scan_carrier %d, UE_no_timing_correction %d \n", + UE->mode, UE->UE_fo_compensation, UE->UE_scan_carrier, UE->no_timing_correction); // Set FP variables - NR_DL_FRAME_PARMS *fp = &UE->frame_parms; - fp->nb_antennas_tx = nb_antenna_tx; - fp->nb_antennas_rx = nb_antenna_rx; - fp->threequarter_fs = threequarter_fs; + + + if (tddflag){ fp->frame_type = TDD; LOG_I(PHY, "Set UE frame_type %d\n", fp->frame_type); } - if (N_RB_DL){ - fp->N_RB_DL = N_RB_DL; - LOG_I(PHY, "Set UE N_RB_DL %d\n", N_RB_DL); - } - LOG_I(PHY, "Set UE nb_rx_antenna %d, nb_tx_antenna %d, threequarter_fs %d\n", nb_antenna_rx, nb_antenna_tx, threequarter_fs); + LOG_I(PHY, "Set UE N_RB_DL %d\n", fp->N_RB_DL); + + LOG_I(PHY, "Set UE nb_rx_antenna %d, nb_tx_antenna %d, threequarter_fs %d\n", fp->nb_antennas_rx, fp->nb_antennas_tx, fp->threequarter_fs); } @@ -555,7 +556,7 @@ int main( int argc, char **argv ) { for(int CC_id=0; CC_idrf_map.card=0; PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+chain_offset; - PHY_vars_UE_g[0][CC_id]->timing_advance = timing_advance; + PHY_vars_UE_g[0][CC_id]->timing_advance = UE[CC_id]->timing_advance; } init_NR_UE_threads(1); diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h index ec6409cf80..de5aa377fc 100644 --- a/executables/nr-uesoftmodem.h +++ b/executables/nr-uesoftmodem.h @@ -5,74 +5,64 @@ #include "PHY/defs_nr_UE.h" #include "SIMULATION/ETH_TRANSPORT/proto.h" + + + +#define CONFIG_HLP_DLSCH_PARA "number of threads for dlsch processing 0 for no parallelization" /***************************************************************************************************************************************/ /* command line options definitions, CMDLINE_XXXX_DESC macros are used to initialize paramdef_t arrays which are then used as argument when calling config_get or config_getlist functions */ +#define CALIBRX_OPT "calib-ue-rx" +#define CALIBRXMED_OPT "calib-ue-rx-med" +#define CALIBRXBYP_OPT "calib-ue-rx-byp" +#define DBGPRACH_OPT "debug-ue-prach" +#define NOL2CONNECT_OPT "no-L2-connect" +#define CALIBPRACH_OPT "calib-prach-tx" +#define DUMPFRAME_OPT "ue-dump-frame" + +/*------------------------------------------------------------------------------------------------------------------------------------------*/ +/* command line parameters defining UE running mode */ +/* optname helpstr paramflags XXXptr defXXXval type numelt */ +/*------------------------------------------------------------------------------------------------------------------------------------------*/ +#define CMDLINE_NRUEPARAMS_DESC { \ + {"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0}, \ + {"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \ + {"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, iptr:(int32_t *)&nrUE_params.nr_dlsch_parallel, defintval:0, TYPE_UINT8, 0}, \ + {"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \ + {"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 0}, \ + {"rrc_config_path", CONFIG_HLP_RRC_CFG_PATH,0, strptr:(char **)&rrc_config_path, defstrval:"./", TYPE_STRING, 0} \ +} + /*------------------------------------------------------------------------------------------------------------------------------------------*/ /* command line parameters defining UE running mode */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*------------------------------------------------------------------------------------------------------------------------------------------*/ -#define CMDLINE_UEMODEPARAMS_DESC { \ - {"calib-ue-rx", CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \ - {"calib-ue-rx-med", CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \ - {"calib-ue-rx-byp", CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \ - {"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ - {"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ - {"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ - {"loop-memory", CONFIG_HLP_UELOOP, 0, strptr:&loopfile, defstrval:"iqs.in", TYPE_STRING,0}, \ - {"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \ - } -#define CMDLINE_CALIBUERX_IDX 0 -#define CMDLINE_CALIBUERXMED_IDX 1 -#define CMDLINE_CALIBUERXBYP_IDX 2 -#define CMDLINE_DEBUGUEPRACH_IDX 3 -#define CMDLINE_NOL2CONNECT_IDX 4 -#define CMDLINE_CALIBPRACHTX_IDX 5 -#define CMDLINE_MEMLOOP_IDX 6 -#define CMDLINE_DUMPMEMORY_IDX 7 -/*------------------------------------------------------------------------------------------------------------------------------------------*/ - - -/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/* command line parameters specific to UE */ -/* optname helpstr paramflags XXXptr defXXXval type numelt */ -/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/ -#define CMDLINE_NRUEPARAMS_DESC { \ - {"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \ - {"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \ - {"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \ - {"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&nb_antenna_rx, defuintval:1, TYPE_UINT8, 0}, \ - {"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \ - {"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \ - {"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, iptr:&UE_fo_compensation, defintval:0, TYPE_INT, 0}, \ - {"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \ - {"r" , CONFIG_HLP_PRB, 0, iptr:&(N_RB_DL), defintval:25, TYPE_UINT, 0}, \ - {"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0} \ - } - - -#define CONFIG_HLP_DLSCH_PARA "number of threads for dlsch processing 0 for no parallelization" -/*----------------------------------------------------------------------------------------------------------------------------------------------------*/ -/* command line parameters common to gNB and UE */ -/* optname helpstr paramflags XXXptr defXXXval type numelt */ -/*----------------------------------------------------------------------------------------------------------------------------------------------------*/ -#define CMDLINE_PARAMS_DESC_UE { \ - {"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \ - {"dlsch-parallel", CONFIG_HLP_DLSCH_PARA, 0, iptr:(int32_t *)&nrUE_params.nr_dlsch_parallel, defintval:0, TYPE_UINT8, 0}, \ - {"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \ - {"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \ - {"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&(openair0_cfg[0].threequarter_fs), defintval:0, TYPE_INT8, 0}, \ - {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \ - {"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 0}, \ - {"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&UE_no_timing_correction, defintval:0, TYPE_INT, 0}, \ - {"rrc_config_path", CONFIG_HLP_RRC_CFG_PATH,0, strptr:(char **)&rrc_config_path, defstrval:"./", TYPE_STRING, 0} \ +#define CMDLINE_NRUE_PHYPARAMS_DESC { \ + { CALIBRX_OPT, CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \ + { CALIBRXMED_OPT, CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \ + { CALIBRXBYP_OPT, CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \ + { DBGPRACH_OPT, CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ + { NOL2CONNECT_OPT, CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ + {CALIBPRACH_OPT, CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ + { DUMPFRAME_OPT, CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \ + {"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \ + {"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \ + {"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \ + {"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&(fp->nb_antennas_rx), defuintval:1, TYPE_UINT8, 0}, \ + {"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&(fp->nb_antennas_tx), defuintval:1, TYPE_UINT8, 0}, \ + {"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&(UE->UE_scan_carrier), defintval:0, TYPE_INT, 0}, \ + {"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, iptr:&(UE->UE_fo_compensation), defintval:0, TYPE_INT, 0}, \ + {"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \ + {"r" , CONFIG_HLP_PRB, 0, iptr:&(fp->N_RB_DL), defintval:25, TYPE_UINT, 0}, \ + {"A" , CONFIG_HLP_TADV, 0, iptr:&(UE->timing_advance), defintval:0, TYPE_INT, 0}, \ + {"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, u8ptr:&(fp->threequarter_fs), defintval:0, TYPE_UINT8, 0}, \ + {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \ + {"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&(UE->no_timing_correction), defintval:0, TYPE_INT, 0}, \ } - - typedef struct { uint64_t optmask; //mask to store boolean config options uint8_t nr_dlsch_parallel; // number of threads for dlsch decoding, 0 means no parallelization diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 70ff18d221..d97bb36717 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -65,11 +65,12 @@ void init_dlsch_tpool(uint8_t nun_dlsch_threads) if( nun_dlsch_threads==0) return; - char *params=malloc(nun_dlsch_threads*3*sizeof(char)); - for (int i=0; iK; Kr_bytes = Kr>>3; - K_bits_F = Kr-harq_process->F; + K_bytes_F = Kr-harq_process->F; E = nr_get_E(G, harq_process->C, harq_process->Qm, harq_process->Nl, r); @@ -1546,9 +1547,9 @@ void nr_dlsch_decoding_process(void *arg) //set first 2*Z_c bits to zeros memset(&z[0],0,2*harq_process->Z*sizeof(int16_t)); //set Filler bits - memset((&z[0]+K_bits_F),127,harq_process->F*sizeof(int16_t)); + memset((&z[0]+K_bytes_F),127,harq_process->F*sizeof(int16_t)); //Move coded bits before filler bits - memcpy((&z[0]+2*harq_process->Z),harq_process->d[r],(K_bits_F-2*harq_process->Z)*sizeof(int16_t)); + memcpy((&z[0]+2*harq_process->Z),harq_process->d[r],(K_bytes_F-2*harq_process->Z)*sizeof(int16_t)); //skip filler bits memcpy((&z[0]+Kr),harq_process->d[r]+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t)); //Saturate coded bits before decoding into 8 bits values @@ -1609,7 +1610,7 @@ void *dlsch_thread(void *arg) { notifiedFIFO_elt_t *res_dl; initNotifiedFIFO_nothreadSafe(&freeBlocks_dl); - for (int i=0; i= RX_NB_TH_DL) { + while (nbDlProcessing >= tpool_nbthreads(pool_dl)) { if ( (res=tryPullTpool(&nf, &pool_dl)) != NULL ) { //nbDlProcessing--; pushNotifiedFIFO_nothreadSafe(&freeBlocks_dl,res); From 79d51ce64560bab7b01aa67b7cbc3effb28c0964 Mon Sep 17 00:00:00 2001 From: Laurent Date: Sat, 26 Dec 2020 11:05:42 +0100 Subject: [PATCH 132/160] reallocarray() doesn't exist in old Ubuntu --- common/utils/ocp_itti/intertask_interface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index a1455577d3..aec702f987 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -340,7 +340,7 @@ extern "C" { pthread_mutex_lock (&lock_nb_queues); int newQueue=nb_queues; nb_queues++; - AssertFatal(reallocarray(tasks, nb_queues, sizeof(*tasks)),"no memory"); + AssertFatal(realloc(tasks, nb_queues* sizeof(*tasks)),"no memory"); pthread_mutex_unlock (&lock_nb_queues); LOG_I(TMR,"Starting itti queue: %s as task %d\n", tasks_info->name, newQueue); pthread_mutex_init(&tasks[newQueue].queue_cond_lock, NULL); From d253301c1a8289f8fcd1ec34d82b5dd010ebafc0 Mon Sep 17 00:00:00 2001 From: Laurent Date: Sun, 27 Dec 2020 12:09:20 +0100 Subject: [PATCH 133/160] intptr_t instead of int64_t for instance_t --- openair2/COMMON/platform_types.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h index 12d90a3d06..e6d46dff8e 100644 --- a/openair2/COMMON/platform_types.h +++ b/openair2/COMMON/platform_types.h @@ -28,10 +28,13 @@ ***************************************************************************/ #ifndef __PLATFORM_TYPES_H__ -# define __PLATFORM_TYPES_H__ +#define __PLATFORM_TYPES_H__ #if !defined(NAS_NETLINK) - #include +#include +#else +#include +typedef void * intptr_t; #endif //----------------------------------------------------------------------------- @@ -229,7 +232,7 @@ typedef uint8_t ebi_t; // eps bearer id // //----------------------------------------------------------------------------- // may be ITTI not enabled, but type instance is useful also for OTG, -typedef int64_t instance_t; +typedef intptr_t instance_t; typedef struct protocol_ctxt_s { module_id_t module_id; /*!< \brief Virtualized module identifier */ eNB_flag_t enb_flag; /*!< \brief Flag to indicate eNB (1) or UE (0) */ @@ -291,7 +294,6 @@ typedef struct protocol_ctxt_s { PROTOCOL_CTXT_COMPUTE_MODULE_ID(Ctxt_Pp) #define PROTOCOL_CTXT_FMT "[FRAME %05u][%s][MOD %02d][RNTI %" PRIx16 "]" -#define PROTOCOL_CTXT_FMTL "[FRAME %05u][%s][MOD %08ld][RNTI %" PRIx16 "]" #define PROTOCOL_CTXT_ARGS(CTXT_Pp) \ (CTXT_Pp)->frame, \ ((CTXT_Pp)->enb_flag == ENB_FLAG_YES) ? "eNB":" UE", \ From bbaef50932561d3882bc8bd90d4e2e1b154c8ae6 Mon Sep 17 00:00:00 2001 From: "masayuki.harada" Date: Sun, 27 Dec 2020 20:19:33 +0900 Subject: [PATCH 134/160] Fix est buffer. --- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 6e86832a60..47c27798bf 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -197,10 +197,6 @@ rx_sdu(const module_id_t enb_mod_idP, if (UE_template_ptr->scheduled_ul_bytes < 0) { UE_template_ptr->scheduled_ul_bytes = 0; } - UE_template_ptr->estimated_ul_buffer -= UE_template_ptr->TBS_UL[harq_pid]; - if (UE_template_ptr->estimated_ul_buffer < 0) { - UE_template_ptr->estimated_ul_buffer = 0; - } } else { // sduP == NULL => error UE_scheduling_control->pusch_rx_error_num[CC_idP]++; LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d, UE_id %d, RNTI %x (len %d)\n", @@ -234,10 +230,6 @@ rx_sdu(const module_id_t enb_mod_idP, if (UE_template_ptr->scheduled_ul_bytes < 0) { UE_template_ptr->scheduled_ul_bytes = 0; } - UE_template_ptr->estimated_ul_buffer -= UE_template_ptr->TBS_UL[harq_pid]; - if (UE_template_ptr->estimated_ul_buffer < 0) { - UE_template_ptr->estimated_ul_buffer = 0; - } if (find_RA_id(enb_mod_idP, CC_idP, current_rnti) != -1) { cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti); @@ -573,8 +565,6 @@ rx_sdu(const module_id_t enb_mod_idP, UE_template_ptr->ul_buffer_info[LCGID1] + UE_template_ptr->ul_buffer_info[LCGID2] + UE_template_ptr->ul_buffer_info[LCGID3]; - UE_template_ptr->scheduled_ul_bytes = 0; - RC.eNB[enb_mod_idP][CC_idP]->pusch_stats_bsr[UE_id][(frameP * 10) + subframeP] = (payload_ptr[0] & 0x3f); if (UE_id == UE_info->list.head) { @@ -620,8 +610,6 @@ rx_sdu(const module_id_t enb_mod_idP, UE_template_ptr->ul_buffer_info[LCGID1] + UE_template_ptr->ul_buffer_info[LCGID2] + UE_template_ptr->ul_buffer_info[LCGID3]; - UE_template_ptr->scheduled_ul_bytes = 0; - LOG_D(MAC, "[eNB %d] CC_id %d MAC CE_LCID %d: Received long BSR. Size is LCGID0 = %u LCGID1 = %u LCGID2 = %u LCGID3 = %u\n", enb_mod_idP, CC_idP, @@ -829,9 +817,6 @@ rx_sdu(const module_id_t enb_mod_idP, UE_template_ptr->ul_buffer_info[1] + UE_template_ptr->ul_buffer_info[2] + UE_template_ptr->ul_buffer_info[3]; - if (UE_template_ptr->estimated_ul_buffer == 0) { - UE_template_ptr->scheduled_ul_bytes = 0; - } //UE_template_ptr->estimated_ul_buffer += UE_template_ptr->estimated_ul_buffer / 4; } From 014b35bca3d7df980efc1a0afcd2dd6b0eaf9fba Mon Sep 17 00:00:00 2001 From: Laurent Date: Mon, 28 Dec 2020 10:07:08 +0100 Subject: [PATCH 135/160] to relaunch CI (aborted) --- openair1/PHY/TOOLS/nr_phy_scope.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index 78e34036a3..caef082116 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -383,7 +383,8 @@ void phy_scope_gNB(OAI_phy_scope_t *form, else remeberForm=form; - if (form==NULL) return; + if (form==NULL) + return; int i=0; @@ -766,11 +767,11 @@ void nrUEinitScope(PHY_VARS_NR_UE *ue) { void nrscope_autoinit(void *dataptr) { AssertFatal( (IS_SOFTMODEM_GNB_BIT||IS_SOFTMODEM_5GUE_BIT),"Scope cannot find NRUE or GNB context"); - + if (IS_SOFTMODEM_GNB_BIT) - gNBinitScope(dataptr); + gNBinitScope(dataptr); else - nrUEinitScope(dataptr); + nrUEinitScope(dataptr); } // Kept to put back the functionality soon #if 0 From c4a91bcc627e82df8ed0e0fe30945e8d182d9c5a Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 29 Dec 2020 19:00:51 +0100 Subject: [PATCH 136/160] scope, dirty replay --- executables/nr-ue.c | 11 +- openair1/PHY/TOOLS/nr_phy_scope.c | 319 +++++++++++++------ openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 5 +- openair2/RRC/NR_UE/rrc_UE.c | 5 + targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 6 + 5 files changed, 249 insertions(+), 97 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 8192546eb7..f2345a08b4 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -745,14 +745,13 @@ void *UE_thread(void *arg) { if (tmp->proc.decoded_frame_rx != -1) decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx); - //decoded_frame_rx=tmp->proc.decoded_frame_rx; + else + decoded_frame_rx=-1; pushNotifiedFIFO_nothreadSafe(&freeBlocks,res); } - if ( (decoded_frame_rx != curMsg->proc.frame_rx) && - (((decoded_frame_rx+1) % MAX_FRAME_NUMBER) != curMsg->proc.frame_rx) && - (((decoded_frame_rx+2) % MAX_FRAME_NUMBER) != curMsg->proc.frame_rx)) + if ( decoded_frame_rx>0 && decoded_frame_rx != curMsg->proc.frame_rx) LOG_E(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n", decoded_frame_rx, curMsg->proc.frame_rx ); @@ -781,7 +780,7 @@ void *UE_thread(void *arg) { msgToPush->key=slot_nr; pushTpool(Tpool, msgToPush); - if (IS_SOFTMODEM_RFSIM || IS_SOFTMODEM_NOS1) { //getenv("RFSIMULATOR") + if ( getenv("RFSIMULATOR") ||IS_SOFTMODEM_RFSIM || IS_SOFTMODEM_NOS1) { //getenv("RFSIMULATOR") // FixMe: Wait previous thread is done, because race conditions seems too bad // in case of actual RF board, the overlap between threads mitigate the issue // We must receive one message, that proves the slot processing is done @@ -791,6 +790,8 @@ void *UE_thread(void *arg) { if (tmp->proc.decoded_frame_rx != -1) decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx); + else + decoded_frame_rx=-1; //decoded_frame_rx=tmp->proc.decoded_frame_rx; pushNotifiedFIFO_nothreadSafe(&freeBlocks,res); diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index 78e34036a3..eb4620096e 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -30,16 +30,13 @@ #include #define TPUT_WINDOW_LENGTH 100 + #define localBuff(NaMe,SiZe) float NaMe[SiZe]; memset(NaMe,0,sizeof(NaMe)); + int otg_enabled; -FL_COLOR rx_antenna_colors[4] = {FL_RED,FL_BLUE,FL_GREEN,FL_YELLOW}; - -float tput_time_enb[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; -float tput_enb[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; -float tput_time_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; -float tput_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; -float tput_ue_max[NUMBER_OF_UE_MAX] = {0}; +const FL_COLOR rx_antenna_colors[4] = {FL_RED,FL_BLUE,FL_GREEN,FL_YELLOW}; +const FL_COLOR water_colors[4] = {FL_BLUE,FL_GREEN,FL_YELLOW,FL_RED}; typedef struct { int16_t r; @@ -49,10 +46,17 @@ typedef struct { typedef struct OAIgraph { FL_OBJECT *graph; + FL_OBJECT *text; float maxX; float maxY; float minX; float minY; + int x; + int y; + int w; + int h; + int waterFallh; + double *waterFallAvg; int iteration; void (*gNBfunct) (struct OAIgraph *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id); void (*nrUEfunct)(struct OAIgraph *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id); @@ -94,38 +98,57 @@ static void dl_traffic_on_off( FL_OBJECT *button, long arg) { } #endif -static FL_OBJECT *commonGraph( int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { - FL_OBJECT *graph; - graph=fl_add_xyplot(type, x, y, w, h, label); - fl_set_object_lcolor(graph, FL_WHITE ); // Label color - fl_set_object_color(graph, FL_BLACK, pointColor); - fl_set_xyplot_symbol(graph, -1, drawsymbol); - return graph; +#define WATERFALL 10000 + +static void commonGraph(OAIgraph_t *graph, int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { + if (type==WATERFALL) { + graph->waterFallh=h-15; + graph->waterFallAvg=malloc(sizeof(*graph->waterFallAvg) * graph->waterFallh); + for (int i=0; i< graph->waterFallh; i++) + graph->waterFallAvg[i]=0; + + graph->graph=fl_add_canvas(FL_NORMAL_CANVAS, x, y, w, graph->waterFallh, label); + graph->text=fl_add_text(FL_NORMAL_TEXT, x, y+graph->waterFallh, w, 15, label); + fl_set_object_lcolor(graph->text,FL_WHITE); + fl_set_object_color(graph->text, FL_BLACK, FL_BLACK); + fl_set_object_lalign(graph->text, FL_ALIGN_CENTER ); + } else { + graph->graph=fl_add_xyplot(type, x, y, w, h, label); + fl_set_object_lcolor(graph->graph, FL_WHITE ); // Label color + fl_set_object_color(graph->graph, FL_BLACK, pointColor); + + for (int i=0; i< FL_MAX_XYPLOTOVERLAY; i++) + fl_set_xyplot_symbol(graph->graph, i, drawsymbol); + } + + graph->x=x; + graph->y=y; + graph->w=w; + graph->h=h; + graph->maxX=0; + graph->maxY=0; + graph->minX=0; + graph->minY=0; + + + graph->iteration=0; } static OAIgraph_t gNBcommonGraph( void (*funct) (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id), int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { OAIgraph_t graph; - graph.graph=commonGraph(type, x, y, w, h, label, pointColor); + commonGraph(&graph, type, x, y, w, h, label, pointColor); graph.gNBfunct=funct; graph.nrUEfunct=NULL; - graph.maxX=0; - graph.maxY=0; - graph.minX=0; - graph.minY=0; return graph; } static OAIgraph_t nrUEcommonGraph( void (*funct) (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id), int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { OAIgraph_t graph; - graph.graph=commonGraph(type, x, y, w, h, label, pointColor); + commonGraph(&graph, type, x, y, w, h, label, pointColor); graph.gNBfunct=NULL; graph.nrUEfunct=funct; - graph.maxX=0; - graph.maxY=0; - graph.minX=0; - graph.minY=0; return graph; } @@ -140,11 +163,39 @@ static void setRange(OAIgraph_t *graph, float minX, float maxX, float minY, floa } } -static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int layer, int NoAutoScale) { - if (layer==0) - fl_set_xyplot_data(graph->graph,x,y,len,"","",""); - else - fl_add_xyplot_overlay(graph->graph,layer,x,y,len,rx_antenna_colors[layer]); +static void oai_xygraph_getbuff(OAIgraph_t *graph, float **x, float **y, int len, int layer) { + float *old_x; + float *old_y; + int old_len=-1; + //LOG_E(HW,"enter oai_xygraph_getbuff, it=%d\n",graph->iteration); + + if (graph->iteration >1) + fl_get_xyplot_data_pointer(graph->graph, layer, &old_x, &old_y, &old_len); + + if (old_len != len) { + LOG_W(HW,"allocating graph of %d scope\n", len); + float values[len]; + float time[len]; + + // make time in case we will use it + for (int i=0; igraph,time,values,len,"","",""); + else + fl_add_xyplot_overlay(graph->graph,layer,time,values,len,rx_antenna_colors[layer]); + + fl_get_xyplot_data_pointer(graph->graph, layer, &old_x, &old_y, &old_len); + AssertFatal(old_len==len,""); + } + + *x=old_x; + *y=old_y; +} + +static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int layer, boolean_t NoAutoScale) { + fl_redraw_object(graph->graph); if ( NoAutoScale && graph->iteration%NoAutoScale == 0) { float maxX=0, maxY=0, minX=0, minY=0; @@ -156,46 +207,87 @@ static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int laye minY=min(minY,y[k]); } - setRange(graph,minX,maxX, minY, maxY); + setRange(graph, minX-5, maxX+5, minY-5, maxY+5); } graph->iteration++; } +static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const int datasize) { + fl_winset(FL_ObjWin(graph->graph)); + const int samplesPerPixel=datasize/graph->w; + int row=graph->iteration%(graph->waterFallh); + double avg=0; + + for (int i=0; i waterFallh; i++) + avg+=graph->waterFallAvg[i]; + + avg/=graph->waterFallh; + graph->waterFallAvg[row]=0; + + for (int pix=0; pixw; pix++) { + scopeSample_t *end=values+(pix+1)*samplesPerPixel; + end-=2; + AssertFatal(end <= values+datasize,"diff : %ld", end-values+datasize); + double val=0; + + for (scopeSample_t *s=values+(pix)*samplesPerPixel; + s waterFallAvg[row]+=val/graph->w; + int col=0; + + if (val > avg*2 ) + col=1; + + if (val > avg*10 ) + col=2; + + if (val > avg*100 ) + col=3; + + fl_point(pix, graph->iteration%(graph->waterFallh), water_colors[col]); + } + + fl_set_object_label_f(graph->text, "average I/Q module: %4.1f", sqrt(avg)); + graph->iteration++; +} + static void genericLogPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) { - float *values=malloc(len*sizeof(*values)); - float *time=malloc(len*sizeof(*time)); + float *values, *time; + oai_xygraph_getbuff(graph, &time, &values, len, 0); for (int ant=0; antframe_parms; + //use 1st antenna + genericWaterFall(graph, (scopeSample_t *)phy_vars_ru->common.rxdata[0], frame_parms->samples_per_frame); +} + +/* replaced by waterfall static void timeSignal (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, const int nb_UEs) { // Received signal in time domain of receive antenna 0 if (!phy_vars_ru->common.rxdata) @@ -213,11 +312,12 @@ static void timeSignal (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy (const scopeSample_t **)phy_vars_ru->common.rxdata, frame_parms->samples_per_frame); } +*/ static void timeResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { const int len=2*phy_vars_gnb->frame_parms.ofdm_symbol_size; - float values[len]; - float time[len]; + float *values, *time; + oai_xygraph_getbuff(graph, &time, &values, len, 0); const int ant=0; // display antenna 0 for each UE for (int ue=0; ueframe_parms; + //use 1st antenna + genericWaterFall(graph, (scopeSample_t *)phy_vars_ru->common.rxdataF[0], frame_parms->samples_per_frame_wCP); +} + +/* static void frequencyResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; genericLogPowerPerAntena(graph, frame_parms->nb_antennas_rx, (const scopeSample_t **)phy_vars_ru->common.rxdataF, frame_parms->samples_per_slot_wCP); } +*/ static void puschLLR (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { //int Qm = 2; int coded_bits_per_codeword =3*8*6144+12; // (8*((3*8*6144)+12)); // frame_parms->N_RB_UL*12*Qm*frame_parms->symbols_per_tti; - float llr[coded_bits_per_codeword]; - float bit[coded_bits_per_codeword]; for (int ue=0; uepusch_vars[ue]->llr; + float *llr, *bit; + oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword, ue); if (pusch_llr) { for (int i=0; iframe_parms; int sz=frame_parms->N_RB_UL*12*frame_parms->symbols_per_slot; - float I[sz], Q[sz]; for (int ue=0; uepusch_vars[ue]->rxdataF_comp[0]; + float *I, *Q; + oai_xygraph_getbuff(graph, &I, &Q, sz, ue); if (pusch_comp) { for (int k=0; kgraph[0] = gNBcommonGraph( timeSignal, FL_NORMAL_XYPLOT, 0, curY, 400, 100, - "Received Signal (Time-Domain, dB)", FL_RED ); + fdui->graph[0] = gNBcommonGraph( gNBWaterFall, WATERFALL, 0, curY, 400, 100, + "Received Signal (Time-Domain, one frame)", FL_RED ); // Time-domain channel response fdui->graph[1] = gNBcommonGraph( timeResponse, FL_NORMAL_XYPLOT, 410, curY, 400, 100, "SRS Frequency Response (samples, abs)", FL_RED ); - fl_get_object_bbox(fdui->graph[0].graph,&x, &y,&w, &h); + fl_get_object_bbox(fdui->graph[1].graph,&x, &y,&w, &h); curY+=h; // Frequency-domain channel response - fdui->graph[2] = gNBcommonGraph( frequencyResponse, FL_NORMAL_XYPLOT, 0, curY, 800, 100, - "Channel Frequency Response (RE, dB)", FL_RED ); + fdui->graph[2] = gNBcommonGraph( gNBfreqWaterFall, WATERFALL, 0, curY, 800, 100, + "Channel Frequency domain (RE, one frame)", FL_RED ); fl_get_object_bbox(fdui->graph[2].graph,&x, &y,&w, &h); - curY+=h; + curY+=h+15; // LLR of PUSCH fdui->graph[3] = gNBcommonGraph( puschLLR, FL_POINTS_XYPLOT, 0, curY, 500, 200, "PUSCH Log-Likelihood Ratios (LLR, mag)", FL_YELLOW ); @@ -376,14 +486,15 @@ void phy_scope_gNB(OAI_phy_scope_t *form, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id) { - static OAI_phy_scope_t *remeberForm=NULL; + static OAI_phy_scope_t *rememberForm=NULL; if (form==NULL) - form=remeberForm; + form=rememberForm; else - remeberForm=form; + rememberForm=form; - if (form==NULL) return; + if (form==NULL) + return; int i=0; @@ -392,7 +503,7 @@ void phy_scope_gNB(OAI_phy_scope_t *form, i++; } - fl_check_forms(); + //fl_check_forms(); } static void *scope_thread_gNB(void *arg) { @@ -406,7 +517,9 @@ static void *scope_thread_gNB(void *arg) { pthread_attr_getstacksize(&atr, &stksize); pthread_attr_setstacksize(&atr,32*1024*1024 ); sleep(3); // no clean interthread barriers - fl_initialize (p->argc, p->argv, NULL, 0, 0); + int fl_argc=1; + char *name="5G-gNB-scope"; + fl_initialize (&fl_argc, &name, NULL, 0, 0); int nb_ue=min(NUMBER_OF_UE_MAX, scope_enb_num_ue); OAI_phy_scope_t *form_gnb = create_phy_scope_gnb(); @@ -425,12 +538,21 @@ void gNBinitScope(scopeParms_t *p) { threadCreate(&forms_thread, scope_thread_gNB, &parms, "scope", -1, OAI_PRIORITY_RT_LOW); } +static void ueWaterFall (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { + // Received signal in time domain of receive antenna 0 + genericWaterFall(graph, + (scopeSample_t *) phy_vars_ue->common_vars.rxdata[0], + phy_vars_ue->frame_parms.samples_per_frame); +} + +/* replaced by waterfall static void ueTimeResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // Received signal in time domain of receive antenna 0 genericLogPowerPerAntena(graph, phy_vars_ue->frame_parms.nb_antennas_rx, (const scopeSample_t **) phy_vars_ue->common_vars.rxdata, phy_vars_ue->frame_parms.samples_per_frame); } +*/ static void ueChannelResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // Channel Impulse Response @@ -439,6 +561,15 @@ static void ueChannelResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, phy_vars_ue->frame_parms.ofdm_symbol_size>>3); } +static void ueFreqWaterFall (OAIgraph_t *graph,PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id ) { + NR_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->frame_parms; + //use 1st antenna + genericWaterFall(graph, + (scopeSample_t *)phy_vars_ue->common_vars.common_vars_rx_data_per_thread[0].rxdataF[0], + frame_parms->samples_per_slot_wCP); +} + +/* static void uePbchFrequencyResp (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // Channel Frequency Response (includes 5 complex sample for filter) if (!phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates) @@ -449,12 +580,13 @@ static void uePbchFrequencyResp (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue uint8_t nb_antennas_tx = frame_parms->nb_antenna_ports_gNB; scopeSample_t **chest_f = (scopeSample_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates; int ind = 0; - float chest_f_abs[frame_parms->ofdm_symbol_size]; - float freq[frame_parms->ofdm_symbol_size]; + float *freq, *chest_f_abs; + oai_xygraph_getbuff(graph, &freq, &chest_f_abs, frame_parms->ofdm_symbol_size, 0); for (int atx=0; atxofdm_symbol_size; k++) { freq[ind] = (float)ind; chest_f_abs[ind] = (short)10*log10(1.0+SquaredNorm(chest_f[(atx<<1)+arx][6144+k])); @@ -471,6 +603,7 @@ static void uePbchFrequencyResp (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue //fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR); oai_xygraph(graph,freq,chest_f_abs,frame_parms->ofdm_symbol_size,0,10); } +*/ static void uePbchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PBCH LLRs @@ -478,11 +611,11 @@ static void uePbchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_ return; int16_t *pbch_llr = (int16_t *) phy_vars_ue->pbch_vars[eNB_id]->llr; - float llr_pbch[864], bit_pbch[864]; + float *llr_pbch, *bit_pbch; + oai_xygraph_getbuff(graph, &bit_pbch, &llr_pbch, 864, 0); for (int i=0; i<864; i++) { llr_pbch[i] = (float) pbch_llr[i]; - bit_pbch[i] = (float) i; } oai_xygraph(graph,bit_pbch,llr_pbch,864,0,10); @@ -494,8 +627,8 @@ static void uePbchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i return; scopeSample_t *pbch_comp = (scopeSample_t *) phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0]; - localBuff(I,180*3); - localBuff(Q,180*3); + float *I, *Q; + oai_xygraph_getbuff(graph, &I, &Q, 180*3, 0); int first_symbol=1; int base=0; @@ -517,6 +650,7 @@ static void uePbchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i base+=nb_re; } + AssertFatal(base <= 180*3,""); oai_xygraph(graph,I,Q,base,0,10); } @@ -528,8 +662,8 @@ static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_ int num_re = 4*273*12; // 12*frame_parms->N_RB_DL*num_pdcch_symbols int Qm = 2; int coded_bits_per_codeword = num_re*Qm; - localBuff(llr,coded_bits_per_codeword*RX_NB_TH_MAX); - localBuff(bit,coded_bits_per_codeword*RX_NB_TH_MAX); + float *llr, *bit; + oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword*RX_NB_TH_MAX, 0); int base=0; for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) { @@ -537,12 +671,12 @@ static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_ for (int i=0; iN_RB_DL*num_pdcch_symbols - localBuff(I,nb*RX_NB_TH_MAX); - localBuff(Q,nb*RX_NB_TH_MAX); + float *I, *Q; + oai_xygraph_getbuff(graph, &I, &Q, nb*RX_NB_TH_MAX, 0); int base=0; for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) { @@ -567,6 +701,7 @@ static void uePcchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i base+=nb; } + AssertFatal(base <= nb*RX_NB_TH_MAX, ""); oai_xygraph(graph,I,Q,base,0,10); } @@ -578,8 +713,8 @@ static void uePdschLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB int num_re = 4500; int Qm = 2; int coded_bits_per_codeword = num_re*Qm; - localBuff(llr,coded_bits_per_codeword*RX_NB_TH_MAX); - localBuff(bit,coded_bits_per_codeword*RX_NB_TH_MAX); + float *llr, *bit; + oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword*RX_NB_TH_MAX, 0); int base=0; for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) { @@ -593,6 +728,7 @@ static void uePdschLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB base+=coded_bits_per_codeword; } + AssertFatal(base <= coded_bits_per_codeword*RX_NB_TH_MAX, ""); //fl_set_xyplot_xbounds(form->pdsch_llr,0,coded_bits_per_codeword); oai_xygraph(graph,bit,llr,base,0,10); } @@ -604,9 +740,11 @@ static void uePdschIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_ NR_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms; int sz=7*2*frame_parms->N_RB_DL*12; // size of the malloced buffer - localBuff(I,sz*RX_NB_TH_MAX); - localBuff(Q,sz*RX_NB_TH_MAX); + float *I, *Q; + oai_xygraph_getbuff(graph, &I, &Q, sz*RX_NB_TH_MAX, 0); int base=0; + memset(I+base, 0, sz*RX_NB_TH_MAX * sizeof(*I)); + memset(Q+base, 0, sz*RX_NB_TH_MAX * sizeof(*Q)); for (int thr=0 ; thr < RX_NB_TH_MAX ; thr ++ ) { scopeSample_t *pdsch_comp = (scopeSample_t *) phy_vars_ue->pdsch_vars[thr][eNB_id]->rxdataF_comp0[0]; @@ -619,11 +757,16 @@ static void uePdschIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_ base+=sz; } - oai_xygraph(graph,I,Q,base,0,10); + AssertFatal(base <= sz*RX_NB_TH_MAX, ""); + oai_xygraph(graph,I,Q,sz*RX_NB_TH_MAX,0,10); } static void uePdschThroughput (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { /* + float tput_time_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; + float tput_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; + float tput_ue_max[NUMBER_OF_UE_MAX] = {0}; + // PDSCH Throughput memmove( tput_time_ue[UE_id], &tput_time_ue[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) ); @@ -652,18 +795,18 @@ static OAI_phy_scope_t *create_phy_scope_nrue( int ID ) { fl_set_object_color( obj, FL_BLACK, FL_BLACK ); int curY=0,x,y,w,h; // Received signal - fdui->graph[0] = nrUEcommonGraph(ueTimeResponse, - FL_NORMAL_XYPLOT, 0, curY, 400, 100, "Received Signal (Time-Domain, dB)", FL_RED ); + fdui->graph[0] = nrUEcommonGraph(ueWaterFall, + WATERFALL, 0, curY, 400, 100, "Received Signal (Time-Domain, one frame)", FL_RED ); // Time-domain channel response fdui->graph[1] = nrUEcommonGraph(ueChannelResponse, FL_NORMAL_XYPLOT, 400, curY, 400, 100, "Channel Impulse Response (samples, abs)", FL_RED ); - fl_get_object_bbox(fdui->graph[0].graph,&x, &y,&w, &h); + fl_get_object_bbox(fdui->graph[1].graph,&x, &y,&w, &h); curY+=h; // Frequency-domain channel response - fdui->graph[2] = nrUEcommonGraph(uePbchFrequencyResp, - FL_IMPULSE_XYPLOT, 0, curY, 800, 100, "Channel Frequency data (RE, dB)", FL_RED ); + fdui->graph[2] = nrUEcommonGraph(ueFreqWaterFall, + WATERFALL, 0, curY, 800, 100, "Channel Frequency (RE, one slot)", FL_RED ); fl_get_object_bbox(fdui->graph[2].graph,&x, &y,&w, &h); - curY+=h; + curY+=h+15; // LLR of PBCH fdui->graph[3] = nrUEcommonGraph(uePbchLLR, FL_POINTS_XYPLOT, 0, curY, 500, 100, "PBCH Log-Likelihood Ratios (LLR, mag)", FL_GREEN ); @@ -733,7 +876,7 @@ void phy_scope_nrUE(OAI_phy_scope_t *form, i++; } - fl_check_forms(); + //fl_check_forms(); } @@ -766,11 +909,11 @@ void nrUEinitScope(PHY_VARS_NR_UE *ue) { void nrscope_autoinit(void *dataptr) { AssertFatal( (IS_SOFTMODEM_GNB_BIT||IS_SOFTMODEM_5GUE_BIT),"Scope cannot find NRUE or GNB context"); - + if (IS_SOFTMODEM_GNB_BIT) - gNBinitScope(dataptr); + gNBinitScope(dataptr); else - nrUEinitScope(dataptr); + nrUEinitScope(dataptr); } // Kept to put back the functionality soon #if 0 @@ -799,8 +942,6 @@ static void reset_stats_gNB(FL_OBJECT *button, } } - - static FD_stats_form *create_form_stats_form(int ID) { FL_OBJECT *obj; FD_stats_form *fdui = calloc(( sizeof *fdui ),1); @@ -820,7 +961,3 @@ static FD_stats_form *create_form_stats_form(int ID) { return fdui; } #endif - - - - diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 4a9de9b559..12eb853595 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1236,7 +1236,10 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, rx_ind.rx_indication_body[0].pdsch_pdu.pdu = dlsch0->harq_processes[harq_pid]->b; rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length = dlsch0->harq_processes[harq_pid]->TBS>>3; - LOG_D(PHY, "PDU length in bits: %d, in bytes: %d \n", dlsch0->harq_processes[harq_pid]->TBS, rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length); + LOG_W(PHY, "PDU length in bits: %d, in bytes: %d \n", dlsch0->harq_processes[harq_pid]->TBS, rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length); + for (int i=0; i< rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length ; i++) + printf("%x:", dlsch0->harq_processes[harq_pid]->b[i]); + printf ("ret: %d\n", ret); rx_ind.number_pdus = 1; // send to mac diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 66d600db46..89d298af08 100755 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1499,7 +1499,12 @@ int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index SEQUENCE_free(&asn_DEF_NR_BCCH_BCH_Message, (void *)sib1, 1 ); } sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; + if (*(int64_t*)sib1 != 1) { + printf("%llx\n", *(int64_t*)sib1); xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)sib1); + } + else + LOG_E(PHY, "sib1 is starting by 8 times 0\n"); } return 0; diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index dd29d01fae..e260bf3540 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -657,6 +657,12 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp } if (samples_received == nsamps) s->wait_for_first_pps=0; } + if ( getenv("recorded") ) { + static int h=-1; + if (h==-1) + h=open(getenv("recorded"), O_RDONLY, 0); + read(h, buff_tmp[0], nsamps*4); + } // bring RX data into 12 LSBs for softmodem RX for (int i=0; i Date: Sat, 2 Jan 2021 18:58:13 +0100 Subject: [PATCH 137/160] add raw capture from UHD examples and fix a rfsim bug --- executables/nr-ue.c | 2 +- openair1/PHY/TOOLS/nr_phy_scope.c | 81 +++++++++++----- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 5 +- openair2/RRC/NR_UE/rrc_UE.c | 6 +- targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp | 6 -- targets/ARCH/rfsimulator/simulator.c | 87 +++++++++-------- targets/ARCH/rfsimulator/stored_node.c | 98 +++++++++++++++++--- 7 files changed, 195 insertions(+), 90 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index f2345a08b4..a0dfa7beca 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -780,7 +780,7 @@ void *UE_thread(void *arg) { msgToPush->key=slot_nr; pushTpool(Tpool, msgToPush); - if ( getenv("RFSIMULATOR") ||IS_SOFTMODEM_RFSIM || IS_SOFTMODEM_NOS1) { //getenv("RFSIMULATOR") + if ( IS_SOFTMODEM_RFSIM || IS_SOFTMODEM_NOS1) { //getenv("RFSIMULATOR") // FixMe: Wait previous thread is done, because race conditions seems too bad // in case of actual RF board, the overlap between threads mitigate the issue // We must receive one message, that proves the slot processing is done diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index eb4620096e..50a43282dc 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -30,7 +30,7 @@ #include #define TPUT_WINDOW_LENGTH 100 - +#define ScaleZone 4 #define localBuff(NaMe,SiZe) float NaMe[SiZe]; memset(NaMe,0,sizeof(NaMe)); int otg_enabled; @@ -57,6 +57,7 @@ typedef struct OAIgraph { int h; int waterFallh; double *waterFallAvg; + boolean_t initDone; int iteration; void (*gNBfunct) (struct OAIgraph *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id); void (*nrUEfunct)(struct OAIgraph *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id); @@ -104,8 +105,9 @@ static void commonGraph(OAIgraph_t *graph, int type, FL_Coord x, FL_Coord y, FL_ if (type==WATERFALL) { graph->waterFallh=h-15; graph->waterFallAvg=malloc(sizeof(*graph->waterFallAvg) * graph->waterFallh); - for (int i=0; i< graph->waterFallh; i++) - graph->waterFallAvg[i]=0; + + for (int i=0; i< graph->waterFallh; i++) + graph->waterFallAvg[i]=0; graph->graph=fl_add_canvas(FL_NORMAL_CANVAS, x, y, w, graph->waterFallh, label); graph->text=fl_add_text(FL_NORMAL_TEXT, x, y+graph->waterFallh, w, 15, label); @@ -129,8 +131,7 @@ static void commonGraph(OAIgraph_t *graph, int type, FL_Coord x, FL_Coord y, FL_ graph->maxY=0; graph->minX=0; graph->minY=0; - - + graph->initDone=false; graph->iteration=0; } @@ -153,13 +154,24 @@ static OAIgraph_t nrUEcommonGraph( void (*funct) (OAIgraph_t *graph, PHY_VARS_NR } static void setRange(OAIgraph_t *graph, float minX, float maxX, float minY, float maxY) { - if ( maxX > graph->maxX || maxY > graph->maxY || minX < graph->minX || minY < graph->minY ) { + if ( maxX > graph->maxX || minX < graph->minX || + abs(maxX-graph->maxX)>abs(graph->maxX)/2 || + abs(maxX-graph->maxX)>abs(graph->maxX)/2 ) { + graph->maxX/=2; + graph->minX/=2; graph->maxX=max(graph->maxX,maxX); graph->minX=min(graph->minX,minX); + fl_set_xyplot_xbounds(graph->graph, graph->minX*1.2, graph->maxX*1.2); + } + + if ( maxY > graph->maxY || minY < graph->minY || + abs(maxY-graph->maxY)>abs(graph->maxY)/2 || + abs(maxY-graph->maxY)>abs(graph->maxY)/2 ) { + graph->maxY/=2; + graph->minY/=2; graph->maxY=max(graph->maxY,maxY); graph->minY=min(graph->minY,minY); - fl_set_xyplot_ybounds(graph->graph, graph->minY, graph->maxY); - fl_set_xyplot_xbounds(graph->graph, graph->minX, graph->maxX); + fl_set_xyplot_ybounds(graph->graph, graph->minY*1.2, graph->maxY*1.2); } } @@ -167,7 +179,6 @@ static void oai_xygraph_getbuff(OAIgraph_t *graph, float **x, float **y, int len float *old_x; float *old_y; int old_len=-1; - //LOG_E(HW,"enter oai_xygraph_getbuff, it=%d\n",graph->iteration); if (graph->iteration >1) fl_get_xyplot_data_pointer(graph->graph, layer, &old_x, &old_y, &old_len); @@ -213,16 +224,17 @@ static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int laye graph->iteration++; } -static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const int datasize) { +static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const int datasize, const int divisions, const char *label) { fl_winset(FL_ObjWin(graph->graph)); const int samplesPerPixel=datasize/graph->w; - int row=graph->iteration%(graph->waterFallh); + int displayPart=graph->waterFallh-ScaleZone; + int row=graph->iteration%displayPart; double avg=0; - for (int i=0; i waterFallh; i++) + for (int i=0; i < displayPart; i++) avg+=graph->waterFallAvg[i]; - avg/=graph->waterFallh; + avg/=displayPart; graph->waterFallAvg[row]=0; for (int pix=0; pixw; pix++) { @@ -249,10 +261,22 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in if (val > avg*100 ) col=3; - fl_point(pix, graph->iteration%(graph->waterFallh), water_colors[col]); + fl_point(pix, graph->iteration%displayPart, water_colors[col]); } - fl_set_object_label_f(graph->text, "average I/Q module: %4.1f", sqrt(avg)); + if (graph->initDone==false) { + for ( int i=0; i < graph->waterFallh; i++ ) + for ( int j = 0 ; j < graph->w ; j++ ) + fl_point(j, i, FL_BLACK); + + for ( int i=1; iwaterFallh; j++) + fl_point(i*(graph->w/divisions),j, FL_WHITE); + + graph->initDone=true; + } + + fl_set_object_label_f(graph->text, "%s, avg I/Q pow: %4.1f", label, sqrt(avg)); graph->iteration++; } @@ -298,7 +322,9 @@ static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const sc static void gNBWaterFall (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; //use 1st antenna - genericWaterFall(graph, (scopeSample_t *)phy_vars_ru->common.rxdata[0], frame_parms->samples_per_frame); + genericWaterFall(graph, (scopeSample_t *)phy_vars_ru->common.rxdata[0], + frame_parms->samples_per_frame, frame_parms->slots_per_frame, + "X axis:one frame in time"); } /* replaced by waterfall @@ -336,7 +362,9 @@ static void timeResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *p static void gNBfreqWaterFall (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; //use 1st antenna - genericWaterFall(graph, (scopeSample_t *)phy_vars_ru->common.rxdataF[0], frame_parms->samples_per_frame_wCP); + genericWaterFall(graph, (scopeSample_t *)phy_vars_ru->common.rxdataF[0], frame_parms->samples_per_frame_wCP, + frame_parms->slots_per_frame, + "X axis: Frequency domain, one frame"); } /* @@ -453,7 +481,7 @@ static OAI_phy_scope_t *create_phy_scope_gnb(void) { fdui->graph[2] = gNBcommonGraph( gNBfreqWaterFall, WATERFALL, 0, curY, 800, 100, "Channel Frequency domain (RE, one frame)", FL_RED ); fl_get_object_bbox(fdui->graph[2].graph,&x, &y,&w, &h); - curY+=h+15; + curY+=h+20; // LLR of PUSCH fdui->graph[3] = gNBcommonGraph( puschLLR, FL_POINTS_XYPLOT, 0, curY, 500, 200, "PUSCH Log-Likelihood Ratios (LLR, mag)", FL_YELLOW ); @@ -542,7 +570,9 @@ static void ueWaterFall (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eN // Received signal in time domain of receive antenna 0 genericWaterFall(graph, (scopeSample_t *) phy_vars_ue->common_vars.rxdata[0], - phy_vars_ue->frame_parms.samples_per_frame); + phy_vars_ue->frame_parms.samples_per_frame, + phy_vars_ue->frame_parms.slots_per_frame, + "X axis: one frame time"); } /* replaced by waterfall @@ -566,7 +596,9 @@ static void ueFreqWaterFall (OAIgraph_t *graph,PHY_VARS_NR_UE *phy_vars_ue, int //use 1st antenna genericWaterFall(graph, (scopeSample_t *)phy_vars_ue->common_vars.common_vars_rx_data_per_thread[0].rxdataF[0], - frame_parms->samples_per_slot_wCP); + frame_parms->samples_per_slot_wCP, + phy_vars_ue->frame_parms.slots_per_frame, + "X axis: one frame frequency" ); } /* @@ -629,6 +661,8 @@ static void uePbchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i scopeSample_t *pbch_comp = (scopeSample_t *) phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0]; float *I, *Q; oai_xygraph_getbuff(graph, &I, &Q, 180*3, 0); + memset(I,0,180*3*sizeof(*I)); + memset(Q,0,180*3*sizeof(*Q)); int first_symbol=1; int base=0; @@ -651,7 +685,7 @@ static void uePbchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i } AssertFatal(base <= 180*3,""); - oai_xygraph(graph,I,Q,base,0,10); + oai_xygraph(graph,I,Q,base,0, 10); } static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { @@ -806,7 +840,7 @@ static OAI_phy_scope_t *create_phy_scope_nrue( int ID ) { fdui->graph[2] = nrUEcommonGraph(ueFreqWaterFall, WATERFALL, 0, curY, 800, 100, "Channel Frequency (RE, one slot)", FL_RED ); fl_get_object_bbox(fdui->graph[2].graph,&x, &y,&w, &h); - curY+=h+15; + curY+=h+20; // LLR of PBCH fdui->graph[3] = nrUEcommonGraph(uePbchLLR, FL_POINTS_XYPLOT, 0, curY, 500, 100, "PBCH Log-Likelihood Ratios (LLR, mag)", FL_GREEN ); @@ -892,9 +926,12 @@ static void *nrUEscopeThread(void *arg) { OAI_phy_scope_t *form_nrue=create_phy_scope_nrue(0); while (!oai_exit) { + fl_freeze_form(form_nrue->phy_scope); phy_scope_nrUE(form_nrue, ue, 0,0); + fl_unfreeze_form(form_nrue->phy_scope); + fl_redraw_form(form_nrue->phy_scope); usleep(99*1000); } diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 12eb853595..4a9de9b559 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1236,10 +1236,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, rx_ind.rx_indication_body[0].pdsch_pdu.pdu = dlsch0->harq_processes[harq_pid]->b; rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length = dlsch0->harq_processes[harq_pid]->TBS>>3; - LOG_W(PHY, "PDU length in bits: %d, in bytes: %d \n", dlsch0->harq_processes[harq_pid]->TBS, rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length); - for (int i=0; i< rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length ; i++) - printf("%x:", dlsch0->harq_processes[harq_pid]->b[i]); - printf ("ret: %d\n", ret); + LOG_D(PHY, "PDU length in bits: %d, in bytes: %d \n", dlsch0->harq_processes[harq_pid]->TBS, rx_ind.rx_indication_body[0].pdsch_pdu.pdu_length); rx_ind.number_pdus = 1; // send to mac diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 89d298af08..41574cbe6d 100755 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1500,11 +1500,11 @@ int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index } sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; if (*(int64_t*)sib1 != 1) { - printf("%llx\n", *(int64_t*)sib1); - xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)sib1); + printf("%llx\n", *(int64_t*)sib1); + xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)sib1); } else - LOG_E(PHY, "sib1 is starting by 8 times 0\n"); + LOG_E(PHY, "sib1 is starting by 8 times 0\n"); } return 0; diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index e260bf3540..dd29d01fae 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -657,12 +657,6 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp } if (samples_received == nsamps) s->wait_for_first_pps=0; } - if ( getenv("recorded") ) { - static int h=-1; - if (h==-1) - h=open(getenv("recorded"), O_RDONLY, 0); - read(h, buff_tmp[0], nsamps*4); - } // bring RX data into 12 LSBs for softmodem RX for (int i=0; i",(cmdfunc_t)rfsimu_setchanmod_cmd,TELNETSRV_CMDFLAG_PUSHINTPOOLQ}, + {"setmodel","",(cmdfunc_t)rfsimu_setchanmod_cmd,TELNETSRV_CMDFLAG_PUSHINTPOOLQ}, {"","",NULL}, }; static telnetshell_vardef_t rfsimu_vardef[] = { {"",0,NULL} -}; +}; pthread_mutex_t Sockmutex; typedef struct complex16 sample_t; // 2*16 bits complex number @@ -170,11 +170,13 @@ void allocCirBuf(rfsimulator_state_t *bridge, int sock) { static bool init_done=false; if (!init_done) { - uint64_t rand; - FILE *h=fopen("/dev/random","r"); + uint64_t rand; + FILE *h=fopen("/dev/random","r"); + if ( 1 != fread(&rand,sizeof(rand),1,h) ) LOG_W(HW, "Simulator can't read /dev/random\n"); - fclose(h); + + fclose(h); randominit(rand); tableNor(rand); init_done=true; @@ -189,7 +191,6 @@ void allocCirBuf(rfsimulator_state_t *bridge, int sock) { bridge->chan_offset, // maybe used for TA bridge->chan_pathloss); // path_loss in dB set_channeldesc_owner(ptr->channel_model, RFSIMU_MODULEID); - random_channel(ptr->channel_model,false); } } @@ -317,25 +318,29 @@ void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) { } static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg) { - char *modelname=NULL; + char *modelname=NULL; int s = sscanf(buff,"%ms\n",&modelname); + if (s == 1) { int channelmod=modelid_fromname(modelname); + if (channelmod<0) prnt("ERROR: model %s unknown\n",modelname); else { - rfsimulator_state_t *t = (rfsimulator_state_t *)arg; - for (int i=0; ibuf[i]; + if (b->conn_sock >= 0 ) { channel_desc_t *newmodel=new_channel_desc_scm(t->tx_num_channels,t->rx_num_channels, - channelmod, - t->sample_rate, - t->tx_bw, - 30e-9, // TDL delay-spread parameter - t->chan_forgetfact, // forgetting_factor - t->chan_offset, // maybe used for TA - t->chan_pathloss); // path_loss in dB + channelmod, + t->sample_rate, + t->tx_bw, + 30e-9, // TDL delay-spread parameter + t->chan_forgetfact, // forgetting_factor + t->chan_offset, // maybe used for TA + t->chan_pathloss); // path_loss in dB set_channeldesc_owner(newmodel, RFSIMU_MODULEID); random_channel(newmodel,false); channel_desc_t *oldmodel=b->channel_model; @@ -346,8 +351,9 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, } } } else { - prnt("ERROR: no model specified\n"); + prnt("ERROR: no model specified\n"); } + free(modelname); return CMDSTATUS_FOUND; } @@ -368,7 +374,7 @@ sin_addr: }; bind(t->listen_sock, (struct sockaddr *)&addr, sizeof(addr)); AssertFatal(listen(t->listen_sock, 5) == 0, ""); - struct epoll_event ev={0}; + struct epoll_event ev= {0}; ev.events = EPOLLIN; ev.data.fd = t->listen_sock; AssertFatal(epoll_ctl(t->epollfd, EPOLL_CTL_ADD, t->listen_sock, &ev) != -1, ""); @@ -440,7 +446,7 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp if (t->lastWroteTS > timestamp+nsamps) LOG_E(HW,"Not supported to send Tx out of order (same in USRP) %lu, %lu\n", - t->lastWroteTS, timestamp); + t->lastWroteTS, timestamp); t->lastWroteTS=timestamp+nsamps; @@ -505,9 +511,9 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi if ( b->headerMode) blockSz=b->remainToTransfer; else - blockSz= b->transferPtr+b->remainToTransfer < b->circularBufEnd ? + blockSz= b->transferPtr + b->remainToTransfer <= b->circularBufEnd ? b->remainToTransfer : - b->circularBufEnd - 1 - b->transferPtr ; + b->circularBufEnd - b->transferPtr ; ssize_t sz=recv(fd, b->transferPtr, blockSz, MSG_DONTWAIT); @@ -523,7 +529,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi AssertFatal((b->remainToTransfer-=sz) >= 0, ""); b->transferPtr+=sz; - if (b->transferPtr==b->circularBufEnd - 1) + if (b->transferPtr==b->circularBufEnd ) b->transferPtr=(char *)b->circularBuf; // check the header and start block transfer @@ -552,14 +558,13 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi } } } else { - memset(b->circularBuf, 0, sampleToByte(CirSize,1)); - } + memset(b->circularBuf, 0, sampleToByte(CirSize,1)); + } if (b->lastReceivedTS != 0 && b->th.timestamp-b->lastReceivedTS < 1000) LOG_W(HW,"UEsock: %d gap of: %ld in reception\n", fd, b->th.timestamp-b->lastReceivedTS ); b->lastReceivedTS=b->th.timestamp; - } else if ( b->lastReceivedTS > b->th.timestamp && b->th.size == 1 ) { LOG_W(HW,"Received Rx/Tx synchro out of order\n"); b->trashingPacket=true; @@ -650,15 +655,15 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo // assuming this should have been done earlier if a Tx would exist pthread_mutex_unlock(&Sockmutex); struct complex16 v= {0}; - void *samplesVoid[t->tx_num_channels]; + void *dummyS[t->tx_num_channels]; for ( int i=0; i < t->tx_num_channels; i++) - samplesVoid[i]=(void *)&v; + dummyS[i]=(void *)&v; LOG_I(HW, "No samples Tx occured, so we send 1 sample to notify it: Tx:%lu, Rx:%lu\n", t->lastWroteTS, t->nextTimestamp); rfsimulator_write_internal(t, t->nextTimestamp, - samplesVoid, 1, + dummyS, 1, t->tx_num_channels, 1, true); } else { pthread_mutex_unlock(&Sockmutex); @@ -706,8 +711,9 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo // it seems legacy behavior is: never in UL, each frame in DL if (reGenerateChannel) random_channel(ptr->channel_model,0); + if (t->poll_telnetcmdq) - t->poll_telnetcmdq(t->telnetcmd_qid,t); + t->poll_telnetcmdq(t->telnetcmd_qid,t); for (int a=0; achannel_model != NULL ) // apply a channel model @@ -721,12 +727,13 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo else { // no channel modeling sample_t *out=(sample_t *)samplesVoid[a]; int nbAnt_tx = ptr->th.nbAnt;//number of Tx antennas + //LOG_I(HW, "nbAnt_tx %d\n",nbAnt_tx); for (int i=0; i < nsamps; i++) {//loop over nsamps - for (int a_tx=0; a_txcircularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].r; - out[i].i+=ptr->circularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].i; - } // end for a_tx + for (int a_tx=0; a_txcircularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].r; + out[i].i+=ptr->circularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].i; + } // end for a_tx } // end for i (number of samps) } // end of no channel modeling } // end for a (number of rx antennas) @@ -804,18 +811,20 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { rfsimulator->tx_bw=openair0_cfg->tx_bw; //randominit(0); set_taus_seed(0); - /* look for telnet server, if it is loaded, add the channel modeling commands to it */ + /* look for telnet server, if it is loaded, add the channel modeling commands to it */ add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME); - + if (addcmd != NULL) { - rfsimulator->poll_telnetcmdq = (poll_telnetcmdq_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_POLLCMDQ_FNAME); + rfsimulator->poll_telnetcmdq = (poll_telnetcmdq_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_POLLCMDQ_FNAME); addcmd("rfsimu",rfsimu_vardef,rfsimu_cmdarray); + for(int i=0; rfsimu_cmdarray[i].cmdfunc != NULL; i++) { - if ( rfsimu_cmdarray[i].qptr != NULL) { + if ( rfsimu_cmdarray[i].qptr != NULL) { rfsimulator->telnetcmd_qid = rfsimu_cmdarray[i].qptr; break; } - } - } + } + } + return 0; } diff --git a/targets/ARCH/rfsimulator/stored_node.c b/targets/ARCH/rfsimulator/stored_node.c index 73f6321ffe..daf0133af2 100644 --- a/targets/ARCH/rfsimulator/stored_node.c +++ b/targets/ARCH/rfsimulator/stored_node.c @@ -34,7 +34,8 @@ int fullread(int fd, void *_buf, int count) { while (count) { l = read(fd, buf, count); - if (l <= 0) return -1; + if (l <= 0) + return -1; count -= l; buf += l; @@ -43,6 +44,44 @@ int fullread(int fd, void *_buf, int count) { return ret; } +#define shift 4 +int32_t signal_energy(int32_t *input,uint32_t length) { + int32_t i; + int32_t temp,temp2; + register __m64 mm0,mm1,mm2,mm3; + __m64 *in = (__m64 *)input; + mm0 = _mm_setzero_si64();//pxor(mm0,mm0); + mm3 = _mm_setzero_si64();//pxor(mm3,mm3); + + for (i=0; i>1; i++) { + mm1 = in[i]; + mm2 = mm1; + mm1 = _m_pmaddwd(mm1,mm1); + mm1 = _m_psradi(mm1,shift);// shift any 32 bits blocs of the word by the value shift + mm0 = _m_paddd(mm0,mm1);// add the two 64 bits words 4 bytes by 4 bytes + // mm2 = _m_psrawi(mm2,shift_DC); + mm3 = _m_paddw(mm3,mm2);// add the two 64 bits words 2 bytes by 2 bytes + } + + mm1 = mm0; + mm0 = _m_psrlqi(mm0,32); + mm0 = _m_paddd(mm0,mm1); + temp = _m_to_int(mm0); + temp/=length; + temp<<=shift; // this is the average of x^2 + // now remove the DC component + mm2 = _m_psrlqi(mm3,32); + mm2 = _m_paddw(mm2,mm3); + mm2 = _m_pmaddwd(mm2,mm2); + temp2 = _m_to_int(mm2); + temp2/=(length*length); + // temp2<<=(2*shift_DC); + temp -= temp2; + _mm_empty(); + _m_empty(); + return((temp>0)?temp:1); +} + void fullwrite(int fd, void *_buf, int count) { char *buf = _buf; @@ -131,8 +170,8 @@ void setblocking(int sock, enum blocking_t active) { } int main(int argc, char *argv[]) { - if(argc != 4) { - printf("Need parameters: source file, server or destination IP, TCP port\n"); + if(argc < 4) { + printf("Need parameters: source file, server or destination IP, TCP port (4043), 'UL|DL' if raw 2*16bits format: UL for UL IQ, DL for DL IQs \n"); exit(1); } @@ -147,10 +186,21 @@ int main(int argc, char *argv[]) { serviceSock=client_start(argv[2],atoi(argv[3])); } + uint64_t typeStamp=ENB_MAGICDL_FDD; + boolean_t raw=false; + + if ( argc == 5 ) { + raw=true; + + if (strcmp(argv[4],"UL") == 0 ) + typeStamp=UE_MAGICDL_FDD; + } + samplesBlockHeader_t header; int bufSize=100000; void *buff=malloc(bufSize); - uint64_t readTS=0; + uint64_t timestamp=0; + const int blockSize=1000; while (1) { //Rewind the file to loop on the samples @@ -159,10 +209,21 @@ int main(int argc, char *argv[]) { // Read one block and send it setblocking(serviceSock, blocking); - AssertFatal(read(fd,&header,sizeof(header)), ""); + + if ( raw ) { + header.magic=typeStamp; + header.size=blockSize; + header.nbAnt=1; + header.timestamp=timestamp; + timestamp+=blockSize; + header.option_value=0; + header.option_flag=0; + } else { + AssertFatal(read(fd,&header,sizeof(header)), ""); + } + fullwrite(serviceSock, &header, sizeof(header)); int dataSize=sizeof(int32_t)*header.size*header.nbAnt; - uint64_t wroteTS=header.timestamp; if (dataSize>bufSize) { void *new_buff = realloc(buff, dataSize); @@ -176,21 +237,28 @@ int main(int argc, char *argv[]) { } AssertFatal(read(fd,buff,dataSize) == dataSize, ""); + + if (raw) // UHD shifts the 12 ADC values in MSB + for (int i=0; i 0 ) ; } return 0; From a6a56d23cbe5aad8ea0af7566e790e791bda8b29 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Wed, 6 Jan 2021 14:39:09 +0000 Subject: [PATCH 138/160] Fix in coreset0 transmission slot calculation --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 4 ++-- openair2/RRC/NR_UE/rrc_UE.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index d5076df6c8..6f3597a39e 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -3235,7 +3235,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC type0_PDCCH_CSS_config->number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; big_m = table_38213_13_11_c3[index_4lsb]; - uint32_t temp = (uint32_t)(big_o*pow(2, scs_pdcch)) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m); + uint32_t temp = (uint32_t)(big_o*scs_pdcch) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m); type0_PDCCH_CSS_config->n_c = temp / num_slot_per_frame; if((temp/num_slot_per_frame) & 0x1){ type0_PDCCH_CSS_config->sfn_c = SFN_C_MOD_2_EQ_1; @@ -3377,7 +3377,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC AssertFatal(type0_PDCCH_CSS_config->sfn_c!=SFN_C_IMPOSSIBLE,""); AssertFatal(type0_PDCCH_CSS_config->n_c!=UINT_MAX,""); - type0_PDCCH_CSS_config->n_0 = ((uint32_t)(big_o*pow(2, scs_pdcch)) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m))%num_slot_per_frame; + type0_PDCCH_CSS_config->n_0 = ((uint32_t)(big_o*scs_pdcch) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m))%num_slot_per_frame; type0_PDCCH_CSS_config->cset_start_rb = ssb_offset_point_a - type0_PDCCH_CSS_config->rb_offset; return 0; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 41574cbe6d..3b49b4c801 100755 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1500,7 +1500,7 @@ int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index } sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; if (*(int64_t*)sib1 != 1) { - printf("%llx\n", *(int64_t*)sib1); + printf("%lx\n", *(int64_t*)sib1); xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)sib1); } else From 223c8b9ad96222169efc63c86da78a037a20b4c5 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 7 Jan 2021 18:28:17 +0000 Subject: [PATCH 139/160] Fix REG mapping type for coreset0 --- cmake_targets/CMakeLists.txt | 215 +++++++++++++++-------------- openair1/PHY/NR_TRANSPORT/nr_dci.c | 4 +- openair2/RRC/NR/rrc_gNB_reconfig.c | 2 + openair2/RRC/NR_UE/rrc_UE.c | 2 +- 4 files changed, 113 insertions(+), 110 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 0b9d925017..87edf4006f 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -24,113 +24,6 @@ cmake_minimum_required (VERSION 3.0) -# System packages that are required -# We use either the cmake buildin, in ubuntu are in: /usr/share/cmake*/Modules/ -# or cmake provide a generic interface to pkg-config that widely used -################################### -include(FindPkgConfig) - -pkg_search_module(LIBXML2 libxml-2.0 REQUIRED) -include_directories(${LIBXML2_INCLUDE_DIRS}) - -pkg_search_module(LIBXSLT libxslt REQUIRED) -include_directories(${LIBXSLT_INCLUDE_DIRS}) - -pkg_search_module(OPENSSL openssl REQUIRED) -include_directories(${OPENSSL_INCLUDE_DIRS}) - -pkg_search_module(CONFIG libconfig REQUIRED) -include_directories(${CONFIG_INCLUDE_DIRS}) - -pkg_search_module(CRYPTO libcrypto REQUIRED) -include_directories(${CRYPTO_INCLUDE_DIRS}) - -#use native cmake method as this package is not in pkg-config -if (${RF_BOARD} STREQUAL "OAI_USRP") - find_package(Boost REQUIRED) - include_directories(${LIBBOOST_INCLUDE_DIR}) - -elseif (${RF_BOARD} STREQUAL "OAI_IRIS") - include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/") - include_directories("/usr/local/include/") - set(HW_SOURCE ${HW_SOURCE} - ${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp) - LINK_DIRECTORIES("/usr/local/lib") - set(option_HW_lib "-lSoapySDR -rdynamic -ldl") - -endif (${RF_BOARD} STREQUAL "OAI_USRP") - -pkg_search_module(OPENPGM openpgm-5.1 openpgm-5.2) -if(NOT ${OPENPGM_FOUND}) - message("PACKAGE openpgm-5.1 is required by binaries such as oaisim: will fail later if this target is built") -else() - include_directories(${OPENPGM_INCLUDE_DIRS}) -endif() - -pkg_search_module(NETTLE nettle) -if(NOT ${NETTLE_FOUND}) - message( FATAL_ERROR "PACKAGE nettle not found: some targets will fail. Run build_oai -I again!") -else() - include_directories(${NETTLE_INCLUDE_DIRS}) -endif() - -message ("NETTLE VERSION_INSTALLED = ${NETTLE_VERSION}") - -string(REGEX REPLACE "([0-9]+).*" "\\1" NETTLE_VERSION_MAJOR ${NETTLE_VERSION}) -string(REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" NETTLE_VERSION_MINOR ${NETTLE_VERSION}) -message ("NETTLE_VERSION_MAJOR = ${NETTLE_VERSION_MAJOR}") -message ("NETTLE_VERSION_MINOR = ${NETTLE_VERSION_MINOR}") - -if ("${NETTLE_VERSION_MAJOR}" STREQUAL "" OR "${NETTLE_VERSION_MINOR}" STREQUAL "") - message( FATAL_ERROR "The nettle version not detected properly. Try to run build_oai -I again" ) -endif() - -add_definitions("-DNETTLE_VERSION_MAJOR=${NETTLE_VERSION_MAJOR}") -add_definitions("-DNETTLE_VERSION_MINOR=${NETTLE_VERSION_MINOR}") - -pkg_search_module(XPM xpm) -if(NOT ${XPM_FOUND}) - message("PACKAGE xpm not found: some targets will fail") -else() - include_directories(${XPM_INCLUDE_DIRS}) -endif() - -# Atlas is required by some packages, but not found in pkg-config -# So, here are some hacks here. Hope this gets fixed in future! -if(EXISTS "/usr/include/atlas/cblas.h" OR EXISTS "/usr/include/cblas.h") - include_directories("/usr/include/atlas") - LINK_DIRECTORIES("/usr/lib/lapack") - LINK_DIRECTORIES("/usr/lib64") - LINK_DIRECTORIES("/usr/lib64/atlas") #Added because atlas libraries in CentOS 7 are here! - - if(EXISTS "/usr/lib64/libblas.so" OR EXISTS "/usr/lib/libblas.so") #Case for CentOS7 - list(APPEND ATLAS_LIBRARIES blas) - - else() # Case for Ubuntu - list(APPEND ATLAS_LIBRARIES cblas) - endif() - - if(EXISTS "/usr/lib/atlas/libtatlas.so" OR EXISTS "/usr/lib64/atlas/libtatlas.so") #Case for CentOS7 - list(APPEND ATLAS_LIBRARIES tatlas) - else() - list(APPEND ATLAS_LIBRARIES atlas) #Case for Ubuntu - endif() - - list(APPEND ATLAS_LIBRARIES lapack) - -# for ubuntu 17.10, directories are different -elseif(EXISTS "/usr/include/x86_64-linux-gnu/cblas.h") - - include_directories("/usr/include/x86_64-linux-gnu") - LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu") - list(APPEND ATLAS_LIBRARIES cblas) - list(APPEND ATLAS_LIBRARIES atlas) - list(APPEND ATLAS_LIBRARIES lapack) - -else() - message("No Blas/Atlas libs found, some targets will fail") -endif() - ######################################################### # Base directories, compatible with legacy OAI building # ######################################################### @@ -3593,3 +3486,111 @@ ADD_CUSTOM_TARGET(oarf ) include (${OPENAIR_DIR}/common/utils/telnetsrv/telnetsrv_CMakeLists.txt) + + +# System packages that are required +# We use either the cmake buildin, in ubuntu are in: /usr/share/cmake*/Modules/ +# or cmake provide a generic interface to pkg-config that widely used +################################### +include(FindPkgConfig) + +pkg_search_module(LIBXML2 libxml-2.0 REQUIRED) +include_directories(${LIBXML2_INCLUDE_DIRS}) + +pkg_search_module(LIBXSLT libxslt REQUIRED) +include_directories(${LIBXSLT_INCLUDE_DIRS}) + +pkg_search_module(OPENSSL openssl REQUIRED) +include_directories(${OPENSSL_INCLUDE_DIRS}) + +pkg_search_module(CONFIG libconfig REQUIRED) +include_directories(${CONFIG_INCLUDE_DIRS}) + +pkg_search_module(CRYPTO libcrypto REQUIRED) +include_directories(${CRYPTO_INCLUDE_DIRS}) + +#use native cmake method as this package is not in pkg-config +if (${RF_BOARD} STREQUAL "OAI_USRP") + find_package(Boost REQUIRED) + include_directories(${LIBBOOST_INCLUDE_DIR}) + +elseif (${RF_BOARD} STREQUAL "OAI_IRIS") + include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/") + include_directories("/usr/local/include/") + set(HW_SOURCE ${HW_SOURCE} + ${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp) + LINK_DIRECTORIES("/usr/local/lib") + set(option_HW_lib "-lSoapySDR -rdynamic -ldl") + +endif (${RF_BOARD} STREQUAL "OAI_USRP") + +pkg_search_module(OPENPGM openpgm-5.1 openpgm-5.2) +if(NOT ${OPENPGM_FOUND}) + message("PACKAGE openpgm-5.1 is required by binaries such as oaisim: will fail later if this target is built") +else() + include_directories(${OPENPGM_INCLUDE_DIRS}) +endif() + +pkg_search_module(NETTLE nettle) +if(NOT ${NETTLE_FOUND}) + message( FATAL_ERROR "PACKAGE nettle not found: some targets will fail. Run build_oai -I again!") +else() + include_directories(${NETTLE_INCLUDE_DIRS}) +endif() + +message ("NETTLE VERSION_INSTALLED = ${NETTLE_VERSION}") + +string(REGEX REPLACE "([0-9]+).*" "\\1" NETTLE_VERSION_MAJOR ${NETTLE_VERSION}) +string(REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" NETTLE_VERSION_MINOR ${NETTLE_VERSION}) +message ("NETTLE_VERSION_MAJOR = ${NETTLE_VERSION_MAJOR}") +message ("NETTLE_VERSION_MINOR = ${NETTLE_VERSION_MINOR}") + +if ("${NETTLE_VERSION_MAJOR}" STREQUAL "" OR "${NETTLE_VERSION_MINOR}" STREQUAL "") + message( FATAL_ERROR "The nettle version not detected properly. Try to run build_oai -I again" ) +endif() + +add_definitions("-DNETTLE_VERSION_MAJOR=${NETTLE_VERSION_MAJOR}") +add_definitions("-DNETTLE_VERSION_MINOR=${NETTLE_VERSION_MINOR}") + +pkg_search_module(XPM xpm) +if(NOT ${XPM_FOUND}) + message("PACKAGE xpm not found: some targets will fail") +else() + include_directories(${XPM_INCLUDE_DIRS}) +endif() + +# Atlas is required by some packages, but not found in pkg-config +# So, here are some hacks here. Hope this gets fixed in future! +if(EXISTS "/usr/include/atlas/cblas.h" OR EXISTS "/usr/include/cblas.h") + include_directories("/usr/include/atlas") + LINK_DIRECTORIES("/usr/lib/lapack") + LINK_DIRECTORIES("/usr/lib64") + LINK_DIRECTORIES("/usr/lib64/atlas") #Added because atlas libraries in CentOS 7 are here! + + if(EXISTS "/usr/lib64/libblas.so" OR EXISTS "/usr/lib/libblas.so") #Case for CentOS7 + list(APPEND ATLAS_LIBRARIES blas) + + else() # Case for Ubuntu + list(APPEND ATLAS_LIBRARIES cblas) + endif() + + if(EXISTS "/usr/lib/atlas/libtatlas.so" OR EXISTS "/usr/lib64/atlas/libtatlas.so") #Case for CentOS7 + list(APPEND ATLAS_LIBRARIES tatlas) + else() + list(APPEND ATLAS_LIBRARIES atlas) #Case for Ubuntu + endif() + + list(APPEND ATLAS_LIBRARIES lapack) + + # for ubuntu 17.10, directories are different +elseif(EXISTS "/usr/include/x86_64-linux-gnu/cblas.h") + + include_directories("/usr/include/x86_64-linux-gnu") + LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu") + list(APPEND ATLAS_LIBRARIES cblas) + list(APPEND ATLAS_LIBRARIES atlas) + list(APPEND ATLAS_LIBRARIES lapack) + +else() + message("No Blas/Atlas libs found, some targets will fail") +endif() \ No newline at end of file diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index ae93810965..a4acaf9476 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -193,7 +193,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, for (int m=0; mCceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED) { + //if (pdcch_pdu_rel15->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED) { ((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1] = (amp * mod_dmrs[l][dmrs_idx<<1]) >> 15; ((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (amp * mod_dmrs[l][(dmrs_idx<<1) + 1]) >> 15; #ifdef DEBUG_PDCCH_DMRS @@ -201,7 +201,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, ((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1)+1]); #endif dmrs_idx++; - } + //} k_prime++; } else { // DCI payload diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 492ec1160a..0186e8aef3 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -89,7 +89,9 @@ void fill_default_coresetZero(NR_ControlResourceSet_t *coreset0, NR_ServingCellC coreset0->frequencyDomainResources.size = 6; coreset0->frequencyDomainResources.bits_unused = 3; coreset0->duration = 1; + coreset0->cce_REG_MappingType.present=NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved; coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset0->cce_REG_MappingType.choice.interleaved)); + coreset0->cce_REG_MappingType.choice.interleaved->reg_BundleSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6; coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = servingcellconfigcommon->physCellId; coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 3b49b4c801..093ecdf788 100755 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1500,7 +1500,7 @@ int8_t nr_rrc_ue_decode_NR_SIB1_Message(module_id_t module_id, uint8_t gNB_index } sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; if (*(int64_t*)sib1 != 1) { - printf("%lx\n", *(int64_t*)sib1); + LOG_D(RRC, "SIB1 address: %lx\n", *(int64_t*)sib1); xer_fprint(stdout, &asn_DEF_NR_SIB1, (const void*)sib1); } else From 41c55be8472f43d71512fc594f00d48a70ee6f60 Mon Sep 17 00:00:00 2001 From: Shweta Shrivastava Date: Thu, 7 Jan 2021 13:40:22 -0600 Subject: [PATCH 140/160] Fix for error message - no active DLSCH --- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 662c9c0516..f6966b040c 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -115,6 +115,11 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ dlsch0_harq->Nl=1; dlsch0_harq->mcs_table=dlsch_config_pdu->mcs_table; dlsch0_harq->harq_ack.rx_status = downlink_harq_process(dlsch0_harq, dlsch0->current_harq_pid, dlsch_config_pdu->ndi, dlsch0->rnti_type); + if (dlsch0_harq->status != ACTIVE) { + // dlsch0_harq->status not ACTIVE may be due to false retransmission. Reset the + // following flag to skip PDSCH procedures in that case. + dlsch0->active = 0; + } dlsch0_harq->harq_ack.vDAI_DL = dlsch_config_pdu->dai; /* PTRS */ dlsch0_harq->PTRSFreqDensity = dlsch_config_pdu->PTRSFreqDensity; From 8bd539025b1beee556445d8f8a4f24dc37c61707 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 7 Jan 2021 23:00:07 +0000 Subject: [PATCH 141/160] Minor correction --- cmake_targets/CMakeLists.txt | 215 +++++++++++++++++------------------ 1 file changed, 107 insertions(+), 108 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 87edf4006f..0b9d925017 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -24,6 +24,113 @@ cmake_minimum_required (VERSION 3.0) +# System packages that are required +# We use either the cmake buildin, in ubuntu are in: /usr/share/cmake*/Modules/ +# or cmake provide a generic interface to pkg-config that widely used +################################### +include(FindPkgConfig) + +pkg_search_module(LIBXML2 libxml-2.0 REQUIRED) +include_directories(${LIBXML2_INCLUDE_DIRS}) + +pkg_search_module(LIBXSLT libxslt REQUIRED) +include_directories(${LIBXSLT_INCLUDE_DIRS}) + +pkg_search_module(OPENSSL openssl REQUIRED) +include_directories(${OPENSSL_INCLUDE_DIRS}) + +pkg_search_module(CONFIG libconfig REQUIRED) +include_directories(${CONFIG_INCLUDE_DIRS}) + +pkg_search_module(CRYPTO libcrypto REQUIRED) +include_directories(${CRYPTO_INCLUDE_DIRS}) + +#use native cmake method as this package is not in pkg-config +if (${RF_BOARD} STREQUAL "OAI_USRP") + find_package(Boost REQUIRED) + include_directories(${LIBBOOST_INCLUDE_DIR}) + +elseif (${RF_BOARD} STREQUAL "OAI_IRIS") + include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/") + include_directories("/usr/local/include/") + set(HW_SOURCE ${HW_SOURCE} + ${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp) + LINK_DIRECTORIES("/usr/local/lib") + set(option_HW_lib "-lSoapySDR -rdynamic -ldl") + +endif (${RF_BOARD} STREQUAL "OAI_USRP") + +pkg_search_module(OPENPGM openpgm-5.1 openpgm-5.2) +if(NOT ${OPENPGM_FOUND}) + message("PACKAGE openpgm-5.1 is required by binaries such as oaisim: will fail later if this target is built") +else() + include_directories(${OPENPGM_INCLUDE_DIRS}) +endif() + +pkg_search_module(NETTLE nettle) +if(NOT ${NETTLE_FOUND}) + message( FATAL_ERROR "PACKAGE nettle not found: some targets will fail. Run build_oai -I again!") +else() + include_directories(${NETTLE_INCLUDE_DIRS}) +endif() + +message ("NETTLE VERSION_INSTALLED = ${NETTLE_VERSION}") + +string(REGEX REPLACE "([0-9]+).*" "\\1" NETTLE_VERSION_MAJOR ${NETTLE_VERSION}) +string(REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" NETTLE_VERSION_MINOR ${NETTLE_VERSION}) +message ("NETTLE_VERSION_MAJOR = ${NETTLE_VERSION_MAJOR}") +message ("NETTLE_VERSION_MINOR = ${NETTLE_VERSION_MINOR}") + +if ("${NETTLE_VERSION_MAJOR}" STREQUAL "" OR "${NETTLE_VERSION_MINOR}" STREQUAL "") + message( FATAL_ERROR "The nettle version not detected properly. Try to run build_oai -I again" ) +endif() + +add_definitions("-DNETTLE_VERSION_MAJOR=${NETTLE_VERSION_MAJOR}") +add_definitions("-DNETTLE_VERSION_MINOR=${NETTLE_VERSION_MINOR}") + +pkg_search_module(XPM xpm) +if(NOT ${XPM_FOUND}) + message("PACKAGE xpm not found: some targets will fail") +else() + include_directories(${XPM_INCLUDE_DIRS}) +endif() + +# Atlas is required by some packages, but not found in pkg-config +# So, here are some hacks here. Hope this gets fixed in future! +if(EXISTS "/usr/include/atlas/cblas.h" OR EXISTS "/usr/include/cblas.h") + include_directories("/usr/include/atlas") + LINK_DIRECTORIES("/usr/lib/lapack") + LINK_DIRECTORIES("/usr/lib64") + LINK_DIRECTORIES("/usr/lib64/atlas") #Added because atlas libraries in CentOS 7 are here! + + if(EXISTS "/usr/lib64/libblas.so" OR EXISTS "/usr/lib/libblas.so") #Case for CentOS7 + list(APPEND ATLAS_LIBRARIES blas) + + else() # Case for Ubuntu + list(APPEND ATLAS_LIBRARIES cblas) + endif() + + if(EXISTS "/usr/lib/atlas/libtatlas.so" OR EXISTS "/usr/lib64/atlas/libtatlas.so") #Case for CentOS7 + list(APPEND ATLAS_LIBRARIES tatlas) + else() + list(APPEND ATLAS_LIBRARIES atlas) #Case for Ubuntu + endif() + + list(APPEND ATLAS_LIBRARIES lapack) + +# for ubuntu 17.10, directories are different +elseif(EXISTS "/usr/include/x86_64-linux-gnu/cblas.h") + + include_directories("/usr/include/x86_64-linux-gnu") + LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu") + list(APPEND ATLAS_LIBRARIES cblas) + list(APPEND ATLAS_LIBRARIES atlas) + list(APPEND ATLAS_LIBRARIES lapack) + +else() + message("No Blas/Atlas libs found, some targets will fail") +endif() + ######################################################### # Base directories, compatible with legacy OAI building # ######################################################### @@ -3486,111 +3593,3 @@ ADD_CUSTOM_TARGET(oarf ) include (${OPENAIR_DIR}/common/utils/telnetsrv/telnetsrv_CMakeLists.txt) - - -# System packages that are required -# We use either the cmake buildin, in ubuntu are in: /usr/share/cmake*/Modules/ -# or cmake provide a generic interface to pkg-config that widely used -################################### -include(FindPkgConfig) - -pkg_search_module(LIBXML2 libxml-2.0 REQUIRED) -include_directories(${LIBXML2_INCLUDE_DIRS}) - -pkg_search_module(LIBXSLT libxslt REQUIRED) -include_directories(${LIBXSLT_INCLUDE_DIRS}) - -pkg_search_module(OPENSSL openssl REQUIRED) -include_directories(${OPENSSL_INCLUDE_DIRS}) - -pkg_search_module(CONFIG libconfig REQUIRED) -include_directories(${CONFIG_INCLUDE_DIRS}) - -pkg_search_module(CRYPTO libcrypto REQUIRED) -include_directories(${CRYPTO_INCLUDE_DIRS}) - -#use native cmake method as this package is not in pkg-config -if (${RF_BOARD} STREQUAL "OAI_USRP") - find_package(Boost REQUIRED) - include_directories(${LIBBOOST_INCLUDE_DIR}) - -elseif (${RF_BOARD} STREQUAL "OAI_IRIS") - include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/") - include_directories("/usr/local/include/") - set(HW_SOURCE ${HW_SOURCE} - ${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp) - LINK_DIRECTORIES("/usr/local/lib") - set(option_HW_lib "-lSoapySDR -rdynamic -ldl") - -endif (${RF_BOARD} STREQUAL "OAI_USRP") - -pkg_search_module(OPENPGM openpgm-5.1 openpgm-5.2) -if(NOT ${OPENPGM_FOUND}) - message("PACKAGE openpgm-5.1 is required by binaries such as oaisim: will fail later if this target is built") -else() - include_directories(${OPENPGM_INCLUDE_DIRS}) -endif() - -pkg_search_module(NETTLE nettle) -if(NOT ${NETTLE_FOUND}) - message( FATAL_ERROR "PACKAGE nettle not found: some targets will fail. Run build_oai -I again!") -else() - include_directories(${NETTLE_INCLUDE_DIRS}) -endif() - -message ("NETTLE VERSION_INSTALLED = ${NETTLE_VERSION}") - -string(REGEX REPLACE "([0-9]+).*" "\\1" NETTLE_VERSION_MAJOR ${NETTLE_VERSION}) -string(REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" NETTLE_VERSION_MINOR ${NETTLE_VERSION}) -message ("NETTLE_VERSION_MAJOR = ${NETTLE_VERSION_MAJOR}") -message ("NETTLE_VERSION_MINOR = ${NETTLE_VERSION_MINOR}") - -if ("${NETTLE_VERSION_MAJOR}" STREQUAL "" OR "${NETTLE_VERSION_MINOR}" STREQUAL "") - message( FATAL_ERROR "The nettle version not detected properly. Try to run build_oai -I again" ) -endif() - -add_definitions("-DNETTLE_VERSION_MAJOR=${NETTLE_VERSION_MAJOR}") -add_definitions("-DNETTLE_VERSION_MINOR=${NETTLE_VERSION_MINOR}") - -pkg_search_module(XPM xpm) -if(NOT ${XPM_FOUND}) - message("PACKAGE xpm not found: some targets will fail") -else() - include_directories(${XPM_INCLUDE_DIRS}) -endif() - -# Atlas is required by some packages, but not found in pkg-config -# So, here are some hacks here. Hope this gets fixed in future! -if(EXISTS "/usr/include/atlas/cblas.h" OR EXISTS "/usr/include/cblas.h") - include_directories("/usr/include/atlas") - LINK_DIRECTORIES("/usr/lib/lapack") - LINK_DIRECTORIES("/usr/lib64") - LINK_DIRECTORIES("/usr/lib64/atlas") #Added because atlas libraries in CentOS 7 are here! - - if(EXISTS "/usr/lib64/libblas.so" OR EXISTS "/usr/lib/libblas.so") #Case for CentOS7 - list(APPEND ATLAS_LIBRARIES blas) - - else() # Case for Ubuntu - list(APPEND ATLAS_LIBRARIES cblas) - endif() - - if(EXISTS "/usr/lib/atlas/libtatlas.so" OR EXISTS "/usr/lib64/atlas/libtatlas.so") #Case for CentOS7 - list(APPEND ATLAS_LIBRARIES tatlas) - else() - list(APPEND ATLAS_LIBRARIES atlas) #Case for Ubuntu - endif() - - list(APPEND ATLAS_LIBRARIES lapack) - - # for ubuntu 17.10, directories are different -elseif(EXISTS "/usr/include/x86_64-linux-gnu/cblas.h") - - include_directories("/usr/include/x86_64-linux-gnu") - LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu") - list(APPEND ATLAS_LIBRARIES cblas) - list(APPEND ATLAS_LIBRARIES atlas) - list(APPEND ATLAS_LIBRARIES lapack) - -else() - message("No Blas/Atlas libs found, some targets will fail") -endif() \ No newline at end of file From cbdfc1c9332f2aae05bb1cfdc83084d28a2b028f Mon Sep 17 00:00:00 2001 From: frtabu Date: Fri, 8 Jan 2021 01:22:23 +0100 Subject: [PATCH 142/160] add tpool thread name parameter, fi init --- common/utils/threadPool/thread-pool.c | 7 ++++--- common/utils/threadPool/thread-pool.h | 4 ++-- executables/nr-uesoftmodem.c | 4 ++-- openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 12 ++++++------ 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/common/utils/threadPool/thread-pool.c b/common/utils/threadPool/thread-pool.c index e1446f15d7..77729ae7a7 100644 --- a/common/utils/threadPool/thread-pool.c +++ b/common/utils/threadPool/thread-pool.c @@ -92,7 +92,7 @@ void *one_thread(void *arg) { } while (true); } -void initTpool(char *params,tpool_t *pool, bool performanceMeas) { +void initNamedTpool(char *params,tpool_t *pool, bool performanceMeas, char *name) { memset(pool,0,sizeof(*pool)); char *measr=getenv("threadPoolMeasurements"); pool->measurePerf=performanceMeas; @@ -116,6 +116,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) { pool->restrictRNTI=false; curptr=strtok_r(parms_cpy,",",&saveptr); struct one_thread * ptr; + char *tname = (name == NULL ? "Tpool" : name); while ( curptr!=NULL ) { int c=toupper(curptr[0]); @@ -129,7 +130,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) { break; default: - ptr=pool->allthreads; + ptr=pool->allthreads; pool->allthreads=(struct one_thread *)malloc(sizeof(struct one_thread)); pool->allthreads->next=ptr; printf("create a thread for core %d\n", atoi(curptr)); @@ -138,7 +139,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) { pool->allthreads->pool=pool; //Configure the thread scheduler policy for Linux // set the thread name for debugging - sprintf(pool->allthreads->name,"Tpool_%d",pool->allthreads->coreID); + sprintf(pool->allthreads->name,"%s%d_%d",tname,pool->nbThreads,pool->allthreads->coreID); threadCreate(&pool->allthreads->threadID, one_thread, (void *)pool->allthreads, pool->allthreads->name, pool->allthreads->coreID, OAI_PRIORITY_RT); pool->nbThreads++; diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h index bd55203c7f..5db1a5e34e 100644 --- a/common/utils/threadPool/thread-pool.h +++ b/common/utils/threadPool/thread-pool.h @@ -294,6 +294,6 @@ static inline int abortTpool(tpool_t *t, uint64_t key) { mutexunlock(nf->lockF); return nbRemoved; } -void initTpool(char *params,tpool_t *pool, bool performanceMeas); - +void initNamedTpool(char *params,tpool_t *pool, bool performanceMeas, char *name); +#define initTpool(PARAMPTR,TPOOLPTR, MEASURFLAG) initNamedTpool(PARAMPTR,TPOOLPTR, MEASURFLAG, NULL) #endif diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 9a8c4cb296..43793fc1ee 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -214,9 +214,9 @@ nrUE_params_t *get_nrUE_params(void) { } /* initialie thread pools used for NRUE processing paralleliation */ void init_tpools(uint8_t nun_dlsch_threads) { - char *params=calloc(1,(RX_NB_TH*2)+1); + char *params=calloc(1,(RX_NB_TH*3)+1); for (int i=0; i Date: Fri, 8 Jan 2021 10:50:56 +0100 Subject: [PATCH 143/160] Update nr_gold_ue.c --- openair1/PHY/NR_REFSIG/nr_gold_ue.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair1/PHY/NR_REFSIG/nr_gold_ue.c b/openair1/PHY/NR_REFSIG/nr_gold_ue.c index b440aca46a..8bfa8411ce 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold_ue.c +++ b/openair1/PHY/NR_REFSIG/nr_gold_ue.c @@ -40,7 +40,6 @@ void nr_gold_pbch(PHY_VARS_NR_UE* ue) reset = 1; x2 = (1<<11) * (i_ssb2 + 1) * ((Nid>>2) + 1) + (1<<6) * (i_ssb2 + 1) + (Nid&3); - x2 = x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); for (n=0; nnr_gold_pbch[n_hf][l][n] = lte_gold_generic(&x1, &x2, reset); From 41f319b02a0173939bd116e82ab41893af915161 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 8 Jan 2021 17:26:38 +0100 Subject: [PATCH 144/160] add test cases for UL transform precoding (SC-FDMA) --- cmake_targets/autotests/test_case_list.xml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml index e081a4186e..6d3424b420 100644 --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1289,7 +1289,10 @@ (Test5: MCS 9 273 PRBs), (Test6: DMRS Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols), (Test7: DMRS Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols), - (Test8: DMRS Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols) + (Test8: DMRS Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols), + (Test9: SC-FDMA, 50 PRBs), + (Test10: SC-FDMA, 75 PRBs), + (Test11: SC-FDMA, 3 DMRS) $OPENAIR_DIR/cmake_targets/build_oai --phy_simulators -c @@ -1303,8 +1306,11 @@ -n100 -m9 -R273 -r273 -s5 -n100 -s5 -T 2 1 2 -U 2 0 2 -n100 -s5 -T 2 2 2 -U 2 1 2 - -n100 -s5 -a4 -b8 -T 2 1 2 -U 2 1 3 - nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 + -n100 -s5 -a4 -b8 -T 2 1 2 -U 2 1 3 + -n100 -s20 -Z + -n100 -s20 -Z -r75 + -n100 -s20 -Z -U 2 0 2 + nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 PUSCH test OK segmentation fault|assertion|exiting|fatal 3 From 6ec065fe2a1f9d2c0d705b3c5c1bc43959a328d4 Mon Sep 17 00:00:00 2001 From: frtabu Date: Fri, 8 Jan 2021 01:22:23 +0100 Subject: [PATCH 145/160] add tpool thread name parameter, review fixes --- common/utils/threadPool/thread-pool.c | 7 ++++--- common/utils/threadPool/thread-pool.h | 4 ++-- common/utils/threadPool/thread-pool.md | 18 ++++++++++------- executables/nr-uesoftmodem.c | 9 ++------- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 20 +++++++++---------- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/common/utils/threadPool/thread-pool.c b/common/utils/threadPool/thread-pool.c index e1446f15d7..77729ae7a7 100644 --- a/common/utils/threadPool/thread-pool.c +++ b/common/utils/threadPool/thread-pool.c @@ -92,7 +92,7 @@ void *one_thread(void *arg) { } while (true); } -void initTpool(char *params,tpool_t *pool, bool performanceMeas) { +void initNamedTpool(char *params,tpool_t *pool, bool performanceMeas, char *name) { memset(pool,0,sizeof(*pool)); char *measr=getenv("threadPoolMeasurements"); pool->measurePerf=performanceMeas; @@ -116,6 +116,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) { pool->restrictRNTI=false; curptr=strtok_r(parms_cpy,",",&saveptr); struct one_thread * ptr; + char *tname = (name == NULL ? "Tpool" : name); while ( curptr!=NULL ) { int c=toupper(curptr[0]); @@ -129,7 +130,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) { break; default: - ptr=pool->allthreads; + ptr=pool->allthreads; pool->allthreads=(struct one_thread *)malloc(sizeof(struct one_thread)); pool->allthreads->next=ptr; printf("create a thread for core %d\n", atoi(curptr)); @@ -138,7 +139,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) { pool->allthreads->pool=pool; //Configure the thread scheduler policy for Linux // set the thread name for debugging - sprintf(pool->allthreads->name,"Tpool_%d",pool->allthreads->coreID); + sprintf(pool->allthreads->name,"%s%d_%d",tname,pool->nbThreads,pool->allthreads->coreID); threadCreate(&pool->allthreads->threadID, one_thread, (void *)pool->allthreads, pool->allthreads->name, pool->allthreads->coreID, OAI_PRIORITY_RT); pool->nbThreads++; diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h index bd55203c7f..5db1a5e34e 100644 --- a/common/utils/threadPool/thread-pool.h +++ b/common/utils/threadPool/thread-pool.h @@ -294,6 +294,6 @@ static inline int abortTpool(tpool_t *t, uint64_t key) { mutexunlock(nf->lockF); return nbRemoved; } -void initTpool(char *params,tpool_t *pool, bool performanceMeas); - +void initNamedTpool(char *params,tpool_t *pool, bool performanceMeas, char *name); +#define initTpool(PARAMPTR,TPOOLPTR, MEASURFLAG) initNamedTpool(PARAMPTR,TPOOLPTR, MEASURFLAG, NULL) #endif diff --git a/common/utils/threadPool/thread-pool.md b/common/utils/threadPool/thread-pool.md index 4db3cd6ad1..a087b989fa 100644 --- a/common/utils/threadPool/thread-pool.md +++ b/common/utils/threadPool/thread-pool.md @@ -112,13 +112,13 @@ No delete() call, same principle as not thread safe queues # Thread pools ## initialization -The clients can create one or more thread pools with init_tpool() +The clients can create one or more thread pools with `initTpool(char *params,tpool_t *pool, bool performanceMeas )` or `initNamedTpool(char *params,tpool_t *pool, bool performanceMeas , char *name)` the params string structure: describes a list of cores, separated by "," that run a worker thread If the core exists on the CPU, the thread pool initialization sets the affinity between this thread and the related code (use negative values is allowed, so the thread will never be mapped on a specific core). -The threads are all Linux real time scheduler, their name is set automatically is "Tpool_" +The threads are all Linux real time scheduler, their name is set automatically to `Tpool_` if initTpool is used or to `_` when initNamedTpool is used. ## adding jobs The client create their jobs messages as a notifiedFIFO_elt_t, then they push it with pushTpool() (that internally calls push_notifiedFIFO()) @@ -132,11 +132,13 @@ A abort service abortTpool() allows to abort all jobs that match a key (see jobs Nevertheless, jobs already performed before the return of abortTpool() are pushed in the response Fifo queue. ## API details -Each thread pool (there can be several in the same process) should be initialized +Each thread pool (there can be several in the same process) should be initialized once using one of the two API's: -### initTpool(char *params,tpool_t *pool, bool performanceMeas) is to be called oncepool +### initNamedTpool(char *params,tpool_t *pool, bool performanceMeas,char *name) -the configuration parameter is a string, elements separated by ",": +### initTpool(char *params,tpool_t *pool, bool performanceMeas) + +`params`: the configuration parameter is a string, elements separator is a comma ",". An element can be: * N: if a N is in the parameter list, no threads are created The purpose is to keep the same API in any case @@ -151,9 +153,11 @@ example: "-1,-1,-1" as there is no core number -1, the thread pool is made of 3 floating threads be careful with fix allocation: it is hard to be more clever than Linux kernel -pool is the memory you allocated before to store the thread pool internal state (same concept as above queues) +`pool` is the memory you allocated before to store the thread pool internal state (same concept as above queues) -performanceMeas is a flag to enable measurements (well described in documentation) +`performanceMeas` is a flag to enable measurements (well described in documentation) + +`name` is used to build the thread names. ### pushTpool(tpool_t *t, notifiedFIFO_elt_t *msg) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 9a8c4cb296..36bca40b1a 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -214,9 +214,9 @@ nrUE_params_t *get_nrUE_params(void) { } /* initialie thread pools used for NRUE processing paralleliation */ void init_tpools(uint8_t nun_dlsch_threads) { - char *params=calloc(1,(RX_NB_TH*2)+1); + char *params=calloc(1,(RX_NB_TH*3)+1); for (int i=0; irf_map.card=0; - PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+chain_offset; - PHY_vars_UE_g[0][CC_id]->timing_advance = UE[CC_id]->timing_advance; - } init_NR_UE_threads(1); config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index d97bb36717..1a5675ffd9 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -60,16 +60,16 @@ int nbDlProcessing =0; static tpool_t pool_dl; //extern double cpuf; -void init_dlsch_tpool(uint8_t nun_dlsch_threads) +void init_dlsch_tpool(uint8_t num_dlsch_threads) { - if( nun_dlsch_threads==0) + if( num_dlsch_threads==0) return; - char *params=calloc(1,(nun_dlsch_threads*2)+1); - for (int i=0; iK; Kr_bytes = Kr>>3; - K_bytes_F = Kr-harq_process->F; + K_bits_F = Kr-harq_process->F; E = nr_get_E(G, harq_process->C, harq_process->Qm, harq_process->Nl, r); @@ -1547,9 +1547,9 @@ void nr_dlsch_decoding_process(void *arg) //set first 2*Z_c bits to zeros memset(&z[0],0,2*harq_process->Z*sizeof(int16_t)); //set Filler bits - memset((&z[0]+K_bytes_F),127,harq_process->F*sizeof(int16_t)); + memset((&z[0]+K_bits_F),127,harq_process->F*sizeof(int16_t)); //Move coded bits before filler bits - memcpy((&z[0]+2*harq_process->Z),harq_process->d[r],(K_bytes_F-2*harq_process->Z)*sizeof(int16_t)); + memcpy((&z[0]+2*harq_process->Z),harq_process->d[r],(K_bits_F-2*harq_process->Z)*sizeof(int16_t)); //skip filler bits memcpy((&z[0]+Kr),harq_process->d[r]+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t)); //Saturate coded bits before decoding into 8 bits values From ab107c98dd238816fadb15bae1811e17f40ec75e Mon Sep 17 00:00:00 2001 From: rmagueta Date: Sat, 9 Jan 2021 15:58:54 +0000 Subject: [PATCH 146/160] Fix RA BWP at UE --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 4 +++- openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c | 1 + openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 6 ++++-- openair2/RRC/NR/MESSAGES/asn1_msg.c | 4 ++-- openair2/RRC/NR/rrc_gNB_reconfig.c | 1 + 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 31b96018e3..bad398458b 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -417,6 +417,8 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ mac->search_space_zero->monitoringSymbolsWithinSlot->buf[0] = (1<<7) | (1<<6); mac->search_space_zero->monitoringSymbolsWithinSlot->size = 2; mac->search_space_zero->monitoringSymbolsWithinSlot->bits_unused = 2; + + // FIXME: update values from TS38.213 Section 10.1 Table 10.1-1: CCE aggregation levels and maximum number of PDCCH candidates per CCE aggregation level for CSS sets configured by searchSpaceSIB1 mac->search_space_zero->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; mac->search_space_zero->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; mac->search_space_zero->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n0; @@ -440,7 +442,7 @@ void config_control_ue(NR_UE_MAC_INST_t *mac){ mac->coreset0->duration = 1; mac->coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*mac->coreset0->cce_REG_MappingType.choice.interleaved)); mac->coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; - mac->coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = 0; // FIXME: mac->scc->physCellId; + mac->coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = NULL; mac->coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; if(mac->coreset0->tci_StatesPDCCH_ToAddList == NULL) mac->coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*mac->coreset0->tci_StatesPDCCH_ToAddList)); NR_TCI_StateId_t *tci[8]; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index c5feb2bf6a..dc4b5b4e04 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -56,6 +56,7 @@ void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pd LOG_D(MAC,"Filling search candidates for DCI\n"); if(ss->searchSpaceId == 0) { + // TODO: Update the maximum number of PDCCH candidates accordingly with Aggregation Level rel15->number_of_candidates=1; rel15->CCE[0]=0; rel15->L[0]=6; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 7e3f08037c..4cde705715 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3365,8 +3365,8 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr */ dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti; - fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; + uint16_t BWPSize = 0; if(rnti == SI_RNTI) { dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH; @@ -3374,6 +3374,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; // For PDSCH with mapping type A, the UE shall assume dmrs-AdditionalPosition='pos2' + BWPSize = dlsch_config_pdu_1_0->BWPSize; } else { if (mac->RA_window_cnt >= 0 && rnti == mac->ra_rnti){ dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH; @@ -3383,11 +3384,12 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275); dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; + BWPSize = n_RB_DLBWP; } /* IDENTIFIER_DCI_FORMATS */ /* FREQ_DOM_RESOURCE_ASSIGNMENT_DL */ - if (nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_0,0,dlsch_config_pdu_1_0->BWPSize,dci->frequency_domain_assignment.val) < 0) + if (nr_ue_process_dci_freq_dom_resource_assignment(NULL,dlsch_config_pdu_1_0,0,BWPSize,dci->frequency_domain_assignment.val) < 0) return -1; /* TIME_DOM_RESOURCE_ASSIGNMENT */ if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val) < 0) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 70a0171eb0..042c419241 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -338,12 +338,12 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][0]); ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][1]); ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][2]); - nr_mnc_digit[i][0] = (configuration->mnc[i]/100)%10; + if(configuration->mnc_digit_length[i] == 3) nr_mnc_digit[i][0] = (configuration->mnc[i]/100)%10; nr_mnc_digit[i][1] = (configuration->mnc[i]/10)%10; nr_mnc_digit[i][2] = (configuration->mnc[i])%10; nr_plmn[i].mnc.list.size=0; nr_plmn[i].mnc.list.count=0; - ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][0]); + if(configuration->mnc_digit_length[i] == 3) ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][0]); ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][1]); ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][2]); ASN_SEQUENCE_ADD(&nr_plmn_info->plmn_IdentityList.list, &nr_plmn[i]); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 0186e8aef3..a9e48efe28 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -132,6 +132,7 @@ void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0) { ss0->monitoringSymbolsWithinSlot->size = 2; ss0->monitoringSymbolsWithinSlot->bits_unused = 2; + // FIXME: update values from TS38.213 Section 10.1 Table 10.1-1: CCE aggregation levels and maximum number of PDCCH candidates per CCE aggregation level for CSS sets configured by searchSpaceSIB1 ss0->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0; ss0->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0; ss0->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n0; From 6995eef871afa4af3ab02ce3344b206f7cebe748 Mon Sep 17 00:00:00 2001 From: francescomani Date: Sat, 9 Jan 2021 17:06:59 +0100 Subject: [PATCH 147/160] moving initialization of msg3 frame and slot --- openair1/PHY/NR_REFSIG/nr_gold_ue.c | 2 +- openair2/LAYER2/NR_MAC_UE/config_ue.c | 2 ++ openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 1 - openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 2 -- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/nr_gold_ue.c b/openair1/PHY/NR_REFSIG/nr_gold_ue.c index b440aca46a..614f001f07 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold_ue.c +++ b/openair1/PHY/NR_REFSIG/nr_gold_ue.c @@ -42,7 +42,7 @@ void nr_gold_pbch(PHY_VARS_NR_UE* ue) x2 = (1<<11) * (i_ssb2 + 1) * ((Nid>>2) + 1) + (1<<6) * (i_ssb2 + 1) + (Nid&3); x2 = x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); - for (n=0; nnr_gold_pbch[n_hf][l][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 66308e46fe..91d81961f1 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -421,6 +421,8 @@ int nr_rrc_mac_config_req_ue( mac->scg = cell_group_config; mac->servCellIndex = *cell_group_config->spCellConfig->servCellIndex; config_control_ue(mac); + mac->msg3_frame = -1; // initialize to an invalid value + mac->msg3_slot = -1; if (cell_group_config->spCellConfig->reconfigurationWithSync) { mac->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink; mac->scc = cell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon; diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 18ad3526b3..bbb44ba47a 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -52,7 +52,6 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(sizeof(NR_UE_MAC_INST_t),NB_NR_UE_MAC_INST); if (rrc_inst) { nr_rrc_mac_config_req_ue(0,0,0,NULL,rrc_inst->cell_group_config); - if (IS_SOFTMODEM_NOS1){ AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__); pdcp_layer_init(); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 062f618195..1f5d81060e 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -499,8 +499,6 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, mac->RA_PREAMBLE_TRANSMISSION_COUNTER = 1; mac->RA_PREAMBLE_POWER_RAMPING_COUNTER = 1; mac->RA_Msg3_size = size_sdu + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); - mac->msg3_frame = -1; // initialize to an invalid value - mac->msg3_slot = -1; mac->RA_prachMaskIndex = 0; // todo: add the backoff condition here mac->RA_backoff_cnt = 0; From 3b0c43c04b3e74227467ad8411d7f9e47bef4ed6 Mon Sep 17 00:00:00 2001 From: Laurent Date: Sun, 10 Jan 2021 21:41:22 +0100 Subject: [PATCH 148/160] fix memory allocation error --- common/utils/ocp_itti/intertask_interface.cpp | 53 ++++++++++--------- openair2/ENB_APP/enb_config.c | 5 +- openair2/NETWORK_DRIVER/MESH/device.c | 4 ++ openair2/RRC/NR/rrc_gNB_nsa.c | 2 +- openair3/SCTP/sctp_eNB_task.c | 2 +- targets/ARCH/rfsimulator/apply_channelmod.c | 5 +- targets/RT/USER/lte-enb.c | 3 +- 7 files changed, 40 insertions(+), 34 deletions(-) diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index aec702f987..964f5409fd 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -45,7 +45,7 @@ extern "C" { std::vector message_queue; std::map timer_map; uint64_t next_timer=UINT64_MAX; - struct epoll_event *events =NULL; + struct epoll_event *events =NULL; int nb_fd_epoll=0; int nb_events=0; int epoll_fd=-1; @@ -53,7 +53,7 @@ extern "C" { } task_list_t; int timer_expired(int fd); - task_list_t *tasks; + static task_list_t **tasks=NULL; static int nb_queues=0; static pthread_mutex_t lock_nb_queues; @@ -124,7 +124,7 @@ extern "C" { } static inline int itti_send_msg_to_task_locked(task_id_t destination_task_id, instance_t destinationInstance, MessageDef *message) { - task_list_t *t=tasks+destination_task_id; + task_list_t *t=tasks[destination_task_id]; message->ittiMsgHeader.destinationTaskId = destination_task_id; message->ittiMsgHeader.destinationInstance = destinationInstance; message->ittiMsgHeader.lte_time.frame = 0; @@ -146,7 +146,7 @@ extern "C" { } int itti_send_msg_to_task(task_id_t destination_task_id, instance_t destinationInstance, MessageDef *message) { - task_list_t *t=&tasks[destination_task_id]; + task_list_t *t=tasks[destination_task_id]; pthread_mutex_lock (&t->queue_cond_lock); int ret=itti_send_msg_to_task_locked(destination_task_id, destinationInstance, message); @@ -165,7 +165,7 @@ extern "C" { void itti_subscribe_event_fd(task_id_t task_id, int fd) { struct epoll_event event; - task_list_t *t=&tasks[task_id]; + task_list_t *t=tasks[task_id]; t->nb_fd_epoll++; t->events = (struct epoll_event *)realloc((void *)t->events, t->nb_fd_epoll * sizeof(struct epoll_event)); @@ -178,7 +178,7 @@ extern "C" { } void itti_unsubscribe_event_fd(task_id_t task_id, int fd) { - task_list_t *t=&tasks[task_id]; + task_list_t *t=tasks[task_id]; AssertFatal (epoll_ctl(t->epoll_fd, EPOLL_CTL_DEL, fd, NULL) == 0, "epoll_ctl (EPOLL_CTL_DEL) failed for task %s, fd %d: %s!\n", itti_get_task_name(task_id), fd, strerror(errno)); @@ -186,7 +186,7 @@ extern "C" { } static inline int itti_get_events_locked(task_id_t task_id, struct epoll_event **events) { - task_list_t *t=&tasks[task_id]; + task_list_t *t=tasks[task_id]; uint64_t current_time=0; do { @@ -266,13 +266,13 @@ extern "C" { } int itti_get_events(task_id_t task_id, struct epoll_event **events) { - pthread_mutex_lock(&tasks[task_id].queue_cond_lock); + pthread_mutex_lock(&tasks[task_id]->queue_cond_lock); return itti_get_events_locked(task_id, events); } void itti_receive_msg(task_id_t task_id, MessageDef **received_msg) { // Reception of one message, blocking caller - task_list_t *t=&tasks[task_id]; + task_list_t *t=tasks[task_id]; pthread_mutex_lock(&t->queue_cond_lock); // Weird condition to deal with crap legacy itti interface @@ -304,7 +304,7 @@ extern "C" { void itti_poll_msg(task_id_t task_id, MessageDef **received_msg) { //reception of one message, non-blocking - task_list_t *t=&tasks[task_id]; + task_list_t *t=tasks[task_id]; pthread_mutex_lock(&t->queue_cond_lock); if (!t->message_queue.empty()) { @@ -320,7 +320,7 @@ extern "C" { int itti_create_task(task_id_t task_id, void *(*start_routine)(void *), void *args_p) { - task_list_t *t=&tasks[task_id]; + task_list_t *t=tasks[task_id]; threadCreate (&t->thread, start_routine, args_p, (char *)itti_get_task_name(task_id),-1,OAI_PRIORITY_RT); LOG_I(TMR,"Created Posix thread %s\n", itti_get_task_name(task_id) ); return 0; @@ -338,19 +338,20 @@ extern "C" { int itti_create_queue(const task_info_t *task_info) { pthread_mutex_lock (&lock_nb_queues); - int newQueue=nb_queues; - nb_queues++; - AssertFatal(realloc(tasks, nb_queues* sizeof(*tasks)),"no memory"); + int newQueue=nb_queues++; + AssertFatal(tasks=(task_list_t **) realloc(tasks, nb_queues * sizeof(*tasks)),""); + tasks[newQueue]= new task_list_t; pthread_mutex_unlock (&lock_nb_queues); LOG_I(TMR,"Starting itti queue: %s as task %d\n", tasks_info->name, newQueue); - pthread_mutex_init(&tasks[newQueue].queue_cond_lock, NULL); - memcpy(&tasks[newQueue].admin, tasks_info, sizeof(task_info_t)); - AssertFatal( ( tasks[newQueue].epoll_fd = epoll_create1(0) ) >=0, ""); - AssertFatal( ( tasks[newQueue].sem_fd = eventfd(0, EFD_SEMAPHORE) ) >=0, ""); - itti_subscribe_event_fd((task_id_t)newQueue, tasks[newQueue].sem_fd); + pthread_mutex_init(&tasks[newQueue]->queue_cond_lock, NULL); + memcpy(&tasks[newQueue]->admin, tasks_info, sizeof(task_info_t)); + AssertFatal( ( tasks[newQueue]->epoll_fd = epoll_create1(0) ) >=0, ""); + AssertFatal( ( tasks[newQueue]->sem_fd = eventfd(0, EFD_SEMAPHORE) ) >=0, ""); + itti_subscribe_event_fd((task_id_t)newQueue, tasks[newQueue]->sem_fd); + + if (tasks[newQueue]->admin.threadFunc != NULL) + itti_create_task((task_id_t)newQueue, tasks[newQueue]->admin.threadFunc, NULL); - if (tasks[newQueue].admin.threadFunc != NULL) - itti_create_task((task_id_t)newQueue, tasks[newQueue].admin.threadFunc, NULL); return newQueue; } @@ -376,7 +377,7 @@ extern "C" { timer_type_t type, void *timer_arg, long *timer_id) { - task_list_t *t=&tasks[task_id]; + task_list_t *t=tasks[task_id]; do { // set the taskid in the timer id to keep compatible with the legacy API @@ -412,9 +413,9 @@ extern "C" { int timer_remove(long timer_id) { task_id_t task_id=(task_id_t)(timer_id&0xffff); int ret; - pthread_mutex_lock (&tasks[task_id].queue_cond_lock); - ret=tasks[task_id].timer_map.erase(timer_id); - pthread_mutex_unlock (&tasks[task_id].queue_cond_lock); + pthread_mutex_lock (&tasks[task_id]->queue_cond_lock); + ret=tasks[task_id]->timer_map.erase(timer_id); + pthread_mutex_unlock (&tasks[task_id]->queue_cond_lock); if (ret==1) return 0; @@ -429,7 +430,7 @@ extern "C" { } const char *itti_get_task_name(task_id_t task_id) { - return tasks[task_id].admin.name; + return tasks[task_id]->admin.name; } // void for compatibility diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 7a01d35d48..b963af0f58 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -121,15 +121,14 @@ void RCconfig_L1(void) { RC.nb_L1_CC[j] = *(L1_ParamList.paramarray[j][L1_CC_IDX].uptr); if (RC.eNB[j] == NULL) { - RC.eNB[j] = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB *)); + RC.eNB[j] = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB *)); LOG_I(PHY,"RC.eNB[%d] = %p\n",j,RC.eNB[j]); memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB *)); } for (i=0; iMod_id = j; RC.eNB[j][i]->CC_id = i; diff --git a/openair2/NETWORK_DRIVER/MESH/device.c b/openair2/NETWORK_DRIVER/MESH/device.c index 5690b9b153..181899cd6e 100644 --- a/openair2/NETWORK_DRIVER/MESH/device.c +++ b/openair2/NETWORK_DRIVER/MESH/device.c @@ -297,7 +297,11 @@ int nas_change_mtu(struct net_device *dev, int mtu) } //--------------------------------------------------------------------------- +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,7,0) void nas_tx_timeout(struct net_device *dev) +#else +void nas_tx_timeout(struct net_device *dev, unsigned int x) +#endif { //--------------------------------------------------------------------------- // Transmitter timeout, serious problems. diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index aa9b9df8f2..419dcc47e1 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -151,7 +151,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_ENDC_SGNB_ADDITION_REQ_ACK); gtpv1u_enb_create_tunnel_req_t create_tunnel_req; gtpv1u_enb_create_tunnel_resp_t create_tunnel_resp; - protocol_ctxt_t ctxt; + protocol_ctxt_t ctxt={0}; // NR RRCReconfiguration AssertFatal(rrc->Nb_ue < MAX_NR_RRC_UE_CONTEXTS,"cannot add another UE\n"); ue_context_p->ue_context.reconfig = calloc(1,sizeof(NR_RRCReconfiguration_t)); diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index 0193c50e1d..2f732443be 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -364,7 +364,7 @@ sctp_handle_new_association_req( int sd = 0; int32_t assoc_id = 0; - struct sctp_event_subscribe events; + struct sctp_event_subscribe events={0}; struct sctp_cnx_list_elm_s *sctp_cnx = NULL; enum sctp_connection_type_e connection_type = SCTP_TYPE_CLIENT; diff --git a/targets/ARCH/rfsimulator/apply_channelmod.c b/targets/ARCH/rfsimulator/apply_channelmod.c index 7aa5d78bf8..3f4c0e1517 100644 --- a/targets/ARCH/rfsimulator/apply_channelmod.c +++ b/targets/ARCH/rfsimulator/apply_channelmod.c @@ -102,8 +102,9 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si } //l } - out_ptr->r += round(rx_tmp.x*pathLossLinear + noise_per_sample*gaussZiggurat(0.0,1.0)); - out_ptr->i += round(rx_tmp.y*pathLossLinear + noise_per_sample*gaussZiggurat(0.0,1.0)); + // Fixme: lround(), rount(), ... is detected by valgrind as error, not found why + out_ptr->r += lround(rx_tmp.x*pathLossLinear + noise_per_sample*gaussZiggurat(0.0,1.0)); + out_ptr->i += lround(rx_tmp.y*pathLossLinear + noise_per_sample*gaussZiggurat(0.0,1.0)); out_ptr++; } diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 1347d75fb0..5316705809 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -1239,7 +1239,8 @@ void init_eNB(int single_thread_flag, if (RC.eNB[inst] == NULL) RC.eNB[inst] = (PHY_VARS_eNB **) malloc(RC.nb_CC[inst]*sizeof(PHY_VARS_eNB *)); for (CC_id=0; CC_idabstraction_flag = 0; From 7e93eef40c308846ba2aeb7f6772348a0ec4345e Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 15 Jan 2021 14:55:38 +0100 Subject: [PATCH 149/160] fix unsigned/signed warning regarding nr_(i)dft --- openair1/PHY/NR_TRANSPORT/nr_transport_proto.h | 2 +- openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 8 ++++---- openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h | 4 ++-- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h index 5228cad98c..e5e81109e4 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h +++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto.h @@ -212,7 +212,7 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext, \param z Pointer to input in frequnecy domain, and it is also the output in time domain \param Msc_PUSCH number of allocated data subcarriers */ -void nr_idft(uint32_t *z, uint32_t Msc_PUSCH); +void nr_idft(int32_t *z, uint32_t Msc_PUSCH); /** \brief This function generates log-likelihood ratios (decoder input) for single-stream QPSK received waveforms. @param rxdataF_comp Compensated channel output diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index 7b7e54fa43..7e6becb4a8 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -12,7 +12,7 @@ //#define DEBUG_RB_EXT //#define DEBUG_CH_MAG -void nr_idft(uint32_t *z, uint32_t Msc_PUSCH) +void nr_idft(int32_t *z, uint32_t Msc_PUSCH) { #if defined(__x86_64__) || defined(__i386__) @@ -38,7 +38,7 @@ void nr_idft(uint32_t *z, uint32_t Msc_PUSCH) } for (i=0,ip=0; ipusch_vars[ulsch_id]->rxdataF_comp[0])[symbol * nb_re_pusch2], nb_re_pusch); + nr_idft(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][symbol * nb_re_pusch2], nb_re_pusch); LOG_D(PHY,"Transform precoding being done on data- symbol: %d, nb_re_pusch: %d\n", symbol, nb_re_pusch); } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index 7d0febbb5a..464bcfcfba 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -181,9 +181,9 @@ typedef struct { /// Scrambled "b"-sequences (for definition see 36-211 V8.6 2009-03, p.14) uint8_t b_tilde[MAX_NUM_NR_CHANNEL_BITS]; /// Modulated "d"-sequences (for definition see 36-211 V8.6 2009-03, p.14) - uint32_t d_mod[MAX_NUM_NR_RE] __attribute__ ((aligned(16))); + int32_t d_mod[MAX_NUM_NR_RE] __attribute__ ((aligned(16))); /// Transform-coded "y"-sequences (for definition see 38-211 V15.3.0 2018-09, subsection 6.3.1.4) - uint32_t y[MAX_NUM_NR_RE] __attribute__ ((aligned(16))); + int32_t y[MAX_NUM_NR_RE] __attribute__ ((aligned(16))); /* /// "q" sequences for CQI/PMI (for definition see 36-212 V8.6 2009-03, p.27) uint8_t q[MAX_CQI_PAYLOAD]; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index c36c4b98ed..208901f289 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -286,7 +286,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, } #ifdef DEBUG_DFT_IDFT - uint32_t debug_symbols[MAX_NUM_NR_RE] __attribute__ ((aligned(16))); + int32_t debug_symbols[MAX_NUM_NR_RE] __attribute__ ((aligned(16))); int offset = 0; printf("NR_ULSCH_UE: available_bits: %d, mod_order: %d", available_bits,mod_order); @@ -303,7 +303,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, } LOG_M("preDFT_all_symbols.m","UE_preDFT", tx_layers[0],number_of_symbols*nb_re_pusch,1,1); - LOG_M("postDFT_all_symbols.m","UE_postDFT", &(ulsch_ue->y[0]),number_of_symbols*nb_re_pusch,1,1); + LOG_M("postDFT_all_symbols.m","UE_postDFT", ulsch_ue->y,number_of_symbols*nb_re_pusch,1,1); LOG_M("DEBUG_IDFT_SYMBOLS.m","UE_Debug_IDFT", debug_symbols,number_of_symbols*nb_re_pusch,1,1); LOG_M("UE_DMRS_SEQ.m","UE_DMRS_SEQ", dmrs_seq,nb_re_pusch,1,1); #endif From e3ac0404a7e26f512a8ea5e5c7b7018bcdd889ee Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 15 Jan 2021 17:09:28 +0100 Subject: [PATCH 150/160] fix printf() formats for unsigned integers in nr_ulsim --- openair1/SIMULATION/NR_PHY/ulsim.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index e93bdba4b2..670cf5cc9f 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -757,10 +757,10 @@ int main(int argc, char **argv) unsigned int TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs * number_dmrs_symbols, 0, 0, precod_nbr_layers); - printf("[ULSIM]: length_dmrs: %d, l_prime_mask: %d number_dmrs_symbols: %d, mapping_type: %d add_pos: %d \n", length_dmrs, l_prime_mask, number_dmrs_symbols, mapping_type,add_pos); - printf("[ULSIM]: CDM groups: %d, dmrs_config_type: %d, num_rbs: %d, nb_symb_sch: %d\n", num_dmrs_cdm_grps_no_data, dmrs_config_type, nb_rb, nb_symb_sch); - printf("[ULSIM]: MCS: %d, mod order: %d, code_rate: %d\n", Imcs, mod_order, code_rate); - printf("[ULSIM]: VALUE OF G: %d, TBS: %d\n", available_bits, TBS); + printf("[ULSIM]: length_dmrs: %u, l_prime_mask: %u number_dmrs_symbols: %u, mapping_type: %u add_pos: %d \n", length_dmrs, l_prime_mask, number_dmrs_symbols, mapping_type, add_pos); + printf("[ULSIM]: CDM groups: %u, dmrs_config_type: %d, num_rbs: %u, nb_symb_sch: %u\n", num_dmrs_cdm_grps_no_data, dmrs_config_type, nb_rb, nb_symb_sch); + printf("[ULSIM]: MCS: %d, mod order: %u, code_rate: %u\n", Imcs, mod_order, code_rate); + printf("[ULSIM]: VALUE OF G: %u, TBS: %u\n", available_bits, TBS); From 4344b9108e356899a55368f1e7fa6974c9b50842 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 14 Jan 2021 11:23:03 +0100 Subject: [PATCH 151/160] macpdu2wireshark: trace scheduling requests You need a recent version of wireshark for this to work properly. Successfully tested with 3.3.2. --- common/utils/T/T_messages.txt | 2 +- common/utils/T/tracer/macpdu2wireshark.c | 62 ++++++++++++++++++++---- common/utils/T/tracer/packet-mac-lte.h | 40 ++++++--------- 3 files changed, 68 insertions(+), 36 deletions(-) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index 84fcdd55af..06ee5bf12b 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -129,7 +129,7 @@ ID = ENB_MAC_UE_DL_PDU_WITH_DATA FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data ID = ENB_MAC_SCHEDULING_REQUEST DESC = MAC scheduling request detected for an UE - GROUP = ALL:MAC:ENB + GROUP = ALL:MAC:ENB:WIRESHARK FORMAT = int,eNB_ID : int,CC_id : int,frame : int,subframe : int,rnti ID = ENB_MAC_UE_DL_RAR_PDU_WITH_DATA DESC = MAC downlink PDU for an UE diff --git a/common/utils/T/tracer/macpdu2wireshark.c b/common/utils/T/tracer/macpdu2wireshark.c index d262f09e4a..ba961553d2 100644 --- a/common/utils/T/tracer/macpdu2wireshark.c +++ b/common/utils/T/tracer/macpdu2wireshark.c @@ -18,6 +18,7 @@ #define DEFAULT_LIVE_PORT 2021 #define NO_PREAMBLE -1 +#define NO_SR_RNTI -1 typedef struct { int socket; @@ -48,6 +49,10 @@ typedef struct { int rar_frame; int rar_subframe; int rar_data; + /* SR */ + int sr_rnti; + int sr_frame; + int sr_subframe; /* NR traces */ /* NR ul */ @@ -87,7 +92,8 @@ typedef struct { /****************************************************************************/ void trace_lte(ev_data *d, int direction, int rnti_type, int rnti, - int frame, int subframe, void *buf, int bufsize, int preamble) + int frame, int subframe, void *buf, int bufsize, int preamble, + int sr_rnti) { ssize_t ret; int fsf; @@ -118,6 +124,16 @@ void trace_lte(ev_data *d, int direction, int rnti_type, int rnti, PUTC(&d->buf, 0); /* rach attempt - always 0 for us (not sure of this) */ } + if (sr_rnti != NO_SR_RNTI) { + PUTC(&d->buf, MAC_LTE_SR_TAG); + PUTC(&d->buf, 0); /* number of items byte 1 */ + PUTC(&d->buf, 1); /* number of items byte 2 */ + PUTC(&d->buf, 0); /* ueid byte 1 (not used, let's put 0) */ + PUTC(&d->buf, 0); /* ueid byte 2 (not used, let's put 0) */ + PUTC(&d->buf, (sr_rnti>>8) & 255); + PUTC(&d->buf, sr_rnti & 255); + } + PUTC(&d->buf, MAC_LTE_PAYLOAD_TAG); for (i = 0; i < bufsize; i++) @@ -135,7 +151,7 @@ void ul(void *_d, event e) trace_lte(d, DIRECTION_UPLINK, C_RNTI, e.e[d->ul_rnti].i, e.e[d->ul_frame].i, e.e[d->ul_subframe].i, e.e[d->ul_data].b, e.e[d->ul_data].bsize, - NO_PREAMBLE); + NO_PREAMBLE, NO_SR_RNTI); } void dl(void *_d, event e) @@ -154,7 +170,7 @@ void dl(void *_d, event e) e.e[d->dl_rnti].i != 0xffff ? C_RNTI : SI_RNTI, e.e[d->dl_rnti].i, e.e[d->dl_frame].i, e.e[d->dl_subframe].i, e.e[d->dl_data].b, e.e[d->dl_data].bsize, - NO_PREAMBLE); + NO_PREAMBLE, NO_SR_RNTI); } void mib(void *_d, event e) @@ -169,7 +185,7 @@ void mib(void *_d, event e) trace_lte(d, DIRECTION_DOWNLINK, NO_RNTI, 0, e.e[d->mib_frame].i, e.e[d->mib_subframe].i, e.e[d->mib_data].b, e.e[d->mib_data].bsize, - NO_PREAMBLE); + NO_PREAMBLE, NO_SR_RNTI); } void preamble(void *_d, event e) @@ -178,7 +194,7 @@ void preamble(void *_d, event e) trace_lte(d, DIRECTION_UPLINK, NO_RNTI, 0, e.e[d->preamble_frame].i, e.e[d->preamble_subframe].i, NULL, 0, - e.e[d->preamble_preamble].i); + e.e[d->preamble_preamble].i, NO_SR_RNTI); } void rar(void *_d, event e) @@ -187,7 +203,16 @@ void rar(void *_d, event e) trace_lte(d, DIRECTION_DOWNLINK, RA_RNTI, e.e[d->rar_rnti].i, e.e[d->rar_frame].i, e.e[d->rar_subframe].i, e.e[d->rar_data].b, e.e[d->rar_data].bsize, - NO_PREAMBLE); + NO_PREAMBLE, NO_SR_RNTI); +} + +void sr(void *_d, event e) +{ + ev_data *d = _d; + trace_lte(d, DIRECTION_UPLINK, NO_RNTI, 0, + e.e[d->sr_frame].i, e.e[d->sr_subframe].i, + NULL, 0, + NO_PREAMBLE, e.e[d->sr_rnti].i); } /****************************************************************************/ @@ -298,7 +323,7 @@ void nr_rar(void *_d, event e) /****************************************************************************/ void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id, - int preamble_id, int rar_id, + int preamble_id, int rar_id, int sr_id, int nr_ul_id, int nr_dl_id, int nr_mib_id, int nr_rar_id) { database_event_format f; @@ -321,6 +346,9 @@ void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id, d->rar_frame = -1; d->rar_subframe = -1; d->rar_data = -1; + d->sr_rnti = -1; + d->sr_frame = -1; + d->sr_subframe = -1; d->nr_ul_rnti = -1; d->nr_ul_frame = -1; @@ -407,6 +435,18 @@ void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id, if (d->rar_rnti == -1 || d->rar_frame == -1 || d->rar_subframe == -1 || d->rar_data == -1) goto error; + /* sr: rnti, frame, subframe */ + f = get_format(database, sr_id); + + for (i = 0; i < f.count; i++) { + G("rnti", "int", d->sr_rnti); + G("frame", "int", d->sr_frame); + G("subframe", "int", d->sr_subframe); + } + + if (d->sr_rnti == -1 || d->sr_frame == -1 || d->sr_subframe == -1) + goto error; + /* NR ul: rnti, frame, slot, data */ f = get_format(database, nr_ul_id); @@ -530,6 +570,7 @@ int main(int n, char **v) int i; int ul_id, dl_id, mib_id, preamble_id, rar_id; int nr_ul_id, nr_dl_id, nr_mib_id, nr_rar_id; + int sr_id; ev_data d; char *ip = DEFAULT_IP; int port = DEFAULT_PORT; @@ -599,6 +640,7 @@ int main(int n, char **v) on_off(database, "ENB_PHY_MIB", is_on, 1); on_off(database, "ENB_PHY_INITIATE_RA_PROCEDURE", is_on, 1); on_off(database, "ENB_MAC_UE_DL_RAR_PDU_WITH_DATA", is_on, 1); + on_off(database, "ENB_MAC_SCHEDULING_REQUEST", is_on, 1); on_off(database, "GNB_MAC_UL_PDU_WITH_DATA", is_on, 1); on_off(database, "GNB_MAC_DL_PDU_WITH_DATA", is_on, 1); @@ -621,13 +663,14 @@ int main(int n, char **v) mib_id = event_id_from_name(database, "ENB_PHY_MIB"); preamble_id = event_id_from_name(database, "ENB_PHY_INITIATE_RA_PROCEDURE"); rar_id = event_id_from_name(database, "ENB_MAC_UE_DL_RAR_PDU_WITH_DATA"); + sr_id = event_id_from_name(database, "ENB_MAC_SCHEDULING_REQUEST"); nr_ul_id = event_id_from_name(database, "GNB_MAC_UL_PDU_WITH_DATA"); nr_dl_id = event_id_from_name(database, "GNB_MAC_DL_PDU_WITH_DATA"); nr_mib_id = event_id_from_name(database, "GNB_PHY_MIB"); nr_rar_id = event_id_from_name(database, "GNB_MAC_DL_RAR_PDU_WITH_DATA"); - setup_data(&d, database, ul_id, dl_id, mib_id, preamble_id, rar_id, + setup_data(&d, database, ul_id, dl_id, mib_id, preamble_id, rar_id, sr_id, nr_ul_id, nr_dl_id, nr_mib_id, nr_rar_id); register_handler_function(h, ul_id, ul, &d); @@ -635,6 +678,7 @@ int main(int n, char **v) register_handler_function(h, mib_id, mib, &d); register_handler_function(h, preamble_id, preamble, &d); register_handler_function(h, rar_id, rar, &d); + register_handler_function(h, sr_id, sr, &d); register_handler_function(h, nr_ul_id, nr_ul, &d); register_handler_function(h, nr_dl_id, nr_dl, &d); @@ -662,7 +706,7 @@ int main(int n, char **v) if (e.type == -1) break; if (!(e.type == ul_id || e.type == dl_id || e.type == mib_id || - e.type == preamble_id || e.type == rar_id || + e.type == preamble_id || e.type == rar_id || e.type == sr_id || e.type == nr_ul_id || e.type == nr_dl_id || e.type == nr_mib_id || e.type == nr_rar_id)) continue; diff --git a/common/utils/T/tracer/packet-mac-lte.h b/common/utils/T/tracer/packet-mac-lte.h index 54e6d1a09b..60181987a9 100644 --- a/common/utils/T/tracer/packet-mac-lte.h +++ b/common/utils/T/tracer/packet-mac-lte.h @@ -11,26 +11,7 @@ * * Copyright (C) 2009 Martin Mathieson. All rights reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE + * SPDX-License-Identifier: BSD-2-Clause */ #ifndef __COMMON_UTILS_T_TRACER_PACKET_MAC_LTE__H__ @@ -67,9 +48,9 @@ /* and implemented by this dissector, using the definitions */ /* below. A link to an example program showing you how to encode */ /* these headers and send LTE MAC PDUs on a UDP socket is */ -/* provided at https://wiki.wireshark.org/MAC-LTE */ +/* provided at https://wiki.wireshark.org/MAC-LTE */ /* */ -/* A heuristic dissecter (enabled by a preference) will */ +/* A heuristic dissector (enabled by a preference) will */ /* recognise a signature at the beginning of these frames. */ /*****************************************************************/ @@ -126,18 +107,25 @@ MCS index (1 byte), redundancy version (1 byte), resource block length (1 byte), HARQ id (1 byte), NDI (1 byte), TB (1 byte), DL reTx (1 byte) */ -#define MAC_LTE_SIMULT_PUCCH_PUSCH_PCELL 0x0C +#define MAC_LTE_SIMULT_PUCCH_PUSCH_PCELL_TAG 0x0C /* 0 byte */ -#define MAC_LTE_SIMULT_PUCCH_PUSCH_PSCELL 0x0D +#define MAC_LTE_SIMULT_PUCCH_PUSCH_PSCELL_TAG 0x0D /* 0 byte */ -#define MAC_LTE_CE_MODE 0x0E +#define MAC_LTE_CE_MODE_TAG 0x0E /* 1 byte containing mac_lte_ce_mode enum value */ -#define MAC_LTE_NB_MODE 0x0F +#define MAC_LTE_NB_MODE_TAG 0x0F /* 1 byte containing mac_lte_nb_mode enum value */ +#define MAC_LTE_N_UL_RB_TAG 0x10 +/* 1 byte containing the number of UL resource blocks: 6, 15, 25, 50, 75 or 100 */ + +#define MAC_LTE_SR_TAG 0x11 +/* 2 bytes for the number of items, followed by that number of ueid, rnti (2 bytes each) */ + + /* MAC PDU. Following this tag comes the actual MAC PDU (there is no length, the PDU continues until the end of the frame) */ #define MAC_LTE_PAYLOAD_TAG 0x01 From 23b24a3c8a11c7a8a9feef622ea24e83e1854881 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 21 Jan 2021 11:29:29 +0100 Subject: [PATCH 152/160] T tracer macpdu2wireshark: add UE id There was a problem with several UEs in the wireshark log. It seems that wireshark needs the UE id otherwise it gets confused and sees retransmissions where it's just another UE connecting and doing the same as a previous UE. Let's put kind of a UE id. Each RNTI seen by macpdu2wireshark gets an UE id assigned the first time it's seen in a trace. This is a bit hackish but seems to be fine. We could have added UE_id in all the traces, that is change the T() calls in the softmodem. It was less work to do it as it is, ie. only touch macpdu2wireshark.c. The RAR uses the same UE id all the time, may be a problem. To be refined if needed. --- common/utils/T/tracer/macpdu2wireshark.c | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/common/utils/T/tracer/macpdu2wireshark.c b/common/utils/T/tracer/macpdu2wireshark.c index ba961553d2..f688e26806 100644 --- a/common/utils/T/tracer/macpdu2wireshark.c +++ b/common/utils/T/tracer/macpdu2wireshark.c @@ -85,6 +85,15 @@ typedef struct { /* runtime vars */ int cur_mib; int cur_sib; + + /* hack to report UE id: + * each time we see a rnti, we allocate the next ue_id + * (two separate versions for lte and nr) + */ + int lte_rnti_to_ueid[65536]; + int lte_next_ue_id; + int nr_rnti_to_ueid[65536]; + int nr_next_ue_id; } ev_data; /****************************************************************************/ @@ -108,6 +117,18 @@ void trace_lte(ev_data *d, int direction, int rnti_type, int rnti, PUTC(&d->buf, MAC_LTE_RNTI_TAG); PUTC(&d->buf, (rnti>>8) & 255); PUTC(&d->buf, rnti & 255); + + /* put UE id */ + if (rnti < 0 || rnti > 65535) { printf("bad rnti!\n"); exit(1); } + /* if no UE id allocated for this rnti then allocate the next one */ + if (d->lte_rnti_to_ueid[rnti] == -1) { + d->lte_rnti_to_ueid[rnti] = d->lte_next_ue_id; + d->lte_next_ue_id++; + } + + PUTC(&d->buf, MAC_LTE_UEID_TAG); + PUTC(&d->buf, (d->lte_rnti_to_ueid[rnti]>>8) & 255); + PUTC(&d->buf, d->lte_rnti_to_ueid[rnti] & 255); } /* for newer version of wireshark? */ @@ -223,6 +244,7 @@ void sr(void *_d, event e) #define MAC_NR_PAYLOAD_TAG 0x01 #define MAC_NR_RNTI_TAG 0x02 +#define MAC_NR_UEID_TAG 0x03 #define MAC_NR_FRAME_SLOT_TAG 0x07 #define NR_FDD_RADIO 1 @@ -250,6 +272,18 @@ void trace_nr(ev_data *d, int direction, int rnti_type, int rnti, PUTC(&d->buf, MAC_NR_RNTI_TAG); PUTC(&d->buf, (rnti>>8) & 255); PUTC(&d->buf, rnti & 255); + + /* put UE id */ + if (rnti < 0 || rnti > 65535) { printf("bad rnti!\n"); exit(1); } + /* if no UE id allocated for this rnti then allocate the next one */ + if (d->nr_rnti_to_ueid[rnti] == -1) { + d->nr_rnti_to_ueid[rnti] = d->nr_next_ue_id; + d->nr_next_ue_id++; + } + + PUTC(&d->buf, MAC_NR_UEID_TAG); + PUTC(&d->buf, (d->nr_rnti_to_ueid[rnti]>>8) & 255); + PUTC(&d->buf, d->nr_rnti_to_ueid[rnti] & 255); } #if 0 @@ -579,6 +613,11 @@ int main(int n, char **v) int live = 0; memset(&d, 0, sizeof(ev_data)); + for (i = 0; i < 65536; i++) { + d.lte_rnti_to_ueid[i] = -1; + d.nr_rnti_to_ueid[i] = -1; + } + for (i = 1; i < n; i++) { if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage(); if (!strcmp(v[i], "-d")) { if(i>n-2)usage(); database_filename = v[++i]; continue; } From 40f985a95786c2c0c03a9262ec459518c86ad8a1 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 21 Jan 2021 11:44:28 +0100 Subject: [PATCH 153/160] macpdu2wireshark: add UE id into scheduling request logging Same logic as previous commit, same caveats. --- common/utils/T/tracer/macpdu2wireshark.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/common/utils/T/tracer/macpdu2wireshark.c b/common/utils/T/tracer/macpdu2wireshark.c index f688e26806..d04f2c317d 100644 --- a/common/utils/T/tracer/macpdu2wireshark.c +++ b/common/utils/T/tracer/macpdu2wireshark.c @@ -149,8 +149,17 @@ void trace_lte(ev_data *d, int direction, int rnti_type, int rnti, PUTC(&d->buf, MAC_LTE_SR_TAG); PUTC(&d->buf, 0); /* number of items byte 1 */ PUTC(&d->buf, 1); /* number of items byte 2 */ - PUTC(&d->buf, 0); /* ueid byte 1 (not used, let's put 0) */ - PUTC(&d->buf, 0); /* ueid byte 2 (not used, let's put 0) */ + + /* put UE id */ + if (sr_rnti < 0 || sr_rnti > 65535) { printf("bad sr rnti!\n"); exit(1); } + /* if no UE id allocated for this rnti then allocate the next one */ + if (d->lte_rnti_to_ueid[sr_rnti] == -1) { + d->lte_rnti_to_ueid[sr_rnti] = d->lte_next_ue_id; + d->lte_next_ue_id++; + } + PUTC(&d->buf, (d->lte_rnti_to_ueid[sr_rnti]>>8) & 255); + PUTC(&d->buf, d->lte_rnti_to_ueid[sr_rnti] & 255); + PUTC(&d->buf, (sr_rnti>>8) & 255); PUTC(&d->buf, sr_rnti & 255); } From eddebae1e4feac96bf0f2b095674c0c202dea7e7 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Thu, 21 Jan 2021 13:47:18 +0100 Subject: [PATCH 154/160] fix after code review --- common/utils/ocp_itti/intertask_interface.cpp | 13 ++++++------- common/utils/ocp_itti/intertask_interface.h | 11 +++++------ executables/main-ocp.c | 2 +- executables/nr-softmodem.c | 2 +- executables/nr-uesoftmodem.c | 2 +- executables/ocp-gnb.c | 2 +- openair1/SIMULATION/LTE_PHY/dlsim.c | 1 - openair1/SIMULATION/LTE_PHY/dlsim_tm4.c | 1 - openair1/SIMULATION/LTE_PHY/mbmssim.c | 1 - openair1/SIMULATION/LTE_PHY/pucchsim.c | 1 - openair1/SIMULATION/LTE_PHY/ulsim.c | 1 - openair2/SIMULATION/NR_RRC/itti_sim.c | 2 +- openair3/TEST/EPC_TEST/play_scenario.c | 2 +- openair3/TEST/oaisim_mme_itti_test.c | 2 +- openair3/TEST/oaisim_mme_test_s1c.c | 2 +- targets/RT/USER/lte-softmodem.c | 2 +- targets/RT/USER/lte-uesoftmodem.c | 2 +- 17 files changed, 21 insertions(+), 28 deletions(-) diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index 964f5409fd..2189be9fe8 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -336,15 +336,15 @@ extern "C" { usleep(100*1000); // Allow the tasks to receive the message before going returning to main thread } - int itti_create_queue(const task_info_t *task_info) { + int itti_create_queue(const task_info_t *taskInfo) { pthread_mutex_lock (&lock_nb_queues); int newQueue=nb_queues++; AssertFatal(tasks=(task_list_t **) realloc(tasks, nb_queues * sizeof(*tasks)),""); tasks[newQueue]= new task_list_t; pthread_mutex_unlock (&lock_nb_queues); - LOG_I(TMR,"Starting itti queue: %s as task %d\n", tasks_info->name, newQueue); + LOG_I(TMR,"Starting itti queue: %s as task %d\n", taskInfo->name, newQueue); pthread_mutex_init(&tasks[newQueue]->queue_cond_lock, NULL); - memcpy(&tasks[newQueue]->admin, tasks_info, sizeof(task_info_t)); + memcpy(&tasks[newQueue]->admin, taskInfo, sizeof(task_info_t)); AssertFatal( ( tasks[newQueue]->epoll_fd = epoll_create1(0) ) >=0, ""); AssertFatal( ( tasks[newQueue]->sem_fd = eventfd(0, EFD_SEMAPHORE) ) >=0, ""); itti_subscribe_event_fd((task_id_t)newQueue, tasks[newQueue]->sem_fd); @@ -356,14 +356,13 @@ extern "C" { } int itti_init(task_id_t task_max, - MessagesIds messages_id_max, - const task_info_t *tasks_info, - const message_info_t *messages_info) { + const task_info_t *tasks + ) { pthread_mutex_init(&lock_nb_queues, NULL); nb_queues=0; for(int i=0; i #ifdef ITTI_SIM -#include + #include #endif /* @@ -301,7 +301,7 @@ typedef struct { //TASK_DEF(TASK_RRC_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) //TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL) //TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000, NULL, NULL) -void * rrc_enb_process_msg(void*); +void *rrc_enb_process_msg(void *); #define FOREACH_TASK(TASK_DEF) \ TASK_DEF(TASK_UNKNOWN, TASK_PRIORITY_MED, 50, NULL, NULL) \ TASK_DEF(TASK_TIMER, TASK_PRIORITY_MED, 10, NULL, NULL) \ @@ -403,8 +403,8 @@ typedef struct MessageHeader_s { MessagesIds messageId; /**< Unique message id as referenced in enum MessagesIds */ task_id_t originTaskId; /**< ID of the sender task */ task_id_t destinationTaskId; /**< ID of the destination task */ - instance_t originInstance; - instance_t destinationInstance; + instance_t originInstance; + instance_t destinationInstance; itti_lte_time_t lte_time; MessageHeaderSize ittiMsgSize; /**< Message size (not including header size) */ } MessageHeader; @@ -566,8 +566,7 @@ void *malloc_or_fail(size_t size); int memory_read(const char *datafile, void *data, size_t size); int itti_free(task_id_t task_id, void *ptr); -int itti_init(task_id_t task_max, MessagesIds messages_id_max, const task_info_t *tasks_info, - const message_info_t *messages_info); +int itti_init(task_id_t task_max, const task_info_t *tasks_info); int timer_setup( uint32_t interval_sec, uint32_t interval_us, diff --git a/executables/main-ocp.c b/executables/main-ocp.c index f464bbd7bc..39e7b558ac 100644 --- a/executables/main-ocp.c +++ b/executables/main-ocp.c @@ -1141,7 +1141,7 @@ int main ( int argc, char **argv ) { if (opp_enabled ==1) reset_opp_meas(); - itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, tasks_info); init_opt(); #ifndef PACKAGE_VERSION # define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL" diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index c3bfd09eb0..266f624547 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -863,7 +863,7 @@ int main( int argc, char **argv ) } cpuf=get_cpu_freq_GHz(); - itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, tasks_info); // initialize mscgen log after ITTI MSC_INIT(MSC_E_UTRAN, ADDED_QUEUES_MAX+TASK_MAX); diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index e25b103860..0737ed2207 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -514,7 +514,7 @@ int main( int argc, char **argv ) { initTpool(params_dl, Tpool_dl, false); #endif cpuf=get_cpu_freq_GHz(); - itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, tasks_info); init_opt() ; load_nrLDPClib(); diff --git a/executables/ocp-gnb.c b/executables/ocp-gnb.c index ff8d8840e9..4ddc7870d9 100644 --- a/executables/ocp-gnb.c +++ b/executables/ocp-gnb.c @@ -928,7 +928,7 @@ int main( int argc, char **argv ) { get_common_options(SOFTMODEM_GNB_BIT ); AssertFatal(!CONFIG_ISFLAGSET(CONFIG_ABORT),"Getting configuration failed\n"); cpuf=get_cpu_freq_GHz(); - itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, tasks_info); set_taus_seed (0); init_opt(); init_pdcp(); diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 87489353d3..667913d377 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -905,7 +905,6 @@ int main(int argc, char **argv) { // moreover you need to init itti with the following line // however itti will catch all signals, so ctrl-c won't work anymore // alternatively you can disable ITTI completely in CMakeLists.txt - //itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); T_stdout = 1; if (common_flag == 0) { diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c index 8a646bb9d5..a585e8efc6 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c @@ -689,7 +689,6 @@ int main(int argc, char **argv) // moreover you need to init itti with the following line // however itti will catch all signals, so ctrl-c won't work anymore // alternatively you can disable ITTI completely in CMakeLists.txt - //itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); if (common_flag == 0) { switch (N_RB_DL) { diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c index 8a2f10df3e..b1f4d933b3 100644 --- a/openair1/SIMULATION/LTE_PHY/mbmssim.c +++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c @@ -997,7 +997,6 @@ int main(int argc, char **argv) { // moreover you need to init itti with the following line // however itti will catch all signals, so ctrl-c won't work anymore // alternatively you can disable ITTI completely in CMakeLists.txt - //itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); if (common_flag == 0) { switch (N_RB_DL) { diff --git a/openair1/SIMULATION/LTE_PHY/pucchsim.c b/openair1/SIMULATION/LTE_PHY/pucchsim.c index 396fce7a91..127bfcb533 100644 --- a/openair1/SIMULATION/LTE_PHY/pucchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pucchsim.c @@ -283,7 +283,6 @@ int main(int argc, char **argv) { } logInit(); - //itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); g_log->log_component[PHY].level = LOG_DEBUG; g_log->log_component[PHY].flag = LOG_HIGH; diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 344425fa62..80beee4bed 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -409,7 +409,6 @@ int main(int argc, char **argv) { // enable these lines if you need debug info // however itti will catch all signals, so ctrl-c won't work anymore // alternatively you can disable ITTI completely in CMakeLists.txt - // itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL); // set_comp_log(PHY,LOG_DEBUG,LOG_HIGH,1); // set_glog(LOG_DEBUG,LOG_HIGH); //hapZEbm:n:Y:X:x:s:w:e:q:d:D:O:c:r:i:f:y:c:oA:C:R:g:N:l:S:T:QB:PI:LF diff --git a/openair2/SIMULATION/NR_RRC/itti_sim.c b/openair2/SIMULATION/NR_RRC/itti_sim.c index 9f81aa1901..77369d4435 100644 --- a/openair2/SIMULATION/NR_RRC/itti_sim.c +++ b/openair2/SIMULATION/NR_RRC/itti_sim.c @@ -557,7 +557,7 @@ int main( int argc, char **argv ) } cpuf=get_cpu_freq_GHz(); - itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, tasks_info); // initialize mscgen log after ITTI MSC_INIT(MSC_E_UTRAN, ADDED_QUEUES_MAX+TASK_MAX); diff --git a/openair3/TEST/EPC_TEST/play_scenario.c b/openair3/TEST/EPC_TEST/play_scenario.c index 858448b815..ebaffdb39e 100644 --- a/openair3/TEST/EPC_TEST/play_scenario.c +++ b/openair3/TEST/EPC_TEST/play_scenario.c @@ -1204,7 +1204,7 @@ int main( int argc, char **argv ) logInit(); set_glog(LOG_TRACE, LOG_MED); - itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, tasks_info); set_comp_log(ENB_APP, LOG_TRACE, LOG_MED, 1); set_comp_log(S1AP, LOG_TRACE, LOG_MED, 1); diff --git a/openair3/TEST/oaisim_mme_itti_test.c b/openair3/TEST/oaisim_mme_itti_test.c index 0b381a0415..ecfbdb0acb 100644 --- a/openair3/TEST/oaisim_mme_itti_test.c +++ b/openair3/TEST/oaisim_mme_itti_test.c @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) /* Calling each layer init function */ log_init(&mme_config); - itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, tasks_info); sctp_init(&mme_config); udp_init(&mme_config); s1ap_mme_init(&mme_config); diff --git a/openair3/TEST/oaisim_mme_test_s1c.c b/openair3/TEST/oaisim_mme_test_s1c.c index 53f8a1d5eb..94a554ab5f 100644 --- a/openair3/TEST/oaisim_mme_test_s1c.c +++ b/openair3/TEST/oaisim_mme_test_s1c.c @@ -309,7 +309,7 @@ int main( int argc, char **argv ) /* Read eNB configuration file */ enb_properties = enb_config_init(conf_config_file_name); - itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, tasks_info); itti_wait_ready(1); diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index cdafb1e3eb..a602e762f1 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -544,7 +544,7 @@ int main ( int argc, char **argv ) cpuf=get_cpu_freq_GHz(); printf("ITTI init, useMME: %i\n",EPC_MODE_ENABLED); - itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, tasks_info); // allows to forward in wireshark L2 protocol for decoding // initialize mscgen log after ITTI if (get_softmodem_params()->start_msc) { diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index dce7a20874..9bf179efb9 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -601,7 +601,7 @@ int main( int argc, char **argv ) { pthread_mutex_init(&sync_mutex, NULL); printf("ITTI init\n"); - itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); + itti_init(TASK_MAX, tasks_info); // initialize mscgen log after ITTI if (get_softmodem_params()->start_msc) { From 9ea9a9bc020610c44b6fafe7396a332828c93775 Mon Sep 17 00:00:00 2001 From: hardy Date: Thu, 21 Jan 2021 13:47:47 +0100 Subject: [PATCH 155/160] adding ue parallelization to get rid of real time errors --- ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml | 2 +- ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml index b15b5bfcbc..ce3d0cb606 100644 --- a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml +++ b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml @@ -52,7 +52,7 @@ Initialize_OAI_UE Initialize NR UE USRP - --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path . + --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path --dlsch-parallel 4 . NR diff --git a/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml b/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml index 54b957473d..7215c94347 100644 --- a/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml +++ b/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml @@ -52,7 +52,7 @@ Initialize_OAI_UE Initialize NR UE USRP - --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path . + --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path --dlsch-parallel 4 . NR From 1cb657accc5c763c4a182192d181506b228571e0 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Thu, 21 Jan 2021 18:51:26 +0100 Subject: [PATCH 156/160] mention support for SC-FDMA in FEATURE_SET.md --- doc/FEATURE_SET.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/FEATURE_SET.md b/doc/FEATURE_SET.md index 2840eed73c..2171fc2f1f 100644 --- a/doc/FEATURE_SET.md +++ b/doc/FEATURE_SET.md @@ -264,6 +264,7 @@ The following features are valid for the gNB and the 5G-NR UE. * Highly efficient 3GPP compliant LDPC encoder and decoder (BG1 and BG2 supported) * Highly efficient 3GPP compliant polar encoder and decoder * Encoder and decoder for short blocks +* Support for UL transform precoding (SC-FDMA) ## gNB PHY Layer ## From 15ee2bf2c47041166d807d9223479e1955c651c0 Mon Sep 17 00:00:00 2001 From: Mohammed Ismail Date: Mon, 4 Jan 2021 12:09:31 +0100 Subject: [PATCH 157/160] [CI] adapted to build the image on asterix and obelix Signed-off-by: Mohammed Ismail --- ci-scripts/cls_containerize.py | 128 ++++++++++++++++++++++++++------- 1 file changed, 103 insertions(+), 25 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 1f95d2602f..d46f7493c0 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -37,6 +37,7 @@ import logging import os import time from multiprocessing import Process, Lock, SimpleQueue +from zipfile import ZipFile #----------------------------------------------------------- # OAI Testing modules @@ -80,7 +81,11 @@ class Containerize(): self.flexranCtrlDeployed = False self.flexranCtrlIpAddress = '' - + self.cli = '' + self.dockerfileprefix = '' + self.host = '' + self.allImagesSize = {} + self.collectInfo = {} #----------------------------------------------------------- # Container management functions #----------------------------------------------------------- @@ -110,10 +115,21 @@ class Containerize(): logging.debug('Building on server: ' + lIpAddr) mySSH = SSH.SSHConnection() mySSH.open(lIpAddr, lUserName, lPassWord) + + # Checking the hostname to get adapted on cli and dockerfileprefixes + mySSH.command('hostnamectl', '\$', 5) + result = re.search('Ubuntu|Red Hat', mySSH.getBefore()) + self.host = result.group(0) + if self.host == 'Ubuntu': + self.cli = 'docker' + self.dockerfileprefix = '.ubuntu18' + elif self.host == 'Red Hat': + self.cli = 'podman' + self.dockerfileprefix = '.rhel8.2' imageNames = [] result = re.search('eNB', self.imageKind) - # Creating a tupple with the imageName and the DockerFile prefix pattern + # Creating a tupple with the imageName and the DockerFile prefix pattern on obelix if result is not None: imageNames.append(('oai-enb', 'eNB')) else: @@ -123,16 +139,19 @@ class Containerize(): else: result = re.search('all', self.imageKind) if result is not None: - imageNames.append(('oai-enb', 'eNB')) + imageNames.append(('oai-enb', 'eNB')) imageNames.append(('oai-gnb', 'gNB')) - imageNames.append(('oai-lte-ue', 'lteUE')) + imageNames.append(('oai-lte-ue', 'lteUE')) imageNames.append(('oai-nr-ue', 'nrUE')) if len(imageNames) == 0: imageNames.append(('oai-enb', 'eNB')) + # Workaround for some servers, we need to erase completely the workspace if self.forcedWorkspaceCleanup: mySSH.command('echo ' + lPassWord + ' | sudo -S rm -Rf ' + lSourcePath, '\$', 15) + self.testCase_id = HTML.testCase_id + # on RedHat/CentOS .git extension is mandatory result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository) if result is not None: @@ -162,97 +181,156 @@ class Containerize(): else: logging.debug('Merging with the target branch: ' + self.ranTargetBranch) mySSH.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) + + # if asterix, copy the entitlement and subscription manager configurations + if self.host == 'Red Hat': + mySSH.command('mkdir -p tmp/ca/', '\$', 5) + mySSH.command('mkdir -p tmp/entitlement/', '\$', 5) + mySSH.command('sudo cp /etc/rhsm/ca/redhat-uep.pem tmp/ca/', '\$', 5) + mySSH.command('sudo cp /etc/pki/entitlement/*.pem tmp/entitlement/', '\$', 5) + + #mySSH.close() + #return 0 + sharedimage = 'ran-build' # Let's remove any previous run artifacts if still there - mySSH.command('docker image prune --force', '\$', 5) - mySSH.command('docker image rm ran-build:' + imageTag, '\$', 5) + mySSH.command(self.cli + ' image prune --force', '\$', 5) + mySSH.command(self.cli + ' image rm ' + sharedimage + ':' + imageTag, '\$', 5) for image,pattern in imageNames: - mySSH.command('docker image rm ' + image + ':' + imageTag, '\$', 5) + mySSH.command(self.cli + ' image rm ' + image + ':' + imageTag, '\$', 5) # Build the shared image - mySSH.command('docker build --target ran-build --tag ran-build:' + imageTag + ' --file docker/Dockerfile.ran.ubuntu18 --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-build.log 2>&1', '\$', 800) + mySSH.command(self.cli + ' build --target ' + sharedimage + ' --tag ' + sharedimage + ':' + imageTag + ' --file docker/Dockerfile.ran' + self.dockerfileprefix + ' --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-build.log 2>&1', '\$', 1600) # Build the target image(s) - previousImage='ran-build:' + imageTag + previousImage = sharedimage + ':' + imageTag danglingShaOnes=[] for image,pattern in imageNames: # the archived Dockerfiles have "ran-build:latest" as base image # we need to update them with proper tag - mySSH.command('sed -i -e "s#ran-build:latest#ran-build:' + imageTag + '#" docker/Dockerfile.' + pattern + '.ubuntu18', '\$', 5) - mySSH.command('docker build --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + '.ubuntu18 . > cmake_targets/log/' + image + '.log 2>&1', '\$', 600) + mySSH.command('sed -i -e "s#' + sharedimage + ':latest#' + sharedimage + ':' + imageTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) + mySSH.command(self.cli + ' build --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200) # Retrieving the dangling image(s) for the log collection - mySSH.command('docker images --filter "dangling=true" --filter "since=' + previousImage + '" -q | sed -e "s#^#sha=#"', '\$', 5) + mySSH.command(self.cli + ' images --filter "dangling=true" --filter "since=' + previousImage + '" -q | sed -e "s#^#sha=#"', '\$', 5) result = re.search('sha=(?P[a-zA-Z0-9\-\_]+)', mySSH.getBefore()) if result is not None: danglingShaOnes.append((image, result.group('imageShaOne'))) - previousImage=image + ':' + imageTag + previousImage = image + ':' + imageTag imageTag = 'ci-temp' # First verify if images were properly created. status = True - mySSH.command('docker image inspect --format=\'Size = {{.Size}} bytes\' ran-build:' + imageTag, '\$', 5) + mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + sharedimage + ':' + imageTag, '\$', 5) if mySSH.getBefore().count('No such object') != 0: logging.error('Could not build properly ran-build') status = False else: - result = re.search('Size = (?P[0-9\-]+) bytes', mySSH.getBefore()) + result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) if result is not None: imageSize = float(result.group('size')) imageSize = imageSize / 1000 if imageSize < 1000: logging.debug('\u001B[1m ran-build size is ' + ('%.0f' % imageSize) + ' kbytes\u001B[0m') + self.allImagesSize['ran-build'] = str(imageSize) + ' kbytes' else: imageSize = imageSize / 1000 if imageSize < 1000: logging.debug('\u001B[1m ran-build size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m') + self.allImagesSize['ran-build'] = str(imageSize) + ' Mbytes' else: imageSize = imageSize / 1000 logging.debug('\u001B[1m ran-build size is ' + ('%.3f' % imageSize) + ' Gbytes\u001B[0m') + self.allImagesSize['ran-build'] = str(imageSize) + ' Gbytes' else: logging.debug('ran-build size is unknown') for image,pattern in imageNames: - mySSH.command('docker image inspect --format=\'Size = {{.Size}} bytes\' ' + image + ':' + imageTag, '\$', 5) + mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + image + ':' + imageTag, '\$', 5) if mySSH.getBefore().count('No such object') != 0: logging.error('Could not build properly ' + image) status = False else: - result = re.search('Size = (?P[0-9\-]+) bytes', mySSH.getBefore()) + result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) if result is not None: imageSize = float(result.group('size')) imageSize = imageSize / 1000 if imageSize < 1000: logging.debug('\u001B[1m ' + image + ' size is ' + ('%.0f' % imageSize) + ' kbytes\u001B[0m') + self.allImagesSize[image] = str(imageSize) + ' kbytes' else: imageSize = imageSize / 1000 if imageSize < 1000: logging.debug('\u001B[1m ' + image + ' size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m') + self.allImagesSize[image] = str(imageSize) + ' Mbytes' else: imageSize = imageSize / 1000 logging.debug('\u001B[1m ' + image + ' size is ' + ('%.3f' % imageSize) + ' Gbytes\u001B[0m') + self.allImagesSize[image] = str(imageSize) + ' Gbytes' else: logging.debug('ran-build size is unknown') if not status: mySSH.close() logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) + #HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) HTML.CreateHtmlTabFooter(False) sys.exit(1) # Recover build logs, for the moment only possible when build is successful - mySSH.command('docker create --name test ran-build:' + imageTag, '\$', 5) + mySSH.command(self.cli + ' create --name test ' + sharedimage + ':' + imageTag, '\$', 5) mySSH.command('mkdir -p cmake_targets/log/ran-build', '\$', 5) - mySSH.command('docker cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/ran-build', '\$', 5) - mySSH.command('docker rm -f test', '\$', 5) + mySSH.command(self.cli + ' cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/ran-build', '\$', 5) + mySSH.command(self.cli + ' rm -f test', '\$', 5) for image,shaone in danglingShaOnes: mySSH.command('mkdir -p cmake_targets/log/' + image, '\$', 5) - mySSH.command('docker create --name test ' + shaone, '\$', 5) - mySSH.command('docker cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/' + image, '\$', 5) - mySSH.command('docker rm -f test', '\$', 5) - mySSH.command('docker image prune --force', '\$', 5) + mySSH.command(self.cli + ' create --name test ' + shaone, '\$', 5) + mySSH.command(self.cli + ' cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/' + image, '\$', 5) + mySSH.command(self.cli + ' rm -f test', '\$', 5) + mySSH.command(self.cli + ' image prune --force', '\$', 5) mySSH.command('cd cmake_targets', '\$', 5) mySSH.command('mkdir -p build_log_' + self.testCase_id, '\$', 5) mySSH.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5) + #mySSH.close() + + mySSH.command('cd /tmp/CI-eNB/cmake_targets', '\$', 5) + if (os.path.isfile('./build_log_' + self.testCase_id + '.zip')): + os.remove('./build_log_' + self.testCase_id + '.zip') + mySSH.command('zip -r -qq build_log_' + self.testCase_id + '.zip build_log_' + self.testCase_id, '\$', 5) + mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/build_log_' + self.testCase_id + '.zip', '.') + #mySSH.command('rm -f build_log_' + self.testCase_id + '.zip','\$', 5) mySSH.close() - + ZipFile('build_log_' + self.testCase_id + '.zip').extractall('.') + + #Trying to identify the errors and warnings for each built images + imageNames1 = imageNames + shared = ('ran-build','ran') + imageNames1.insert(0, shared) + for image,pattern in imageNames1: + files = {} + file_list = [f for f in os.listdir('build_log_' + self.testCase_id + '/' + image) if os.path.isfile(os.path.join('build_log_' + self.testCase_id + '/' + image, f)) and f.endswith('.txt')] + for fil in file_list: + errorandwarnings = {} + warningsNo = 0 + errorsNo = 0 + with open(f'build_log_{self.testCase_id}/{image}/{fil}', mode='r') as inputfile: + for line in inputfile: + result = re.search(' ERROR ', str(line)) + if result is not None: + errorsNo += 1 + result = re.search(' error:', str(line)) + if result is not None: + errorsNo += 1 + result = re.search(' WARNING ', str(line)) + if result is not None: + warningsNo += 1 + result = re.search(' warning:', str(line)) + if result is not None: + warningsNo += 1 + errorandwarnings['errors'] = errorsNo + errorandwarnings['warnings'] = warningsNo + errorandwarnings['status'] = status + files[fil] = errorandwarnings + self.collectInfo[image] = files + logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m') HTML.CreateHtmlTestRow(self.imageKind, 'OK', CONST.ALL_PROCESSES_OK) + HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) def DeployObject(self, HTML, EPC): if self.eNB_serverId[self.eNB_instance] == '0': From d7220cee376f057f22d13e8965f4b0e081f0032e Mon Sep 17 00:00:00 2001 From: hardy Date: Fri, 22 Jan 2021 15:25:43 +0100 Subject: [PATCH 158/160] parameters typo in xml --- ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml | 2 +- ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml index ce3d0cb606..ed134f478c 100644 --- a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml +++ b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml @@ -52,7 +52,7 @@ Initialize_OAI_UE Initialize NR UE USRP - --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path --dlsch-parallel 4 . + --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path . --dlsch-parallel 4 NR diff --git a/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml b/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml index 7215c94347..2c44ead8ea 100644 --- a/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml +++ b/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml @@ -52,7 +52,7 @@ Initialize_OAI_UE Initialize NR UE USRP - --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path --dlsch-parallel 4 . + --phy-test --usrp-args "addr=192.168.30.2,second_addr=192.168.50.2,clock_source=external,time_source=external" --ue-rxgain 75 --rrc_config_path . --dlsch-parallel 4 NR From c9e08d030b7308793d2166312fb30985c48e17d2 Mon Sep 17 00:00:00 2001 From: Mohammed Ismail Date: Fri, 22 Jan 2021 10:28:40 +0100 Subject: [PATCH 159/160] CI: html tab extention to add more details on built shared and target images fix ssh connection when remote server has public key Signed-off-by: Mohammed Ismail --- ci-scripts/cls_containerize.py | 16 +++++------ ci-scripts/html.py | 49 +++++++++++++++++++++++++++++++++- ci-scripts/sshconnection.py | 6 ++--- 3 files changed, 58 insertions(+), 13 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index d46f7493c0..a1df1e2385 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -139,9 +139,9 @@ class Containerize(): else: result = re.search('all', self.imageKind) if result is not None: - imageNames.append(('oai-enb', 'eNB')) + imageNames.append(('oai-enb', 'eNB')) imageNames.append(('oai-gnb', 'gNB')) - imageNames.append(('oai-lte-ue', 'lteUE')) + imageNames.append(('oai-lte-ue', 'lteUE')) imageNames.append(('oai-nr-ue', 'nrUE')) if len(imageNames) == 0: imageNames.append(('oai-enb', 'eNB')) @@ -228,16 +228,16 @@ class Containerize(): imageSize = imageSize / 1000 if imageSize < 1000: logging.debug('\u001B[1m ran-build size is ' + ('%.0f' % imageSize) + ' kbytes\u001B[0m') - self.allImagesSize['ran-build'] = str(imageSize) + ' kbytes' + self.allImagesSize['ran-build'] = str(round(imageSize,1)) + ' kbytes' else: imageSize = imageSize / 1000 if imageSize < 1000: logging.debug('\u001B[1m ran-build size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m') - self.allImagesSize['ran-build'] = str(imageSize) + ' Mbytes' + self.allImagesSize['ran-build'] = str(round(imageSize,1)) + ' Mbytes' else: imageSize = imageSize / 1000 logging.debug('\u001B[1m ran-build size is ' + ('%.3f' % imageSize) + ' Gbytes\u001B[0m') - self.allImagesSize['ran-build'] = str(imageSize) + ' Gbytes' + self.allImagesSize['ran-build'] = str(round(imageSize,1)) + ' Gbytes' else: logging.debug('ran-build size is unknown') for image,pattern in imageNames: @@ -252,16 +252,16 @@ class Containerize(): imageSize = imageSize / 1000 if imageSize < 1000: logging.debug('\u001B[1m ' + image + ' size is ' + ('%.0f' % imageSize) + ' kbytes\u001B[0m') - self.allImagesSize[image] = str(imageSize) + ' kbytes' + self.allImagesSize[image] = str(round(imageSize,1)) + ' kbytes' else: imageSize = imageSize / 1000 if imageSize < 1000: logging.debug('\u001B[1m ' + image + ' size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m') - self.allImagesSize[image] = str(imageSize) + ' Mbytes' + self.allImagesSize[image] = str(round(imageSize,1)) + ' Mbytes' else: imageSize = imageSize / 1000 logging.debug('\u001B[1m ' + image + ' size is ' + ('%.3f' % imageSize) + ' Gbytes\u001B[0m') - self.allImagesSize[image] = str(imageSize) + ' Gbytes' + self.allImagesSize[image] = str(round(imageSize,1)) + ' Gbytes' else: logging.debug('ran-build size is unknown') if not status: diff --git a/ci-scripts/html.py b/ci-scripts/html.py index f50899be4f..b3ee00e7dc 100644 --- a/ci-scripts/html.py +++ b/ci-scripts/html.py @@ -218,7 +218,7 @@ class HTMLManagement(): self.htmlFile.write('
\n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') - self.htmlFile.write(' \n') + self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') @@ -399,6 +399,53 @@ class HTMLManagement(): self.htmlFile.write(' \n') self.htmlFile.close() + + def CreateHtmlNextTabHeaderTestRow(self, collectInfo, allImagesSize, machine='eNB'): + if (self.htmlFooterCreated or (not self.htmlHeaderCreated)): + return + self.htmlFile = open('test_results.html', 'a') + if bool(collectInfo) == False: + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + else: + for image in collectInfo: + files = collectInfo[image] + # TabHeader for image logs on built shared and target images + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + + for fil in files: + parameters = files[fil] + # TestRow for image logs on built shared and target images + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + if (parameters['errors'] == 0): + self.htmlFile.write(' \n') + else: + self.htmlFile.write(' \n') + if (parameters['warnings'] == 0): + self.htmlFile.write(' \n') + elif ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)): + self.htmlFile.write(' \n') + else: + self.htmlFile.write(' \n') + if (parameters['errors'] == 0) and (parameters['warnings'] == 0): + self.htmlFile.write(' \n') + elif (parameters['errors'] == 0) and ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)): + self.htmlFile.write(' \n') + else: + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.close() + def CreateHtmlTestRowQueue(self, options, status, ue_status, ue_queue): if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)): self.htmlFile = open('test_results.html', 'a') diff --git a/ci-scripts/sshconnection.py b/ci-scripts/sshconnection.py index ed0cf5379a..5bfe5da70f 100644 --- a/ci-scripts/sshconnection.py +++ b/ci-scripts/sshconnection.py @@ -52,13 +52,11 @@ class SSHConnection(): self.picocom_closure = True def open(self, ipaddress, username, password): - extraSshOptions = '' count = 0 connect_status = False - if ipaddress == '192.168.18.197': - extraSshOptions = ' -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' while count < 4: - self.ssh = pexpect.spawn('ssh', [username + '@' + ipaddress + extraSshOptions], timeout = 5) + self.ssh = pexpect.spawn('ssh -o PubkeyAuthentication=no {}@{}'.format(username,ipaddress)) + self.ssh.timeout = 5 self.sshresponse = self.ssh.expect(['Are you sure you want to continue connecting (yes/no)?', 'password:', 'Last login', pexpect.EOF, pexpect.TIMEOUT]) if self.sshresponse == 0: self.ssh.sendline('yes') From 747695e4760602724de24f43e72de8b66178895f Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 26 Jan 2021 09:51:59 +0100 Subject: [PATCH 160/160] CI: fix string formatting for python3.5 Signed-off-by: Raphael Defosseux --- ci-scripts/cls_containerize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index a1df1e2385..0c07dfe91f 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -308,7 +308,7 @@ class Containerize(): errorandwarnings = {} warningsNo = 0 errorsNo = 0 - with open(f'build_log_{self.testCase_id}/{image}/{fil}', mode='r') as inputfile: + with open('build_log_{}/{}/{}'.format(self.testCase_id,image,fil), mode='r') as inputfile: for line in inputfile: result = re.search(' ERROR ', str(line)) if result is not None:
Relative Time (ms)Relative Time (s)Test IdTest DescTest Options
----IMAGES BUILDING FAILED - Unable to recover the image logs ----
---- ' + image + ' IMAGE STATUS ----> Size ' + allImagesSize[image] + '
ElementNb ErrorsNb WarningsStatus
' + fil + ' ' + str(parameters['errors']) + '' + str(parameters['errors']) + '' + str(parameters['warnings']) + '' + str(parameters['warnings']) + '' + str(parameters['warnings']) + 'OK OK NOT OK