Commit 18892963 authored by francescomani's avatar francescomani

cleanup and fixes

parent 3d824e39
...@@ -516,7 +516,7 @@ void nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id, ...@@ -516,7 +516,7 @@ void nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id,
struct NR_CellGroupConfig__rlc_BearerToReleaseList *rlc_torelease_list) struct NR_CellGroupConfig__rlc_BearerToReleaseList *rlc_torelease_list)
{ {
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
if(rlc_toadd_list) { if (rlc_toadd_list) {
for (int i = 0; i < rlc_toadd_list->list.count; i++) { for (int i = 0; i < rlc_toadd_list->list.count; i++) {
NR_RLC_BearerConfig_t *rlc_bearer = rlc_toadd_list->list.array[i]; NR_RLC_BearerConfig_t *rlc_bearer = rlc_toadd_list->list.array[i];
int id = rlc_bearer->logicalChannelIdentity - 1; int id = rlc_bearer->logicalChannelIdentity - 1;
...@@ -525,7 +525,7 @@ void nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id, ...@@ -525,7 +525,7 @@ void nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id,
} }
if (rlc_torelease_list) { if (rlc_torelease_list) {
for (int i = 0; i < rlc_torelease_list->list.count; i++) { for (int i = 0; i < rlc_torelease_list->list.count; i++) {
if(rlc_torelease_list->list.array[i]) { if (rlc_torelease_list->list.array[i]) {
int id = *rlc_torelease_list->list.array[i] - 1; int id = *rlc_torelease_list->list.array[i] - 1;
mac->active_RLC_bearer[id] = false; mac->active_RLC_bearer[id] = false;
} }
...@@ -533,7 +533,6 @@ void nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id, ...@@ -533,7 +533,6 @@ void nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id,
} }
} }
void configure_current_BWP(NR_UE_MAC_INST_t *mac, void configure_current_BWP(NR_UE_MAC_INST_t *mac,
NR_ServingCellConfigCommonSIB_t *scc, NR_ServingCellConfigCommonSIB_t *scc,
NR_CellGroupConfig_t *cell_group_config) NR_CellGroupConfig_t *cell_group_config)
......
...@@ -51,7 +51,7 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) { ...@@ -51,7 +51,7 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) {
//LOG_I(MAC, "[MAIN] init UE MAC functions \n"); //LOG_I(MAC, "[MAIN] init UE MAC functions \n");
//init mac here //init mac here
nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(sizeof(NR_UE_MAC_INST_t), NB_NR_UE_MAC_INST); nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(NB_NR_UE_MAC_INST, sizeof(NR_UE_MAC_INST_t));
for (int j = 0; j < NB_NR_UE_MAC_INST; j++) for (int j = 0; j < NB_NR_UE_MAC_INST; j++)
nr_ue_init_mac(j); nr_ue_init_mac(j);
...@@ -80,6 +80,7 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) { ...@@ -80,6 +80,7 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) {
nr_rlc_add_drb(nr_ue_mac_inst->crnti, rbconfig->drb_ToAddModList->list.array[0]->drb_Identity, rlc_rbconfig); nr_rlc_add_drb(nr_ue_mac_inst->crnti, rbconfig->drb_ToAddModList->list.array[0]->drb_Identity, rlc_rbconfig);
struct NR_CellGroupConfig__rlc_BearerToAddModList rlc_toadd_list; struct NR_CellGroupConfig__rlc_BearerToAddModList rlc_toadd_list;
rlc_toadd_list.list.count = 1; rlc_toadd_list.list.count = 1;
rlc_toadd_list.list.array = calloc(1, sizeof(NR_RLC_BearerConfig_t));
rlc_toadd_list.list.array[0] = rlc_rbconfig; rlc_toadd_list.list.array[0] = rlc_rbconfig;
nr_rrc_mac_config_req_ue_logicalChannelBearer(0, &rlc_toadd_list, NULL); nr_rrc_mac_config_req_ue_logicalChannelBearer(0, &rlc_toadd_list, NULL);
......
...@@ -1211,10 +1211,13 @@ bool nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t ...@@ -1211,10 +1211,13 @@ bool nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t
*/ */
{ {
bsr_regular_triggered = true; bsr_regular_triggered = true;
LOG_D(NR_MAC, "[UE %d] PDCCH Tick : MAC BSR Triggered LCID%d LCGID%d data become available at frame %d slot %d\n", LOG_D(NR_MAC,
module_idP, lcid, "[UE %d] PDCCH Tick : MAC BSR Triggered LCID%d LCGID%d data become available at frame %d slot %d\n",
module_idP,
lcid,
mac->scheduling_info.LCGID[lcid - 1], mac->scheduling_info.LCGID[lcid - 1],
frameP, slotP); frameP,
slotP);
break; break;
} }
} }
...@@ -2896,7 +2899,9 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP, ...@@ -2896,7 +2899,9 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP,
continue; continue;
buflen_remain = buflen - (mac_ce_p->total_mac_pdu_header_len + mac_ce_p->sdu_length_total + sh_size); buflen_remain = buflen - (mac_ce_p->total_mac_pdu_header_len + mac_ce_p->sdu_length_total + sh_size);
LOG_D(NR_MAC, "[UE %d] [%d.%d] UL-DXCH -> ULSCH, RLC with LCID 0x%02x (TBS %d bytes, sdu_length_total %d bytes, MAC header len %d bytes, buflen_remain %d bytes)\n", LOG_D(NR_MAC,
"[UE %d] [%d.%d] UL-DXCH -> ULSCH, RLC with LCID 0x%02x (TBS %d bytes, sdu_length_total %d bytes, MAC header len %d "
"bytes, buflen_remain %d bytes)\n",
module_idP, module_idP,
frameP, frameP,
subframe, subframe,
...@@ -2907,7 +2912,6 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP, ...@@ -2907,7 +2912,6 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP,
buflen_remain); buflen_remain);
while (buflen_remain > 0) { while (buflen_remain > 0) {
// Pointer used to build the MAC sub-PDU headers in the ULSCH buffer for each SDU // Pointer used to build the MAC sub-PDU headers in the ULSCH buffer for each SDU
NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) pdu; NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) pdu;
...@@ -2925,14 +2929,16 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP, ...@@ -2925,14 +2929,16 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP,
0, 0,
0); 0);
AssertFatal(buflen_remain >= sdu_length, "LCID = 0x%02x RLC has segmented %d bytes but MAC has max %d remaining bytes\n", AssertFatal(buflen_remain >= sdu_length,
"LCID = 0x%02x RLC has segmented %d bytes but MAC has max %d remaining bytes\n",
lcid, lcid,
sdu_length, sdu_length,
buflen_remain); buflen_remain);
if (sdu_length > 0) { if (sdu_length > 0) {
LOG_D(NR_MAC,
LOG_D(NR_MAC, "[UE %d] [%d.%d] UL-DXCH -> ULSCH, Generating UL MAC sub-PDU for SDU %d, length %d bytes, RB with LCID 0x%02x (buflen (TBS) %d bytes)\n", "[UE %d] [%d.%d] UL-DXCH -> ULSCH, Generating UL MAC sub-PDU for SDU %d, length %d bytes, RB with LCID 0x%02x "
"(buflen (TBS) %d bytes)\n",
module_idP, module_idP,
frameP, frameP,
subframe, subframe,
...@@ -2969,9 +2975,13 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP, ...@@ -2969,9 +2975,13 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP,
//Update Buffer remain and BSR bytes after transmission //Update Buffer remain and BSR bytes after transmission
mac->scheduling_info.LCID_buffer_remain[lcid - 1] -= sdu_length; mac->scheduling_info.LCID_buffer_remain[lcid - 1] -= sdu_length;
mac->scheduling_info.BSR_bytes[mac->scheduling_info.LCGID[lcid- 1]] -= sdu_length; mac->scheduling_info.BSR_bytes[mac->scheduling_info.LCGID[lcid - 1]] -= sdu_length;
LOG_D(NR_MAC, "[UE %d] Update BSR [%d.%d] BSR_bytes for LCG%d=%d\n", LOG_D(NR_MAC,
module_idP, frameP, subframe, mac->scheduling_info.LCGID[lcid - 1], "[UE %d] Update BSR [%d.%d] BSR_bytes for LCG%d=%d\n",
module_idP,
frameP,
subframe,
mac->scheduling_info.LCGID[lcid - 1],
mac->scheduling_info.BSR_bytes[mac->scheduling_info.LCGID[lcid - 1]]); mac->scheduling_info.BSR_bytes[mac->scheduling_info.LCGID[lcid - 1]]);
if (mac->scheduling_info.BSR_bytes[mac->scheduling_info.LCGID[lcid - 1]] < 0) if (mac->scheduling_info.BSR_bytes[mac->scheduling_info.LCGID[lcid - 1]] < 0)
mac->scheduling_info.BSR_bytes[mac->scheduling_info.LCGID[lcid - 1]] = 0; mac->scheduling_info.BSR_bytes[mac->scheduling_info.LCGID[lcid - 1]] = 0;
......
...@@ -32,8 +32,7 @@ void e1_add_drb(int is_gnb, ...@@ -32,8 +32,7 @@ void e1_add_drb(int is_gnb,
unsigned char *ciphering_key, unsigned char *ciphering_key,
unsigned char *integrity_key) unsigned char *integrity_key)
{ {
add_drb(is_gnb, ue_id, s, ciphering_algorithm, integrity_algorithm, add_drb(is_gnb, ue_id, s, ciphering_algorithm, integrity_algorithm, ciphering_key, integrity_key);
ciphering_key, integrity_key);
LOG_I(PDCP, "%s:%s:%d: added DRB for UE ID %ld\n", __FILE__, __FUNCTION__, __LINE__, ue_id); LOG_I(PDCP, "%s:%s:%d: added DRB for UE ID %ld\n", __FILE__, __FUNCTION__, __LINE__, ue_id);
} }
......
...@@ -770,14 +770,19 @@ void add_srb(int is_gnb, ...@@ -770,14 +770,19 @@ void add_srb(int is_gnb,
int srb_id = s->srb_Identity; int srb_id = s->srb_Identity;
int t_Reordering = -1; // infinity as per default SRB configuration in 9.2.1 of 38.331 int t_Reordering = -1; // infinity as per default SRB configuration in 9.2.1 of 38.331
if (s->pdcp_Config != NULL && if (s->pdcp_Config != NULL && s->pdcp_Config->t_Reordering != NULL)
s->pdcp_Config->t_Reordering != NULL)
t_Reordering = decode_t_reordering(*s->pdcp_Config->t_Reordering); t_Reordering = decode_t_reordering(*s->pdcp_Config->t_Reordering);
nr_pdcp_manager_lock(nr_pdcp_ue_manager); nr_pdcp_manager_lock(nr_pdcp_ue_manager);
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rntiMaybeUEid); ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rntiMaybeUEid);
if (ue->srb[srb_id-1] != NULL) { if (ue->srb[srb_id-1] != NULL) {
LOG_E(PDCP, "%s:%d:%s: warning SRB %d already exist for UE ID/RNTI %ld, do nothing\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rntiMaybeUEid); LOG_E(PDCP,
"%s:%d:%s: warning SRB %d already exist for UE ID/RNTI %ld, do nothing\n",
__FILE__,
__LINE__,
__FUNCTION__,
srb_id,
rntiMaybeUEid);
} else { } else {
pdcp_srb = new_nr_pdcp_entity(NR_PDCP_SRB, is_gnb, srb_id, pdcp_srb = new_nr_pdcp_entity(NR_PDCP_SRB, is_gnb, srb_id,
0, false, false, // sdap parameters 0, false, false, // sdap parameters
...@@ -794,7 +799,8 @@ void add_srb(int is_gnb, ...@@ -794,7 +799,8 @@ void add_srb(int is_gnb,
nr_pdcp_manager_unlock(nr_pdcp_ue_manager); nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
} }
void add_drb(int is_gnb, ue_id_t rntiMaybeUEid, void add_drb(int is_gnb,
ue_id_t rntiMaybeUEid,
struct NR_DRB_ToAddMod *s, struct NR_DRB_ToAddMod *s,
int ciphering_algorithm, int ciphering_algorithm,
int integrity_algorithm, int integrity_algorithm,
...@@ -912,7 +918,13 @@ void nr_pdcp_add_drbs(eNB_flag_t enb_flag, ...@@ -912,7 +918,13 @@ void nr_pdcp_add_drbs(eNB_flag_t enb_flag,
{ {
if (drb2add_list != NULL) { if (drb2add_list != NULL) {
for (int i = 0; i < drb2add_list->list.count; i++) { for (int i = 0; i < drb2add_list->list.count; i++) {
add_drb(enb_flag, rntiMaybeUEid, drb2add_list->list.array[i], security_modeP & 0x0f, (security_modeP >> 4) & 0x0f, kUPenc, kUPint); add_drb(enb_flag,
rntiMaybeUEid,
drb2add_list->list.array[i],
security_modeP & 0x0f,
(security_modeP >> 4) & 0x0f,
kUPenc,
kUPint);
} }
} else } else
LOG_W(PDCP, "nr_pdcp_add_drbs() with void list\n"); LOG_W(PDCP, "nr_pdcp_add_drbs() with void list\n");
...@@ -1045,9 +1057,7 @@ bool nr_pdcp_data_req_srb(ue_id_t ue_id, ...@@ -1045,9 +1057,7 @@ bool nr_pdcp_data_req_srb(ue_id_t ue_id,
return 1; return 1;
} }
void nr_pdcp_reconfigure_srb(ue_id_t ue_id, void nr_pdcp_reconfigure_srb(ue_id_t ue_id, int srb_id, long t_Reordering)
int srb_id,
long t_Reordering)
{ {
nr_pdcp_manager_lock(nr_pdcp_ue_manager); nr_pdcp_manager_lock(nr_pdcp_ue_manager);
nr_pdcp_ue_t *ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, ue_id); nr_pdcp_ue_t *ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, ue_id);
...@@ -1057,9 +1067,7 @@ void nr_pdcp_reconfigure_srb(ue_id_t ue_id, ...@@ -1057,9 +1067,7 @@ void nr_pdcp_reconfigure_srb(ue_id_t ue_id,
nr_pdcp_manager_unlock(nr_pdcp_ue_manager); nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
} }
void nr_pdcp_reconfigure_drb(ue_id_t ue_id, void nr_pdcp_reconfigure_drb(ue_id_t ue_id, int drb_id, long t_Reordering)
int drb_id,
long t_Reordering)
{ {
// The enabling/disabling of ciphering or integrity protection // The enabling/disabling of ciphering or integrity protection
// can be changed only by releasing and adding the DRB // can be changed only by releasing and adding the DRB
......
...@@ -53,7 +53,8 @@ void nr_pdcp_add_drbs(eNB_flag_t enb_flag, ...@@ -53,7 +53,8 @@ void nr_pdcp_add_drbs(eNB_flag_t enb_flag,
uint8_t *const kUPenc, uint8_t *const kUPenc,
uint8_t *const kUPint); uint8_t *const kUPint);
void add_drb(int is_gnb, ue_id_t rntiMaybeUEid, void add_drb(int is_gnb,
ue_id_t rntiMaybeUEid,
struct NR_DRB_ToAddMod *s, struct NR_DRB_ToAddMod *s,
int ciphering_algorithm, int ciphering_algorithm,
int integrity_algorithm, int integrity_algorithm,
...@@ -65,12 +66,8 @@ void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid); ...@@ -65,12 +66,8 @@ void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid);
bool nr_pdcp_remove_UE(ue_id_t ue_id); bool nr_pdcp_remove_UE(ue_id_t ue_id);
void nr_pdcp_reestablishment(ue_id_t ue_id); void nr_pdcp_reestablishment(ue_id_t ue_id);
void nr_pdcp_reconfigure_srb(ue_id_t ue_id, void nr_pdcp_reconfigure_srb(ue_id_t ue_id, int srb_id, long t_Reordering);
int srb_id, void nr_pdcp_reconfigure_drb(ue_id_t ue_id, int drb_id, long t_Reordering);
long t_Reordering);
void nr_pdcp_reconfigure_drb(ue_id_t ue_id,
int drb_id,
long t_Reordering);
void add_srb(int is_gnb, void add_srb(int is_gnb,
ue_id_t rntiMaybeUEid, ue_id_t rntiMaybeUEid,
......
...@@ -67,7 +67,7 @@ int decode_poll_pdu(int v) ...@@ -67,7 +67,7 @@ int decode_poll_pdu(int v)
{ {
static const int tab[24] = { static const int tab[24] = {
4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 6144, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 6144,
8192, 12288, 16384, 20480, 24576, 28672, 32768, 40960, 49152, 57344, 65536, - 1 /* -1 means infinity */ 8192, 12288, 16384, 20480, 24576, 28672, 32768, 40960, 49152, 57344, 65536, -1 /* -1 means infinity */
}; };
if (v < 0 || v > 23) { if (v < 0 || v > 23) {
......
...@@ -244,9 +244,7 @@ nr_rlc_entity_t *new_nr_rlc_entity_tm( ...@@ -244,9 +244,7 @@ nr_rlc_entity_t *new_nr_rlc_entity_tm(
return (nr_rlc_entity_t *)ret; return (nr_rlc_entity_t *)ret;
} }
void nr_rlc_entity_um_reconfigure(nr_rlc_entity_t *_entity, void nr_rlc_entity_um_reconfigure(nr_rlc_entity_t *_entity, int t_reassembly, int *sn_field_length)
int t_reassembly,
int *sn_field_length)
{ {
nr_rlc_entity_um_t *entity = (nr_rlc_entity_um_t *)_entity; nr_rlc_entity_um_t *entity = (nr_rlc_entity_um_t *)_entity;
entity->t_reassembly = t_reassembly; entity->t_reassembly = t_reassembly;
......
...@@ -176,9 +176,7 @@ nr_rlc_entity_t *new_nr_rlc_entity_tm( ...@@ -176,9 +176,7 @@ nr_rlc_entity_t *new_nr_rlc_entity_tm(
char *buf, int size), char *buf, int size),
void *deliver_sdu_data); void *deliver_sdu_data);
void nr_rlc_entity_um_reconfigure(nr_rlc_entity_t *_entity, void nr_rlc_entity_um_reconfigure(nr_rlc_entity_t *_entity, int t_reassembly, int *sn_field_length);
int t_reassembly,
int *sn_field_length);
void nr_rlc_entity_am_reconfigure(nr_rlc_entity_t *_entity, void nr_rlc_entity_am_reconfigure(nr_rlc_entity_t *_entity,
int t_poll_retransmit, int t_poll_retransmit,
......
...@@ -71,38 +71,22 @@ static nr_rlc_entity_t *get_rlc_entity_from_lcid(nr_rlc_ue_t *ue, logical_chan_i ...@@ -71,38 +71,22 @@ static nr_rlc_entity_t *get_rlc_entity_from_lcid(nr_rlc_ue_t *ue, logical_chan_i
} }
} }
void nr_release_rlc_entity(int rnti, void nr_release_rlc_entity(int rnti, logical_chan_id_t channel_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, rnti);
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);
ue->srb0->delete(ue->srb0); ue->srb0->delete (ue->srb0);
} } else
else LOG_E(RLC, "Trying to release a non-established enity with LCID %d\n", channel_id);
LOG_E(RLC, "Trying to release a non-established enity with LCID %d\n", } else {
channel_id); nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, channel_id);
} if (rb)
else { rb->delete(rb);
nr_rlc_rb_t *rb = &ue->lcid2rb[channel_id - 1];
if (rb->type == NR_RLC_SRB) {
if (ue->srb[rb->choice.srb_id - 1] != NULL)
ue->srb[rb->choice.srb_id - 1]->delete(ue->srb[rb->choice.srb_id - 1]);
else
LOG_E(RLC, "Trying to release a non-established enity with LCID %d\n",
channel_id);
}
else {
AssertFatal(rb->type == NR_RLC_DRB,
"Invalid RB type\n");
if (ue->drb[rb->choice.drb_id - 1] != NULL)
ue->drb[rb->choice.drb_id - 1]->delete(ue->drb[rb->choice.drb_id - 1]);
else else
LOG_E(RLC, "Trying to release a non-established enity with LCID %d\n", LOG_E(RLC, "Trying to release a non-established enity with LCID %d\n", channel_id);
channel_id);
}
} }
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
} }
...@@ -623,7 +607,7 @@ void nr_rlc_reestablish_entity(int rnti, int lc_id) ...@@ -623,7 +607,7 @@ void nr_rlc_reestablish_entity(int rnti, 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, rnti);
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");
nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, lc_id); nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, lc_id);
...@@ -632,16 +616,12 @@ void nr_rlc_reestablish_entity(int rnti, int lc_id) ...@@ -632,16 +616,12 @@ void nr_rlc_reestablish_entity(int rnti, int lc_id)
LOG_D(RLC, "RB found! (channel ID %d) \n", lc_id); LOG_D(RLC, "RB found! (channel ID %d) \n", lc_id);
rb->reestablishment(rb); rb->reestablishment(rb);
} else { } else {
LOG_E(RLC, "no RLC entity found (channel ID %d) for reestablishment\n", LOG_E(RLC, "no RLC entity found (channel ID %d) for reestablishment\n", lc_id);
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, void nr_rlc_reconfigure_entity(int rnti, int lc_id, struct NR_RLC_Config *rlc_Config, struct NR_LogicalChannelConfig *lc_Config)
int lc_id,
struct NR_RLC_Config *rlc_Config,
struct NR_LogicalChannelConfig *lc_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, rnti);
...@@ -651,16 +631,14 @@ void nr_rlc_reconfigure_entity(int rnti, ...@@ -651,16 +631,14 @@ void nr_rlc_reconfigure_entity(int rnti,
nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, lc_id); nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, lc_id);
if (lc_Config) { if (lc_Config) {
if(lc_Config->ul_SpecificParameters && if (lc_Config->ul_SpecificParameters && lc_Config->ul_SpecificParameters->logicalChannelGroup)
lc_Config->ul_SpecificParameters->logicalChannelGroup) AssertFatal(*lc_Config->ul_SpecificParameters->logicalChannelGroup < 2,
AssertFatal(*lc_Config->ul_SpecificParameters->logicalChannelGroup == 0, "LCG %ld not supported as per limitation when creating RBs\n",
"LCG %ld not supported\n",
*lc_Config->ul_SpecificParameters->logicalChannelGroup); *lc_Config->ul_SpecificParameters->logicalChannelGroup);
} }
if (rlc_Config) { if (rlc_Config) {
if (rb->stats.mode == NR_RLC_AM) { if (rb->stats.mode == NR_RLC_AM) {
AssertFatal(rlc_Config->present == NR_RLC_Config_PR_am, AssertFatal(rlc_Config->present == NR_RLC_Config_PR_am, "Invalid RLC Config type\n");
"Invalid RLC Config type\n");
struct NR_RLC_Config__am *am = rlc_Config->choice.am; struct NR_RLC_Config__am *am = rlc_Config->choice.am;
int t_reassembly = decode_t_reassembly(am->dl_AM_RLC.t_Reassembly); int t_reassembly = decode_t_reassembly(am->dl_AM_RLC.t_Reassembly);
int t_status_prohibit = decode_t_status_prohibit(am->dl_AM_RLC.t_StatusProhibit); int t_status_prohibit = decode_t_status_prohibit(am->dl_AM_RLC.t_StatusProhibit);
...@@ -668,20 +646,18 @@ void nr_rlc_reconfigure_entity(int rnti, ...@@ -668,20 +646,18 @@ void nr_rlc_reconfigure_entity(int rnti,
int poll_pdu = decode_poll_pdu(am->ul_AM_RLC.pollPDU); int poll_pdu = decode_poll_pdu(am->ul_AM_RLC.pollPDU);
int poll_byte = decode_poll_byte(am->ul_AM_RLC.pollByte); int poll_byte = decode_poll_byte(am->ul_AM_RLC.pollByte);
int max_retx_threshold = decode_max_retx_threshold(am->ul_AM_RLC.maxRetxThreshold); int max_retx_threshold = decode_max_retx_threshold(am->ul_AM_RLC.maxRetxThreshold);
int _sn_field_length;
int *sn_field_length = NULL; int *sn_field_length = NULL;
if (am->dl_AM_RLC.sn_FieldLength) { if (am->dl_AM_RLC.sn_FieldLength) {
AssertFatal(am->ul_AM_RLC.sn_FieldLength != NULL, AssertFatal(am->ul_AM_RLC.sn_FieldLength != NULL, "Cannot handle different sn_FieldLength for DL and UL\n");
"Cannot handle different sn_FieldLength for DL and UL\n");
if (am->ul_AM_RLC.sn_FieldLength) { if (am->ul_AM_RLC.sn_FieldLength) {
AssertFatal(*am->dl_AM_RLC.sn_FieldLength == *am->ul_AM_RLC.sn_FieldLength, AssertFatal(*am->dl_AM_RLC.sn_FieldLength == *am->ul_AM_RLC.sn_FieldLength,
"Cannot handle different sn_FieldLength for DL and UL\n"); "Cannot handle different sn_FieldLength for DL and UL\n");
sn_field_length = calloc(1, sizeof(*sn_field_length)); _sn_field_length = decode_sn_field_length_am(*am->dl_AM_RLC.sn_FieldLength);
*sn_field_length = decode_sn_field_length_am(*am->dl_AM_RLC.sn_FieldLength); sn_field_length = &_sn_field_length;
} }
} } else
else AssertFatal(am->ul_AM_RLC.sn_FieldLength == NULL, "Cannot handle different sn_FieldLength for DL and UL\n");
AssertFatal(am->ul_AM_RLC.sn_FieldLength == NULL,
"Cannot handle different sn_FieldLength for DL and UL\n");
nr_rlc_entity_am_reconfigure(rb, nr_rlc_entity_am_reconfigure(rb,
t_poll_retransmit, t_poll_retransmit,
t_reassembly, t_reassembly,
...@@ -690,29 +666,23 @@ void nr_rlc_reconfigure_entity(int rnti, ...@@ -690,29 +666,23 @@ void nr_rlc_reconfigure_entity(int rnti,
poll_byte, poll_byte,
max_retx_threshold, max_retx_threshold,
sn_field_length); sn_field_length);
} } else { // UM
else { // UM AssertFatal(rlc_Config->present == NR_RLC_Config_PR_um_Bi_Directional, "Invalid RLC Config type\n");
AssertFatal(rlc_Config->present == NR_RLC_Config_PR_um_Bi_Directional,
"Invalid RLC Config type\n");
struct NR_RLC_Config__um_Bi_Directional *um = rlc_Config->choice.um_Bi_Directional; struct NR_RLC_Config__um_Bi_Directional *um = rlc_Config->choice.um_Bi_Directional;
int t_reassembly = decode_t_reassembly(um->dl_UM_RLC.t_Reassembly); int t_reassembly = decode_t_reassembly(um->dl_UM_RLC.t_Reassembly);
int _sn_field_length;
int *sn_field_length = NULL; int *sn_field_length = NULL;
if (um->dl_UM_RLC.sn_FieldLength) { if (um->dl_UM_RLC.sn_FieldLength) {
AssertFatal(um->ul_UM_RLC.sn_FieldLength != NULL, AssertFatal(um->ul_UM_RLC.sn_FieldLength != NULL, "Cannot handle different sn_FieldLength for DL and UL\n");
"Cannot handle different sn_FieldLength for DL and UL\n");
if (um->ul_UM_RLC.sn_FieldLength) { if (um->ul_UM_RLC.sn_FieldLength) {
AssertFatal(*um->dl_UM_RLC.sn_FieldLength == *um->ul_UM_RLC.sn_FieldLength, AssertFatal(*um->dl_UM_RLC.sn_FieldLength == *um->ul_UM_RLC.sn_FieldLength,
"Cannot handle different sn_FieldLength for DL and UL\n"); "Cannot handle different sn_FieldLength for DL and UL\n");
sn_field_length = calloc(1, sizeof(*sn_field_length)); _sn_field_length = decode_sn_field_length_um(*um->dl_UM_RLC.sn_FieldLength);
*sn_field_length = decode_sn_field_length_um(*um->dl_UM_RLC.sn_FieldLength); sn_field_length = &_sn_field_length;
}
} }
else } else
AssertFatal(um->ul_UM_RLC.sn_FieldLength == NULL, AssertFatal(um->ul_UM_RLC.sn_FieldLength == NULL, "Cannot handle different sn_FieldLength for DL and UL\n");
"Cannot handle different sn_FieldLength for DL and UL\n"); nr_rlc_entity_um_reconfigure(rb, t_reassembly, sn_field_length);
nr_rlc_entity_um_reconfigure(rb,
t_reassembly,
sn_field_length);
} }
} }
nr_rlc_manager_unlock(nr_rlc_ue_manager); nr_rlc_manager_unlock(nr_rlc_ue_manager);
...@@ -736,9 +706,7 @@ void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_Beare ...@@ -736,9 +706,7 @@ void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_Beare
AssertFatal(srb_id > 0 && srb_id < 4, AssertFatal(srb_id > 0 && srb_id < 4,
"Invalid srb id %d\n", srb_id); "Invalid srb id %d\n", srb_id);
if (l && if (l && l->ul_SpecificParameters && l->ul_SpecificParameters->logicalChannelGroup)
l->ul_SpecificParameters &&
l->ul_SpecificParameters->logicalChannelGroup)
logical_channel_group = *l->ul_SpecificParameters->logicalChannelGroup; logical_channel_group = *l->ul_SpecificParameters->logicalChannelGroup;
else else
logical_channel_group = 0; // default value as in 9.2.1 of 38.331 logical_channel_group = 0; // default value as in 9.2.1 of 38.331
...@@ -749,8 +717,7 @@ void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_Beare ...@@ -749,8 +717,7 @@ void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_Beare
exit(1); exit(1);
} }
if (r && if (r && r->present == NR_RLC_Config_PR_am) {
r-> present == NR_RLC_Config_PR_am) {
struct NR_RLC_Config__am *am; struct NR_RLC_Config__am *am;
am = r->choice.am; am = r->choice.am;
t_reassembly = decode_t_reassembly(am->dl_AM_RLC.t_Reassembly); t_reassembly = decode_t_reassembly(am->dl_AM_RLC.t_Reassembly);
...@@ -764,8 +731,7 @@ void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_Beare ...@@ -764,8 +731,7 @@ void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_Beare
exit(1); exit(1);
} }
sn_field_length = decode_sn_field_length_am(*am->dl_AM_RLC.sn_FieldLength); sn_field_length = decode_sn_field_length_am(*am->dl_AM_RLC.sn_FieldLength);
} } else {
else {
// default values as in 9.2.1 of 38.331 // default values as in 9.2.1 of 38.331
t_reassembly = 35; t_reassembly = 35;
t_status_prohibit = 0; t_status_prohibit = 0;
......
...@@ -51,13 +51,9 @@ bool nr_rlc_update_rnti(int from_rnti, int to_rnti); ...@@ -51,13 +51,9 @@ bool nr_rlc_update_rnti(int from_rnti, int to_rnti);
/* 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 rnti);
void nr_release_rlc_entity(int rnti, void nr_release_rlc_entity(int rnti, logical_chan_id_t channel_id);
logical_chan_id_t channel_id);
void nr_rlc_reconfigure_entity(int rnti, void nr_rlc_reconfigure_entity(int rnti, int lc_id, struct NR_RLC_Config *rlc_Config, struct NR_LogicalChannelConfig *lc_Config);
int lc_id,
struct NR_RLC_Config *rlc_Config,
struct NR_LogicalChannelConfig *lc_Config);
int nr_rlc_get_available_tx_space( int nr_rlc_get_available_tx_space(
const rnti_t rntiP, const rnti_t rntiP,
......
...@@ -133,11 +133,12 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP, ...@@ -133,11 +133,12 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP,
switch(Srb_id) { switch(Srb_id) {
case CCCH: case CCCH:
LOG_D(NR_RRC, "nr_mac_rrc_data_req_ue: Payload size = %i\n", LOG_D(NR_RRC,
"nr_mac_rrc_data_req_ue: Payload size = %i\n",
NR_UE_rrc_inst[Mod_idP].Srb[gNB_id][0].srb_buffers.Tx_buffer.payload_size); NR_UE_rrc_inst[Mod_idP].Srb[gNB_id][0].srb_buffers.Tx_buffer.payload_size);
NR_UE_RRC_SRB_INFO_t *Srb0 = &NR_UE_rrc_inst[Mod_idP].Srb[gNB_id][0]; NR_UE_RRC_SRB_INFO_t *Srb0 = &NR_UE_rrc_inst[Mod_idP].Srb[gNB_id][0];
memcpy(buffer_pP, (uint8_t*)Srb0->srb_buffers.Tx_buffer.Payload, Srb0->srb_buffers.Tx_buffer.payload_size); memcpy(buffer_pP, (uint8_t *)Srb0->srb_buffers.Tx_buffer.Payload, Srb0->srb_buffers.Tx_buffer.payload_size);
for(int i = 0; i < Srb0->srb_buffers.Tx_buffer.payload_size; i++) { for (int i = 0; i < Srb0->srb_buffers.Tx_buffer.payload_size; i++) {
LOG_D(NR_RRC,"(%i): %i\n", i, buffer_pP[i]); LOG_D(NR_RRC,"(%i): %i\n", i, buffer_pP[i]);
} }
......
This diff is collapsed.
...@@ -178,11 +178,7 @@ typedef enum { ...@@ -178,11 +178,7 @@ typedef enum {
IN_SYNC = 1 IN_SYNC = 1
} nr_sync_msg_t; } nr_sync_msg_t;
typedef enum { typedef enum { RB_NOT_PRESENT = 0, RB_ESTABLISHED, RB_SUSPENDED } NR_RB_status_t;
RB_NOT_PRESENT = 0,
RB_ESTABLISHED,
RB_SUSPENDED
} NR_RB_status_t;
typedef struct NR_UE_RRC_SRB_INFO_s { typedef struct NR_UE_RRC_SRB_INFO_s {
NR_RB_status_t status; NR_RB_status_t status;
...@@ -207,8 +203,8 @@ typedef struct NR_UE_RRC_INST_s { ...@@ -207,8 +203,8 @@ typedef struct NR_UE_RRC_INST_s {
rnti_t rnti; rnti_t rnti;
NR_UE_RRC_SRB_INFO_t Srb[NB_CNX_UE][NR_NUM_SRB]; NR_UE_RRC_SRB_INFO_t Srb[NB_CNX_UE][NR_NUM_SRB];
bool active_DRBs [NB_CNX_UE][MAX_DRBS_PER_UE]; bool active_DRBs[NB_CNX_UE][MAX_DRBS_PER_UE];
bool active_RLC_entity [NB_CNX_UE][NR_MAX_NUM_LCID]; bool active_RLC_entity[NB_CNX_UE][NR_MAX_NUM_LCID];
OAI_NR_UECapability_t *UECap; OAI_NR_UECapability_t *UECap;
uint8_t *UECapability; uint8_t *UECapability;
......
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