From 68f6047c60a2ce99f6e5e8cb9e438bb6058420bb Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 27 Sep 2021 08:48:38 +0200 Subject: [PATCH 01/16] reworking acknack scheduling function --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 157 +++++++++++------- 1 file changed, 99 insertions(+), 58 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 6a17cb4879..12775ab46c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1160,15 +1160,16 @@ int nr_acknack_scheduling(int mod_id, int UE_id, frame_t frame, sub_frame_t slot, - int r_pucch) -{ + int r_pucch, + int is_common) { + const NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; const NR_TDD_UL_DL_Pattern_t *tdd = &scc->tdd_UL_DL_ConfigurationCommon->pattern1; - const int nr_ulmix_slots = tdd->nrofUplinkSlots + (tdd->nrofUplinkSymbols != 0); const int nr_mix_slots = tdd->nrofDownlinkSymbols != 0 || tdd->nrofUplinkSymbols != 0; const int nr_slots_period = tdd->nrofDownlinkSlots + tdd->nrofUplinkSlots + nr_mix_slots; const int first_ul_slot_tdd = tdd->nrofDownlinkSlots + nr_slots_period * (slot / nr_slots_period); + const int first_ul_slot_period = first_ul_slot_tdd%nr_slots_period; const int CC_id = 0; NR_sched_pucch_t *csi_pucch; @@ -1186,6 +1187,7 @@ int nr_acknack_scheduling(int mod_id, * * each UE has dedicated PUCCH Format 0 resources, and we use index 0! */ NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[mod_id]->UE_info.UE_sched_ctrl[UE_id]; NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[0]; + LOG_D(NR_MAC,"pucch_acknak %d.%d Trying to allocate pucch, current DAI %d\n",frame,slot,pucch->dai_c); pucch->r_pucch=r_pucch; AssertFatal(pucch->csi_bits == 0, "%s(): csi_bits %d in sched_pucch[0]\n", @@ -1197,10 +1199,14 @@ int nr_acknack_scheduling(int mod_id, * the same slot again */ const int f = pucch->frame; const int s = pucch->ul_slot; + LOG_D(NR_MAC,"pucch_acknak : %d.%d DAI = 2 pucch currently in %d.%d, advancing by 1 slot\n",frame,slot,f,s); nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id); memset(pucch, 0, sizeof(*pucch)); pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; - pucch->ul_slot = (s + 1) % n_slots_frame; + if(((s + 1)%nr_slots_period) == 0) + pucch->ul_slot = (s + 1 + first_ul_slot_period) % n_slots_frame; + else + pucch->ul_slot = (s + 1) % n_slots_frame; // we assume that only two indices over the array sched_pucch exist csi_pucch = &sched_ctrl->sched_pucch[1]; // skip the CSI PUCCH if it is present and if in the next frame/slot @@ -1212,34 +1218,47 @@ int nr_acknack_scheduling(int mod_id, && !csi_pucch->simultaneous_harqcsi) { nr_fill_nfapi_pucch(mod_id, frame, slot, csi_pucch, UE_id); memset(csi_pucch, 0, sizeof(*csi_pucch)); - pucch->frame = s >= n_slots_frame - 2 ? (f + 1) % 1024 : f; - pucch->ul_slot = (s + 2) % n_slots_frame; + pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; + if(((s + 1)%nr_slots_period) == 0) + pucch->ul_slot = (s + 1 + first_ul_slot_period) % n_slots_frame; + else + pucch->ul_slot = (s + 1) % n_slots_frame; } } - LOG_D(MAC,"1. DL slot %d, UL_ACK %d\n",slot,pucch->ul_slot); - /* if the UE's next PUCCH occasion is after the possible UL slots (within the - * same frame) or wrapped around to the next frame, then we assume there is - * no possible PUCCH allocation anymore */ - if ((pucch->frame == frame - && (pucch->ul_slot >= first_ul_slot_tdd + nr_ulmix_slots)) - || (pucch->frame == frame + 1)) - return -1; + LOG_D(NR_MAC,"pucch_acknak 1. DL %d.%d, UL_ACK %d.%d, DAI_C %d\n",frame,slot,pucch->frame,pucch->ul_slot,pucch->dai_c); // this is hardcoded for now as ue specific only if we are not on the initialBWP (to be fixed to allow ue_Specific also on initialBWP - NR_SearchSpace__searchSpaceType_PR ss_type = sched_ctrl->active_bwp ? NR_SearchSpace__searchSpaceType_PR_ue_Specific: NR_SearchSpace__searchSpaceType_PR_common; - uint8_t pdsch_to_harq_feedback[8]; - get_pdsch_to_harq_feedback(mod_id, UE_id, ss_type, pdsch_to_harq_feedback); + NR_CellGroupConfig_t *cg = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]; + NR_BWP_UplinkDedicated_t *ubwpd=NULL; + if (cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) + ubwpd = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP; + + NR_SearchSpace__searchSpaceType_PR ss_type = (is_common==0 && (sched_ctrl->active_bwp || ubwpd)) ? NR_SearchSpace__searchSpaceType_PR_ue_Specific: NR_SearchSpace__searchSpaceType_PR_common; + uint8_t pdsch_to_harq_feedback[8]; + int bwp_Id = 0; + if (sched_ctrl->active_ubwp) bwp_Id = sched_ctrl->active_ubwp->bwp_Id; + + int max_fb_time = 0; + get_pdsch_to_harq_feedback(mod_id, UE_id, bwp_Id, ss_type, &max_fb_time, pdsch_to_harq_feedback); + int max_absslot = frame*n_slots_frame + slot + max_fb_time; + + LOG_D(NR_MAC,"pucch_acknak 1b. DL %d.%d, UL_ACK %d.%d, DAI_C %d\n",frame,slot,pucch->frame,pucch->ul_slot,pucch->dai_c); /* there is a HARQ. Check whether we can use it for this ACKNACK */ if (pucch->dai_c > 0) { /* this UE already has a PUCCH occasion */ - DevAssert(pucch->frame == frame); - // Find the right timing_indicator value. int i = 0; while (i < 8) { - if (pdsch_to_harq_feedback[i] == pucch->ul_slot - slot) + int diff = pucch->ul_slot - slot; + if (diff<0) + diff += n_slots_frame; + if (pdsch_to_harq_feedback[i] == diff) break; ++i; } @@ -1248,50 +1267,66 @@ int nr_acknack_scheduling(int mod_id, const int f = pucch->frame; const int s = pucch->ul_slot; const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; + LOG_D(NR_MAC,"pucch_acknak : %d.%d DAI > 0, cannot reach timing for pucch in %d.%d, advancing slot by 1 and trying again\n",frame,slot,f,s); nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id); memset(pucch, 0, sizeof(*pucch)); pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; - pucch->ul_slot = (s + 1) % n_slots_frame; - return nr_acknack_scheduling(mod_id, UE_id, frame, slot, pucch->r_pucch); + if(((s + 1)%nr_slots_period) == 0) + pucch->ul_slot = (s + 1 + first_ul_slot_period) % n_slots_frame; + else + pucch->ul_slot = (s + 1) % n_slots_frame; + return nr_acknack_scheduling(mod_id, UE_id, frame, slot, r_pucch,is_common); } pucch->timing_indicator = i; pucch->dai_c++; // retain old resource indicator, and we are good + LOG_D(NR_MAC,"pucch_acknak : %d.%d. DAI > 0, pucch allocated for %d.%d (index %d)\n",frame,slot,pucch->frame,pucch->ul_slot,pucch->timing_indicator); return 0; } + LOG_D(NR_MAC,"pucch_acknak : %d.%d DAI = 0, looking for new pucch occasion\n",frame,slot); /* we need to find a new PUCCH occasion */ - /* if time information is outdated (e.g., last PUCCH occasion in last frame), - * set to first possible UL occasion in this frame. Note that if such UE is - * scheduled a lot and used all AckNacks, pucch->frame might have been - * wrapped around to next frame */ - if (frame != pucch->frame || pucch->ul_slot < first_ul_slot_tdd) { + /*Inizialization of timing information*/ + if (pucch->frame == 0 && pucch->ul_slot == 0) { AssertFatal(pucch->sr_flag + pucch->dai_c == 0, "expected no SR/AckNack for UE %d in %4d.%2d, but has %d/%d for %4d.%2d\n", UE_id, frame, slot, pucch->sr_flag, pucch->dai_c, pucch->frame, pucch->ul_slot); - AssertFatal(frame + 1 != pucch->frame, - "frame wrap around not handled in %s() yet\n", - __func__); pucch->frame = frame; pucch->ul_slot = first_ul_slot_tdd; } - // advance ul_slot if it is not reachable by UE - pucch->ul_slot = max(pucch->ul_slot, slot + pdsch_to_harq_feedback[0]); - // Find the right timing_indicator value. - int i = 0; - while (i < 8) { - LOG_D(MAC,"pdsch_to_harq_feedback[%d] = %d (pucch->ul_slot %d - slot %d)\n", - i,pdsch_to_harq_feedback[i],pucch->ul_slot,slot); - if (pdsch_to_harq_feedback[i] == pucch->ul_slot - slot) + int ind_found = -1; + // while we are within the feedback limits + while ((pucch->frame*n_slots_frame + pucch->ul_slot) <= max_absslot) { + int i = 0; + while (i < 8) { + LOG_D(NR_MAC,"pdsch_to_harq_feedback[%d] = %d (pucch->ul_slot %d - slot %d)\n", + i,pdsch_to_harq_feedback[i],pucch->ul_slot,slot); + int diff = pucch->ul_slot - slot; + if (diff<0) + diff += n_slots_frame; + if (pdsch_to_harq_feedback[i] == diff) { + ind_found = i; + break; + } + ++i; + } + if (ind_found!=-1) break; - ++i; + // advance to the next ul slot + const int f = pucch->frame; + const int s = pucch->ul_slot; + pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; + if(((s + 1)%nr_slots_period) == 0) + pucch->ul_slot = (s + 1 + first_ul_slot_period) % n_slots_frame; + else + pucch->ul_slot = (s + 1) % n_slots_frame; } - if (i >= 8) { - LOG_W(MAC, + if (ind_found==-1) { + LOG_W(NR_MAC, "%4d.%2d could not find pdsch_to_harq_feedback for UE %d: earliest " "ack slot %d\n", frame, @@ -1303,9 +1338,10 @@ int nr_acknack_scheduling(int mod_id, // is there already CSI in this slot? csi_pucch = &sched_ctrl->sched_pucch[1]; - if (csi_pucch->csi_bits > 0 - && csi_pucch->frame == pucch->frame - && csi_pucch->ul_slot == pucch->ul_slot) { + if (csi_pucch && + csi_pucch->csi_bits > 0 && + csi_pucch->frame == pucch->frame && + csi_pucch->ul_slot == pucch->ul_slot) { // skip the CSI PUCCH if it is present and if in the next frame/slot // and if we don't multiplex // FIXME currently we support at most 11 bits in pucch2 so skip also in that case @@ -1319,24 +1355,27 @@ int nr_acknack_scheduling(int mod_id, const int s = pucch->ul_slot; memset(pucch, 0, sizeof(*pucch)); pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; - pucch->ul_slot = (s + 1) % n_slots_frame; - return nr_acknack_scheduling(mod_id, UE_id, frame, slot, -1); + if(((s + 1)%nr_slots_period) == 0) + pucch->ul_slot = (s + 1 + first_ul_slot_period) % n_slots_frame; + else + pucch->ul_slot = (s + 1) % n_slots_frame; + return nr_acknack_scheduling(mod_id, UE_id, frame, slot, r_pucch,is_common); } // multiplexing harq and csi in a pucch else { - csi_pucch->timing_indicator = i; + csi_pucch->timing_indicator = ind_found; csi_pucch->dai_c++; return 1; } } - pucch->timing_indicator = i; // index in the list of timing indicators + pucch->timing_indicator = ind_found; // index in the list of timing indicators - LOG_D(MAC,"2. DL slot %d, UL_ACK %d (index %d)\n",slot,pucch->ul_slot,i); + LOG_D(NR_MAC,"pucch_acknak 2. DAI 0 DL %d.%d, UL_ACK %d.%d (index %d)\n",frame,slot,pucch->frame,pucch->ul_slot,pucch->timing_indicator); pucch->dai_c++; pucch->resource_indicator = 0; // each UE has dedicated PUCCH resources - + pucch->r_pucch=r_pucch; NR_PUCCH_Config_t *pucch_Config = NULL; if (sched_ctrl->active_ubwp) { pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup; @@ -1352,14 +1391,16 @@ int nr_acknack_scheduling(int mod_id, /* verify that at that slot and symbol, resources are free. We only do this * for initialCyclicShift 0 (we assume it always has that one), so other * initialCyclicShifts can overlap with ICS 0!*/ - const NR_PUCCH_Resource_t *resource = pucch_Config->resourceToAddModList->list.array[pucch->resource_indicator]; - DevAssert(resource->format.present == NR_PUCCH_Resource__format_PR_format0); - if (resource->format.choice.format0->initialCyclicShift == 0) { - uint16_t *vrb_map_UL = &RC.nrmac[mod_id]->common_channels[CC_id].vrb_map_UL[pucch->ul_slot * MAX_BWP_SIZE]; - const uint16_t symb = 1 << resource->format.choice.format0->startingSymbolIndex; - if ((vrb_map_UL[resource->startingPRB] & symb) != 0) - LOG_W(MAC, "symbol 0x%x is not free for PUCCH alloc in vrb_map_UL at RB %ld and slot %d.%d\n", symb, resource->startingPRB, pucch->frame, pucch->ul_slot); - vrb_map_UL[resource->startingPRB] |= symb; + if (pucch_Config) { + const NR_PUCCH_Resource_t *resource = pucch_Config->resourceToAddModList->list.array[pucch->resource_indicator]; + DevAssert(resource->format.present == NR_PUCCH_Resource__format_PR_format0); + if (resource->format.choice.format0->initialCyclicShift == 0) { + uint16_t *vrb_map_UL = &RC.nrmac[mod_id]->common_channels[CC_id].vrb_map_UL[pucch->ul_slot * MAX_BWP_SIZE]; + const uint16_t symb = 1 << resource->format.choice.format0->startingSymbolIndex; + if ((vrb_map_UL[resource->startingPRB] & symb) != 0) + LOG_W(NR_MAC, "symbol 0x%x is not free for PUCCH alloc in vrb_map_UL at RB %ld and slot %d.%d\n", symb, resource->startingPRB, pucch->frame, pucch->ul_slot); + vrb_map_UL[resource->startingPRB] |= symb; + } } return 0; } From a21b6e0f069f3d1911d2bb461e9e8315e6d37497 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 27 Sep 2021 09:08:19 +0200 Subject: [PATCH 02/16] update get_pdsch_to_harq_feedback --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 65 ++++++++++++++----- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 13 ++-- 2 files changed, 58 insertions(+), 20 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 1948959d55..17d3736d02 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2045,34 +2045,61 @@ uint8_t nr_get_tpc(int target, uint8_t cqi, int incr) { void get_pdsch_to_harq_feedback(int Mod_idP, int UE_id, + int bwp_id, NR_SearchSpace__searchSpaceType_PR ss_type, + int *max_fb_time, uint8_t *pdsch_to_harq_feedback) { - int bwp_id=1; NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id]; - NR_BWP_Downlink_t *bwp=NULL; - NR_BWP_Uplink_t *ubwp=NULL; + NR_BWP_DownlinkDedicated_t *bwpd=NULL; + NR_BWP_UplinkDedicated_t *ubwpd=NULL; - if (CellGroup && CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList) - bwp = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]; - if (CellGroup && CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList) - ubwp = CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]; + if (ss_type == NR_SearchSpace__searchSpaceType_PR_ue_Specific) { + AssertFatal(CellGroup!=NULL,"Cellgroup is not defined for UE_id %d\n",UE_id); + AssertFatal(CellGroup->spCellConfig!=NULL,"Cellgroup->spCellConfig is null\n"); + AssertFatal(CellGroup->spCellConfig->spCellConfigDedicated!=NULL,"CellGroup->spCellConfig->spCellConfigDedicated is null\n"); + } + if (bwp_id>0) { + AssertFatal(CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList!=NULL, + "CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList is null\n"); + AssertFatal(CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList!=NULL, + "CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList is null\n"); + AssertFatal(CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count >= bwp_id, + "CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count %d < bwp_id %d\n", + CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count,bwp_id); + AssertFatal(CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count >= bwp_id, + "CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count %d < bwp_id %d\n", + CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count,bwp_id); + bwpd = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1]->bwp_Dedicated; + ubwpd = CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1]->bwp_Dedicated; + } + else if (CellGroup) { // this is an initialBWP + AssertFatal((bwpd=CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP)!=NULL, + "CellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP is null\n"); + AssertFatal((ubwpd=CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP)!=NULL, + "CellGroup->spCellConfig->spCellConfigDedicated->uplnikConfig->initialUplinkBWP is null\n"); + } NR_SearchSpace_t *ss=NULL; // common search type uses DCI format 1_0 if (ss_type == NR_SearchSpace__searchSpaceType_PR_common) { - for (int i=0; i<8; i++) + for (int i=0; i<8; i++) { pdsch_to_harq_feedback[i] = i+1; + if(pdsch_to_harq_feedback[i]>*max_fb_time) + *max_fb_time = pdsch_to_harq_feedback[i]; + } } else { // searching for a ue specific search space int found=0; - - for (int i=0;ibwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count;i++) { - ss=bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.array[i]; + AssertFatal(bwpd->pdcch_Config!=NULL,"bwpd->pdcch_Config is null\n"); + AssertFatal(bwpd->pdcch_Config->choice.setup->searchSpacesToAddModList!=NULL, + "bwpd->pdcch_Config->choice.setup->searchSpacesToAddModList is null\n"); + for (int i=0;ipdcch_Config->choice.setup->searchSpacesToAddModList->list.count;i++) { + ss=bwpd->pdcch_Config->choice.setup->searchSpacesToAddModList->list.array[i]; AssertFatal(ss->controlResourceSetId != NULL,"ss->controlResourceSetId is null\n"); AssertFatal(ss->searchSpaceType != NULL,"ss->searchSpaceType is null\n"); if (ss->searchSpaceType->present == ss_type) { @@ -2084,13 +2111,20 @@ void get_pdsch_to_harq_feedback(int Mod_idP, if (ss->searchSpaceType->choice.ue_Specific->dci_Formats == NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_0_And_1_0) { - for (int i=0; i<8; i++) + for (int i=0; i<8; i++) { pdsch_to_harq_feedback[i] = i+1; + if(pdsch_to_harq_feedback[i]>*max_fb_time) + *max_fb_time = pdsch_to_harq_feedback[i]; + } } else { - if(ubwp->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK != NULL) { - for (int i=0; i<8; i++) - pdsch_to_harq_feedback[i] = *ubwp->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK->list.array[i]; + AssertFatal(ubwpd!=NULL,"ubwpd shouldn't be null here\n"); + if(ubwpd->pucch_Config->choice.setup->dl_DataToUL_ACK != NULL) { + for (int i=0; i<8; i++) { + pdsch_to_harq_feedback[i] = *ubwpd->pucch_Config->choice.setup->dl_DataToUL_ACK->list.array[i]; + if(pdsch_to_harq_feedback[i]>*max_fb_time) + *max_fb_time = pdsch_to_harq_feedback[i]; + } } else AssertFatal(0==1,"There is no allocated dl_DataToUL_ACK for pdsch to harq feedback\n"); @@ -2099,6 +2133,7 @@ void get_pdsch_to_harq_feedback(int Mod_idP, } + void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 391b98af36..a40edf8512 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -200,15 +200,18 @@ void nr_csi_meas_reporting(int Mod_idP, frame_t frameP, sub_frame_t slotP); -int nr_acknack_scheduling(int Mod_idP, - int UE_id, - frame_t frameP, - sub_frame_t slotP, - int r_pucch); +int nr_acknack_scheduling(int mod_id, + int UE_id, + frame_t frame, + sub_frame_t slot, + int r_pucch, + int is_common); void get_pdsch_to_harq_feedback(int Mod_idP, int UE_id, + int bwp_id, NR_SearchSpace__searchSpaceType_PR ss_type, + int *max_fb_time, uint8_t *pdsch_to_harq_feedback); void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu, From ef75edeae54e98baf240c5a5c208b9da632d726e Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 27 Sep 2021 09:22:54 +0200 Subject: [PATCH 03/16] fix acknack scheduling compilation --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 4 ++-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 606da48575..ae7da36205 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1462,7 +1462,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra const int delta_PRI=0; int r_pucch = ((CCEIndex<<1)/N_cce)+(delta_PRI<<1); - int alloc = nr_acknack_scheduling(module_idP, UE_id, frameP, slotP, r_pucch); + int alloc = nr_acknack_scheduling(module_idP, UE_id, frameP, slotP, r_pucch, 1); AssertFatal(alloc>=0,"Couldn't find a pucch allocation for ack nack (msg4)\n"); NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[alloc]; harq->feedback_slot = pucch->ul_slot; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 2cbe232fe0..925c0774df 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -518,7 +518,7 @@ bool allocate_dl_retransmission(module_id_t module_id, /* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH * allocation after CCE alloc fail would be more complex) */ - const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, -1); + const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, -1, 0); if (alloc<0) { LOG_D(MAC, "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n", @@ -653,7 +653,7 @@ void pf_dl(module_id_t module_id, /* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH * allocation after CCE alloc fail would be more complex) */ - const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, -1); + const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, -1, 0); if (alloc<0) { LOG_D(NR_MAC, "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n", diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index f707e6efeb..a26a3aad15 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -342,7 +342,7 @@ void nr_preprocessor_phytest(module_id_t module_id, __func__, UE_id); - const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, -1); + const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, -1, 0); if (alloc < 0) { LOG_D(MAC, "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n", From 849a388f725528cddb9096a21118ae4b71c8c1e7 Mon Sep 17 00:00:00 2001 From: francescomani Date: Fri, 24 Sep 2021 19:06:47 +0200 Subject: [PATCH 04/16] acknack fixes at UE --- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 2 +- openair1/SCHED_NR_UE/harq_nr.c | 13 ++++++------- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 3 +-- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 6 +++++- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 1 + 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 697f5b19d1..1333f049a9 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -105,7 +105,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ dlsch0->active = 1; dlsch0->rnti = dl_config->dl_config_list[i].dlsch_config_pdu.rnti; - LOG_D(PHY,"current_harq_pid = %d\n", current_harq_pid); + LOG_D(PHY,"slot %d current_harq_pid = %d\n",slot, current_harq_pid); NR_DL_UE_HARQ_t *dlsch0_harq = dlsch0->harq_processes[current_harq_pid]; if (dlsch0_harq){ diff --git a/openair1/SCHED_NR_UE/harq_nr.c b/openair1/SCHED_NR_UE/harq_nr.c index 7bc1f3053b..5b65131934 100644 --- a/openair1/SCHED_NR_UE/harq_nr.c +++ b/openair1/SCHED_NR_UE/harq_nr.c @@ -331,7 +331,6 @@ void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ndi, int rv, uint8_t rnti_type) { - if (rnti_type == _SI_RNTI_ || rnti_type == _P_RNTI_ || rnti_type == _RA_RNTI_) { @@ -351,38 +350,38 @@ void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ndi, int break; case 1: dl_harq->round = 2; + dl_harq->status = ACTIVE; dl_harq->first_rx = 0; if (dl_harq->DCINdi != ndi) { LOG_E(PHY,"Missed previous DCI detections. NDI toggled but rv %d does not correspond to first reception\n",rv); - dl_harq->status = ACTIVE; dl_harq->first_rx = 1; dl_harq->DCINdi = ndi; } - else if (dl_harq->ack) + else if (dl_harq->ack == 1) dl_harq->status = SCH_IDLE; break; case 2: dl_harq->round = 1; + dl_harq->status = ACTIVE; dl_harq->first_rx = 0; if (dl_harq->DCINdi != ndi) { LOG_E(PHY,"Missed previous DCI detections. NDI toggled but rv %d does not correspond to first reception\n",rv); - dl_harq->status = ACTIVE; dl_harq->first_rx = 1; dl_harq->DCINdi = ndi; } - else if (dl_harq->ack) + else if (dl_harq->ack == 1) dl_harq->status = SCH_IDLE; break; case 3: dl_harq->round = 3; + dl_harq->status = ACTIVE; dl_harq->first_rx = 0; if (dl_harq->DCINdi != ndi) { LOG_E(PHY,"Missed previous DCI detections. NDI toggled but rv %d does not correspond to first reception\n",rv); - dl_harq->status = ACTIVE; dl_harq->first_rx = 1; dl_harq->DCINdi = ndi; } - else if (dl_harq->ack) + else if (dl_harq->ack == 1) dl_harq->status = SCH_IDLE; break; default: diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 4e47eb2865..95995258b6 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1926,11 +1926,10 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_OUT); } - // do procedures for C-RNTI if (ue->dlsch[proc->thread_id][gNB_id][0]->active == 1) { - LOG_D(PHY, "DLSCH data reception at nr_slot_rx: %d \n \n", nr_slot_rx); + LOG_D(PHY, "DLSCH data reception at nr_slot_rx: %d\n", nr_slot_rx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); #if UE_TIMING_TRACE diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 6e22a05b17..f135ff8bec 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2017,7 +2017,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac, uint32_t V_temp = 0; uint32_t V_temp2 = 0; int O_ACK = 0; - int o_ACK = 0; + uint8_t o_ACK = 0; int O_bit_number_cw0 = 0; int O_bit_number_cw1 = 0; @@ -2045,6 +2045,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac, } o_ACK = o_ACK | (ack_data[0][m] << O_bit_number_cw0); + LOG_D(MAC,"m %d bit number %d o_ACK %d\n",m,O_bit_number_cw0,o_ACK); } if (V_temp2 < V_temp) { @@ -2063,8 +2064,11 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac, return (0); } + reverse_n_bits(&o_ACK,number_harq_feedback); pucch->ack_payload = o_ACK; + LOG_D(MAC,"frame %d slot %d pucch payload %d\n",frame,slot,o_ACK); + return(number_harq_feedback); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 12775ab46c..26f4dfd02d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1083,6 +1083,7 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, DevAssert(harq->is_waiting); const int8_t pid = sched_ctrl->feedback_dl_harq.head; remove_front_nr_list(&sched_ctrl->feedback_dl_harq); + LOG_D(NR_MAC,"bit %d pid %d ack/nack %d\n",harq_bit,pid,harq_value); handle_dl_harq(mod_id, UE_id, pid, harq_value == 1 && harq_confidence == 0); } } From c2a56faea8161b72f7b7b4fdd8dd55d9046bc496 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 27 Sep 2021 11:52:10 +0200 Subject: [PATCH 05/16] fix retransmission of acknack in pucch after ack missed detection --- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 5 +++-- openair1/SCHED_NR_UE/fapi_nr_ue_l1.h | 3 ++- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 3 --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 21 ++------------------ openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 19 +++++++++++++++++- 5 files changed, 25 insertions(+), 26 deletions(-) diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 1333f049a9..666f06db42 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -131,9 +131,10 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ dlsch0_harq->mcs_table=dlsch_config_pdu->mcs_table; downlink_harq_process(dlsch0_harq, dlsch0->current_harq_pid, dlsch_config_pdu->ndi, dlsch_config_pdu->rv, dlsch0->rnti_type); if (dlsch0_harq->status != ACTIVE) { - // dlsch0_harq->status not ACTIVE may be due to false retransmission. Reset the - // following flag to skip PDSCH procedures in that case. + // dlsch0_harq->status not ACTIVE due to false retransmission + // Reset the following flag to skip PDSCH procedures in that case and retrasmit harq status dlsch0->active = 0; + update_harq_status(module_id,dlsch0->current_harq_pid,dlsch0_harq->ack); } /* PTRS */ dlsch0_harq->PTRSFreqDensity = dlsch_config_pdu->PTRSFreqDensity; diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.h b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.h index 9b7b87a18c..0cd882a9b5 100755 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.h +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.h @@ -43,5 +43,6 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response); \param scheduled_response including transmission config(dl_config, ul_config) and data transmission (tx_req)*/ int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config); +void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nack); -#endif \ No newline at end of file +#endif diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 83ff1d3a9e..63ade508cb 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -215,9 +215,6 @@ void set_harq_status(NR_UE_MAC_INST_t *mac, frame_t frame, int slot); -void update_harq_status(nr_downlink_indication_t *dl_info, - int pdu_id); - uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index f135ff8bec..a426f8143c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -171,7 +171,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, uint16_t ssb_start_subcarrier, uint16_t cell_id) { - LOG_I(MAC,"[L2][MAC] decode mib\n"); + LOG_D(MAC,"[L2][MAC] decode mib\n"); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); mac->physCellId = cell_id; @@ -1233,23 +1233,6 @@ void set_harq_status(NR_UE_MAC_INST_t *mac, } -void update_harq_status(nr_downlink_indication_t *dl_info, int pdu_id) { - - NR_UE_MAC_INST_t *mac = get_mac_inst(dl_info->module_id); - uint8_t harq_pid = dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid; - NR_UE_HARQ_STATUS_t *current_harq = &mac->dl_harq_info[harq_pid]; - - if (current_harq->active) { - current_harq->ack = dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack; - current_harq->ack_received = true; - } - else { - //shouldn't get here - LOG_E(MAC, "Trying to process acknack for an inactive harq process (%d)\n", harq_pid); - } -} - - void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, int slot, uint16_t rnti, @@ -2067,7 +2050,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac, reverse_n_bits(&o_ACK,number_harq_feedback); pucch->ack_payload = o_ACK; - LOG_D(MAC,"frame %d slot %d pucch payload %d\n",frame,slot,o_ACK); + LOG_D(MAC,"frame %d slot %d pucch acknack payload %d\n",frame,slot,o_ACK); return(number_harq_feedback); } diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index b5c2f666a2..32f85a2fc5 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -81,13 +81,30 @@ int handle_dci(module_id_t module_id, int cc_id, unsigned int gNB_index, frame_t // Note: sdu should always be processed because data and timing advance updates are transmitted by the UE int8_t handle_dlsch(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment, int pdu_id){ - update_harq_status(dl_info, pdu_id); + update_harq_status(dl_info->module_id, + dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid, + dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack); if(dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack) nr_ue_send_sdu(dl_info, ul_time_alignment, pdu_id); return 0; } +void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nack) { + + NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); + NR_UE_HARQ_STATUS_t *current_harq = &mac->dl_harq_info[harq_pid]; + + if (current_harq->active) { + current_harq->ack = ack_nack; + current_harq->ack_received = true; + } + else { + //shouldn't get here + LOG_E(MAC, "Trying to process acknack for an inactive harq process (%d)\n", harq_pid); + } +} + int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ NR_UE_L2_STATE_t ret; From 388918768af100729634b0a18a04d6728fa6ebb2 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 27 Sep 2021 11:52:47 +0200 Subject: [PATCH 06/16] another fix in scheduler acknack --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 26f4dfd02d..5a61e7973a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1364,6 +1364,7 @@ int nr_acknack_scheduling(int mod_id, } // multiplexing harq and csi in a pucch else { + memset(pucch, 0, sizeof(*pucch)); csi_pucch->timing_indicator = ind_found; csi_pucch->dai_c++; return 1; From b57b83faf3f4da67228011baf1b483a02a829520 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 27 Sep 2021 12:12:02 +0200 Subject: [PATCH 07/16] bugfix in pucch scheduler at ue --- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index f3a2496ce3..5b88e1e06a 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1806,7 +1806,8 @@ void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, in if (N_UCI > 0) { - pucch->resource_set_id = find_pucch_resource_set(mac, N_UCI); + LOG_D(NR_MAC,"%d.%d configure pucch, O_SR %d, O_ACK %d, O_CSI %d\n",frameP,slotP,O_SR,O_ACK,O_CSI); + pucch->resource_set_id = find_pucch_resource_set(mac, O_ACK + O_CSI); select_pucch_resource(mac, pucch); fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, slotP); fapi_nr_ul_config_pucch_pdu *pucch_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pucch_config_pdu; From 655bead8f13ecb9a00766c6fec86a08e847cfbb2 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 27 Sep 2021 12:19:40 +0200 Subject: [PATCH 08/16] logs --- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 8 ++++---- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 13 +++++++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index e3b87ff233..f67e2be4d1 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -392,8 +392,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0; uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1); uci_pdu->harq->harq_list[0].harq_value = index&0x01; - LOG_D(PHY, "Slot %d HARQ value %d with confidence level (0 is good, 1 is bad) %d xrt_mag %d n0 %d pucch0_thres %d\n", - slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dB,max_n0,uci_stats->pucch0_thres); + LOG_D(PHY, "Frame %d Slot %d HARQ value %d with confidence level (0 is good, 1 is bad) %d xrt_mag %d n0 %d pucch0_thres %d\n", + frame, slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dB,max_n0,uci_stats->pucch0_thres); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr->sr_indication = (index>1) ? 1 : 0; @@ -409,8 +409,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2); uci_pdu->harq->harq_list[1].harq_value = index&0x01; uci_pdu->harq->harq_list[0].harq_value = (index>>1)&0x01; - LOG_D(PHY, "Slot %d HARQ values %d and %d with confidence level (0 is good, 1 is bad) %d, xrt_mag %d\n", - slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dB); + LOG_D(PHY, "Frame %d Slot %d HARQ values %d and %d with confidence level (0 is good, 1 is bad) %d, xrt_mag %d\n", + frame, slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dB); if (pucch_pdu->sr_flag == 1) { uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); uci_pdu->sr->sr_indication = (index>3) ? 1 : 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 925c0774df..67e5ff8d29 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -856,19 +856,28 @@ void nr_schedule_ue_spec(module_id_t module_id, UE_info->mac_stats[UE_id].dlsch_rounds[harq->round]++; LOG_D(NR_MAC, - "%4d.%2d RNTI %04x start %3d RBs %3d startSymbol %2d nb_symbol %2d MCS %2d TBS %4d HARQ PID %2d round %d NDI %d\n", + "%4d.%2d [DLSCH/PDSCH/PUCCH] UE %d RNTI %04x DCI L %d start %3d RBs %3d startSymbol %2d nb_symbol %2d dmrspos %x MCS %2d TBS %4d HARQ PID %2d round %d RV %d NDI %d dl_data_to_ULACK %d (%d.%d) TPC %d\n", frame, slot, + UE_id, rnti, + sched_ctrl->aggregation_level, sched_pdsch->rbStart, sched_pdsch->rbSize, ps->startSymbolIndex, ps->nrOfSymbols, + ps->dl_dmrs_symb_pos, sched_pdsch->mcs, TBS, current_harq_pid, harq->round, - harq->ndi); + nr_rv_round_map[harq->round], + harq->ndi, + pucch->timing_indicator, + pucch->frame, + pucch->ul_slot, + sched_ctrl->tpc1); + NR_BWP_Downlink_t *bwp = sched_ctrl->active_bwp; From e946804bbf680eda03bbb277691eb29cbca581be Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 27 Sep 2021 18:45:59 +0200 Subject: [PATCH 09/16] Minimum value of DL to ACK --- openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- openair1/SIMULATION/NR_PHY/ulsim.c | 2 +- openair2/COMMON/rrc_messages_types.h | 1 + openair2/GNB_APP/gnb_config.c | 2 ++ openair2/GNB_APP/gnb_paramdef.h | 4 ++++ openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 19 +++++++++++-------- openair2/RRC/NR/nr_rrc_defs.h | 1 + openair2/RRC/NR/nr_rrc_proto.h | 2 ++ openair2/RRC/NR/rrc_gNB.c | 1 + openair2/RRC/NR/rrc_gNB_nsa.c | 2 ++ openair2/RRC/NR/rrc_gNB_reconfig.c | 5 ++++- 11 files changed, 30 insertions(+), 11 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 5df03a903b..8938cfb0e6 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -761,7 +761,7 @@ int main(int argc, char **argv) prepare_scd(scd); - fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 0, 0, 0); + fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 2, 0, 0, 0); /* RRC parameter validation for secondaryCellGroup */ fix_scd(scd); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index e267c8b6d7..c08f2f3bbf 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -712,7 +712,7 @@ int main(int argc, char **argv) prepare_scd(scd); - fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 0, 0, 0); + fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 0, 0, 0, 0); // xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index c0fa80d4a9..f61648d8b4 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -412,6 +412,7 @@ typedef struct NRRrcConfigurationReq_s { int sib1_tda; int pdsch_AntennaPorts; int pusch_AntennaPorts; + int minRXTXTIMEpdsch; int do_CSIRS; int pusch_TargetSNRx10; int pucch_TargetSNRx10; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 7e6fd61b0e..09ec9b6f50 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1018,6 +1018,8 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { printf("pusch_AntennaPorts %d\n",*GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr); NRRRC_CONFIGURATION_REQ (msg_p).pusch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr; NRRRC_CONFIGURATION_REQ (msg_p).sib1_tda = *GNBParamList.paramarray[i][GNB_SIB1_TDA_IDX].iptr; + printf("minTXRXTIMEpdsch %d\n",*GNBParamList.paramarray[i][GNB_MINRXTXTIMEPDSCH_IDX].iptr); + NRRRC_CONFIGURATION_REQ (msg_p).minRXTXTIMEpdsch = *GNBParamList.paramarray[i][GNB_MINRXTXTIMEPDSCH_IDX].iptr; printf("Do CSI-RS %d\n",*GNBParamList.paramarray[i][GNB_DO_CSIRS_IDX].iptr); NRRRC_CONFIGURATION_REQ (msg_p).do_CSIRS = *GNBParamList.paramarray[i][GNB_DO_CSIRS_IDX].iptr; NRRRC_CONFIGURATION_REQ (msg_p).scc = scc; diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index ccab98d63c..4a553378bc 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -119,6 +119,8 @@ typedef enum { #define GNB_CONFIG_STRING_SIB1TDA "sib1_tda" #define GNB_CONFIG_STRING_DOCSIRS "do_CSIRS" #define GNB_CONFIG_STRING_NRCELLID "nr_cellid" +#define GNB_CONFIG_STRING_MINRXTXTIMEPDSCH "min_rxtxtime_pdsch" + /*-----------------------------------------------------------------------------------------------------------------------------------------*/ /* cell configuration parameters */ @@ -145,6 +147,7 @@ typedef enum { {GNB_CONFIG_STRING_SIB1TDA, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_DOCSIRS, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_NRCELLID, NULL, 0, u64ptr:NULL, defint64val:1, TYPE_UINT64, 0}, \ +{GNB_CONFIG_STRING_MINRXTXTIMEPDSCH, NULL, 0, iptr:NULL, defintval:2, TYPE_INT, 0} \ } #define GNB_GNB_ID_IDX 0 @@ -167,6 +170,7 @@ typedef enum { #define GNB_SIB1_TDA_IDX 17 #define GNB_DO_CSIRS_IDX 18 #define GNB_NRCELLID_IDX 19 +#define GNB_MINRXTXTIMEPDSCH_IDX 20 #define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD} #define GNBPARAMS_CHECK { \ diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index a426f8143c..3a5a1b5369 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -1137,14 +1137,17 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr uint8_t feedback_ti = mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0]; - // set the harq status at MAC for feedback - set_harq_status(mac,dci->pucch_resource_indicator, - dci->harq_pid, - dlsch_config_pdu_1_1->accumulated_delta_PUCCH, - feedback_ti, - dci->dai[0].val, - dci_ind->n_CCE,dci_ind->N_CCE, - frame,slot); + AssertFatal(feedback_ti>=DURATION_RX_TO_TX,"PDSCH to HARQ feedback time (%d) cannot be less than DURATION_RX_TO_TX (%d)\n", + feedback_ti,DURATION_RX_TO_TX); + + // set the harq status at MAC for feedback + set_harq_status(mac,dci->pucch_resource_indicator, + dci->harq_pid, + dlsch_config_pdu_1_1->accumulated_delta_PUCCH, + feedback_ti, + dci->dai[0].val, + dci_ind->n_CCE,dci_ind->N_CCE, + frame,slot); dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; LOG_D(MAC,"(nr_ue_procedures.c) pdu_type=%d\n\n",dl_config->dl_config_list[dl_config->number_pdus].pdu_type); diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index c8b412df1f..efdfefd2be 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -449,6 +449,7 @@ typedef struct { int pusch_AntennaPorts; int pusch_TargetSNRx10; int pucch_TargetSNRx10; + int minRXTXTIMEpdsch; int do_CSIRS; NR_BCCH_DL_SCH_Message_t *siblock1; NR_ServingCellConfigCommon_t *servingcellconfigcommon; diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 9465b9b4b0..22109c3029 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -79,6 +79,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco int scg_id, int servCellIndex, int dl_antenna_ports, + int minRXTXTIMEpdsch, int do_csirs, int initial_csi_index, int uid); @@ -90,6 +91,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, int dl_antenna_ports, + int minRXTXTIMEpdsch, int do_csirs, int initial_csi_index, int uid); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 810e83fc43..70a1627e1f 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -331,6 +331,7 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu rrc->carrier.ssb_SubcarrierOffset = configuration->ssb_SubcarrierOffset; rrc->carrier.pdsch_AntennaPorts = configuration->pdsch_AntennaPorts; rrc->carrier.pusch_AntennaPorts = configuration->pusch_AntennaPorts; + rrc->carrier.minRXTXTIMEpdsch = configuration->minRXTXTIMEpdsch; rrc->carrier.sib1_tda = configuration->sib1_tda; rrc->carrier.do_CSIRS = configuration->do_CSIRS; /// System Information INIT diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 167f85ba48..ee36e097ae 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -245,6 +245,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ reconfig_ies, ue_context_p->ue_context.secondaryCellGroup, carrier->pdsch_AntennaPorts, + carrier->minRXTXTIMEpdsch, carrier->do_CSIRS, carrier->initial_csi_index[ue_context_p->local_uid + 1], ue_context_p->local_uid); @@ -254,6 +255,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ reconfig_ies, ue_context_p->ue_context.secondaryCellGroup, carrier->pdsch_AntennaPorts, + carrier->minRXTXTIMEpdsch, carrier->do_CSIRS, carrier->initial_csi_index[ue_context_p->local_uid + 1], ue_context_p->local_uid); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 980bd39c37..4b8fd77dc5 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -55,6 +55,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco int scg_id, int servCellIndex, int dl_antenna_ports, + int minRXTXTIMEpdsch, int do_csirs, int initial_csi_index, int uid) { @@ -945,7 +946,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco long *delay[8]; for (int i=0;i<8;i++) { delay[i] = calloc(1,sizeof(*delay[i])); - *delay[i] = (i<6) ? (i+2) : 0; + *delay[i] = i+minRXTXTIMEpdsch; ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]); } pucch_Config->spatialRelationInfoToAddModList = calloc(1,sizeof(*pucch_Config->spatialRelationInfoToAddModList)); @@ -1348,6 +1349,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, int dl_antenna_ports, + int minRXTXTIMEpdsch, int do_csirs, int initial_csi_index, int uid) { @@ -1363,6 +1365,7 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon 1, 1, dl_antenna_ports, + minRXTXTIMEpdsch, do_csirs, initial_csi_index, uid); From 1022311a8e7960c7c21b94d0b7967230bd8cb90f Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 27 Sep 2021 19:35:34 +0200 Subject: [PATCH 10/16] another fix in acknack scheduling --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index 252144be3b..827d2c6863 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -445,7 +445,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, schedule_nr_prach(module_idP, f, s); } - // This schedule SR + // This schedule SR nr_sr_reporting(module_idP, frame, slot); // Schedule CSI-RS transmission diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 5a61e7973a..d5e51d2a0d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1289,8 +1289,10 @@ int nr_acknack_scheduling(int mod_id, LOG_D(NR_MAC,"pucch_acknak : %d.%d DAI = 0, looking for new pucch occasion\n",frame,slot); /* we need to find a new PUCCH occasion */ - /*Inizialization of timing information*/ - if (pucch->frame == 0 && pucch->ul_slot == 0) { + /*(Re)Inizialization of timing information*/ + if ((pucch->frame == 0 && pucch->ul_slot == 0) || + ((pucch->frame*n_slots_frame + pucch->ul_slot) < + (frame*n_slots_frame + slot))) { AssertFatal(pucch->sr_flag + pucch->dai_c == 0, "expected no SR/AckNack for UE %d in %4d.%2d, but has %d/%d for %4d.%2d\n", UE_id, frame, slot, pucch->sr_flag, pucch->dai_c, pucch->frame, pucch->ul_slot); @@ -1364,7 +1366,6 @@ int nr_acknack_scheduling(int mod_id, } // multiplexing harq and csi in a pucch else { - memset(pucch, 0, sizeof(*pucch)); csi_pucch->timing_indicator = ind_found; csi_pucch->dai_c++; return 1; From df4a57096bcbccde41fd276e29577c8a3f803d1f Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 28 Sep 2021 11:28:14 +0200 Subject: [PATCH 11/16] dlsim fix --- openair1/PHY/NR_TRANSPORT/nr_dci.c | 2 +- openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 54e6b2ac79..4325543865 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -133,7 +133,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, 0,NULL); polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, n_RNTI,1,currentPtr); #ifdef DEBUG_CHANNEL_CODING - printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]); + printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,pdcch_pdu_rel15->dci_pdu->AggregationLevel); printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n", ((uint64_t*)dci_pdu->Payload)[0], ((uint64_t*)dci_pdu->Payload)[1]); printf("Encoded Payload (length:%d dwords):\n", encoded_length>>5); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 8938cfb0e6..e9af18e583 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -761,7 +761,7 @@ int main(int argc, char **argv) prepare_scd(scd); - fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 2, 0, 0, 0); + fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 6, 0, 0, 0); /* RRC parameter validation for secondaryCellGroup */ fix_scd(scd); From 485acb4ffafb5aeafdaf1bce69a4546677382d1d Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 29 Sep 2021 10:55:59 +0200 Subject: [PATCH 12/16] changes in ci config files --- .../conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf | 9 +++++---- .../conf_files/gnb.band78.tm1.106PRB.usrpn300.conf | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf index db190f177d..e227c4ba39 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -32,9 +32,10 @@ gNBs = ////////// Physical parameters: - ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + min_rxtxtime_pdsch = 6; pdcch_ConfigSIB1 = ( { @@ -142,7 +143,7 @@ gNBs = initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - initialULBWPstartSymbolAndLength_1 = 52; # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_1 = 38; # this is SS=10 L=3 initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index 8d32e8b792..e83111c96c 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -21,9 +21,10 @@ gNBs = ////////// Physical parameters: - ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + min_rxtxtime_pdsch = 6; servingCellConfigCommon = ( { @@ -124,7 +125,7 @@ gNBs = initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 + initialULBWPstartSymbolAndLength_1 = 38; # this is SS=10 L=3 initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; From 0141ae6137c70eb4d2a43d2f70c7220a0e78d892 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 18 Oct 2021 08:51:35 +0000 Subject: [PATCH 13/16] review improvement --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index d5e51d2a0d..e37b20983f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1170,7 +1170,7 @@ int nr_acknack_scheduling(int mod_id, const int nr_mix_slots = tdd->nrofDownlinkSymbols != 0 || tdd->nrofUplinkSymbols != 0; const int nr_slots_period = tdd->nrofDownlinkSlots + tdd->nrofUplinkSlots + nr_mix_slots; const int first_ul_slot_tdd = tdd->nrofDownlinkSlots + nr_slots_period * (slot / nr_slots_period); - const int first_ul_slot_period = first_ul_slot_tdd%nr_slots_period; + const int first_ul_slot_period = tdd->nrofDownlinkSlots; const int CC_id = 0; NR_sched_pucch_t *csi_pucch; From 1e99bbdc6e034241a1d9c1fe22d03a23c0d54b0e Mon Sep 17 00:00:00 2001 From: Francesco Mani Date: Mon, 18 Oct 2021 09:42:09 +0000 Subject: [PATCH 14/16] fix review --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index e37b20983f..fb2e593685 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1247,8 +1247,7 @@ int nr_acknack_scheduling(int mod_id, int max_fb_time = 0; get_pdsch_to_harq_feedback(mod_id, UE_id, bwp_Id, ss_type, &max_fb_time, pdsch_to_harq_feedback); - int max_absslot = frame*n_slots_frame + slot + max_fb_time; - + LOG_D(NR_MAC,"pucch_acknak 1b. DL %d.%d, UL_ACK %d.%d, DAI_C %d\n",frame,slot,pucch->frame,pucch->ul_slot,pucch->dai_c); /* there is a HARQ. Check whether we can use it for this ACKNACK */ if (pucch->dai_c > 0) { @@ -1303,7 +1302,7 @@ int nr_acknack_scheduling(int mod_id, // Find the right timing_indicator value. int ind_found = -1; // while we are within the feedback limits - while ((pucch->frame*n_slots_frame + pucch->ul_slot) <= max_absslot) { + while ((n_slots_frame + pucch->ul_slot - slot) % n_slots_frame <= max_fb_time) { int i = 0; while (i < 8) { LOG_D(NR_MAC,"pdsch_to_harq_feedback[%d] = %d (pucch->ul_slot %d - slot %d)\n", From 7b54ee312e91b7e71a6c37a72aca857e9d7f94c4 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 18 Oct 2021 09:46:00 +0000 Subject: [PATCH 15/16] Another review fix --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index fb2e593685..b33e9dfbb0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1219,11 +1219,11 @@ int nr_acknack_scheduling(int mod_id, && !csi_pucch->simultaneous_harqcsi) { nr_fill_nfapi_pucch(mod_id, frame, slot, csi_pucch, UE_id); memset(csi_pucch, 0, sizeof(*csi_pucch)); - pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; - if(((s + 1)%nr_slots_period) == 0) - pucch->ul_slot = (s + 1 + first_ul_slot_period) % n_slots_frame; + pucch->frame = pucch->ul_slot == n_slots_frame - 1 ? (pucch->frame + 1) % 1024 : pucch->frame; + if(((pucch->ul_slot + 1)%nr_slots_period) == 0) + pucch->ul_slot = (pucch->ul_slot + 1 + first_ul_slot_period) % n_slots_frame; else - pucch->ul_slot = (s + 1) % n_slots_frame; + pucch->ul_slot = (pucch->ul_slot + 1) % n_slots_frame; } } From facf3aa6ac83f580c9f39e04997efb0c8ae31bd0 Mon Sep 17 00:00:00 2001 From: francescomani Date: Fri, 29 Oct 2021 11:05:52 +0200 Subject: [PATCH 16/16] min_rxtxtime_pdsch for OAI UE in ci files --- ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf | 1 + ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf | 1 + 2 files changed, 2 insertions(+) diff --git a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf index 0e503188c5..4292504af2 100644 --- a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf @@ -24,6 +24,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; + min_rxtxtime_pdsch = 6; servingCellConfigCommon = ( { diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf index e73192b4d8..d4ec87c652 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -35,6 +35,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; + min_rxtxtime_pdsch = 6; ul_prbblacklist = "51,52,53,54" pdcch_ConfigSIB1 = (