Commit 3cd4b3c3 authored by Cedric Roux's avatar Cedric Roux

fixes some issues found by review

- AssertFatal() in nr_rlc_srb0_recv_sdu() if the srb0 is not found
- do_RRCSetup() may return -1, handle it properly
- do_RRCReject() may return -1, handle it properly
- remove one switch in rrc_gNB_generate_RRCReject()
parent 231c2f3c
......@@ -1252,13 +1252,10 @@ void nr_rlc_srb0_recv_sdu(int rnti, unsigned char *buf, int size)
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
rb = ue->srb0;
AssertFatal(rb != NULL, "SDU sent to unknown RB rnti %d srb0\n", rnti);
if (rb != NULL) {
rb->set_time(rb, nr_rlc_current_time);
rb->recv_sdu(rb, (char *)buf, size, -1);
} else {
LOG_E(RLC, "SDU sent to unknown RB rnti %d srb0\n", rnti);
}
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
......@@ -726,11 +726,11 @@ void do_SpCellConfig(gNB_RRC_INST *rrc,
}
//------------------------------------------------------------------------------
uint8_t do_RRCReject(uint8_t Mod_id,
int do_RRCReject(uint8_t Mod_id,
uint8_t *const buffer)
//------------------------------------------------------------------------------
{
asn_enc_rval_t enc_rval;;
asn_enc_rval_t enc_rval;
NR_DL_CCCH_Message_t dl_ccch_msg;
NR_RRCReject_t *rrcReject;
NR_RejectWaitTime_t waitTime = 1;
......@@ -767,7 +767,7 @@ uint8_t do_RRCReject(uint8_t Mod_id,
LOG_D(NR_RRC,"RRCReject Encoded %zd bits (%zd bytes)\n",
enc_rval.encoded,(enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8);
return (enc_rval.encoded + 7) / 8;
}
void fill_initial_SpCellConfig(int uid,
......
......@@ -72,7 +72,7 @@ uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier,
void do_SpCellConfig(gNB_RRC_INST *rrc,
struct NR_SpCellConfig *spconfig);
uint8_t do_RRCReject(uint8_t Mod_id,
int do_RRCReject(uint8_t Mod_id,
uint8_t *const buffer);
void fill_initial_SpCellConfig(int uid,
......
......@@ -362,6 +362,7 @@ rrc_gNB_generate_RRCSetup(
scc,
sccd,
&rrc->configuration);
AssertFatal(size > 0, "do_RRCSetup failed\n");
AssertFatal(size <= 1024, "memory corruption\n");
LOG_DUMPMSG(NR_RRC, DEBUG_RRC,
......@@ -413,6 +414,7 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(
scc,
sccd,
&rrc_instance_p->configuration);
AssertFatal(size > 0, "do_RRCSetup failed\n");
AssertFatal(size <= 1024, "memory corruption\n");
AssertFatal(size>0,"Error generating RRCSetup for RRCReestablishmentRequest\n");
......@@ -471,7 +473,9 @@ rrc_gNB_generate_RRCReject(
unsigned char buf[1024];
int size = do_RRCReject(ctxt_pP->module_id, buf);
AssertFatal(size > 0, "do_RRCReject failed\n");
AssertFatal(size <= 1024, "memory corruption\n");
LOG_DUMPMSG(NR_RRC, DEBUG_RRC,
(char *)buf,
size,
......@@ -481,9 +485,6 @@ rrc_gNB_generate_RRCReject(
PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),
size);
switch (RC.nrrrc[ctxt_pP->module_id]->node_type) {
case ngran_gNB:
case ngran_gNB_CU: {
f1ap_dl_rrc_message_t dl_rrc = {
.gNB_CU_ue_id = 0,
.gNB_DU_ue_id = 0,
......@@ -496,17 +497,6 @@ rrc_gNB_generate_RRCReject(
.RAT_frequency_priority_information.en_dc = 0
};
rrc->mac_rrc.dl_rrc_message_transfer(ctxt_pP->module_id, &dl_rrc);
break;
}
case ngran_gNB_DU:
// nothing to do for DU
AssertFatal(1==0,"nothing to do for DU\n");
break;
default :
LOG_W(NR_RRC, "Unknown node type %d\n", RC.nrrrc[ctxt_pP->module_id]->node_type);
}
}
//-----------------------------------------------------------------------------
......
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