Commit c70f0a1d authored by laurent's avatar laurent

cleanup srb data structure

parent ef06b145
......@@ -431,15 +431,6 @@ void configure_ss_coreset(NR_UE_MAC_INST_t *mac,
NR_ServingCellConfig_t *scd,
NR_BWP_Id_t dl_bwp_id);
static uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
nr_dci_format_t dci_format,
uint8_t dci_size,
uint16_t rnti,
int ss_type,
uint64_t *dci_pdu,
dci_pdu_rel15_t *dci_pdu_rel15,
int slot);
fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot, int fb_time);
fapi_nr_dl_config_request_t *get_dl_config_request(NR_UE_MAC_INST_t *mac, int slot);
......
......@@ -149,6 +149,14 @@ const initial_pucch_resource_t initial_pucch_resource[16] = {
/* 14 */ { 1, 0, 14, 4, 4, { 0, 3, 6, 9 } },
/* 15 */ { 1, 0, 14, 0, 4, { 0, 3, 6, 9 } },
};
static uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
nr_dci_format_t dci_format,
uint8_t dci_size,
uint16_t rnti,
int ss_type,
uint64_t *dci_pdu,
dci_pdu_rel15_t *dci_pdu_rel15,
int slot);
void nr_ue_init_mac(module_id_t module_idP)
{
......
......@@ -511,51 +511,25 @@ int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
const uint8_t transaction_id,
const uint8_t *masterCellGroup,
int masterCellGroup_len,
const gNB_RrcConfigurationReq *configuration)
const gNB_RrcConfigurationReq *configuration,
NR_SRB_ToAddModList_t *SRBs)
//------------------------------------------------------------------------------
{
asn_enc_rval_t enc_rval;
NR_DL_CCCH_Message_t dl_ccch_msg;
NR_RRCSetup_t *rrcSetup;
NR_RRCSetup_IEs_t *ie;
NR_SRB_ToAddMod_t *SRB1_config = NULL;
NR_PDCP_Config_t *pdcp_Config = NULL;
AssertFatal(ue_context_pP != NULL,"ue_context_p is null\n");
AssertFatal(ue_context_pP != NULL, "ue_context_p is null\n");
gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context;
NR_SRB_ToAddModList_t **SRB_configList = &ue_p->SRB_configList;
memset((void *)&dl_ccch_msg, 0, sizeof(NR_DL_CCCH_Message_t));
NR_DL_CCCH_Message_t dl_ccch_msg = {0};
dl_ccch_msg.message.present = NR_DL_CCCH_MessageType_PR_c1;
dl_ccch_msg.message.choice.c1 = CALLOC(1, sizeof(struct NR_DL_CCCH_MessageType__c1));
dl_ccch_msg.message.choice.c1->present = NR_DL_CCCH_MessageType__c1_PR_rrcSetup;
dl_ccch_msg.message.choice.c1->choice.rrcSetup = calloc(1, sizeof(NR_RRCSetup_t));
rrcSetup = dl_ccch_msg.message.choice.c1->choice.rrcSetup;
asn1cCalloc(dl_ccch_msg.message.choice.c1, dl_msg);
dl_msg->present = NR_DL_CCCH_MessageType__c1_PR_rrcSetup;
asn1cCalloc(dl_msg->choice.rrcSetup, rrcSetup);
rrcSetup->criticalExtensions.present = NR_RRCSetup__criticalExtensions_PR_rrcSetup;
rrcSetup->rrc_TransactionIdentifier = transaction_id;
rrcSetup->criticalExtensions.choice.rrcSetup = calloc(1, sizeof(NR_RRCSetup_IEs_t));
ie = rrcSetup->criticalExtensions.choice.rrcSetup;
NR_RRCSetup_IEs_t *ie = rrcSetup->criticalExtensions.choice.rrcSetup;
/****************************** radioBearerConfig ******************************/
/* Configure SRB1 */
if (*SRB_configList) {
free(*SRB_configList);
}
*SRB_configList = calloc(1, sizeof(NR_SRB_ToAddModList_t));
// SRB1
/* TODO */
SRB1_config = calloc(1, sizeof(NR_SRB_ToAddMod_t));
SRB1_config->srb_Identity = 1;
// pdcp_Config->t_Reordering
SRB1_config->pdcp_Config = pdcp_Config;
ie->radioBearerConfig.srb_ToAddModList = *SRB_configList;
asn1cSeqAdd(&(*SRB_configList)->list, SRB1_config);
ie->radioBearerConfig.srb_ToAddModList = SRBs;
ie->radioBearerConfig.srb3_ToRelease = NULL;
ie->radioBearerConfig.drb_ToAddModList = NULL;
ie->radioBearerConfig.drb_ToReleaseList = NULL;
......@@ -571,24 +545,17 @@ int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
// decode masterCellGroup OCTET_STRING received from DU and place in ue context
ue_p->masterCellGroup = decode_cellGroupConfig(masterCellGroup, masterCellGroup_len);
if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
if (LOG_DEBUGFLAG(DEBUG_ASN1)) {
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, ue_p->masterCellGroup);
xer_fprint(stdout, &asn_DEF_NR_DL_CCCH_Message, (void *)&dl_ccch_msg);
}
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_CCCH_Message,
NULL,
(void *)&dl_ccch_msg,
buffer,
1000);
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_CCCH_Message, NULL, (void *)&dl_ccch_msg, buffer, 1000);
AssertFatal(enc_rval.encoded >0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded);
LOG_D(NR_RRC,"RRCSetup Encoded %zd bits (%zd bytes)\n",
enc_rval.encoded,(enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8);
LOG_D(NR_RRC, "RRCSetup Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded + 7) / 8);
return ((enc_rval.encoded + 7) / 8);
}
uint8_t do_NR_SecurityModeCommand(
......@@ -1139,62 +1106,21 @@ int do_RRCReestablishment(const protocol_ctxt_t *const ctxt_pP,
uint8_t *const buffer,
size_t buffer_size,
const uint8_t Transaction_id,
NR_SRB_ToAddModList_t **SRB_configList,
NR_SRB_ToAddModList_t *SRB_configList,
const uint8_t *masterCellGroup_from_DU,
NR_ServingCellConfigCommon_t *scc,
rrc_gNB_carrier_data_t *carrier)
{
asn_enc_rval_t enc_rval;
struct NR_SRB_ToAddMod *SRB1_config = NULL;
struct NR_SRB_ToAddMod *SRB2_config = NULL;
NR_DL_DCCH_Message_t dl_dcch_msg = {0};
NR_RRCReestablishment_t *rrcReestablishment = NULL;
NR_SRB_ToAddModList_t **SRB_configList2 = NULL;
SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[Transaction_id];
if (*SRB_configList2) {
free(*SRB_configList2);
}
*SRB_configList2 = CALLOC(1, sizeof(NR_SRB_ToAddModList_t));
dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1;
dl_dcch_msg.message.choice.c1 = calloc(1, sizeof(struct NR_DL_DCCH_MessageType__c1));
dl_dcch_msg.message.choice.c1->present = NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment;
dl_dcch_msg.message.choice.c1->choice.rrcReestablishment = CALLOC(1, sizeof(NR_RRCReestablishment_t));
rrcReestablishment = dl_dcch_msg.message.choice.c1->choice.rrcReestablishment;
// get old configuration of SRB2
if (*SRB_configList != NULL) {
for (int i = 0; (i < (*SRB_configList)->list.count) && (i < 3); i++) {
LOG_D(NR_RRC, "(*SRB_configList)->list.array[%d]->srb_Identity=%ld\n", i, (*SRB_configList)->list.array[i]->srb_Identity);
if ((*SRB_configList)->list.array[i]->srb_Identity == 2) {
SRB2_config = (*SRB_configList)->list.array[i];
} else if ((*SRB_configList)->list.array[i]->srb_Identity == 1) {
SRB1_config = (*SRB_configList)->list.array[i];
}
}
}
if (SRB1_config == NULL) {
// default SRB1 configuration
LOG_W(NR_RRC, "SRB1 configuration does not exist in SRB configuration list, use default\n");
/// SRB1
SRB1_config = CALLOC(1, sizeof(*SRB1_config));
SRB1_config->srb_Identity = 1;
}
if (SRB2_config == NULL) {
LOG_W(NR_RRC, "SRB2 configuration does not exist in SRB configuration list\n");
} else {
asn1cSeqAdd(&(*SRB_configList2)->list, SRB2_config);
}
if (*SRB_configList) {
free(*SRB_configList);
}
*SRB_configList = CALLOC(1, sizeof(NR_SRB_ToAddModList_t));
asn1cSeqAdd(&(*SRB_configList)->list, SRB1_config);
/****************************** masterCellGroup ******************************/
rrcReestablishment->rrc_TransactionIdentifier = Transaction_id;
rrcReestablishment->criticalExtensions.present = NR_RRCReestablishment__criticalExtensions_PR_rrcReestablishment;
......
......@@ -104,7 +104,8 @@ int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP,
const uint8_t transaction_id,
const uint8_t *masterCellGroup,
int masterCellGroup_len,
const gNB_RrcConfigurationReq *configuration);
const gNB_RrcConfigurationReq *configuration,
NR_SRB_ToAddModList_t *SRBs);
uint8_t do_NR_SecurityModeCommand(
const protocol_ctxt_t *const ctxt_pP,
......@@ -177,7 +178,7 @@ int do_RRCReestablishment(const protocol_ctxt_t *const ctxt_pP,
uint8_t *const buffer,
size_t buffer_size,
const uint8_t Transaction_id,
NR_SRB_ToAddModList_t **SRB_configList,
NR_SRB_ToAddModList_t *SRB_configList,
const uint8_t *masterCellGroup_from_DU,
NR_ServingCellConfigCommon_t *scc,
rrc_gNB_carrier_data_t *carrier);
......
......@@ -104,9 +104,8 @@ static int drb_config_gtpu_create(const protocol_ctxt_t *const ctxt_p,
rrc_gNB_ue_context_t *ue_context_p,
e1ap_bearer_setup_req_t *const req,
NR_DRB_ToAddModList_t *DRB_configList,
NR_SRB_ToAddModList_t *SRB_configList,
instance_t instance) {
instance_t instance)
{
gtpv1u_gnb_create_tunnel_req_t create_tunnel_req={0};
gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp={0};
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
......@@ -153,7 +152,12 @@ static int drb_config_gtpu_create(const protocol_ctxt_t *const ctxt_p,
LOG_D(NR_RRC, "Configuring PDCP DRBs/SRBs for UE %x\n", UE->rnti);
nr_pdcp_add_srbs(ctxt_p->enb_flag, ctxt_p->rntiMaybeUEid, SRB_configList, (UE->integrity_algorithm << 4) | UE->ciphering_algorithm, kRRCenc, kRRCint);
nr_pdcp_add_srbs(ctxt_p->enb_flag,
ctxt_p->rntiMaybeUEid,
NULL,
(UE->integrity_algorithm << 4) | UE->ciphering_algorithm,
kRRCenc,
kRRCint);
nr_pdcp_add_drbs(ctxt_p->enb_flag,
ctxt_p->rntiMaybeUEid,
......@@ -167,21 +171,6 @@ static int drb_config_gtpu_create(const protocol_ctxt_t *const ctxt_p,
return ret;
}
static NR_SRB_ToAddModList_t **generateSRB2_confList(gNB_RRC_UE_t *ue, NR_SRB_ToAddModList_t *SRB_configList, uint8_t xid)
{
NR_SRB_ToAddModList_t **SRB_configList2 = NULL;
SRB_configList2 = &ue->SRB_configList2[xid];
if (*SRB_configList2 == NULL) {
*SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2));
NR_SRB_ToAddMod_t *SRB2_config = CALLOC(1, sizeof(*SRB2_config));
SRB2_config->srb_Identity = 2;
asn1cSeqAdd(&(*SRB_configList2)->list, SRB2_config);
asn1cSeqAdd(&SRB_configList->list, SRB2_config);
}
return SRB_configList2;
}
static void cucp_cuup_bearer_context_setup_direct(e1ap_bearer_setup_req_t *const req, instance_t instance, uint8_t xid)
{
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[instance], req->rnti);
......@@ -205,10 +194,8 @@ static void cucp_cuup_bearer_context_setup_direct(e1ap_bearer_setup_req_t *const
}
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
// Fixme: xid not random, but almost!
NR_SRB_ToAddModList_t **SRB_configList2 = generateSRB2_confList(UE, UE->SRB_configList, UE->pduSession[0].xid);
// GTP tunnel for UL
int ret = drb_config_gtpu_create(&ctxt, ue_context_p, req, UE->DRB_configList, *SRB_configList2, rrc->e1_inst);
int ret = drb_config_gtpu_create(&ctxt, ue_context_p, req, UE->DRB_configList, rrc->e1_inst);
if (ret < 0) AssertFatal(false, "Unable to configure DRB or to create GTP Tunnel\n");
// Used to store teids: if monolithic, will simply be NULL
......
......@@ -54,14 +54,3 @@ void rrc_init_nr_srb_param(NR_LCHAN_DESC *chan)
chan->Delay_class = 1;
return;
}
//-----------------------------------------------------------------------------
void rrc_config_nr_buffer(NR_SRB_INFO* Srb_info,
uint8_t Lchan_type,
uint8_t Role)
{
Srb_info->Rx_buffer.payload_size = 0;
Srb_info->Tx_buffer.payload_size = 0;
}
//-----------------------------------------------------------------------------
......@@ -61,31 +61,16 @@ typedef struct RB_INFO_NR_s {
} NR_RB_INFO;
typedef struct NR_SRB_INFO_s {
uint16_t Srb_id; //=Lchan_id
NR_RRC_BUFFER Rx_buffer;
NR_RRC_BUFFER Tx_buffer;
NR_LCHAN_DESC Lchan_desc[2];
unsigned int Trans_id;
uint8_t Active;
} NR_SRB_INFO;
typedef struct RB_INFO_TABLE_ENTRY_NR_s {
NR_RB_INFO Rb_info;
uint8_t Active;
uint32_t Next_check_frame;
uint8_t status;
} NR_RB_INFO_TABLE_ENTRY;
typedef struct SRB_INFO_TABLE_ENTRY_NR_s {
NR_SRB_INFO Srb_info;
uint8_t Active;
uint8_t status;
uint32_t Next_check_frame;
} NR_SRB_INFO_TABLE_ENTRY;
void rrc_init_nr_srb_param(NR_LCHAN_DESC *chan);
void rrc_config_nr_buffer(NR_SRB_INFO* Srb_info,
uint8_t Lchan_type,
uint8_t Role);
#endif
......@@ -237,8 +237,6 @@ typedef enum {
typedef struct gNB_RRC_UE_s {
uint8_t primaryCC_id;
NR_SRB_ToAddModList_t *SRB_configList;
NR_SRB_ToAddModList_t *SRB_configList2[NR_RRC_TRANSACTION_IDENTIFIER_NUMBER];
NR_DRB_ToAddModList_t *DRB_configList;
NR_DRB_ToAddModList_t *DRB_configList2[NR_RRC_TRANSACTION_IDENTIFIER_NUMBER];
NR_DRB_ToReleaseList_t *DRB_Release_configList2[NR_RRC_TRANSACTION_IDENTIFIER_NUMBER];
......
This diff is collapsed.
......@@ -125,8 +125,6 @@ nr_rrc_pdcp_config_security(
)
//------------------------------------------------------------------------------
{
NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList;
(void)SRB_configList;
uint8_t kRRCenc[16] = {0};
uint8_t kRRCint[16] = {0};
uint8_t kUPenc[16] = {0};
......
......@@ -1651,8 +1651,7 @@ nr_rrc_ue_establish_srb1(
{
// add descriptor from RRC PDU
NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Active = 1;
NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].status = RADIO_CONFIG_OK;//RADIO CFG
NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Srb_info.Srb_id = 1;
NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].status = RADIO_CONFIG_OK; // RADIO CFG
LOG_I(NR_RRC, "[UE %d], CONFIG_SRB1 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH, gNB_index);
return(0);
}
......@@ -1669,8 +1668,7 @@ nr_rrc_ue_establish_srb2(
{
// add descriptor from RRC PDU
NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Active = 1;
NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].status = RADIO_CONFIG_OK;//RADIO CFG
NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Srb_info.Srb_id = 2;
NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].status = RADIO_CONFIG_OK; // RADIO CFG
LOG_I(NR_RRC, "[UE %d], CONFIG_SRB2 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH1, gNB_index);
return(0);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment