initial RRC for NSA

This commit is contained in:
Raymond Knopp
2019-09-20 08:49:04 +02:00
parent b2bdf7eb9a
commit 686d68a826
6 changed files with 93 additions and 170 deletions
@@ -795,152 +795,6 @@ static inline void memcpy_printer(uint32_t* p_lut_cn2bn,int dest0,int M) {
} }
} }
static inline void nrLDPC_prep_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, uint16_t Z)
{
const uint32_t* lut_cn2bnProcBuf = p_lut->cn2bnProcBuf;
const uint32_t* lut_cn2bnProcBuf2 = p_lut->cn2bnProcBuf2;
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
uint32_t* p_lut_cn2bn;
uint32_t bitOffsetInGroup;
uint32_t i;
uint32_t j;
uint32_t M;
// For CN groups 3 to 19 no need to send the last BN back since it's single edge
// and BN processing does not change the value already in the CN proc buf
// =====================================================================
// CN group with 3 BNs
p_lut_cn2bn = &lut_cn2bnProcBuf[0];
M = lut_numCnInCnGroups[0]*Z;
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[0]*NR_LDPC_ZMAX;
for (j=0;j<2; j++)
{
printf("******3 BN (%d): cNProcBuf output at %d\n",j,lut_startAddrCnGroups[0] + j*bitOffsetInGroup);
memcpy_printer(p_lut_cn2bn,lut_startAddrCnGroups[0] + j*bitOffsetInGroup,M);
}
// =====================================================================
// CN group with 4 BNs
p_lut_cn2bn += (M*3); // Number of elements of previous group
M = lut_numCnInCnGroups[1]*Z;
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[1]*NR_LDPC_ZMAX;
for (j=0; j<3; j++)
{
printf("******4 BN (%d): cNProcBuf output at %d\n",j,lut_startAddrCnGroups[1] + j*bitOffsetInGroup);
memcpy_printer(p_lut_cn2bn,lut_startAddrCnGroups[0] + j*bitOffsetInGroup,M);
}
// =====================================================================
// CN group with 5 BNs
// p_lut_cn2bn += (M*4); // Number of elements of previous group
p_lut_cn2bn += M; // Number of elements of previous group
M = lut_numCnInCnGroups[2]*Z;
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[2]*NR_LDPC_ZMAX;
for (j=0; j<4; j++)
{
printf("******5 BN (%d): cNProcBuf output at %d\n",j,lut_startAddrCnGroups[2] + j*bitOffsetInGroup);
memcpy_printer(p_lut_cn2bn,lut_startAddrCnGroups[0] + j*bitOffsetInGroup,M);
}
// =====================================================================
// CN group with 6 BNs
// p_lut_cn2bn += (M*5); // Number of elements of previous group
p_lut_cn2bn += M; // Number of elements of previous group
M = lut_numCnInCnGroups[3]*Z;
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[3]*NR_LDPC_ZMAX;
for (j=0; j<5; j++)
{
printf("******6 BN (%d): cNProcBuf output at %d\n",j,lut_startAddrCnGroups[3] + j*bitOffsetInGroup);
}
// =====================================================================
// CN group with 7 BNs
// p_lut_cn2bn += (M*6); // Number of elements of previous group
p_lut_cn2bn += M; // Number of elements of previous group
M = lut_numCnInCnGroups[4]*Z;
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[4]*NR_LDPC_ZMAX;
for (j=0; j<6; j++)
{
printf("******7 BN (%d): cNProcBuf output at %d\n",j,lut_startAddrCnGroups[4] + j*bitOffsetInGroup);
}
// =====================================================================
// CN group with 8 BNs
// p_lut_cn2bn += (M*7); // Number of elements of previous group
p_lut_cn2bn += M; // Number of elements of previous group
M = lut_numCnInCnGroups[5]*Z;
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[5]*NR_LDPC_ZMAX;
for (j=0; j<7; j++)
{
printf("******8 BN (%d): cNProcBuf output at %d\n",j,lut_startAddrCnGroups[5] + j*bitOffsetInGroup);
}
// =====================================================================
// CN group with 9 BNs
// p_lut_cn2bn += (M*8); // Number of elements of previous group
p_lut_cn2bn += M; // Number of elements of previous group
M = lut_numCnInCnGroups[6]*Z;
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[6]*NR_LDPC_ZMAX;
for (j=0; j<8; j++)
{
printf("******9 BN (%d): cNProcBuf output at %d\n",j,lut_startAddrCnGroups[6] + j*bitOffsetInGroup);
}
// =====================================================================
// CN group with 10 BNs
// p_lut_cn2bn += (M*9); // Number of elements of previous group
p_lut_cn2bn += M; // Number of elements of previous group
M = lut_numCnInCnGroups[7]*Z;
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[7]*NR_LDPC_ZMAX;
for (j=0; j<9; j++)
{
p_cnProcBuf = &cnProcBuf[lut_startAddrCnGroups[7] + j*bitOffsetInGroup];
printf("******10 BN (%d): cNProcBuf output at %d\n",j,lut_startAddrCnGroups[7] + j*bitOffsetInGroup);
}
// =====================================================================
// CN group with 19 BNs
// p_lut_cn2bn += (M*10); // Number of elements of previous group
p_lut_cn2bn += M; // Number of elements of previous group
M = lut_numCnInCnGroups[8]*Z;
bitOffsetInGroup = lut_numCnInCnGroups_BG1_R13[8]*NR_LDPC_ZMAX;
for (j=0; j<19; j++)
{
printf("******19 BN (%d): cNProcBuf output at %d\n",j,lut_startAddrCnGroups[8] + j*bitOffsetInGroup);
}
}
/** /**
\brief Copies the values in the LLR results buffer to their corresponding place in the output LLR vector. \brief Copies the values in the LLR results buffer to their corresponding place in the output LLR vector.
\param p_lut Pointer to decoder LUTs \param p_lut Pointer to decoder LUTs
+4 -2
View File
@@ -269,6 +269,10 @@ typedef struct gNB_RRC_UE_s {
NR_UE_NR_Capability_t* UE_Capability_nr; NR_UE_NR_Capability_t* UE_Capability_nr;
NR_UE_MRDC_Capability_t* UE_Capability_MRDC; NR_UE_MRDC_Capability_t* UE_Capability_MRDC;
NR_CellGroupConfig_t *secondaryCellGroup;
NR_RRCReconfiguration_t *reconfig;
NR_RadioBearerConfig_t *rb_config;
ImsiMobileIdentity_t imsi; ImsiMobileIdentity_t imsi;
#if defined(ENABLE_SECURITY) #if defined(ENABLE_SECURITY)
@@ -376,8 +380,6 @@ typedef struct {
int ssb_SubcarrierOffset; int ssb_SubcarrierOffset;
NR_ServingCellConfigCommon_t *servingcellconfigcommon; NR_ServingCellConfigCommon_t *servingcellconfigcommon;
NR_RRCReconfiguration_t *reconfig[MAX_NR_RRC_UE_CONTEXTS];
NR_RadioBearerConfig_t *rb_config[MAX_NR_RRC_UE_CONTEXTS];
NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS]; NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS];
NR_SRB_INFO SI; NR_SRB_INFO SI;
NR_SRB_INFO Srb0; NR_SRB_INFO Srb0;
+13
View File
@@ -203,6 +203,8 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge(
///---------------------------------------------------------------------------------------------------------------/// ///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------/// ///---------------------------------------------------------------------------------------------------------------///
extern int phy_test;
static void init_NR_SI(gNB_RRC_INST *rrc) { static void init_NR_SI(gNB_RRC_INST *rrc) {
@@ -221,6 +223,17 @@ static void init_NR_SI(gNB_RRC_INST *rrc) {
rrc->carrier.ssb_SubcarrierOffset, rrc->carrier.ssb_SubcarrierOffset,
(NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon (NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon
); );
if (phy_test > 0) {
// This is for phytest only
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(rrc);
LOG_I(NR_RRC,"Adding new user\n");
rrc_add_nsa_user(rrc,ue_context_p);
}
} }
+20 -7
View File
@@ -39,8 +39,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void void nr_uid_linear_allocator_init(
uid_linear_allocator_init(
nr_uid_allocator_t *const uid_pP nr_uid_allocator_t *const uid_pP
) )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -49,10 +48,7 @@ uid_linear_allocator_init(
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uid_nr_t uid_nr_t nr_uid_linear_allocator_new(gNB_RRC_INST *const rrc_instance_pP)
uid_linear_allocator_new(
gNB_RRC_INST *const rrc_instance_pP
)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
unsigned int i; unsigned int i;
@@ -135,7 +131,7 @@ rrc_gNB_allocate_new_UE_context(
} }
memset(new_p, 0, sizeof(struct rrc_gNB_ue_context_s)); memset(new_p, 0, sizeof(struct rrc_gNB_ue_context_s));
new_p->local_uid = uid_linear_allocator_new(rrc_instance_pP); new_p->local_uid = nr_uid_linear_allocator_new(rrc_instance_pP);
for(int i = 0; i < NB_RB_MAX; i++) { for(int i = 0; i < NB_RB_MAX; i++) {
new_p->ue_context.e_rab[i].xid = -1; new_p->ue_context.e_rab[i].xid = -1;
@@ -172,6 +168,23 @@ rrc_gNB_get_ue_context(
} }
} }
rrc_gNB_free_mem_UE_context(
const protocol_ctxt_t *const ctxt_pP,
struct rrc_gNB_ue_context_s *const ue_context_pP
)
//-----------------------------------------------------------------------------
{
int i;
LOG_T(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" Clearing UE context 0x%p (free internal structs)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
ue_context_pP);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_LTE_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[0]);
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_LTE_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[1]);
// empty the internal fields of the UE context here
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void rrc_gNB_remove_ue_context( void rrc_gNB_remove_ue_context(
+16 -15
View File
@@ -55,8 +55,8 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,NR_UE_CapabilityRAT_ContainerLi
AssertFatal(ueCapabilityRAT_Container_nr!=NULL,"ueCapabilityRAT_Container_nr is NULL\n"); AssertFatal(ueCapabilityRAT_Container_nr!=NULL,"ueCapabilityRAT_Container_nr is NULL\n");
AssertFatal(ueCapabilityRAT_Container_MRDC!=NULL,"ueCapabilityRAT_Container_MRDC is NULL\n"); AssertFatal(ueCapabilityRAT_Container_MRDC!=NULL,"ueCapabilityRAT_Container_MRDC is NULL\n");
// decode and store capabilities // decode and store capabilities
ue_context_p = rrc_gNB_get_ue_context(rrc, ue_context_p = rrc_gNB_allocate_new_UE_context(rrc);
rnti); ue_context_p->ue_id_rnti = rnti;
asn_dec_rval_t dec_rval = uper_decode(NULL, asn_dec_rval_t dec_rval = uper_decode(NULL,
&asn_DEF_NR_UE_NR_Capability, &asn_DEF_NR_UE_NR_Capability,
@@ -107,27 +107,28 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_
// NR RRCReconfiguration // NR RRCReconfiguration
AssertFatal(carrier->reconfig[rrc->Nb_ue]==NULL,
"carrier->reconfig[%d] isn't null\n",rrc->Nb_ue);
AssertFatal(rrc->Nb_ue < MAX_NR_RRC_UE_CONTEXTS,"cannot add another UE\n"); AssertFatal(rrc->Nb_ue < MAX_NR_RRC_UE_CONTEXTS,"cannot add another UE\n");
carrier->reconfig[rrc->Nb_ue] = calloc(1,sizeof(NR_RRCReconfiguration_t)); ue_context_p->ue_context.reconfig = calloc(1,sizeof(NR_RRCReconfiguration_t));
carrier->secondaryCellGroup[rrc->Nb_ue] = calloc(1,sizeof(NR_CellGroupConfig_t)); ue_context_p->ue_context.secondaryCellGroup = calloc(1,sizeof(NR_CellGroupConfig_t));
memset((void*)carrier->reconfig[rrc->Nb_ue],0,sizeof(NR_RRCReconfiguration_t)); memset((void*)ue_context_p->ue_context.reconfig,0,sizeof(NR_RRCReconfiguration_t));
carrier->reconfig[rrc->Nb_ue]->rrc_TransactionIdentifier=0; ue_context_p->ue_context.reconfig->rrc_TransactionIdentifier=0;
carrier->reconfig[rrc->Nb_ue]->criticalExtensions.present = NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration; ue_context_p->ue_context.reconfig->criticalExtensions.present = NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration;
NR_RRCReconfiguration_IEs_t *reconfig_ies=calloc(1,sizeof(NR_RRCReconfiguration_IEs_t)); NR_RRCReconfiguration_IEs_t *reconfig_ies=calloc(1,sizeof(NR_RRCReconfiguration_IEs_t));
carrier->reconfig[rrc->Nb_ue]->criticalExtensions.choice.rrcReconfiguration = reconfig_ies; ue_context_p->ue_context.reconfig->criticalExtensions.choice.rrcReconfiguration = reconfig_ies;
fill_default_reconfig(carrier->ServingCellConfigCommon, fill_default_reconfig(carrier->ServingCellConfigCommon,
reconfig_ies, reconfig_ies,
carrier->secondaryCellGroup[rrc->Nb_ue], ue_context_p->ue_context.secondaryCellGroup,
carrier->n_physical_antenna_ports, carrier->n_physical_antenna_ports,
carrier->initial_csi_index[rrc->Nb_ue]); &carrier->initial_csi_index[rrc->Nb_ue]);
carrier->rb_config[rrc->Nb_ue] = calloc(1,sizeof(NR_RadioBearerConfig_t));
fill_default_rbconfig(rrc,carrier->rb_config[rrc->Nb_ue]); ue_context_p->ue_context.rb_config = calloc(1,sizeof(NR_RRCReconfiguration_t));
fill_default_rbconfig(ue_context_p->ue_context.rb_config);
NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config)); NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config));
memset((void*)CG_Config,0,sizeof(*CG_Config)); memset((void*)CG_Config,0,sizeof(*CG_Config));
generate_CG_Config(rrc,CG_Config,carrier->reconfig[rrc->Nb_ue],carrier->rb_config[rrc->Nb_ue]); generate_CG_Config(rrc,CG_Config,ue_context_p->ue_context.reconfig,ue_context_p->ue_context.rb_config);
// Send to X2 entity to transport to MeNB // Send to X2 entity to transport to MeNB
rrc->Nb_ue++; rrc->Nb_ue++;
+40
View File
@@ -2007,5 +2007,45 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
reconfig->nonCriticalExtension = NULL; reconfig->nonCriticalExtension = NULL;
} }
void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig) {
rbconfig->srb_ToAddModList = NULL;
rbconfig->srb3_ToRelease = NULL;
rbconfig->drb_ToAddModList = calloc(1,sizeof(*rbconfig->drb_ToAddModList));
NR_DRB_ToAddMod_t *drb_ToAddMod = calloc(1,sizeof(*drb_ToAddMod));
drb_ToAddMod->cnAssociation = calloc(1,sizeof(*drb_ToAddMod->cnAssociation));
drb_ToAddMod->cnAssociation->present = NR_DRB_ToAddMod__cnAssociation_PR_eps_BearerIdentity;
drb_ToAddMod->cnAssociation->choice.eps_BearerIdentity=5;
drb_ToAddMod->drb_Identity = 4;
drb_ToAddMod->reestablishPDCP = NULL;
drb_ToAddMod->recoverPDCP = NULL;
drb_ToAddMod->pdcp_Config = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config));
drb_ToAddMod->pdcp_Config->drb = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb));
drb_ToAddMod->pdcp_Config->drb->discardTimer = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->discardTimer));
*drb_ToAddMod->pdcp_Config->drb->discardTimer=NR_PDCP_Config__drb__discardTimer_ms30;
drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL));
*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len18bits;
drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL));
*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = NR_PDCP_Config__drb__pdcp_SN_SizeDL_len18bits;
drb_ToAddMod->pdcp_Config->drb->headerCompression.present = NR_PDCP_Config__drb__headerCompression_PR_notUsed;
drb_ToAddMod->pdcp_Config->drb->headerCompression.choice.notUsed = 0;
drb_ToAddMod->pdcp_Config->drb->integrityProtection=NULL;
drb_ToAddMod->pdcp_Config->drb->statusReportRequired=NULL;
drb_ToAddMod->pdcp_Config->drb->outOfOrderDelivery=NULL;
drb_ToAddMod->pdcp_Config->moreThanOneRLC = NULL;
drb_ToAddMod->pdcp_Config->t_Reordering = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->t_Reordering));
*drb_ToAddMod->pdcp_Config->t_Reordering = NR_PDCP_Config__t_Reordering_ms0;
drb_ToAddMod->pdcp_Config->ext1 = NULL;
rbconfig->drb_ToReleaseList = NULL;
rbconfig->securityConfig = calloc(1,sizeof(*rbconfig->securityConfig));
rbconfig->securityConfig->securityAlgorithmConfig = calloc(1,sizeof(*rbconfig->securityConfig->securityAlgorithmConfig));
rbconfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm = NR_CipheringAlgorithm_nea2;
rbconfig->securityConfig->securityAlgorithmConfig->integrityProtAlgorithm=NULL;
rbconfig->securityConfig->keyToUse = calloc(1,sizeof(*rbconfig->securityConfig->keyToUse));
*rbconfig->securityConfig->keyToUse = NR_SecurityConfig__keyToUse_master;
}
#endif #endif