Commit 82e6d04e authored by Mario Joa-Ng's avatar Mario Joa-Ng Committed by Melissa Elkadi

fix bugs in GNB MAC nr_store_dlsch_buffer()

This commit is to handle multipe UE correctly.
Right now UE #1 and UE #2 can both ping google.
parent a34856ba
......@@ -56,7 +56,7 @@
#define HALFWORD 16
#define WORD 32
//#define SIZE_OF_POINTER sizeof (void *)
static int loop_dcch_dtch = DL_SCH_LCID_DTCH;
//static int loop_dcch_dtch = DL_SCH_LCID_DTCH;
void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t *bwp)
{
......@@ -394,14 +394,14 @@ void nr_store_dlsch_buffer(module_id_t module_id,
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
sched_ctrl->num_total_bytes = 0;
if ((sched_ctrl->lcid_mask&(1<<4)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DCCH1)
loop_dcch_dtch = DL_SCH_LCID_DTCH;
else if ((sched_ctrl->lcid_mask&(1<<1)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DTCH)
loop_dcch_dtch = DL_SCH_LCID_DCCH;
else if ((sched_ctrl->lcid_mask&(1<<2)) > 0 && loop_dcch_dtch == DL_SCH_LCID_DCCH)
loop_dcch_dtch = DL_SCH_LCID_DCCH1;
const int lcid = loop_dcch_dtch;
if ((sched_ctrl->lcid_mask&(1<<4)) > 0 && UE_info->loop_dcch_dtch[UE_id] == DL_SCH_LCID_DCCH1)
UE_info->loop_dcch_dtch[UE_id] = DL_SCH_LCID_DTCH;
else if ((sched_ctrl->lcid_mask&(1<<1)) > 0 && UE_info->loop_dcch_dtch[UE_id] == DL_SCH_LCID_DTCH)
UE_info->loop_dcch_dtch[UE_id] = DL_SCH_LCID_DCCH;
else if ((sched_ctrl->lcid_mask&(1<<2)) > 0 && UE_info->loop_dcch_dtch[UE_id] == DL_SCH_LCID_DCCH)
UE_info->loop_dcch_dtch[UE_id] = DL_SCH_LCID_DCCH1;
const int lcid = UE_info->loop_dcch_dtch[UE_id];
// const int lcid = DL_SCH_LCID_DTCH;
const uint16_t rnti = UE_info->rnti[UE_id];
sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id,
......@@ -416,25 +416,25 @@ void nr_store_dlsch_buffer(module_id_t module_id,
0);
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
LOG_D(NR_MAC,
"%d.%d, LCID%d:->DLSCH, RLC status %d bytes. \n",
"%d.%d, LCID%d:->DLSCH, RLC status %d bytes. sched_ctrl %p RC %p module_id %d UE_info %p UE_id %d \n",
frame,
slot,
lcid,
sched_ctrl->num_total_bytes);
sched_ctrl->num_total_bytes, sched_ctrl, &RC, module_id, UE_info, UE_id);
if (sched_ctrl->num_total_bytes == 0
&& !sched_ctrl->ta_apply) /* If TA should be applied, give at least one RB */
return;
continue;
LOG_D(NR_MAC,
"[%s][%d.%d], %s%d->DLSCH, RLC status %d bytes TA %d\n",
"[%s][%d.%d], %s%d->DLSCH, RLC status %d bytes TA %d sched_ctrl %p UE_id %d\n",
__func__,
frame,
slot,
lcid<4?"DCCH":"DTCH",
lcid,
sched_ctrl->rlc_status[lcid].bytes_in_buffer,
sched_ctrl->ta_apply);
sched_ctrl->ta_apply, sched_ctrl, UE_id);
}
}
......@@ -1109,7 +1109,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
/* next, get RLC data */
// const int lcid = DL_SCH_LCID_DTCH;
const int lcid = loop_dcch_dtch;
const int lcid = UE_info->loop_dcch_dtch[UE_id];
int dlsch_total_bytes = 0;
if (sched_ctrl->num_total_bytes > 0) {
tbs_size_t len = 0;
......
......@@ -1830,6 +1830,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG
int UE_id = i;
UE_info->num_UEs++;
UE_info->active[UE_id] = true;
UE_info->loop_dcch_dtch[UE_id] = DL_SCH_LCID_DTCH;
if (CellGroup) UE_info->Msg4_ACKed[UE_id] = true;
else UE_info->Msg4_ACKed[UE_id] = false;
UE_info->rnti[UE_id] = rntiP;
......
......@@ -639,6 +639,7 @@ typedef struct {
// UE selected beam index
uint8_t UE_beam_index[MAX_MOBILES_PER_GNB];
bool Msg4_ACKed[MAX_MOBILES_PER_GNB];
int loop_dcch_dtch[MAX_MOBILES_PER_GNB];
} NR_UE_info_t;
typedef void (*nr_pp_impl_dl)(module_id_t mod_id,
......
......@@ -72,6 +72,8 @@
#include "NR_RRCReestablishmentRequest.h"
#include "NR_UE-CapabilityRequestFilterNR.h"
#include "PHY/defs_nr_common.h"
#include "common/utils/nr/nr_common.h"
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac.h"
#if defined(NR_Rel16)
#include "NR_SCS-SpecificCarrier.h"
#include "NR_TDD-UL-DL-ConfigCommon.h"
......@@ -980,7 +982,7 @@ uint8_t do_RRCReject(uint8_t Mod_id,
void fill_initial_SpCellConfig(rnti_t rnti,
NR_SpCellConfig_t *SpCellConfig,
NR_ServingCellConfigCommon_t *scc) {
int curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,MAX_BWP_SIZE);
SpCellConfig->servCellIndex = NULL;
SpCellConfig->reconfigurationWithSync = NULL;
SpCellConfig->rlmInSyncOutOfSyncThreshold = NULL;
......@@ -1009,7 +1011,9 @@ void fill_initial_SpCellConfig(rnti_t rnti,
// one symbol (13)
NR_PUCCH_Resource_t *pucchres0=calloc(1,sizeof(*pucchres0));
pucchres0->pucch_ResourceId=0;
pucchres0->startingPRB=0;
//pucchres0->startingPRB=0;
pucchres0->startingPRB=(8+rnti) % curr_bwp;
LOG_D(NR_RRC, "pucchres0->startPRB %ld rnti %d curr_bwp %d\n", pucchres0->startingPRB, rnti, curr_bwp);
pucchres0->intraSlotFrequencyHopping=NULL;
pucchres0->secondHopPRB=NULL;
pucchres0->format.present= NR_PUCCH_Resource__format_PR_format0;
......@@ -1053,7 +1057,7 @@ void fill_initial_SpCellConfig(rnti_t rnti,
ss2->searchSpaceId=2;
ss2->controlResourceSetId=calloc(1,sizeof(*ss2->controlResourceSetId));
*ss2->controlResourceSetId=0;
*ss2->controlResourceSetId=1;
ss2->monitoringSlotPeriodicityAndOffset=calloc(1,sizeof(*ss2->monitoringSlotPeriodicityAndOffset));
ss2->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
ss2->monitoringSlotPeriodicityAndOffset->choice.sl1=(NULL_t)0;
......@@ -1073,7 +1077,7 @@ void fill_initial_SpCellConfig(rnti_t rnti,
ss2->searchSpaceType=calloc(1,sizeof(*ss2->searchSpaceType));
ss2->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
ss2->searchSpaceType->choice.ue_Specific = calloc(1,sizeof(*ss2->searchSpaceType->choice.ue_Specific));
ss2->searchSpaceType->choice.ue_Specific->dci_Formats=NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_0_And_1_0;
ss2->searchSpaceType->choice.ue_Specific->dci_Formats=NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1;
ASN_SEQUENCE_ADD(&bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list,
ss2);
......
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