mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 12:40:28 +00:00
Compare commits
2 Commits
beam-api-b
...
multi-rach
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ff4e11fdf | ||
|
|
e415fa5046 |
@@ -77,7 +77,7 @@
|
||||
#else
|
||||
#define MAX_MOBILES_PER_ENB 4
|
||||
#define MAX_MOBILES_PER_ENB_NB_IoT 4
|
||||
#define MAX_MOBILES_PER_GNB 2//16
|
||||
#define MAX_MOBILES_PER_GNB 4//16
|
||||
#define MAX_eNB 2
|
||||
#define MAX_gNB 2
|
||||
#endif
|
||||
|
||||
@@ -30,9 +30,6 @@
|
||||
* \warning
|
||||
*/
|
||||
|
||||
/* Tools */
|
||||
#include "SIMULATION/TOOLS/sim.h" // for taus
|
||||
|
||||
/* RRC */
|
||||
#include "NR_RACH-ConfigCommon.h"
|
||||
#include "RRC/NR_UE/rrc_proto.h"
|
||||
@@ -245,6 +242,10 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t
|
||||
int PLThreshold = 0;
|
||||
long deltaPreamble_Msg3 = 0;
|
||||
uint8_t noGroupB = 0;
|
||||
// Random seed generation
|
||||
long long tmp = rdtsc_oai();
|
||||
unsigned short int *seed = (unsigned short int*)&tmp;
|
||||
|
||||
RA_config_t *ra = &mac->ra;
|
||||
NR_RACH_ConfigCommon_t *setup;
|
||||
if (mac->scc) setup = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
|
||||
@@ -343,28 +344,28 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t
|
||||
if(ra->ra_PreambleIndex < 0 || ra->ra_PreambleIndex > 63) {
|
||||
if (noGroupB) {
|
||||
// use Group A preamble
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb);
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + (nrand48(seed) % ra->cb_preambles_per_ssb);
|
||||
ra->RA_usedGroupA = 1;
|
||||
} else if ((ra->Msg3_size < messageSizeGroupA) && (dl_pathloss > PLThreshold)) {
|
||||
// Group B is configured and RA preamble Group A is used
|
||||
// - todo add condition on CCCH_sdu_size for initiation by CCCH
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA);
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + (nrand48(seed) % sizeOfRA_PreamblesGroupA);
|
||||
ra->RA_usedGroupA = 1;
|
||||
} else {
|
||||
// Group B preamble is configured and used
|
||||
// the first sizeOfRA_PreamblesGroupA RA preambles belong to RA Preambles Group A
|
||||
// the remaining belong to RA Preambles Group B
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA));
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + (nrand48(seed) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA));
|
||||
ra->RA_usedGroupA = 0;
|
||||
}
|
||||
}
|
||||
} else { // Msg3 is being retransmitted
|
||||
if (ra->RA_usedGroupA && noGroupB) {
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb);
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + (nrand48(seed) % ra->cb_preambles_per_ssb);
|
||||
} else if (ra->RA_usedGroupA && !noGroupB){
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA);
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + (nrand48(seed) % sizeOfRA_PreamblesGroupA);
|
||||
} else {
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA));
|
||||
ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + (nrand48(seed) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA));
|
||||
}
|
||||
}
|
||||
prach_resources->ra_PreambleIndex = ra->ra_PreambleIndex;
|
||||
@@ -802,6 +803,9 @@ void nr_ra_failed(uint8_t mod_id, uint8_t CC_id, NR_PRACH_RESOURCES_t *prach_res
|
||||
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
|
||||
RA_config_t *ra = &mac->ra;
|
||||
// Random seed generation
|
||||
long long tmp = rdtsc_oai();
|
||||
unsigned short int *seed = (unsigned short int*)&tmp;
|
||||
|
||||
ra->first_Msg3 = 1;
|
||||
ra->ra_PreambleIndex = -1;
|
||||
@@ -815,7 +819,7 @@ void nr_ra_failed(uint8_t mod_id, uint8_t CC_id, NR_PRACH_RESOURCES_t *prach_res
|
||||
LOG_D(MAC, "In %s: [UE %d][%d.%d] Maximum number of RACH attempts (%d) reached, selecting backoff time...\n",
|
||||
__FUNCTION__, mod_id, frame, slot, ra->preambleTransMax);
|
||||
|
||||
ra->RA_backoff_cnt = rand() % (prach_resources->RA_PREAMBLE_BACKOFF + 1);
|
||||
ra->RA_backoff_cnt = nrand48(seed) % (prach_resources->RA_PREAMBLE_BACKOFF + 1);
|
||||
prach_resources->RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
|
||||
prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP += 2; // 2 dB increment
|
||||
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = nr_get_Po_NOMINAL_PUSCH(prach_resources, mod_id, CC_id);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
@@ -391,14 +391,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;
|
||||
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 = loop_dcch_dtch;
|
||||
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,
|
||||
@@ -413,25 +413,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1098,7 +1098,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;
|
||||
|
||||
@@ -1842,6 +1842,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;
|
||||
|
||||
@@ -640,6 +640,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);
|
||||
|
||||
Reference in New Issue
Block a user