Commit 08b80710 authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Merge remote-tracking branch 'origin/NR_RLC_UE_ID' into integration_2024_w13

parents 0edb81dc e77a1468
...@@ -715,7 +715,7 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc) ...@@ -715,7 +715,7 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc)
mac_remove_nr_ue(mac, *dl_rrc->old_gNB_DU_ue_id); mac_remove_nr_ue(mac, *dl_rrc->old_gNB_DU_ue_id);
pthread_mutex_unlock(&mac->sched_lock); pthread_mutex_unlock(&mac->sched_lock);
nr_rlc_remove_ue(dl_rrc->gNB_DU_ue_id); nr_rlc_remove_ue(dl_rrc->gNB_DU_ue_id);
nr_rlc_update_rnti(*dl_rrc->old_gNB_DU_ue_id, dl_rrc->gNB_DU_ue_id); nr_rlc_update_id(*dl_rrc->old_gNB_DU_ue_id, dl_rrc->gNB_DU_ue_id);
instance_t f1inst = get_f1_gtp_instance(); instance_t f1inst = get_f1_gtp_instance();
if (f1inst >= 0) // we actually use F1-U if (f1inst >= 0) // we actually use F1-U
gtpv1u_update_ue_id(f1inst, *dl_rrc->old_gNB_DU_ue_id, dl_rrc->gNB_DU_ue_id); gtpv1u_update_ue_id(f1inst, *dl_rrc->old_gNB_DU_ue_id, dl_rrc->gNB_DU_ue_id);
......
...@@ -118,10 +118,10 @@ static nr_rlc_entity_t *get_rlc_entity_from_lcid(nr_rlc_ue_t *ue, logical_chan_i ...@@ -118,10 +118,10 @@ static nr_rlc_entity_t *get_rlc_entity_from_lcid(nr_rlc_ue_t *ue, logical_chan_i
} }
} }
void nr_rlc_release_entity(int rnti, logical_chan_id_t channel_id) void nr_rlc_release_entity(int ue_id, logical_chan_id_t channel_id)
{ {
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
if (channel_id == 0) { if (channel_id == 0) {
if (ue->srb0 != NULL) { if (ue->srb0 != NULL) {
free(ue->srb0->deliver_sdu_data); free(ue->srb0->deliver_sdu_data);
...@@ -136,7 +136,7 @@ void nr_rlc_release_entity(int rnti, logical_chan_id_t channel_id) ...@@ -136,7 +136,7 @@ void nr_rlc_release_entity(int rnti, logical_chan_id_t channel_id)
} }
void mac_rlc_data_ind(const module_id_t module_idP, void mac_rlc_data_ind(const module_id_t module_idP,
const rnti_t rntiP, const uint16_t ue_id,
const eNB_index_t eNB_index, const eNB_index_t eNB_index,
const frame_t frameP, const frame_t frameP,
const eNB_flag_t enb_flagP, const eNB_flag_t enb_flagP,
...@@ -153,11 +153,11 @@ void mac_rlc_data_ind(const module_id_t module_idP, ...@@ -153,11 +153,11 @@ void mac_rlc_data_ind(const module_id_t module_idP,
} }
if (enb_flagP) if (enb_flagP)
T(T_ENB_RLC_MAC_UL, T_INT(module_idP), T_INT(rntiP), T(T_ENB_RLC_MAC_UL, T_INT(module_idP), T_INT(ue_id),
T_INT(channel_idP), T_INT(tb_sizeP)); T_INT(channel_idP), T_INT(tb_sizeP));
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rntiP); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
if(ue == NULL) if(ue == NULL)
LOG_I(RLC, "RLC instance for the given UE was not found \n"); LOG_I(RLC, "RLC instance for the given UE was not found \n");
...@@ -169,8 +169,7 @@ void mac_rlc_data_ind(const module_id_t module_idP, ...@@ -169,8 +169,7 @@ void mac_rlc_data_ind(const module_id_t module_idP,
rb->set_time(rb, nr_rlc_current_time); rb->set_time(rb, nr_rlc_current_time);
rb->recv_pdu(rb, buffer_pP, tb_sizeP); rb->recv_pdu(rb, buffer_pP, tb_sizeP);
} else { } else {
LOG_E(RLC, "Fatal: no RB found (channel ID %d RNTI %d)\n", LOG_E(RLC, "Fatal: no RB found (channel ID %d UE ID %d)\n", channel_idP, ue_id);
channel_idP, rntiP);
// exit(1); // exit(1);
} }
...@@ -178,7 +177,7 @@ void mac_rlc_data_ind(const module_id_t module_idP, ...@@ -178,7 +177,7 @@ void mac_rlc_data_ind(const module_id_t module_idP,
} }
tbs_size_t mac_rlc_data_req(const module_id_t module_idP, tbs_size_t mac_rlc_data_req(const module_id_t module_idP,
const rnti_t rntiP, const uint16_t ue_id,
const eNB_index_t eNB_index, const eNB_index_t eNB_index,
const frame_t frameP, const frame_t frameP,
const eNB_flag_t enb_flagP, const eNB_flag_t enb_flagP,
...@@ -193,7 +192,7 @@ tbs_size_t mac_rlc_data_req(const module_id_t module_idP, ...@@ -193,7 +192,7 @@ tbs_size_t mac_rlc_data_req(const module_id_t module_idP,
int maxsize; int maxsize;
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rntiP); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, channel_idP); nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, channel_idP);
if (rb != NULL) { if (rb != NULL) {
...@@ -209,14 +208,14 @@ tbs_size_t mac_rlc_data_req(const module_id_t module_idP, ...@@ -209,14 +208,14 @@ tbs_size_t mac_rlc_data_req(const module_id_t module_idP,
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
if (enb_flagP) if (enb_flagP)
T(T_ENB_RLC_MAC_DL, T_INT(module_idP), T_INT(rntiP), T(T_ENB_RLC_MAC_DL, T_INT(module_idP), T_INT(ue_id),
T_INT(channel_idP), T_INT(ret)); T_INT(channel_idP), T_INT(ret));
return ret; return ret;
} }
mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP, mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP,
const rnti_t rntiP, const uint16_t ue_id,
const eNB_index_t eNB_index, const eNB_index_t eNB_index,
const frame_t frameP, const frame_t frameP,
const sub_frame_t subframeP, const sub_frame_t subframeP,
...@@ -229,7 +228,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP, ...@@ -229,7 +228,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP,
mac_rlc_status_resp_t ret; mac_rlc_status_resp_t ret;
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rntiP); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, channel_idP); nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, channel_idP);
if (rb != NULL) { if (rb != NULL) {
...@@ -246,7 +245,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP, ...@@ -246,7 +245,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP,
+ buf_stat.tx_size; + buf_stat.tx_size;
} else { } else {
if (!(frameP%128) || channel_idP == 0) //to suppress this warning message if (!(frameP%128) || channel_idP == 0) //to suppress this warning message
LOG_W(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rntiP %x\n", __FUNCTION__, channel_idP, rntiP); LOG_W(RLC, "Radio Bearer (channel ID %d) is NULL for UE %d\n", channel_idP, ue_id);
ret.bytes_in_buffer = 0; ret.bytes_in_buffer = 0;
} }
...@@ -261,7 +260,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP, ...@@ -261,7 +260,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP,
} }
rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(const module_id_t module_idP, rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(const module_id_t module_idP,
const rnti_t rntiP, const uint16_t ue_id,
const eNB_index_t eNB_index, const eNB_index_t eNB_index,
const frame_t frameP, const frame_t frameP,
const sub_frame_t subframeP, const sub_frame_t subframeP,
...@@ -284,7 +283,7 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(const module_id_t module ...@@ -284,7 +283,7 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(const module_id_t module
} }
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rntiP); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, channel_idP); nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, channel_idP);
if (rb != NULL) { if (rb != NULL) {
...@@ -302,7 +301,7 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(const module_id_t module ...@@ -302,7 +301,7 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(const module_id_t module
+ buf_stat.tx_size; + buf_stat.tx_size;
} else { } else {
if (!(frameP%128)) //to suppress this warning message if (!(frameP%128)) //to suppress this warning message
LOG_W(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rntiP %x\n", __FUNCTION__, channel_idP, rntiP); LOG_W(RLC, "Radio Bearer (channel ID %d) is NULL for UE %d\n", channel_idP, ue_id);
ret = 0; ret = 0;
} }
...@@ -322,18 +321,18 @@ rlc_op_status_t rlc_data_req(const protocol_ctxt_t *const ctxt_pP, ...@@ -322,18 +321,18 @@ rlc_op_status_t rlc_data_req(const protocol_ctxt_t *const ctxt_pP,
const uint32_t *const sourceL2Id, const uint32_t *const sourceL2Id,
const uint32_t *const destinationL2Id) const uint32_t *const destinationL2Id)
{ {
int rnti = ctxt_pP->rntiMaybeUEid; int ue_id = ctxt_pP->rntiMaybeUEid;
nr_rlc_ue_t *ue; nr_rlc_ue_t *ue;
nr_rlc_entity_t *rb; nr_rlc_entity_t *rb;
LOG_D(RLC, "rnti %d srb_flag %d rb_id %ld mui %d confirm %d sdu_size %d MBMS_flag %d\n", LOG_D(RLC, "UE %d srb_flag %d rb_id %ld mui %d confirm %d sdu_size %d MBMS_flag %d\n",
rnti, srb_flagP, rb_idP, muiP, confirmP, sdu_sizeP, MBMS_flagP); ue_id, srb_flagP, rb_idP, muiP, confirmP, sdu_sizeP, MBMS_flagP);
if (ctxt_pP->enb_flag) if (ctxt_pP->enb_flag)
T(T_ENB_RLC_DL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rntiMaybeUEid), T_INT(rb_idP), T_INT(sdu_sizeP)); T(T_ENB_RLC_DL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rntiMaybeUEid), T_INT(rb_idP), T_INT(sdu_sizeP));
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
rb = NULL; rb = NULL;
...@@ -359,19 +358,18 @@ rlc_op_status_t rlc_data_req(const protocol_ctxt_t *const ctxt_pP, ...@@ -359,19 +358,18 @@ rlc_op_status_t rlc_data_req(const protocol_ctxt_t *const ctxt_pP,
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
} }
int nr_rlc_get_available_tx_space(const rnti_t rntiP, int nr_rlc_get_available_tx_space(const int ue_id, const logical_chan_id_t channel_idP)
const logical_chan_id_t channel_idP)
{ {
int ret; int ret;
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rntiP); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, channel_idP); nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, channel_idP);
if (rb != NULL) { if (rb != NULL) {
ret = rb->available_tx_space(rb); ret = rb->available_tx_space(rb);
} else { } else {
LOG_E(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rntiP %x\n", __FUNCTION__, channel_idP, rntiP); LOG_E(RLC, "Radio Bearer (channel ID %d) is NULL for UE %d\n", channel_idP, ue_id);
ret = -1; ret = -1;
} }
...@@ -440,13 +438,11 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size) ...@@ -440,13 +438,11 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size)
} }
} }
LOG_E(RLC, "%s:%d:%s: fatal, no RB found for ue %d\n", LOG_E(RLC, "Fatal, no RB found for ue %d\n", ue->ue_id);
__FILE__, __LINE__, __FUNCTION__, ue->rnti);
exit(1); exit(1);
rb_found: rb_found:
LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d\n", LOG_D(RLC, "Delivering SDU (ue_id %d is_srb %d rb_id %d) size %d\n", ue->ue_id, is_srb, rb_id, size);
__FILE__, __LINE__, __FUNCTION__, ue->rnti, is_srb, rb_id, size);
/* unused fields? */ /* unused fields? */
ctx.instance = 0; ctx.instance = 0;
...@@ -461,9 +457,9 @@ rb_found: ...@@ -461,9 +457,9 @@ rb_found:
ctx.module_id = 0; ctx.module_id = 0;
/* CU (PDCP, RRC, SDAP) use a different ID than RNTI, so below set the CU UE /* CU (PDCP, RRC, SDAP) use a different ID than RNTI, so below set the CU UE
* ID if in gNB, else use RNTI normally */ * ID if in gNB, else use RNTI normally */
ctx.rntiMaybeUEid = ue->rnti; ctx.rntiMaybeUEid = ue->ue_id;
if (is_enb) { if (is_enb) {
f1_ue_data_t ue_data = du_get_f1_ue_data(ue->rnti); f1_ue_data_t ue_data = du_get_f1_ue_data(ue->ue_id);
ctx.rntiMaybeUEid = ue_data.secondary_ue; ctx.rntiMaybeUEid = ue_data.secondary_ue;
} }
...@@ -472,7 +468,7 @@ rb_found: ...@@ -472,7 +468,7 @@ rb_found:
if (is_enb) { if (is_enb) {
T(T_ENB_RLC_UL, T(T_ENB_RLC_UL,
T_INT(0 /*ctxt_pP->module_id*/), T_INT(0 /*ctxt_pP->module_id*/),
T_INT(ue->rnti), T_INT(rb_id), T_INT(size)); T_INT(ue->ue_id), T_INT(rb_id), T_INT(size));
const ngran_node_t type = RC.nrrrc[0 /*ctxt_pP->module_id*/]->node_type; const ngran_node_t type = RC.nrrrc[0 /*ctxt_pP->module_id*/]->node_type;
AssertFatal(!NODE_IS_CU(type), AssertFatal(!NODE_IS_CU(type),
...@@ -491,7 +487,7 @@ rb_found: ...@@ -491,7 +487,7 @@ rb_found:
uint8_t *message_buffer = itti_malloc (TASK_RLC_ENB, TASK_DU_F1, size); uint8_t *message_buffer = itti_malloc (TASK_RLC_ENB, TASK_DU_F1, size);
memcpy (message_buffer, buf, size); memcpy (message_buffer, buf, size);
F1AP_UL_RRC_MESSAGE(msg).gNB_CU_ue_id = ctx.rntiMaybeUEid; F1AP_UL_RRC_MESSAGE(msg).gNB_CU_ue_id = ctx.rntiMaybeUEid;
F1AP_UL_RRC_MESSAGE(msg).gNB_DU_ue_id = ue->rnti; F1AP_UL_RRC_MESSAGE(msg).gNB_DU_ue_id = ue->ue_id;
F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id;
F1AP_UL_RRC_MESSAGE(msg).rrc_container = message_buffer; F1AP_UL_RRC_MESSAGE(msg).rrc_container = message_buffer;
F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size; F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size;
...@@ -504,8 +500,8 @@ rb_found: ...@@ -504,8 +500,8 @@ rb_found:
req->buffer=(uint8_t*)(req+1); req->buffer=(uint8_t*)(req+1);
memcpy(req->buffer,buf,size); memcpy(req->buffer,buf,size);
req->length=size; req->length=size;
req->offset=0; req->offset = 0;
req->ue_id=ue->rnti; // use RNTI here, which GTP will use to look up TEID req->ue_id = ue->ue_id;
req->bearer_id=rb_id; req->bearer_id=rb_id;
LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size);
extern instance_t DUuniqInstance; extern instance_t DUuniqInstance;
...@@ -558,8 +554,7 @@ static void successful_delivery(void *_ue, nr_rlc_entity_t *entity, int sdu_id) ...@@ -558,8 +554,7 @@ static void successful_delivery(void *_ue, nr_rlc_entity_t *entity, int sdu_id)
} }
} }
LOG_E(RLC, "%s:%d:%s: fatal, no RB found for ue %d\n", LOG_E(RLC, "Fatal, no RB found for ue %d\n", ue->ue_id);
__FILE__, __LINE__, __FUNCTION__, ue->rnti);
exit(1); exit(1);
rb_found: rb_found:
...@@ -616,8 +611,7 @@ static void max_retx_reached(void *_ue, nr_rlc_entity_t *entity) ...@@ -616,8 +611,7 @@ static void max_retx_reached(void *_ue, nr_rlc_entity_t *entity)
} }
} }
LOG_E(RLC, "%s:%d:%s: fatal, no RB found for ue %d\n", LOG_E(RLC, "Fatal, no RB found for ue %d\n", ue->ue_id);
__FILE__, __LINE__, __FUNCTION__, ue->rnti);
exit(1); exit(1);
rb_found: rb_found:
...@@ -644,10 +638,10 @@ rb_found: ...@@ -644,10 +638,10 @@ rb_found:
#endif #endif
} }
void nr_rlc_reestablish_entity(int rnti, int lc_id) void nr_rlc_reestablish_entity(int ue_id, int lc_id)
{ {
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
if (ue == NULL) { if (ue == NULL) {
LOG_E(RLC, "RLC instance for the given UE was not found \n"); LOG_E(RLC, "RLC instance for the given UE was not found \n");
...@@ -663,10 +657,11 @@ void nr_rlc_reestablish_entity(int rnti, int lc_id) ...@@ -663,10 +657,11 @@ void nr_rlc_reestablish_entity(int rnti, int lc_id)
} }
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
} }
void nr_rlc_reconfigure_entity(int rnti, int lc_id, NR_RLC_Config_t *rlc_Config)
void nr_rlc_reconfigure_entity(int ue_id, int lc_id, NR_RLC_Config_t *rlc_Config)
{ {
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
if (ue == NULL) if (ue == NULL)
LOG_E(RLC, "RLC instance for the given UE was not found \n"); LOG_E(RLC, "RLC instance for the given UE was not found \n");
...@@ -737,7 +732,7 @@ void nr_rlc_reconfigure_entity(int rnti, int lc_id, NR_RLC_Config_t *rlc_Config) ...@@ -737,7 +732,7 @@ void nr_rlc_reconfigure_entity(int rnti, int lc_id, NR_RLC_Config_t *rlc_Config)
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
} }
void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig) void nr_rlc_add_srb(int ue_id, int srb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig)
{ {
struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config; struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config;
int t_status_prohibit; int t_status_prohibit;
...@@ -778,7 +773,7 @@ void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_Beare ...@@ -778,7 +773,7 @@ void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_Beare
} }
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
AssertFatal(rlc_BearerConfig->servedRadioBearer && AssertFatal(rlc_BearerConfig->servedRadioBearer &&
(rlc_BearerConfig->servedRadioBearer->present == (rlc_BearerConfig->servedRadioBearer->present ==
NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity), NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity),
...@@ -787,7 +782,7 @@ void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_Beare ...@@ -787,7 +782,7 @@ void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_Beare
ue->lcid2rb[local_id].type = NR_RLC_SRB; ue->lcid2rb[local_id].type = NR_RLC_SRB;
ue->lcid2rb[local_id].choice.srb_id = rlc_BearerConfig->servedRadioBearer->choice.srb_Identity; ue->lcid2rb[local_id].choice.srb_id = rlc_BearerConfig->servedRadioBearer->choice.srb_Identity;
if (ue->srb[srb_id-1] != NULL) { if (ue->srb[srb_id-1] != NULL) {
LOG_E(RLC, "%s:%d:%s: SRB %d already exists for UE with RNTI %04x, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); LOG_E(RLC, "SRB %d already exists for UE %d, do nothing\n", srb_id, ue_id);
} else { } else {
nr_rlc_entity_t *nr_rlc_am = new_nr_rlc_entity_am(RLC_RX_MAXSIZE, nr_rlc_entity_t *nr_rlc_am = new_nr_rlc_entity_am(RLC_RX_MAXSIZE,
RLC_TX_MAXSIZE, RLC_TX_MAXSIZE,
...@@ -800,12 +795,12 @@ void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_Beare ...@@ -800,12 +795,12 @@ void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_Beare
sn_field_length); sn_field_length);
nr_rlc_ue_add_srb_rlc_entity(ue, srb_id, nr_rlc_am); nr_rlc_ue_add_srb_rlc_entity(ue, srb_id, nr_rlc_am);
LOG_I(RLC, "Added srb %d to UE with RNTI 0x%x\n", srb_id, rnti); LOG_I(RLC, "Added srb %d to UE %d\n", srb_id, ue_id);
} }
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
} }
static void add_drb_am(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig) static void add_drb_am(int ue_id, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig)
{ {
struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config; struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config;
...@@ -843,7 +838,7 @@ static void add_drb_am(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_Be ...@@ -843,7 +838,7 @@ static void add_drb_am(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_Be
} }
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
AssertFatal(rlc_BearerConfig->servedRadioBearer && AssertFatal(rlc_BearerConfig->servedRadioBearer &&
(rlc_BearerConfig->servedRadioBearer->present == (rlc_BearerConfig->servedRadioBearer->present ==
NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity), NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity),
...@@ -852,7 +847,7 @@ static void add_drb_am(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_Be ...@@ -852,7 +847,7 @@ static void add_drb_am(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_Be
ue->lcid2rb[local_id].type = NR_RLC_DRB; ue->lcid2rb[local_id].type = NR_RLC_DRB;
ue->lcid2rb[local_id].choice.drb_id = rlc_BearerConfig->servedRadioBearer->choice.drb_Identity; ue->lcid2rb[local_id].choice.drb_id = rlc_BearerConfig->servedRadioBearer->choice.drb_Identity;
if (ue->drb[drb_id-1] != NULL) { if (ue->drb[drb_id-1] != NULL) {
LOG_E(RLC, "%s:%d:%s: DRB %d already exists for UE with RNTI %04x, do nothing\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); LOG_E(RLC, "DRB %d already exists for UE %d, do nothing\n", drb_id, ue_id);
} else { } else {
nr_rlc_entity_t *nr_rlc_am = new_nr_rlc_entity_am(RLC_RX_MAXSIZE, nr_rlc_entity_t *nr_rlc_am = new_nr_rlc_entity_am(RLC_RX_MAXSIZE,
RLC_TX_MAXSIZE, RLC_TX_MAXSIZE,
...@@ -865,12 +860,12 @@ static void add_drb_am(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_Be ...@@ -865,12 +860,12 @@ static void add_drb_am(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_Be
sn_field_length); sn_field_length);
nr_rlc_ue_add_drb_rlc_entity(ue, drb_id, nr_rlc_am); nr_rlc_ue_add_drb_rlc_entity(ue, drb_id, nr_rlc_am);
LOG_I(RLC, "%s:%d:%s: added drb %d to UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); LOG_I(RLC, "Added drb %d to UE %d\n", drb_id, ue_id);
} }
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
} }
static void add_drb_um(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig) static void add_drb_um(int ue_id, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig)
{ {
struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config; struct NR_RLC_Config *r = rlc_BearerConfig->rlc_Config;
...@@ -898,7 +893,7 @@ static void add_drb_um(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_Be ...@@ -898,7 +893,7 @@ static void add_drb_um(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_Be
} }
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
AssertFatal(rlc_BearerConfig->servedRadioBearer && AssertFatal(rlc_BearerConfig->servedRadioBearer &&
(rlc_BearerConfig->servedRadioBearer->present == (rlc_BearerConfig->servedRadioBearer->present ==
NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity), NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity),
...@@ -907,7 +902,7 @@ static void add_drb_um(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_Be ...@@ -907,7 +902,7 @@ static void add_drb_um(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_Be
ue->lcid2rb[local_id].type = NR_RLC_DRB; ue->lcid2rb[local_id].type = NR_RLC_DRB;
ue->lcid2rb[local_id].choice.drb_id = rlc_BearerConfig->servedRadioBearer->choice.drb_Identity; ue->lcid2rb[local_id].choice.drb_id = rlc_BearerConfig->servedRadioBearer->choice.drb_Identity;
if (ue->drb[drb_id-1] != NULL) { if (ue->drb[drb_id-1] != NULL) {
LOG_E(RLC, "DEBUG add_drb_um %s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); LOG_E(RLC, "DEBUG add_drb_um: warning DRB %d already exist for ue %d, do nothing\n", drb_id, ue_id);
} else { } else {
nr_rlc_entity_t *nr_rlc_um = new_nr_rlc_entity_um(RLC_RX_MAXSIZE, nr_rlc_entity_t *nr_rlc_um = new_nr_rlc_entity_um(RLC_RX_MAXSIZE,
RLC_TX_MAXSIZE, RLC_TX_MAXSIZE,
...@@ -916,26 +911,25 @@ static void add_drb_um(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_Be ...@@ -916,26 +911,25 @@ static void add_drb_um(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_Be
sn_field_length); sn_field_length);
nr_rlc_ue_add_drb_rlc_entity(ue, drb_id, nr_rlc_um); nr_rlc_ue_add_drb_rlc_entity(ue, drb_id, nr_rlc_um);
LOG_D(RLC, "%s:%d:%s: added drb %d to UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); LOG_D(RLC, "Added drb %d to UE %d\n", drb_id, ue_id);
} }
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
} }
void nr_rlc_add_drb(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig) void nr_rlc_add_drb(int ue_id, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig)
{ {
switch (rlc_BearerConfig->rlc_Config->present) { switch (rlc_BearerConfig->rlc_Config->present) {
case NR_RLC_Config_PR_am: case NR_RLC_Config_PR_am:
add_drb_am(rnti, drb_id, rlc_BearerConfig); add_drb_am(ue_id, drb_id, rlc_BearerConfig);
break; break;
case NR_RLC_Config_PR_um_Bi_Directional: case NR_RLC_Config_PR_um_Bi_Directional:
add_drb_um(rnti, drb_id, rlc_BearerConfig); add_drb_um(ue_id, drb_id, rlc_BearerConfig);
break; break;
default: default:
LOG_E(RLC, "%s:%d:%s: fatal: unhandled DRB type\n", LOG_E(RLC, "Fatal: unhandled DRB type\n");
__FILE__, __LINE__, __FUNCTION__);
exit(1); exit(1);
} }
LOG_I(RLC, "%s:%s:%d: added DRB to UE with RNTI 0x%x\n", __FILE__, __FUNCTION__, __LINE__, rnti); LOG_I(RLC, "Added DRB to UE %d\n", ue_id);
} }
/* Dummy function due to dependency from LTE libraries */ /* Dummy function due to dependency from LTE libraries */
...@@ -951,66 +945,52 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP ...@@ -951,66 +945,52 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
} }
struct srb0_data { struct srb0_data {
int rnti; int ue_id;
void *data; void *data;
void (*send_initial_ul_rrc_message)(int rnti, void (*send_initial_ul_rrc_message)(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data);
const uint8_t *sdu,
sdu_size_t sdu_len,
void *data);
}; };
void deliver_sdu_srb0(void *deliver_sdu_data, struct nr_rlc_entity_t *entity, void deliver_sdu_srb0(void *deliver_sdu_data, struct nr_rlc_entity_t *entity,
char *buf, int size) char *buf, int size)
{ {
struct srb0_data *s0 = (struct srb0_data *)deliver_sdu_data; struct srb0_data *s0 = (struct srb0_data *)deliver_sdu_data;
s0->send_initial_ul_rrc_message(s0->rnti, (unsigned char *)buf, size, s0->data); s0->send_initial_ul_rrc_message(s0->ue_id, (unsigned char *)buf, size, s0->data);
} }
void nr_rlc_activate_srb0(int rnti, void *data, void nr_rlc_activate_srb0(int ue_id,
void (*send_initial_ul_rrc_message)( void *data,
int rnti, void (*send_initial_ul_rrc_message)(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data))
const uint8_t *sdu,
sdu_size_t sdu_len,
void *data))
{ {
nr_rlc_entity_t *nr_rlc_tm; struct srb0_data *srb0_data = calloc(1, sizeof(struct srb0_data));
nr_rlc_ue_t *ue;
struct srb0_data *srb0_data;
srb0_data = calloc(1, sizeof(struct srb0_data));
AssertFatal(srb0_data != NULL, "out of memory\n"); AssertFatal(srb0_data != NULL, "out of memory\n");
srb0_data->rnti = rnti; srb0_data->ue_id = ue_id;
srb0_data->data = data; srb0_data->data = data;
srb0_data->send_initial_ul_rrc_message = send_initial_ul_rrc_message; srb0_data->send_initial_ul_rrc_message = send_initial_ul_rrc_message;
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
if (ue->srb0 != NULL) { if (ue->srb0 != NULL) {
LOG_W(RLC, "SRB0 already exists for UE with RNTI 0x%x, do nothing\n", rnti); LOG_W(RLC, "SRB0 already exists for UE %d, do nothing\n", ue_id);
free(srb0_data); free(srb0_data);
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
return; return;
} }
nr_rlc_tm = new_nr_rlc_entity_tm(10000, nr_rlc_entity_t *nr_rlc_tm = new_nr_rlc_entity_tm(10000,
deliver_sdu_srb0, srb0_data); deliver_sdu_srb0, srb0_data);
nr_rlc_ue_add_srb_rlc_entity(ue, 0, nr_rlc_tm); nr_rlc_ue_add_srb_rlc_entity(ue, 0, nr_rlc_tm);
LOG_I(RLC, "activated srb0 for UE with RNTI 0x%x\n", rnti); LOG_I(RLC, "Activated srb0 for UE %d\n", ue_id);
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
} }
rlc_op_status_t rrc_rlc_config_req ( rlc_op_status_t rrc_rlc_config_req(const protocol_ctxt_t* const ctxt_pP,
const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP,
const srb_flag_t srb_flagP, const MBMS_flag_t mbms_flagP,
const MBMS_flag_t mbms_flagP, const config_action_t actionP,
const config_action_t actionP, const rb_id_t rb_idP)
const rb_id_t rb_idP)
{ {
nr_rlc_ue_t *ue;
int i;
if (mbms_flagP) { if (mbms_flagP) {
LOG_E(RLC, "%s:%d:%s: todo (MBMS NOT supported)\n", __FILE__, __LINE__, __FUNCTION__); LOG_E(RLC, "%s:%d:%s: todo (MBMS NOT supported)\n", __FILE__, __LINE__, __FUNCTION__);
exit(1); exit(1);
...@@ -1029,8 +1009,8 @@ rlc_op_status_t rrc_rlc_config_req ( ...@@ -1029,8 +1009,8 @@ rlc_op_status_t rrc_rlc_config_req (
exit(1); exit(1);
} }
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
LOG_D(RLC, "%s:%d:%s: remove rb %ld (is_srb %d) for UE RNTI %lx\n", __FILE__, __LINE__, __FUNCTION__, rb_idP, srb_flagP, ctxt_pP->rntiMaybeUEid); LOG_D(RLC, "%s:%d:%s: remove rb %ld (is_srb %d) for UE %lx\n", __FILE__, __LINE__, __FUNCTION__, rb_idP, srb_flagP, ctxt_pP->rntiMaybeUEid);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ctxt_pP->rntiMaybeUEid); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ctxt_pP->rntiMaybeUEid);
if (srb_flagP) { if (srb_flagP) {
if (ue->srb[rb_idP-1] != NULL) { if (ue->srb[rb_idP-1] != NULL) {
ue->srb[rb_idP-1]->delete_entity(ue->srb[rb_idP-1]); ue->srb[rb_idP-1]->delete_entity(ue->srb[rb_idP-1]);
...@@ -1045,6 +1025,7 @@ rlc_op_status_t rrc_rlc_config_req ( ...@@ -1045,6 +1025,7 @@ rlc_op_status_t rrc_rlc_config_req (
LOG_W(RLC, "removing non allocated DRB %ld, do nothing\n", rb_idP); LOG_W(RLC, "removing non allocated DRB %ld, do nothing\n", rb_idP);
} }
/* remove UE if it has no more RB configured */ /* remove UE if it has no more RB configured */
int i;
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
if (ue->srb[i] != NULL) if (ue->srb[i] != NULL)
break; break;
...@@ -1059,11 +1040,11 @@ rlc_op_status_t rrc_rlc_config_req ( ...@@ -1059,11 +1040,11 @@ rlc_op_status_t rrc_rlc_config_req (
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
} }
void nr_rlc_remove_ue(int rnti) void nr_rlc_remove_ue(int ue_id)
{ {
LOG_W(RLC, "remove UE %x\n", rnti); LOG_W(RLC, "Remove UE %d\n", ue_id);
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_manager_remove_ue(nr_rlc_ue_manager, rnti); nr_rlc_manager_remove_ue(nr_rlc_ue_manager, ue_id);
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
} }
...@@ -1073,17 +1054,17 @@ rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x) ...@@ -1073,17 +1054,17 @@ rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x)
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
} }
bool nr_rlc_update_rnti(int from_rnti, int to_rnti) bool nr_rlc_update_id(int from_id, int to_id)
{ {
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, from_rnti); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, from_id);
if (ue == NULL) { if (ue == NULL) {
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
LOG_E(RLC, "Cannot find RLC entity for UE %04x\n", from_rnti); LOG_E(RLC, "Cannot find RLC entity for UE %d\n", from_id);
return false; return false;
} }
ue->rnti = to_rnti; ue->ue_id = to_id;
LOG_I(RLC, "Update old UE RNTI %04x context to RNTI %04x\n", from_rnti, to_rnti); LOG_I(RLC, "Update old UE ID %d context to ID %d\n", from_id, to_id);
for (int i = 0; i < sizeof(ue->srb) / sizeof(ue->srb[0]); ++i) for (int i = 0; i < sizeof(ue->srb) / sizeof(ue->srb[0]); ++i)
if (ue->srb[i]) if (ue->srb[i])
ue->srb[i]->reestablishment(ue->srb[i]); ue->srb[i]->reestablishment(ue->srb[i]);
...@@ -1096,13 +1077,13 @@ bool nr_rlc_update_rnti(int from_rnti, int to_rnti) ...@@ -1096,13 +1077,13 @@ bool nr_rlc_update_rnti(int from_rnti, int to_rnti)
/* This function is for testing purposes. At least on a COTS UE, it will /* This function is for testing purposes. At least on a COTS UE, it will
* trigger a reestablishment. */ * trigger a reestablishment. */
void nr_rlc_test_trigger_reestablishment(int rnti) void nr_rlc_test_trigger_reestablishment(int ue_id)
{ {
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
if (ue == NULL) { if (ue == NULL) {
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
LOG_E(RLC, "Cannot find RLC entity for UE %04x\n", rnti); LOG_E(RLC, "Cannot find RLC entity for UE %04x\n", ue_id);
return; return;
} }
/* we simply assume the SRB exists, because the scheduler creates it as soon /* we simply assume the SRB exists, because the scheduler creates it as soon
...@@ -1132,16 +1113,13 @@ void rlc_tick(int a, int b) ...@@ -1132,16 +1113,13 @@ void rlc_tick(int a, int b)
exit(1); exit(1);
} }
void nr_rlc_activate_avg_time_to_tx( void nr_rlc_activate_avg_time_to_tx(const int ue_id,
const rnti_t rnti, const logical_chan_id_t channel_id,
const logical_chan_id_t channel_id, const bool is_on)
const bool is_on)
{ {
nr_rlc_ue_t *ue;
nr_rlc_entity_t *rb; nr_rlc_entity_t *rb;
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
switch (channel_id) { switch (channel_id) {
case 1 ... 3: rb = ue->srb[channel_id - 1]; break; case 1 ... 3: rb = ue->srb[channel_id - 1]; break;
...@@ -1153,27 +1131,20 @@ void nr_rlc_activate_avg_time_to_tx( ...@@ -1153,27 +1131,20 @@ void nr_rlc_activate_avg_time_to_tx(
rb->avg_time_is_on = is_on; rb->avg_time_is_on = is_on;
time_average_reset(rb->txsdu_avg_time_to_tx); time_average_reset(rb->txsdu_avg_time_to_tx);
} else { } else {
LOG_E(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rnti %x\n", __FUNCTION__, channel_id, rnti); LOG_E(RLC, "Radio Bearer (channel ID %d) is NULL for UE %d\n", channel_id, ue_id);
} }
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
} }
/* returns false in case of error, true if everything ok */ /* returns false in case of error, true if everything ok */
bool nr_rlc_get_statistics( bool nr_rlc_get_statistics(int ue_id, int srb_flag, int rb_id, nr_rlc_statistics_t *out)
int rnti,
int srb_flag,
int rb_id,
nr_rlc_statistics_t *out)
{ {
nr_rlc_ue_t *ue; bool ret;
nr_rlc_entity_t *rb;
bool ret;
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
rb = NULL; nr_rlc_entity_t *rb = NULL;
if (srb_flag) { if (srb_flag) {
if (rb_id >= 1 && rb_id <= 2) if (rb_id >= 1 && rb_id <= 2)
...@@ -1201,23 +1172,21 @@ bool nr_rlc_get_statistics( ...@@ -1201,23 +1172,21 @@ bool nr_rlc_get_statistics(
return ret; return ret;
} }
void nr_rlc_srb_recv_sdu(const int rnti, const logical_chan_id_t channel_id, unsigned char *buf, int size) void nr_rlc_srb_recv_sdu(const int ue_id, const logical_chan_id_t channel_id, unsigned char *buf, int size)
{ {
nr_rlc_ue_t *ue; T(T_ENB_RLC_DL, T_INT(0), T_INT(ue_id), T_INT(0), T_INT(size));
nr_rlc_entity_t *rb;
T(T_ENB_RLC_DL, T_INT(0), T_INT(rnti), T_INT(0), T_INT(size));
nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id);
nr_rlc_entity_t *rb = NULL;
if (channel_id == 0) { if (channel_id == 0) {
rb = ue->srb0; rb = ue->srb0;
} else { } else {
rb = ue->srb[channel_id - 1]; rb = ue->srb[channel_id - 1];
} }
AssertFatal(rb != NULL, "SDU sent to unknown RB RNTI %04x SRB %d\n", rnti, channel_id); AssertFatal(rb != NULL, "SDU sent to unknown RB UE-ID %d SRB %d\n", ue_id, channel_id);
rb->set_time(rb, nr_rlc_current_time); rb->set_time(rb, nr_rlc_current_time);
rb->recv_sdu(rb, (char *)buf, size, -1); rb->recv_sdu(rb, (char *)buf, size, -1);
......
...@@ -41,37 +41,29 @@ ...@@ -41,37 +41,29 @@
struct NR_RLC_Config; struct NR_RLC_Config;
struct NR_LogicalChannelConfig; struct NR_LogicalChannelConfig;
void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig); void nr_rlc_add_srb(int ue_id, int srb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig);
void nr_rlc_add_drb(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig); void nr_rlc_add_drb(int ue_id, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig);
void nr_rlc_reestablish_entity(int rnti, int lc_id);
logical_chan_id_t nr_rlc_get_lcid_from_rb(int ue_id, bool is_srb, int rb_id); logical_chan_id_t nr_rlc_get_lcid_from_rb(int ue_id, bool is_srb, int rb_id);
void nr_rlc_remove_ue(int rnti); void nr_rlc_reestablish_entity(int ue_id, int lc_id);
bool nr_rlc_update_rnti(int from_rnti, int to_rnti); void nr_rlc_remove_ue(int ue_id);
bool nr_rlc_update_id(int from_id, int to_id);
/* test function for CI to trigger reestablishments */ /* test function for CI to trigger reestablishments */
void nr_rlc_test_trigger_reestablishment(int rnti); void nr_rlc_test_trigger_reestablishment(int ue_id);
void nr_rlc_release_entity(int rnti, logical_chan_id_t channel_id); void nr_rlc_release_entity(int ue_id, logical_chan_id_t channel_id);
void nr_rlc_reconfigure_entity(int rnti, int lc_id, NR_RLC_Config_t *rlc_Config); void nr_rlc_reconfigure_entity(int ue_id, int lc_id, NR_RLC_Config_t *rlc_Config);
int nr_rlc_get_available_tx_space( int nr_rlc_get_available_tx_space(const int ue_id, const logical_chan_id_t channel_idP);
const rnti_t rntiP,
const logical_chan_id_t channel_idP);
void nr_rlc_activate_avg_time_to_tx( void nr_rlc_activate_avg_time_to_tx(const int ue_id, const logical_chan_id_t channel_id, const bool is_on);
const rnti_t rnti,
const logical_chan_id_t channel_id,
const bool is_on);
void nr_rlc_srb_recv_sdu(const int rnti, const logical_chan_id_t channel_id, unsigned char *buf, int size); void nr_rlc_srb_recv_sdu(const int ue_id, const logical_chan_id_t channel_id, unsigned char *buf, int size);
void nr_rlc_activate_srb0(int rnti, void *data, void nr_rlc_activate_srb0(int ue_id,
void (*send_initial_ul_rrc_message)( void *data,
int rnti, void (*send_initial_ul_rrc_message)(int rnti, const uint8_t *sdu, sdu_size_t sdu_len, void *data));
const uint8_t *sdu,
sdu_size_t sdu_len,
void *data));
bool nr_rlc_get_statistics(int rnti, int srb_flag, int rb_id, nr_rlc_statistics_t *out); bool nr_rlc_get_statistics(int ue_id, int srb_flag, int rb_id, nr_rlc_statistics_t *out);
...@@ -75,17 +75,17 @@ void nr_rlc_manager_unlock(nr_rlc_ue_manager_t *_m) ...@@ -75,17 +75,17 @@ void nr_rlc_manager_unlock(nr_rlc_ue_manager_t *_m)
} }
/* must be called with lock acquired */ /* must be called with lock acquired */
nr_rlc_ue_t *nr_rlc_manager_get_ue(nr_rlc_ue_manager_t *_m, int rnti) nr_rlc_ue_t *nr_rlc_manager_get_ue(nr_rlc_ue_manager_t *_m, int ue_id)
{ {
/* TODO: optimze */ /* TODO: optimze */
nr_rlc_ue_manager_internal_t *m = _m; nr_rlc_ue_manager_internal_t *m = _m;
int i; int i;
for (i = 0; i < m->ue_count; i++) for (i = 0; i < m->ue_count; i++)
if (m->ue_list[i]->rnti == rnti) if (m->ue_list[i]->ue_id == ue_id)
return m->ue_list[i]; return m->ue_list[i];
LOG_D(RLC, "%s:%d:%s: new UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, rnti); LOG_D(RLC, "New UE with ID %d\n", ue_id);
m->ue_count++; m->ue_count++;
m->ue_list = realloc(m->ue_list, sizeof(nr_rlc_ue_t *) * m->ue_count); m->ue_list = realloc(m->ue_list, sizeof(nr_rlc_ue_t *) * m->ue_count);
...@@ -99,13 +99,13 @@ nr_rlc_ue_t *nr_rlc_manager_get_ue(nr_rlc_ue_manager_t *_m, int rnti) ...@@ -99,13 +99,13 @@ nr_rlc_ue_t *nr_rlc_manager_get_ue(nr_rlc_ue_manager_t *_m, int rnti)
exit(1); exit(1);
} }
m->ue_list[m->ue_count-1]->rnti = rnti; m->ue_list[m->ue_count-1]->ue_id = ue_id;
return m->ue_list[m->ue_count-1]; return m->ue_list[m->ue_count-1];
} }
/* must be called with lock acquired */ /* must be called with lock acquired */
void nr_rlc_manager_remove_ue(nr_rlc_ue_manager_t *_m, int rnti) void nr_rlc_manager_remove_ue(nr_rlc_ue_manager_t *_m, int ue_id)
{ {
nr_rlc_ue_manager_internal_t *m = _m; nr_rlc_ue_manager_internal_t *m = _m;
nr_rlc_ue_t *ue; nr_rlc_ue_t *ue;
...@@ -113,13 +113,11 @@ void nr_rlc_manager_remove_ue(nr_rlc_ue_manager_t *_m, int rnti) ...@@ -113,13 +113,11 @@ void nr_rlc_manager_remove_ue(nr_rlc_ue_manager_t *_m, int rnti)
int j; int j;
for (i = 0; i < m->ue_count; i++) for (i = 0; i < m->ue_count; i++)
if (m->ue_list[i]->rnti == rnti) if (m->ue_list[i]->ue_id == ue_id)
break; break;
if (i == m->ue_count) { if (i == m->ue_count) {
LOG_W(RLC, "%s:%d:%s: warning: ue %x not found\n", LOG_W(RLC, "Warning: ue %d not found\n", ue_id);
__FILE__, __LINE__, __FUNCTION__,
rnti);
return; return;
} }
......
...@@ -38,8 +38,7 @@ typedef struct nr_rlc_rb_t { ...@@ -38,8 +38,7 @@ typedef struct nr_rlc_rb_t {
} nr_rlc_rb_t; } nr_rlc_rb_t;
typedef struct nr_rlc_ue_t { typedef struct nr_rlc_ue_t {
int rnti; int ue_id;
ue_id_t ue_id;
nr_rlc_entity_t *srb0; nr_rlc_entity_t *srb0;
nr_rlc_entity_t *srb[3]; nr_rlc_entity_t *srb[3];
nr_rlc_entity_t *drb[MAX_DRBS_PER_UE]; nr_rlc_entity_t *drb[MAX_DRBS_PER_UE];
...@@ -57,8 +56,8 @@ int nr_rlc_manager_get_enb_flag(nr_rlc_ue_manager_t *m); ...@@ -57,8 +56,8 @@ int nr_rlc_manager_get_enb_flag(nr_rlc_ue_manager_t *m);
void nr_rlc_manager_lock(nr_rlc_ue_manager_t *m); void nr_rlc_manager_lock(nr_rlc_ue_manager_t *m);
void nr_rlc_manager_unlock(nr_rlc_ue_manager_t *m); void nr_rlc_manager_unlock(nr_rlc_ue_manager_t *m);
nr_rlc_ue_t *nr_rlc_manager_get_ue(nr_rlc_ue_manager_t *m, int rnti); nr_rlc_ue_t *nr_rlc_manager_get_ue(nr_rlc_ue_manager_t *m, int ue_id);
void nr_rlc_manager_remove_ue(nr_rlc_ue_manager_t *m, int rnti); void nr_rlc_manager_remove_ue(nr_rlc_ue_manager_t *m, int ue_id);
/***********************************************************************/ /***********************************************************************/
/* ue functions */ /* ue functions */
......
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