From 68471d0525cff47a7b4cdf68750a302b7ca81168 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 23 Sep 2021 16:03:14 +0200 Subject: [PATCH 1/9] Extending DL scheduling to multiple LCIDs --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 199 ++++++++---------- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 9 +- 2 files changed, 94 insertions(+), 114 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 92391ed1d5..55771c0e3f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -466,76 +466,49 @@ void nr_store_dlsch_buffer(module_id_t module_id, NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - sched_ctrl->num_total_bytes = 0; + sched_ctrl->dl_pdus_total = 0; - int lcid; - const uint16_t rnti = UE_info->rnti[UE_id]; - LOG_D(NR_MAC,"UE %d/%x : lcid_mask %x\n",UE_id,rnti,sched_ctrl->lcid_mask); - if ((sched_ctrl->lcid_mask&(1<<2)) > 0) - sched_ctrl->rlc_status[DL_SCH_LCID_DCCH1] = mac_rlc_status_ind(module_id, + /* loop over all activated logical channels */ + // Note: DL_SCH_LCID_DCCH, DL_SCH_LCID_DCCH1, DL_SCH_LCID_DTCH + for (int i = 0; i < sched_ctrl->dl_lc_num; ++i) { + + const int lcid = sched_ctrl->dl_lc_ids[i]; + const uint16_t rnti = UE_info->rnti[UE_id]; + LOG_D(NR_MAC, "In %s: UE %d/%x: LCID %d\n", __FUNCTION__, UE_id, rnti, lcid); + start_meas(&RC.nrmac[module_id]->rlc_status_ind); + sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id, rnti, module_id, frame, slot, ENB_FLAG_YES, MBMS_FLAG_NO, - DL_SCH_LCID_DCCH1, + lcid, 0, 0); - if ((sched_ctrl->lcid_mask&(1<<1)) > 0) - sched_ctrl->rlc_status[DL_SCH_LCID_DCCH] = mac_rlc_status_ind(module_id, - rnti, - module_id, - frame, - slot, - ENB_FLAG_YES, - MBMS_FLAG_NO, - DL_SCH_LCID_DCCH, - 0, - 0); - if ((sched_ctrl->lcid_mask&(1<<4)) > 0) { - start_meas(&RC.nrmac[module_id]->rlc_status_ind); - sched_ctrl->rlc_status[DL_SCH_LCID_DTCH] = mac_rlc_status_ind(module_id, - rnti, - module_id, - frame, - slot, - ENB_FLAG_YES, - MBMS_FLAG_NO, - DL_SCH_LCID_DTCH, - 0, - 0); - stop_meas(&RC.nrmac[module_id]->rlc_status_ind); - } - if(sched_ctrl->rlc_status[DL_SCH_LCID_DCCH].bytes_in_buffer > 0){ - lcid = DL_SCH_LCID_DCCH; - } - else if (sched_ctrl->rlc_status[DL_SCH_LCID_DCCH1].bytes_in_buffer > 0) - { - lcid = DL_SCH_LCID_DCCH1; - }else{ - lcid = DL_SCH_LCID_DTCH; - } - - sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; - //later multiplex here. Just select DCCH/SRB before DTCH/DRB - sched_ctrl->lcid_to_schedule = lcid; + stop_meas(&RC.nrmac[module_id]->rlc_status_ind); - if (sched_ctrl->num_total_bytes == 0 - && !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */ - continue; + if (sched_ctrl->rlc_status[lcid].bytes_in_buffer == 0) + continue; - LOG_D(NR_MAC, - "[%s][%d.%d], %s%d->DLSCH, RLC status %d bytes TA %d\n", - __func__, - frame, - slot, - lcid<4?"DCCH":"DTCH", - lcid, - sched_ctrl->rlc_status[lcid].bytes_in_buffer, - sched_ctrl->ta_apply); + sched_ctrl->dl_pdus_total += sched_ctrl->rlc_status[lcid].pdus_in_buffer; + sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; + LOG_D(MAC, + "[gNB %d][%4d.%2d] %s%d->DLSCH, RLC status for UE %d: %d bytes in buffer, total DL buffer size = %d bytes, %d total PDU bytes, %s TA command\n", + module_id, + frame, + slot, + lcid < 4 ? "DCCH":"DTCH", + lcid, + UE_id, + sched_ctrl->rlc_status[lcid].bytes_in_buffer, + sched_ctrl->num_total_bytes, + sched_ctrl->dl_pdus_total, + sched_ctrl->ta_apply ? "send":"do not send"); + } } } @@ -882,7 +855,7 @@ void pf_dl(module_id_t module_id, sched_pdsch->pucch_allocation = alloc; uint32_t TBS = 0; uint16_t rbSize; - const int oh = 3 + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); + const int oh = 3*sched_ctrl->dl_pdus_total + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); nr_find_nb_rb(sched_pdsch->Qm, sched_pdsch->R, ps->nrOfLayers, @@ -1326,68 +1299,70 @@ void nr_schedule_ue_spec(module_id_t module_id, buf += written; int size = TBS - written; DevAssert(size >= 0); - /* next, get RLC data */ - // const int lcid = DL_SCH_LCID_DTCH; - const int lcid = sched_ctrl->lcid_to_schedule; - int dlsch_total_bytes = 0; start_meas(&gNB_mac->rlc_data_req); if (sched_ctrl->num_total_bytes > 0) { - tbs_size_t len = 0; - while (size > 3) { - // we do not know how much data we will get from RLC, i.e., whether it - // will be longer than 256B or not. Therefore, reserve space for long header, then - // fetch data, then fill real length - NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf; - buf += 3; - size -= 3; - /* limit requested number of bytes to what preprocessor specified, or - * such that TBS is full */ - const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer, size); + /* loop over all activated logical channels */ + for (int i = 0; i < sched_ctrl->dl_lc_num; ++i) { - len = mac_rlc_data_req(module_id, - rnti, - module_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - ndata, - (char *)buf, - 0, - 0); + const int lcid = sched_ctrl->dl_lc_ids[i]; + int dlsch_total_bytes = 0; - LOG_D(NR_MAC, - "%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %d)\n", - frame, - slot, - rnti, - len, - lcid < 4 ? "DCCH" : "DTCH", - lcid, - ndata, - size); - if (len == 0) - break; + while (size > 3) { + // we do not know how much data we will get from RLC, i.e., whether it + // will be longer than 256B or not. Therefore, reserve space for long header, then + // fetch data, then fill real length + NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf; + buf += 3; + size -= 3; - header->R = 0; - header->F = 1; - header->LCID = lcid; - header->L1 = (len >> 8) & 0xff; - header->L2 = len & 0xff; - size -= len; - buf += len; - dlsch_total_bytes += len; + /* limit requested number of bytes to what preprocessor specified, or + * such that TBS is full */ + const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer, size); + tbs_size_t len = mac_rlc_data_req(module_id, + rnti, + module_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + ndata, + (char *)buf, + 0, + 0); + + LOG_D(NR_MAC, + "%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %d)\n", + frame, + slot, + rnti, + len, + lcid < 4 ? "DCCH" : "DTCH", + lcid, + ndata, + size); + if (len == 0) { + /* RLC did not have data anymore, mark buffer as unused */ + buf -= 3; + size += 3; + break; + } + + header->R = 0; + header->F = 1; + header->LCID = lcid; + header->L1 = (len >> 8) & 0xff; + header->L2 = len & 0xff; + size -= len; + buf += len; + dlsch_total_bytes += len; + } + + UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += dlsch_total_bytes; } - if (len == 0) { - /* RLC did not have data anymore, mark buffer as unused */ - buf -= 3; - size += 3; - } - } - else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra || get_softmodem_params()->sa) { + } else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra) { /* we will need the large header, phy-test typically allocates all * resources and fills to the last byte below */ NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf; @@ -1405,7 +1380,6 @@ void nr_schedule_ue_spec(module_id_t module_id, header->L2 = size & 0xff; size -= size; buf += size; - dlsch_total_bytes += size; } stop_meas(&gNB_mac->rlc_data_req); @@ -1425,7 +1399,6 @@ void nr_schedule_ue_spec(module_id_t module_id, UE_info->mac_stats[UE_id].dlsch_total_bytes += TBS; UE_info->mac_stats[UE_id].dlsch_current_bytes = TBS; - UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += dlsch_total_bytes; /* save retransmission information */ harq->sched_pdsch = *sched_pdsch; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 22a0932c3f..2745a4c46a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -597,8 +597,9 @@ typedef struct { /// total amount of data awaiting for this UE uint32_t num_total_bytes; + uint16_t dl_pdus_total; /// per-LC status data - mac_rlc_status_resp_t rlc_status[MAX_NUM_LCID]; + mac_rlc_status_resp_t rlc_status[NR_MAX_NUM_LCID]; /// Estimation of HARQ from BLER NR_DL_bler_stats_t dl_bler_stats; @@ -638,6 +639,12 @@ typedef struct { /// UL HARQ processes that await retransmission NR_list_t retrans_ul_harq; NR_UE_mac_ce_ctrl_t UE_mac_ce_ctrl;// MAC CE related information + + /// number of active DL LCs + uint8_t dl_lc_num; + /// order in which DLSCH scheduler should allocate LCs + uint8_t dl_lc_ids[NR_MAX_NUM_LCID]; + } NR_UE_sched_ctrl_t; typedef struct { From 0df80e648a53b8e00f6ee59126df97f889c2173e Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 29 Sep 2021 09:04:25 +0200 Subject: [PATCH 2/9] Replaced lcid_mask with arrays logic - this will be later used to prioritise the LCs --- openair2/LAYER2/NR_MAC_gNB/config.c | 47 ++++++++++++++----- .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 1 - .../NR_MAC_gNB/gNB_scheduler_primitives.c | 1 + openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 - 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 19c82c71df..27dc7df94f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -58,19 +58,42 @@ void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddModList * struct NR_CellGroupConfig__rlc_BearerToReleaseList *rlc_bearer2release_list, NR_UE_sched_ctrl_t *sched_ctrl) { - - if (rlc_bearer2add_list) - // keep lcids - for (int i=0;ilist.count;i++) { - sched_ctrl->lcid_mask |= (1<list.array[i]->logicalChannelIdentity); - LOG_I(NR_MAC,"Adding LCID %d (%s %d)\n", - (int)rlc_bearer2add_list->list.array[i]->logicalChannelIdentity, - rlc_bearer2add_list->list.array[i]->logicalChannelIdentity<4 ? "SRB" : "DRB", - (int)rlc_bearer2add_list->list.array[i]->logicalChannelIdentity); + if (rlc_bearer2release_list) { + for (int i = 0; i < rlc_bearer2release_list->list.count; i++) { + for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) { + if (sched_ctrl->dl_lc_ids[idx] == *rlc_bearer2release_list->list.array[i]) { + const int remaining_lcs = sched_ctrl->dl_lc_num - idx - 1; + memmove(&sched_ctrl->dl_lc_ids[idx], &sched_ctrl->dl_lc_ids[idx + 1], sizeof(sched_ctrl->dl_lc_ids[idx]) * remaining_lcs); + sched_ctrl->dl_lc_num--; + break; + } + } } - if (rlc_bearer2release_list) - for (int i=0;ilist.count;i++) - sched_ctrl->lcid_mask |= (1<<*rlc_bearer2release_list->list.array[i]); + } + + if (rlc_bearer2add_list) { + // keep lcids + for (int i = 0; i < rlc_bearer2add_list->list.count; i++) { + const int lcid = rlc_bearer2add_list->list.array[i]->logicalChannelIdentity; + bool found = false; + for (int idx = 0; idx < sched_ctrl->dl_lc_num; idx++) { + if (sched_ctrl->dl_lc_ids[idx] == lcid) { + found = true; + break; + } + } + + if (!found) { + sched_ctrl->dl_lc_num++; + sched_ctrl->dl_lc_ids[sched_ctrl->dl_lc_num - 1] = lcid; + LOG_D(NR_MAC, "Adding LCID %d (%s %d)\n", lcid, lcid < 4 ? "SRB" : "DRB", lcid); + } + } + } + + LOG_D(NR_MAC, "In %s: total num of active bearers %d) \n", + __FUNCTION__, + sched_ctrl->dl_lc_num); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index fddf084a38..61cc2c505f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -329,7 +329,6 @@ void nr_preprocessor_phytest(module_id_t module_id, 0, 0); sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; - sched_ctrl->lcid_to_schedule = lcid; uint8_t nr_of_candidates; for (int i=0; i<5; i++) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 721f67295b..b76a781491 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2152,6 +2152,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG if (!get_softmodem_params()->phy_test && !get_softmodem_params()->do_ra && !get_softmodem_params()->sa) { sched_ctrl->lcid_mask = 1<dl_lc_num = 0; sched_ctrl->ta_frame = 0; sched_ctrl->ta_update = 31; sched_ctrl->ta_apply = false; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 2745a4c46a..b6364c6d15 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -604,8 +604,6 @@ typedef struct { /// Estimation of HARQ from BLER NR_DL_bler_stats_t dl_bler_stats; - int lcid_mask; - int lcid_to_schedule; uint16_t ta_frame; int16_t ta_update; bool ta_apply; From f8d6677d4d4ffeda5d29b34cf26f4186fc39d8c0 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Fri, 5 Nov 2021 14:01:06 +0100 Subject: [PATCH 3/9] Adapted phytest scheduler to multiple LCs scheduling logic --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 61cc2c505f..416c049473 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -314,7 +314,9 @@ void nr_preprocessor_phytest(module_id_t module_id, } sched_ctrl->num_total_bytes = 0; + sched_ctrl->dl_lc_num = 1; const int lcid = DL_SCH_LCID_DTCH; + sched_ctrl->dl_lc_ids[sched_ctrl->dl_lc_num - 1] = lcid; const uint16_t rnti = UE_info->rnti[UE_id]; /* update sched_ctrl->num_total_bytes so that postprocessor schedules data, * if available */ From 79591741e1b627a4d5e11832adec260a691d476f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 1 Dec 2021 18:05:48 +0100 Subject: [PATCH 4/9] Fixup: do not abort scheduling when UE has no CCE --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 55771c0e3f..a5cfaefca2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -828,6 +828,10 @@ void pf_dl(module_id_t module_id, CCEIndex, sched_ctrl->aggregation_level); + /* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */ + max_num_ue--; + if (max_num_ue < 0) return; + /* MCS has been set above */ const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0][slot]; From 06236ff7964b319b907764ebc76d675674c99411 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 1 Dec 2021 18:09:08 +0100 Subject: [PATCH 5/9] Consider fixed MAC overhead while no RLC PDU number --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index a5cfaefca2..94baf2adbd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -859,7 +859,12 @@ void pf_dl(module_id_t module_id, sched_pdsch->pucch_allocation = alloc; uint32_t TBS = 0; uint16_t rbSize; - const int oh = 3*sched_ctrl->dl_pdus_total + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); + // Fix me: currently, the RLC does not give us the total number of PDUs + // awaiting. Therefore, for the time being, we put a fixed overhead of 12 + // (for 4 PDUs) and optionally + 2 for TA. Once RLC gives the number of + // PDUs, we replace with 3 * numPDUs + const int oh = 3 * 4 + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); + //const int oh = 3 * sched_ctrl->dl_pdus_total + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); nr_find_nb_rb(sched_pdsch->Qm, sched_pdsch->R, ps->nrOfLayers, From f9079f1d2b03438861491845a1feb67f9db3e390 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 1 Dec 2021 18:17:14 +0100 Subject: [PATCH 6/9] Do not do RLC Ind if no data for LC --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 94baf2adbd..c9dd7fdd59 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1317,8 +1317,10 @@ void nr_schedule_ue_spec(module_id_t module_id, for (int i = 0; i < sched_ctrl->dl_lc_num; ++i) { const int lcid = sched_ctrl->dl_lc_ids[i]; - int dlsch_total_bytes = 0; + if (sched_ctrl->rlc_status[lcid].bytes_in_buffer == 0) + continue; // no data for this LC + int dlsch_total_bytes = 0; while (size > 3) { // we do not know how much data we will get from RLC, i.e., whether it // will be longer than 256B or not. Therefore, reserve space for long header, then From b8511d511d4b3babbb548e1926460560bdf15d33 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sat, 26 Feb 2022 00:05:36 +0100 Subject: [PATCH 7/9] fix --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index b76a781491..c83882935e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2148,11 +2148,6 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; memset(sched_ctrl, 0, sizeof(*sched_ctrl)); sched_ctrl->set_mcs = TRUE; - sched_ctrl->lcid_mask = 0; - if (!get_softmodem_params()->phy_test && !get_softmodem_params()->do_ra && !get_softmodem_params()->sa) { - sched_ctrl->lcid_mask = 1<dl_lc_num = 0; sched_ctrl->ta_frame = 0; sched_ctrl->ta_update = 31; sched_ctrl->ta_apply = false; From e7500354c1440d5447cb84d5345d2ce0363c6339 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 7 Mar 2022 16:02:01 +0100 Subject: [PATCH 8/9] harmonize RLC and PDCP configurations in nr_DRB_preconfiguration() and fill_default_secondaryCellGroup() nr_DRB_preconfiguration() is used in phy-test mode by both, OAI UE and gNB, and in all other modes by OAI UE. Because of inconsistencies, data transfer with OAI UE was only reliably working in phy-test mode. Ultimately, OAI UE should use nr_DRB_preconfiguration() only in phy-test mode and do proper DRB configuration instead in all other modes! --- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 7 ++++--- openair2/RRC/NR/rrc_gNB_reconfig.c | 6 ++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index a08c9d2c78..0c869ceeb1 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -1156,9 +1156,9 @@ void nr_DRB_preconfiguration(uint16_t crnti) drb_ToAddMod->pdcp_Config->drb->discardTimer = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->discardTimer)); *drb_ToAddMod->pdcp_Config->drb->discardTimer=NR_PDCP_Config__drb__discardTimer_infinity; drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL)); - *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len12bits; + *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len18bits; drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL)); - *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = NR_PDCP_Config__drb__pdcp_SN_SizeDL_len12bits; + *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = NR_PDCP_Config__drb__pdcp_SN_SizeDL_len18bits; drb_ToAddMod->pdcp_Config->drb->headerCompression.present = NR_PDCP_Config__drb__headerCompression_PR_notUsed; drb_ToAddMod->pdcp_Config->drb->headerCompression.choice.notUsed = 0; @@ -1188,7 +1188,8 @@ void nr_DRB_preconfiguration(uint16_t crnti) NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig)); nr_rlc_bearer_init(RLC_BearerConfig,NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity); - nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_am); + nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional); + //nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_am); nr_rlc_bearer_init_ul_spec(RLC_BearerConfig->mac_LogicalChannelConfig); Rlc_Bearer_ToAdd_list = calloc(1,sizeof(*Rlc_Bearer_ToAdd_list)); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index b4938404bd..610fd8e699 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -89,10 +89,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->cellGroupId = scg_id; NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig)); nr_rlc_bearer_init(RLC_BearerConfig, NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity); - if (get_softmodem_params()->do_ra || get_softmodem_params()->sa) - nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional); - else - nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_am); + nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_um_Bi_Directional); + //nr_drb_config(RLC_BearerConfig->rlc_Config, NR_RLC_Config_PR_am); nr_rlc_bearer_init_ul_spec(RLC_BearerConfig->mac_LogicalChannelConfig); secondaryCellGroup->rlc_BearerToAddModList = calloc(1,sizeof(*secondaryCellGroup->rlc_BearerToAddModList)); From e3901a499be0bd5584421a65adc2ee8696703fe0 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 7 Mar 2022 16:22:50 +0100 Subject: [PATCH 9/9] call process_CellGroup() after add_new_nr_ue() in gNB_scheduler_ulsch.c In case of do-ra mode (NSA) the OAI UE needs this, so the gNB correctly establishes the DRB. --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 34d4496eee..4b72b9cea3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -818,6 +818,8 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); UE_info->active[UE_id] = true; + process_CellGroup(ra->CellGroup, UE_scheduling_control); + } else { LOG_A(NR_MAC,"[RAPROC] RA-Msg3 received (sdu_lenP %d)\n",sdu_lenP);