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,
struct NR_CellGroupConfig__rlc_BearerToReleaseList *rlc_torelease_list)
{
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++) {
NR_RLC_BearerConfig_t *rlc_bearer = rlc_toadd_list->list.array[i];
int id = rlc_bearer->logicalChannelIdentity - 1;
......@@ -525,7 +525,7 @@ void nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id,
}
if (rlc_torelease_list) {
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;
mac->active_RLC_bearer[id] = false;
}
......@@ -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,
NR_ServingCellConfigCommonSIB_t *scc,
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) {
//LOG_I(MAC, "[MAIN] init UE MAC functions \n");
//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++)
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) {
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;
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;
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
*/
{
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",
module_idP, lcid,
LOG_D(NR_MAC,
"[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],
frameP, slotP);
frameP,
slotP);
break;
}
}
......@@ -2687,13 +2690,13 @@ Update the following in mac_ce_p:
bsr_t
*/
void nr_ue_get_sdu_mac_ce_post(module_id_t module_idP,
int CC_id,
frame_t frameP,
sub_frame_t subframe,
uint8_t gNB_index,
uint8_t *ulsch_buffer,
uint16_t buflen,
NR_UE_MAC_CE_INFO *mac_ce_p)
int CC_id,
frame_t frameP,
sub_frame_t subframe,
uint8_t gNB_index,
uint8_t *ulsch_buffer,
uint16_t buflen,
NR_UE_MAC_CE_INFO *mac_ce_p)
{
NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP);
......@@ -2896,7 +2899,9 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP,
continue;
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,
frameP,
subframe,
......@@ -2907,7 +2912,6 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP,
buflen_remain);
while (buflen_remain > 0) {
// 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;
......@@ -2925,21 +2929,23 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP,
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,
sdu_length,
buflen_remain);
if (sdu_length > 0) {
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",
module_idP,
frameP,
subframe,
num_sdus + 1,
sdu_length,
lcid,
buflen);
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",
module_idP,
frameP,
subframe,
num_sdus + 1,
sdu_length,
lcid,
buflen);
header->R = 0;
header->F = 1;
......@@ -2969,9 +2975,13 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP,
//Update Buffer remain and BSR bytes after transmission
mac->scheduling_info.LCID_buffer_remain[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",
module_idP, frameP, subframe, mac->scheduling_info.LCGID[lcid - 1],
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",
module_idP,
frameP,
subframe,
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)
mac->scheduling_info.BSR_bytes[mac->scheduling_info.LCGID[lcid - 1]] = 0;
......
......@@ -32,8 +32,7 @@ void e1_add_drb(int is_gnb,
unsigned char *ciphering_key,
unsigned char *integrity_key)
{
add_drb(is_gnb, ue_id, s, ciphering_algorithm, integrity_algorithm,
ciphering_key, integrity_key);
add_drb(is_gnb, ue_id, s, ciphering_algorithm, integrity_algorithm, ciphering_key, integrity_key);
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,
int srb_id = s->srb_Identity;
int t_Reordering = -1; // infinity as per default SRB configuration in 9.2.1 of 38.331
if (s->pdcp_Config != NULL &&
s->pdcp_Config->t_Reordering != NULL)
if (s->pdcp_Config != NULL && s->pdcp_Config->t_Reordering != NULL)
t_Reordering = decode_t_reordering(*s->pdcp_Config->t_Reordering);
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rntiMaybeUEid);
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 {
pdcp_srb = new_nr_pdcp_entity(NR_PDCP_SRB, is_gnb, srb_id,
0, false, false, // sdap parameters
......@@ -794,7 +799,8 @@ void add_srb(int is_gnb,
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,
int ciphering_algorithm,
int integrity_algorithm,
......@@ -912,7 +918,13 @@ void nr_pdcp_add_drbs(eNB_flag_t enb_flag,
{
if (drb2add_list != NULL) {
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
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,
return 1;
}
void nr_pdcp_reconfigure_srb(ue_id_t ue_id,
int srb_id,
long t_Reordering)
void nr_pdcp_reconfigure_srb(ue_id_t ue_id, int srb_id, long t_Reordering)
{
nr_pdcp_manager_lock(nr_pdcp_ue_manager);
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,
nr_pdcp_manager_unlock(nr_pdcp_ue_manager);
}
void nr_pdcp_reconfigure_drb(ue_id_t ue_id,
int drb_id,
long t_Reordering)
void nr_pdcp_reconfigure_drb(ue_id_t ue_id, int drb_id, long t_Reordering)
{
// The enabling/disabling of ciphering or integrity protection
// can be changed only by releasing and adding the DRB
......
......@@ -53,7 +53,8 @@ void nr_pdcp_add_drbs(eNB_flag_t enb_flag,
uint8_t *const kUPenc,
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,
int ciphering_algorithm,
int integrity_algorithm,
......@@ -65,12 +66,8 @@ void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid);
bool nr_pdcp_remove_UE(ue_id_t ue_id);
void nr_pdcp_reestablishment(ue_id_t ue_id);
void nr_pdcp_reconfigure_srb(ue_id_t ue_id,
int srb_id,
long t_Reordering);
void nr_pdcp_reconfigure_drb(ue_id_t ue_id,
int drb_id,
long t_Reordering);
void nr_pdcp_reconfigure_srb(ue_id_t ue_id, int srb_id, 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,
ue_id_t rntiMaybeUEid,
......
......@@ -67,7 +67,7 @@ int decode_poll_pdu(int v)
{
static const int tab[24] = {
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) {
......
......@@ -244,9 +244,7 @@ nr_rlc_entity_t *new_nr_rlc_entity_tm(
return (nr_rlc_entity_t *)ret;
}
void nr_rlc_entity_um_reconfigure(nr_rlc_entity_t *_entity,
int t_reassembly,
int *sn_field_length)
void nr_rlc_entity_um_reconfigure(nr_rlc_entity_t *_entity, int t_reassembly, int *sn_field_length)
{
nr_rlc_entity_um_t *entity = (nr_rlc_entity_um_t *)_entity;
entity->t_reassembly = t_reassembly;
......
......@@ -176,9 +176,7 @@ nr_rlc_entity_t *new_nr_rlc_entity_tm(
char *buf, int size),
void *deliver_sdu_data);
void nr_rlc_entity_um_reconfigure(nr_rlc_entity_t *_entity,
int t_reassembly,
int *sn_field_length);
void nr_rlc_entity_um_reconfigure(nr_rlc_entity_t *_entity, int t_reassembly, int *sn_field_length);
void nr_rlc_entity_am_reconfigure(nr_rlc_entity_t *_entity,
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
}
}
void nr_release_rlc_entity(int rnti,
logical_chan_id_t channel_id)
void nr_release_rlc_entity(int rnti, logical_chan_id_t channel_id)
{
nr_rlc_manager_lock(nr_rlc_ue_manager);
nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti);
if (channel_id == 0) {
if (ue->srb0 != NULL) {
free(ue->srb0->deliver_sdu_data);
ue->srb0->delete(ue->srb0);
}
ue->srb0->delete (ue->srb0);
} else
LOG_E(RLC, "Trying to release a non-established enity with LCID %d\n", channel_id);
} else {
nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, channel_id);
if (rb)
rb->delete(rb);
else
LOG_E(RLC, "Trying to release a non-established enity with LCID %d\n",
channel_id);
}
else {
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
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", channel_id);
}
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
......@@ -623,7 +607,7 @@ void nr_rlc_reestablish_entity(int rnti, int lc_id)
nr_rlc_manager_lock(nr_rlc_ue_manager);
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");
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)
LOG_D(RLC, "RB found! (channel ID %d) \n", lc_id);
rb->reestablishment(rb);
} else {
LOG_E(RLC, "no RLC entity found (channel ID %d) for reestablishment\n",
lc_id);
LOG_E(RLC, "no RLC entity found (channel ID %d) for reestablishment\n", lc_id);
}
nr_rlc_manager_unlock(nr_rlc_ue_manager);
}
void nr_rlc_reconfigure_entity(int rnti,
int lc_id,
struct NR_RLC_Config *rlc_Config,
struct NR_LogicalChannelConfig *lc_Config)
void nr_rlc_reconfigure_entity(int rnti, int lc_id, struct NR_RLC_Config *rlc_Config, struct NR_LogicalChannelConfig *lc_Config)
{
nr_rlc_manager_lock(nr_rlc_ue_manager);
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,
nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, lc_id);
if (lc_Config) {
if(lc_Config->ul_SpecificParameters &&
lc_Config->ul_SpecificParameters->logicalChannelGroup)
AssertFatal(*lc_Config->ul_SpecificParameters->logicalChannelGroup == 0,
"LCG %ld not supported\n",
if (lc_Config->ul_SpecificParameters && lc_Config->ul_SpecificParameters->logicalChannelGroup)
AssertFatal(*lc_Config->ul_SpecificParameters->logicalChannelGroup < 2,
"LCG %ld not supported as per limitation when creating RBs\n",
*lc_Config->ul_SpecificParameters->logicalChannelGroup);
}
if (rlc_Config) {
if (rb->stats.mode == NR_RLC_AM) {
AssertFatal(rlc_Config->present == NR_RLC_Config_PR_am,
"Invalid RLC Config type\n");
AssertFatal(rlc_Config->present == NR_RLC_Config_PR_am, "Invalid RLC Config type\n");
struct NR_RLC_Config__am *am = rlc_Config->choice.am;
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);
......@@ -668,20 +646,18 @@ void nr_rlc_reconfigure_entity(int rnti,
int poll_pdu = decode_poll_pdu(am->ul_AM_RLC.pollPDU);
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 _sn_field_length;
int *sn_field_length = NULL;
if (am->dl_AM_RLC.sn_FieldLength) {
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");
if (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");
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
AssertFatal(am->ul_AM_RLC.sn_FieldLength == NULL,
"Cannot handle different sn_FieldLength for DL and UL\n");
} else
AssertFatal(am->ul_AM_RLC.sn_FieldLength == NULL, "Cannot handle different sn_FieldLength for DL and UL\n");
nr_rlc_entity_am_reconfigure(rb,
t_poll_retransmit,
t_reassembly,
......@@ -690,29 +666,23 @@ void nr_rlc_reconfigure_entity(int rnti,
poll_byte,
max_retx_threshold,
sn_field_length);
}
else { // UM
AssertFatal(rlc_Config->present == NR_RLC_Config_PR_um_Bi_Directional,
"Invalid RLC Config type\n");
} else { // UM
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;
int t_reassembly = decode_t_reassembly(um->dl_UM_RLC.t_Reassembly);
int _sn_field_length;
int *sn_field_length = NULL;
if (um->dl_UM_RLC.sn_FieldLength) {
AssertFatal(um->ul_UM_RLC.sn_FieldLength != NULL,
"Cannot handle different sn_FieldLength for DL and UL\n");
AssertFatal(um->ul_UM_RLC.sn_FieldLength != NULL, "Cannot handle different sn_FieldLength for DL and UL\n");
if (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");
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
AssertFatal(um->ul_UM_RLC.sn_FieldLength == NULL,
"Cannot handle different sn_FieldLength for DL and UL\n");
nr_rlc_entity_um_reconfigure(rb,
t_reassembly,
sn_field_length);
} else
AssertFatal(um->ul_UM_RLC.sn_FieldLength == NULL, "Cannot handle different sn_FieldLength for DL and UL\n");
nr_rlc_entity_um_reconfigure(rb, t_reassembly, sn_field_length);
}
}
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
AssertFatal(srb_id > 0 && srb_id < 4,
"Invalid srb id %d\n", srb_id);
if (l &&
l->ul_SpecificParameters &&
l->ul_SpecificParameters->logicalChannelGroup)
if (l && l->ul_SpecificParameters && l->ul_SpecificParameters->logicalChannelGroup)
logical_channel_group = *l->ul_SpecificParameters->logicalChannelGroup;
else
logical_channel_group = 0; // default value as in 9.2.1 of 38.331
......@@ -749,14 +717,13 @@ void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_Beare
exit(1);
}
if (r &&
r-> present == NR_RLC_Config_PR_am) {
if (r && r->present == NR_RLC_Config_PR_am) {
struct NR_RLC_Config__am *am;
am = r->choice.am;
t_reassembly = decode_t_reassembly(am->dl_AM_RLC.t_Reassembly);
t_status_prohibit = decode_t_status_prohibit(am->dl_AM_RLC.t_StatusProhibit);
t_poll_retransmit = decode_t_poll_retransmit(am->ul_AM_RLC.t_PollRetransmit);
poll_pdu = decode_poll_pdu(am->ul_AM_RLC.pollPDU);
poll_pdu = decode_poll_pdu(am->ul_AM_RLC.pollPDU);
poll_byte = decode_poll_byte(am->ul_AM_RLC.pollByte);
max_retx_threshold = decode_max_retx_threshold(am->ul_AM_RLC.maxRetxThreshold);
if (*am->dl_AM_RLC.sn_FieldLength != *am->ul_AM_RLC.sn_FieldLength) {
......@@ -764,8 +731,7 @@ void nr_rlc_add_srb(int rnti, int srb_id, const NR_RLC_BearerConfig_t *rlc_Beare
exit(1);
}
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
t_reassembly = 35;
t_status_prohibit = 0;
......
......@@ -51,13 +51,9 @@ bool nr_rlc_update_rnti(int from_rnti, int to_rnti);
/* test function for CI to trigger reestablishments */
void nr_rlc_test_trigger_reestablishment(int rnti);
void nr_release_rlc_entity(int rnti,
logical_chan_id_t channel_id);
void nr_release_rlc_entity(int rnti, logical_chan_id_t channel_id);
void nr_rlc_reconfigure_entity(int rnti,
int lc_id,
struct NR_RLC_Config *rlc_Config,
struct NR_LogicalChannelConfig *lc_Config);
void nr_rlc_reconfigure_entity(int rnti, int lc_id, struct NR_RLC_Config *rlc_Config, struct NR_LogicalChannelConfig *lc_Config);
int nr_rlc_get_available_tx_space(
const rnti_t rntiP,
......
......@@ -46,17 +46,17 @@ typedef enum UE_STATE_NR_e {
} NR_UE_STATE_t;
typedef struct {
unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */
unsigned short max_transport_blocks; /*!< \brief Maximum PDU size in bytes provided by RLC to MAC layer interface */
unsigned long Guaranteed_bit_rate; /*!< \brief Guaranteed Bit Rate (average) to be offered by MAC layer scheduling*/
unsigned long Max_bit_rate; /*!< \brief Maximum Bit Rate that can be offered by MAC layer scheduling*/
uint8_t Delay_class; /*!< \brief Delay class offered by MAC layer scheduling*/
uint8_t Target_bler; /*!< \brief Target Average Transport Block Error rate*/
uint8_t Lchan_t; /*!< \brief Logical Channel Type (BCCH,CCCH,DCCH,DTCH_B,DTCH,MRBCH)*/
unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */
unsigned short max_transport_blocks; /*!< \brief Maximum PDU size in bytes provided by RLC to MAC layer interface */
unsigned long Guaranteed_bit_rate; /*!< \brief Guaranteed Bit Rate (average) to be offered by MAC layer scheduling*/
unsigned long Max_bit_rate; /*!< \brief Maximum Bit Rate that can be offered by MAC layer scheduling*/
uint8_t Delay_class; /*!< \brief Delay class offered by MAC layer scheduling*/
uint8_t Target_bler; /*!< \brief Target Average Transport Block Error rate*/
uint8_t Lchan_t; /*!< \brief Logical Channel Type (BCCH,CCCH,DCCH,DTCH_B,DTCH,MRBCH)*/
} __attribute__ ((__packed__)) NR_LCHAN_DESC;
typedef struct RB_INFO_NR_s {
uint16_t Rb_id; //=Lchan_id
uint16_t Rb_id; //=Lchan_id
NR_LCHAN_DESC Lchan_desc[2];
//MAC_MEAS_REQ_ENTRY *Meas_entry; //may not needed for NB-IoT
} NR_RB_INFO;
......
......@@ -133,11 +133,12 @@ int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP,
switch(Srb_id) {
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_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);
for(int i = 0; i < Srb0->srb_buffers.Tx_buffer.payload_size; i++) {
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++) {
LOG_D(NR_RRC,"(%i): %i\n", i, buffer_pP[i]);
}
......
This diff is collapsed.
......@@ -178,11 +178,7 @@ typedef enum {
IN_SYNC = 1
} nr_sync_msg_t;
typedef enum {
RB_NOT_PRESENT = 0,
RB_ESTABLISHED,
RB_SUSPENDED
} NR_RB_status_t;
typedef enum { RB_NOT_PRESENT = 0, RB_ESTABLISHED, RB_SUSPENDED } NR_RB_status_t;
typedef struct NR_UE_RRC_SRB_INFO_s {
NR_RB_status_t status;
......@@ -207,8 +203,8 @@ typedef struct NR_UE_RRC_INST_s {
rnti_t rnti;
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_RLC_entity [NB_CNX_UE][NR_MAX_NUM_LCID];
bool active_DRBs[NB_CNX_UE][MAX_DRBS_PER_UE];
bool active_RLC_entity[NB_CNX_UE][NR_MAX_NUM_LCID];
OAI_NR_UECapability_t *UECap;
uint8_t *UECapability;
......@@ -220,7 +216,7 @@ typedef struct NR_UE_RRC_INST_s {
plmn_t plmnID;
NR_UE_RRC_SI_INFO SInfo[NB_CNX_UE];
NR_UE_RRC_SI_INFO SInfo[NB_CNX_UE];
NR_MIB_t *mib;
......
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