Commit 59a25c48 authored by Robert Schmidt's avatar Robert Schmidt

RRC UE context lookup by RNTI: use assoc_id

parent 6520dbc9
...@@ -71,7 +71,7 @@ int add_bearer(char *buf, int debug, telnet_printfunc_t prnt) ...@@ -71,7 +71,7 @@ int add_bearer(char *buf, int debug, telnet_printfunc_t prnt)
} }
// verify it exists in RRC as well // verify it exists in RRC as well
rrc_gNB_ue_context_t *rrcue = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[0], rnti); rrc_gNB_ue_context_t *rrcue = rrc_gNB_get_ue_context_by_rnti_any_du(RC.nrrrc[0], rnti);
if (!rrcue) if (!rrcue)
ERROR_MSG_RET("could not find UE with RNTI %04x\n", rnti); ERROR_MSG_RET("could not find UE with RNTI %04x\n", rnti);
...@@ -95,7 +95,7 @@ int release_bearer(char *buf, int debug, telnet_printfunc_t prnt) ...@@ -95,7 +95,7 @@ int release_bearer(char *buf, int debug, telnet_printfunc_t prnt)
} }
// verify it exists in RRC as well // verify it exists in RRC as well
rrc_gNB_ue_context_t *rrcue = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[0], rnti); rrc_gNB_ue_context_t *rrcue = rrc_gNB_get_ue_context_by_rnti_any_du(RC.nrrrc[0], rnti);
if (!rrcue) if (!rrcue)
ERROR_MSG_RET("could not find UE with RNTI %04x\n", rnti); ERROR_MSG_RET("could not find UE with RNTI %04x\n", rnti);
......
...@@ -87,7 +87,7 @@ int get_reestab_count(char *buf, int debug, telnet_printfunc_t prnt) ...@@ -87,7 +87,7 @@ int get_reestab_count(char *buf, int debug, telnet_printfunc_t prnt)
rnti = strtol(buf, NULL, 16); rnti = strtol(buf, NULL, 16);
if (rnti < 1 || rnti >= 0xfffe) if (rnti < 1 || rnti >= 0xfffe)
ERROR_MSG_RET("RNTI needs to be [1,0xfffe]\n"); ERROR_MSG_RET("RNTI needs to be [1,0xfffe]\n");
ue = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[0], rnti); ue = rrc_gNB_get_ue_context_by_rnti_any_du(RC.nrrrc[0], rnti);
if (!ue) if (!ue)
ERROR_MSG_RET("could not find UE with RNTI %04x in RRC\n"); ERROR_MSG_RET("could not find UE with RNTI %04x in RRC\n");
} }
......
...@@ -38,7 +38,7 @@ void read_gtp_sm(void * data) ...@@ -38,7 +38,7 @@ void read_gtp_sm(void * data)
UE_iterator(UE_info->list, UE) UE_iterator(UE_info->list, UE)
{ {
uint16_t const rnti = UE->rnti; uint16_t const rnti = UE->rnti;
struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[mod_id], rnti); struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context_by_rnti_any_du(RC.nrrrc[mod_id], rnti);
if (ue_context_p != NULL) { if (ue_context_p != NULL) {
gtp->msg.ngut[i].rnti = ue_context_p->ue_context.rnti; gtp->msg.ngut[i].rnti = ue_context_p->ue_context.rnti;
int nb_pdu_session = ue_context_p->ue_context.nb_of_pdusessions; int nb_pdu_session = ue_context_p->ue_context.nb_of_pdusessions;
......
...@@ -43,7 +43,7 @@ matched_ues_mac_t filter_ues_by_s_nssai_in_du_or_monolithic(test_cond_e const co ...@@ -43,7 +43,7 @@ matched_ues_mac_t filter_ues_by_s_nssai_in_du_or_monolithic(test_cond_e const co
{ {
if (NODE_IS_MONOLITHIC(RC.nrrrc[0]->node_type)) if (NODE_IS_MONOLITHIC(RC.nrrrc[0]->node_type))
{ {
rrc_gNB_ue_context_t *rrc_ue_context_list = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[0], ue->rnti); rrc_gNB_ue_context_t *rrc_ue_context_list = rrc_gNB_get_ue_context_by_rnti_any_du(RC.nrrrc[0], ue->rnti);
ngap_ue_context_list = ngap_get_ue_context(rrc_ue_context_list->ue_context.rrc_ue_id); ngap_ue_context_list = ngap_get_ue_context(rrc_ue_context_list->ue_context.rrc_ue_id);
assert(ngap_ue_context_list->gNB_instance[0].s_nssai[0][0].sST == value && "Please, check the condition for S-NSSAI. At the moment, OAI supports eMBB"); assert(ngap_ue_context_list->gNB_instance[0].s_nssai[0][0].sST == value && "Please, check the condition for S-NSSAI. At the moment, OAI supports eMBB");
} }
...@@ -589,7 +589,7 @@ kpm_ind_msg_format_3_t fill_kpm_ind_msg_frm_3_in_monolithic(const matched_ues_ma ...@@ -589,7 +589,7 @@ kpm_ind_msg_format_3_t fill_kpm_ind_msg_frm_3_in_monolithic(const matched_ues_ma
for (size_t i = 0; i<msg_frm_3.ue_meas_report_lst_len; i++) for (size_t i = 0; i<msg_frm_3.ue_meas_report_lst_len; i++)
{ {
// Fill UE ID data // Fill UE ID data
rrc_gNB_ue_context_t *rrc_ue_context_list = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[0], matched_ues.ue_list[i].rnti); rrc_gNB_ue_context_t *rrc_ue_context_list = rrc_gNB_get_ue_context_by_rnti_any_du(RC.nrrrc[0], matched_ues.ue_list[i].rnti);
msg_frm_3.meas_report_per_ue[i].ue_meas_report_lst.type = GNB_UE_ID_E2SM; msg_frm_3.meas_report_per_ue[i].ue_meas_report_lst.type = GNB_UE_ID_E2SM;
msg_frm_3.meas_report_per_ue[i].ue_meas_report_lst.gnb = fill_gnb_data(rrc_ue_context_list); msg_frm_3.meas_report_per_ue[i].ue_meas_report_lst.gnb = fill_gnb_data(rrc_ue_context_list);
......
...@@ -58,7 +58,7 @@ int8_t nr_mac_rrc_bwp_switch_req(const module_id_t module_idP, ...@@ -58,7 +58,7 @@ int8_t nr_mac_rrc_bwp_switch_req(const module_id_t module_idP,
const rnti_t rntiP, const rnti_t rntiP,
const int dl_bwp_id, const int dl_bwp_id,
const int ul_bwp_id) { const int ul_bwp_id) {
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(RC.nrrrc[module_idP], rntiP); rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti_any_du(RC.nrrrc[module_idP], rntiP);
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, GNB_FLAG_YES, rntiP, frameP, sub_frameP, 0); PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, GNB_FLAG_YES, rntiP, frameP, sub_frameP, 0);
......
...@@ -1276,9 +1276,7 @@ static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc, sctp_assoc_t ...@@ -1276,9 +1276,7 @@ static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc, sctp_assoc_t
} }
rnti_t old_rnti = req->ue_Identity.c_RNTI; rnti_t old_rnti = req->ue_Identity.c_RNTI;
// TODO: we need to check within a specific DU! rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(rrc, assoc_id, old_rnti);
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(rrc, old_rnti);
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
/* in case we need to do RRC Setup, give the UE a new random identity */ /* in case we need to do RRC Setup, give the UE a new random identity */
uint64_t random_value; uint64_t random_value;
fill_random(&random_value, sizeof(random_value)); fill_random(&random_value, sizeof(random_value));
...@@ -1291,6 +1289,7 @@ static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc, sctp_assoc_t ...@@ -1291,6 +1289,7 @@ static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc, sctp_assoc_t
return; return;
} }
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
// 3GPP TS 38.321 version 15.13.0 Section 7.1 Table 7.1-1: RNTI values // 3GPP TS 38.321 version 15.13.0 Section 7.1 Table 7.1-1: RNTI values
if (req->ue_Identity.c_RNTI < 0x1 || req->ue_Identity.c_RNTI > 0xffef) { if (req->ue_Identity.c_RNTI < 0x1 || req->ue_Identity.c_RNTI > 0xffef) {
/* c_RNTI range error should not happen */ /* c_RNTI range error should not happen */
...@@ -2546,7 +2545,7 @@ void rrc_gNB_trigger_new_bearer(int rnti) ...@@ -2546,7 +2545,7 @@ void rrc_gNB_trigger_new_bearer(int rnti)
{ {
/* get RRC and UE */ /* get RRC and UE */
gNB_RRC_INST *rrc = RC.nrrrc[0]; gNB_RRC_INST *rrc = RC.nrrrc[0];
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(rrc, rnti); rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti_any_du(rrc, rnti);
if (ue_context_p == NULL) { if (ue_context_p == NULL) {
LOG_E(RRC, "unknown UE RNTI %04x\n", rnti); LOG_E(RRC, "unknown UE RNTI %04x\n", rnti);
return; return;
...@@ -2628,7 +2627,7 @@ void rrc_gNB_trigger_release_bearer(int rnti) ...@@ -2628,7 +2627,7 @@ void rrc_gNB_trigger_release_bearer(int rnti)
{ {
/* get RRC and UE */ /* get RRC and UE */
gNB_RRC_INST *rrc = RC.nrrrc[0]; gNB_RRC_INST *rrc = RC.nrrrc[0];
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(rrc, rnti); rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti_any_du(rrc, rnti);
if (ue_context_p == NULL) { if (ue_context_p == NULL) {
LOG_E(RRC, "unknown UE RNTI %04x\n", rnti); LOG_E(RRC, "unknown UE RNTI %04x\n", rnti);
return; return;
......
...@@ -87,7 +87,19 @@ rrc_gNB_ue_context_t *rrc_gNB_get_ue_context(gNB_RRC_INST *rrc_instance_pP, ue_i ...@@ -87,7 +87,19 @@ rrc_gNB_ue_context_t *rrc_gNB_get_ue_context(gNB_RRC_INST *rrc_instance_pP, ue_i
return RB_FIND(rrc_nr_ue_tree_s, &rrc_instance_pP->rrc_ue_head, &temp); return RB_FIND(rrc_nr_ue_tree_s, &rrc_instance_pP->rrc_ue_head, &temp);
} }
rrc_gNB_ue_context_t *rrc_gNB_get_ue_context_by_rnti(gNB_RRC_INST *rrc_instance_pP, rnti_t rntiP) rrc_gNB_ue_context_t *rrc_gNB_get_ue_context_by_rnti(gNB_RRC_INST *rrc_instance_pP, sctp_assoc_t assoc_id, rnti_t rntiP)
{
rrc_gNB_ue_context_t *ue_context_p;
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &(rrc_instance_pP->rrc_ue_head)) {
f1_ue_data_t ue_data = cu_get_f1_ue_data(ue_context_p->ue_context.rrc_ue_id);
if (ue_data.du_assoc_id == assoc_id && ue_context_p->ue_context.rnti == rntiP)
return ue_context_p;
}
LOG_W(NR_RRC, "search by RNTI %04x and assoc_id %d: no UE found\n", rntiP, assoc_id);
return NULL;
}
rrc_gNB_ue_context_t *rrc_gNB_get_ue_context_by_rnti_any_du(gNB_RRC_INST *rrc_instance_pP, rnti_t rntiP)
{ {
rrc_gNB_ue_context_t *ue_context_p; rrc_gNB_ue_context_t *ue_context_p;
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &(rrc_instance_pP->rrc_ue_head)) RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &(rrc_instance_pP->rrc_ue_head))
......
...@@ -41,7 +41,8 @@ RB_PROTOTYPE(rrc_nr_ue_tree_s, rrc_gNB_ue_context_s, entries, rrc_gNB_compare_ue ...@@ -41,7 +41,8 @@ RB_PROTOTYPE(rrc_nr_ue_tree_s, rrc_gNB_ue_context_s, entries, rrc_gNB_compare_ue
rrc_gNB_ue_context_t* rrc_gNB_allocate_new_ue_context(gNB_RRC_INST* rrc_instance_pP); rrc_gNB_ue_context_t* rrc_gNB_allocate_new_ue_context(gNB_RRC_INST* rrc_instance_pP);
rrc_gNB_ue_context_t* rrc_gNB_get_ue_context(gNB_RRC_INST* rrc_instance_pP, ue_id_t ue); rrc_gNB_ue_context_t* rrc_gNB_get_ue_context(gNB_RRC_INST* rrc_instance_pP, ue_id_t ue);
rrc_gNB_ue_context_t* rrc_gNB_get_ue_context_by_rnti(gNB_RRC_INST* rrc_instance_pP, rnti_t rntiP); rrc_gNB_ue_context_t* rrc_gNB_get_ue_context_by_rnti(gNB_RRC_INST* rrc_instance_pP, sctp_assoc_t assoc_id, rnti_t rntiP);
rrc_gNB_ue_context_t* rrc_gNB_get_ue_context_by_rnti_any_du(gNB_RRC_INST* rrc_instance_pP, rnti_t rntiP);
void rrc_gNB_free_mem_ue_context(rrc_gNB_ue_context_t* const ue_context_pP); void rrc_gNB_free_mem_ue_context(rrc_gNB_ue_context_t* const ue_context_pP);
......
...@@ -414,7 +414,7 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { ...@@ -414,7 +414,7 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) {
LOG_D(RRC, "calling rrc_remove_nsa_user rnti %d\n", rnti); LOG_D(RRC, "calling rrc_remove_nsa_user rnti %d\n", rnti);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, rnti, 0, 0, rrc->module_id); PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, rrc->module_id, GNB_FLAG_YES, rnti, 0, 0, rrc->module_id);
ue_context = rrc_gNB_get_ue_context_by_rnti(rrc, rnti); ue_context = rrc_gNB_get_ue_context_by_rnti_any_du(rrc, rnti);
if (ue_context == NULL) { if (ue_context == NULL) {
LOG_W(RRC, "rrc_remove_nsa_user: rnti %d not found\n", rnti); LOG_W(RRC, "rrc_remove_nsa_user: rnti %d not found\n", rnti);
return; return;
......
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