merge develop
This commit is contained in:
@@ -708,12 +708,12 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
uint16_t msi_control_element[29], *msi_ptr;
|
||||
// MSI buffer pointer
|
||||
char *buffer_pointer=NULL;
|
||||
if (msi_flag == 1) {
|
||||
// Create MSI here
|
||||
msi_ptr = &msi_control_element[0];
|
||||
if (msi_flag == 1 && cc->mbms_SessionList) {
|
||||
// Create MSI here
|
||||
msi_ptr = &msi_control_element[0];
|
||||
|
||||
//Header for MTCHs
|
||||
num_mtch = cc->mbms_SessionList[mbms_mch_i]->list.count;
|
||||
// Header for MTCHs
|
||||
num_mtch = cc->mbms_SessionList[mbms_mch_i]->list.count;
|
||||
|
||||
TBS =
|
||||
get_TBS_DL(cc->MCH_pdu.mcs, to_prb(cc->mib->message.dl_Bandwidth));
|
||||
@@ -867,52 +867,63 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
//if ((i == 0) && ((RC.mac[module_idP]->MBMS_flag != multicast_relay) || (RC.mac[module_idP]->mcch_active==0))) {
|
||||
|
||||
// there is MTCHs, loop if there are more than 1
|
||||
if (mtch_flag == 1 ) {
|
||||
// Calculate TBS
|
||||
// get MTCH data from RLC (like for DTCH)
|
||||
LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframeP %d: Schedule MTCH (area %d, sfAlloc %d)\n",
|
||||
module_idP, CC_id, frameP, subframeP, i, j);
|
||||
// BAd race condition: all this struct is filled by another thread, no mutex or any code to make it coherent
|
||||
if (mtch_flag == 1 && cc->mbms_SessionList && cc->mbms_SessionList[0] && cc->mbms_SessionList[0]->list.array[0]) {
|
||||
// Calculate TBS
|
||||
// get MTCH data from RLC (like for DTCH)
|
||||
LOG_D(MAC, "[eNB %d] CC_id %d Frame %d subframeP %d: Schedule MTCH (area %d, sfAlloc %d)\n", module_idP, CC_id, frameP, subframeP, i, j);
|
||||
|
||||
header_len_mtch = 3;
|
||||
LOG_D(MAC,"[eNB %d], CC_id %d, Frame %d, MTCH->MCH, Checking RLC status (rab %d, tbs %d, len %d)\n",
|
||||
module_idP, CC_id, frameP, MTCH, TBS,
|
||||
TBS - header_len_mcch - header_len_msi - sdu_length_total -
|
||||
header_len_mtch);
|
||||
header_len_mtch = 3;
|
||||
LOG_D(MAC,
|
||||
"[eNB %d], CC_id %d, Frame %d, MTCH->MCH, Checking RLC status (rab %d, tbs %d, len %d)\n",
|
||||
module_idP,
|
||||
CC_id,
|
||||
frameP,
|
||||
MTCH,
|
||||
TBS,
|
||||
TBS - header_len_mcch - header_len_msi - sdu_length_total - header_len_mtch);
|
||||
|
||||
//TODO
|
||||
mbms_rab_id = cc->mbms_SessionList[0/*mbms_mch_i*/]->list.array[0]->logicalChannelIdentity_r9;
|
||||
// TODO
|
||||
mbms_rab_id = cc->mbms_SessionList[0 /*mbms_mch_i*/]->list.array[0]->logicalChannelIdentity_r9;
|
||||
|
||||
rlc_status =
|
||||
mac_rlc_status_ind(module_idP, 0xfffd, frameP, subframeP,
|
||||
module_idP, ENB_FLAG_YES, MBMS_FLAG_YES,
|
||||
cc->mbms_SessionList[mbms_mch_i]->list.array[0]->logicalChannelIdentity_r9,
|
||||
//MTCH,
|
||||
0, 0
|
||||
);
|
||||
rlc_status = mac_rlc_status_ind(module_idP,
|
||||
0xfffd,
|
||||
frameP,
|
||||
subframeP,
|
||||
module_idP,
|
||||
ENB_FLAG_YES,
|
||||
MBMS_FLAG_YES,
|
||||
cc->mbms_SessionList[mbms_mch_i]->list.array[0]->logicalChannelIdentity_r9,
|
||||
// MTCH,
|
||||
0,
|
||||
0);
|
||||
|
||||
bytes_in_buffer = rlc_status.bytes_in_buffer;
|
||||
bytes_in_buffer = rlc_status.bytes_in_buffer;
|
||||
|
||||
//TOCHECK is this really neede?
|
||||
if( !(mcch_flag==1 || msi_flag==1) )
|
||||
msi_sfs = rlc_status.bytes_in_buffer/(TBS- header_len_mcch - header_len_msi -sdu_length_total - header_len_mtch)+(rlc_status.bytes_in_buffer%(TBS- header_len_mcch - header_len_msi -sdu_length_total - header_len_mtch)?1:0);
|
||||
// TOCHECK is this really neede?
|
||||
if (!(mcch_flag == 1 || msi_flag == 1))
|
||||
msi_sfs = rlc_status.bytes_in_buffer / (TBS - header_len_mcch - header_len_msi - sdu_length_total - header_len_mtch)
|
||||
+ (rlc_status.bytes_in_buffer % (TBS - header_len_mcch - header_len_msi - sdu_length_total - header_len_mtch) ? 1 : 0);
|
||||
|
||||
uint16_t TBS_MTCH =
|
||||
get_TBS_DL(cc->pmch_Config[mbms_mch_i]->dataMCS_r9, to_prb(cc->mib->message.dl_Bandwidth));
|
||||
uint16_t TBS_MTCH = get_TBS_DL(cc->pmch_Config[mbms_mch_i]->dataMCS_r9, to_prb(cc->mib->message.dl_Bandwidth));
|
||||
|
||||
if(msi_flag==1 && buffer_pointer!=NULL){
|
||||
// msi_ptr = &msi_control_element[0];
|
||||
if (msi_flag == 1 && buffer_pointer != NULL) {
|
||||
// msi_ptr = &msi_control_element[0];
|
||||
|
||||
msi_pmch_stop = (rlc_status.bytes_in_buffer - header_len_mcch - header_len_msi -sdu_length_total - header_len_mtch)/(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)+((rlc_status.bytes_in_buffer-TBS-header_len_mcch - header_len_msi -sdu_length_total)%(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)?0:0);
|
||||
msi_pmch_stop =
|
||||
(rlc_status.bytes_in_buffer - header_len_mcch - header_len_msi - sdu_length_total - header_len_mtch) / (TBS_MTCH /*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)
|
||||
+ ((rlc_status.bytes_in_buffer - TBS - header_len_mcch - header_len_msi - sdu_length_total) % (TBS_MTCH /*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch) ? 0
|
||||
: 0);
|
||||
|
||||
for (k = 0; k < num_mtch; k++) { // loop for all session in this MCH (MCH[0]) at this moment
|
||||
msi_ptr = &msi_control_element[k];
|
||||
for (k = 0; k < num_mtch; k++) { // loop for all session in this MCH (MCH[0]) at this moment
|
||||
msi_ptr = &msi_control_element[k];
|
||||
|
||||
((MSI_ELEMENT *) msi_ptr)->lcid = cc->mbms_SessionList[mbms_mch_i]->list.array[k]->logicalChannelIdentity_r9; //mtch_lcid;
|
||||
((MSI_ELEMENT *)msi_ptr)->lcid = cc->mbms_SessionList[mbms_mch_i]->list.array[k]->logicalChannelIdentity_r9; // mtch_lcid;
|
||||
|
||||
if( msi_pmch_stop > cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9)
|
||||
LOG_E(MAC,"e-MBMS Buffer Overflow\n");
|
||||
if (msi_pmch_stop > cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9)
|
||||
LOG_E(MAC, "e-MBMS Buffer Overflow\n");
|
||||
|
||||
if(msi_pmch_stop>=num_sf_alloc /*&& msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9*/) {
|
||||
if (msi_pmch_stop >= num_sf_alloc /*&& msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9*/) {
|
||||
((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = (((msi_pmch_stop <=cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9) >> 8) & 0x7f);
|
||||
((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = ((msi_pmch_stop <=cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9) & 0xff);
|
||||
msi_pmch_stop = (msi_pmch_stop <=cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9);
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
#include "PHY/defs_common.h" // for PRACH_RESOURCES_t
|
||||
#include "PHY/LTE_TRANSPORT/transport_common.h"
|
||||
|
||||
#include "targets/ARCH/COMMON/common_lib.h"
|
||||
#include "sdr/COMMON/common_lib.h"
|
||||
|
||||
/** @defgroup _mac MAC
|
||||
* @ingroup _oai2
|
||||
|
||||
@@ -1962,7 +1962,7 @@ void get_delta_arfcn(int i, uint32_t nrarfcn, uint64_t N_OFFs){
|
||||
uint32_t delta_arfcn = nrarfcn - N_OFFs;
|
||||
|
||||
if(delta_arfcn%(nr_bandtable[i].step_size)!=0)
|
||||
AssertFatal(1 == 0, "nrarfcn %u is not on the channel raster for step size %lu", nrarfcn, nr_bandtable[i].step_size);
|
||||
AssertFatal(1==0, "nrarfcn %u is not on the channel raster for step size %lu", nrarfcn, nr_bandtable[i].step_size);
|
||||
|
||||
}
|
||||
|
||||
@@ -1982,10 +1982,10 @@ uint32_t to_nrarfcn(int nr_bandP,
|
||||
"Band %d, bw %u : DL carrier frequency %llu kHz < %llu\n",
|
||||
nr_bandP, bw, (long long unsigned int)dl_CarrierFreq_by_1k,
|
||||
(long long unsigned int)nr_bandtable[i].dl_min);
|
||||
AssertFatal(dl_CarrierFreq_by_1k <= (nr_bandtable[i].dl_max - bw_kHz),
|
||||
AssertFatal(dl_CarrierFreq_by_1k <= (nr_bandtable[i].dl_max - bw_kHz/2),
|
||||
"Band %d, dl_CarrierFreq %llu bw %u: DL carrier frequency %llu kHz > %llu\n",
|
||||
nr_bandP, (long long unsigned int)dl_CarrierFreq,bw, (long long unsigned int)dl_CarrierFreq_by_1k,
|
||||
(long long unsigned int)(nr_bandtable[i].dl_max - bw_kHz));
|
||||
(long long unsigned int)(nr_bandtable[i].dl_max - bw_kHz/2));
|
||||
|
||||
int deltaFglobal = 60;
|
||||
uint32_t N_REF_Offs = 2016667;
|
||||
@@ -2005,7 +2005,7 @@ uint32_t to_nrarfcn(int nr_bandP,
|
||||
// This is equation before Table 5.4.2.1-1 in 38101-1-f30
|
||||
// F_REF=F_REF_Offs + deltaF_Global(N_REF-NREF_REF_Offs)
|
||||
nrarfcn = (((dl_CarrierFreq_by_1k - F_REF_Offs_khz)/deltaFglobal)+N_REF_Offs);
|
||||
get_delta_arfcn(i, nrarfcn, nr_bandtable[i].N_OFFs_DL);
|
||||
//get_delta_arfcn(i, nrarfcn, nr_bandtable[i].N_OFFs_DL);
|
||||
|
||||
return nrarfcn;
|
||||
}
|
||||
@@ -3155,26 +3155,28 @@ int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, sl
|
||||
else return(slot_in_period >= slots1+tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0);
|
||||
}
|
||||
|
||||
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols, int startSymbol, int mappingtype_fromDCI, int length) {
|
||||
int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols, int startSymbol, mappingType_t mappingtype, int length) {
|
||||
|
||||
int l0;int dmrs_AdditionalPosition = 0;
|
||||
int dmrs_AdditionalPosition = 0;
|
||||
NR_DMRS_DownlinkConfig_t *dmrs_config = NULL;
|
||||
|
||||
LOG_D(MAC, "NrofSymbols:%d, startSymbol:%d, mappingtype:%d, dmrs_TypeA_Position:%d\n", NrOfSymbols, startSymbol, mappingtype_fromDCI, dmrs_TypeA_Position);
|
||||
|
||||
if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos2) l0=2;
|
||||
else if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos3) l0=3;
|
||||
else AssertFatal(1==0,"Illegal dmrs_TypeA_Position %d\n",(int)dmrs_TypeA_Position);
|
||||
LOG_D(MAC, "NrofSymbols:%d, startSymbol:%d, mappingtype:%d, dmrs_TypeA_Position:%d\n", NrOfSymbols, startSymbol, mappingtype, dmrs_TypeA_Position);
|
||||
|
||||
int l0 = 0; // type B
|
||||
if (mappingtype == typeA) {
|
||||
if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos2) l0=2;
|
||||
else if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos3) l0=3;
|
||||
else AssertFatal(1==0,"Illegal dmrs_TypeA_Position %d\n",(int)dmrs_TypeA_Position);
|
||||
}
|
||||
// in case of DCI FORMAT 1_0 or dedicated pdsch config not received additionposition = pos2, len1 should be used
|
||||
// referred to section 5.1.6.2 in 38.214
|
||||
dmrs_AdditionalPosition = 2;
|
||||
|
||||
if (pdsch_Config != NULL) {
|
||||
if (mappingtype_fromDCI == typeA) { // Type A
|
||||
if (mappingtype == typeA) { // Type A
|
||||
if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA && pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup)
|
||||
dmrs_config = (NR_DMRS_DownlinkConfig_t *)pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup;
|
||||
} else if (mappingtype_fromDCI == typeB) {
|
||||
} else if (mappingtype == typeB) {
|
||||
if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB && pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup)
|
||||
dmrs_config = (NR_DMRS_DownlinkConfig_t *)pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup;
|
||||
} else {
|
||||
@@ -3191,17 +3193,17 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i
|
||||
int32_t l_prime = -1;
|
||||
|
||||
// columns 0-3 for TypeA, 4-7 for TypeB
|
||||
column = (mappingtype_fromDCI == typeA) ? dmrs_AdditionalPosition : (dmrs_AdditionalPosition + 4);
|
||||
column = (mappingtype == typeA) ? dmrs_AdditionalPosition : (dmrs_AdditionalPosition + 4);
|
||||
|
||||
// Section 7.4.1.1.2 in Spec 38.211
|
||||
// For PDSCH Mapping TypeA, ld is duration between first OFDM of the slot and last OFDM symbol of the scheduled PDSCH resources
|
||||
// For TypeB, ld is the duration of the scheduled PDSCH resources
|
||||
ld = (mappingtype_fromDCI == typeA) ? (NrOfSymbols + startSymbol) : NrOfSymbols;
|
||||
ld = (mappingtype == typeA) ? (NrOfSymbols + startSymbol) : NrOfSymbols;
|
||||
|
||||
AssertFatal(ld > 2 && ld < 15,"Illegal NrOfSymbols according to Table 5.1.2.1-1 Spec 38.214 %d\n",ld);
|
||||
AssertFatal((NrOfSymbols + startSymbol) < 15,"Illegal S+L according to Table 5.1.2.1-1 Spec 38.214 S:%d L:%d\n",startSymbol, NrOfSymbols);
|
||||
|
||||
if (mappingtype_fromDCI == typeA) {
|
||||
if (mappingtype == typeA) {
|
||||
|
||||
// Section 7.4.1.1.2 in Spec 38.211
|
||||
AssertFatal((l0 == 2) || (l0 == 3 && dmrs_AdditionalPosition != 3),"Wrong config, If dmrs_TypeA_Position POS3, ADD POS cannot be POS3 \n");
|
||||
@@ -3229,7 +3231,7 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i
|
||||
LOG_D(MAC, "l0:%d, ld:%d,row:%d, column:%d, addpos:%d, maxlen:%d\n", l0, ld, row, column, dmrs_AdditionalPosition, length);
|
||||
AssertFatal(l_prime>=0,"ERROR in configuration.Check Time Domain allocation of this Grant. l_prime < 1. row:%d, column:%d\n", row, column);
|
||||
|
||||
l_prime = (mappingtype_fromDCI == typeA) ? (l_prime | l0) : (l_prime << startSymbol);
|
||||
l_prime = (mappingtype == typeA) ? (l_prime | l0) : (l_prime << startSymbol);
|
||||
LOG_D(MAC, " PDSCH DMRS MASK in HEX:%x\n", l_prime);
|
||||
|
||||
return l_prime;
|
||||
|
||||
@@ -38,6 +38,18 @@
|
||||
#include "openair1/PHY/impl_defs_nr.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
|
||||
typedef enum {
|
||||
pusch_dmrs_pos0 = 0,
|
||||
pusch_dmrs_pos1 = 1,
|
||||
pusch_dmrs_pos2 = 2,
|
||||
pusch_dmrs_pos3 = 3,
|
||||
} pusch_dmrs_AdditionalPosition_t;
|
||||
|
||||
typedef enum {
|
||||
typeA = 0,
|
||||
typeB = 1
|
||||
} mappingType_t;
|
||||
|
||||
uint32_t get_Y(NR_SearchSpace_t *ss, int slot, rnti_t rnti);
|
||||
|
||||
uint8_t get_BG(uint32_t A, uint16_t R);
|
||||
@@ -46,7 +58,7 @@ uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
|
||||
|
||||
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw);
|
||||
|
||||
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,int mappingtype_fromDCI,int length);
|
||||
int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,mappingType_t mappingtype,int length);
|
||||
|
||||
int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slot_t slotP);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
//#include "defs.h"
|
||||
#include "mac_proto.h"
|
||||
#include "../../ARCH/COMMON/common_lib.h"
|
||||
#include "sdr/COMMON/common_lib.h"
|
||||
//#undef MALLOC
|
||||
#include "assertions.h"
|
||||
#include "PHY/types.h"
|
||||
|
||||
@@ -512,6 +512,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
int nr_dl_slots = n;
|
||||
int nr_ulstart_slot = 0;
|
||||
if (tdd) {
|
||||
nr_ulstart_slot = tdd->nrofDownlinkSlots + (tdd->nrofUplinkSymbols == 0);
|
||||
nr_dl_slots = tdd->nrofDownlinkSlots + (tdd->nrofDownlinkSymbols != 0);
|
||||
nr_ulstart_slot = tdd->nrofDownlinkSlots + (tdd->nrofUplinkSymbols == 0);
|
||||
nr_slots_period /= get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity);
|
||||
|
||||
@@ -181,8 +181,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
|
||||
|
||||
if ((slot == 0) && (frame & 127) == 0) {
|
||||
char stats_output[16384];
|
||||
stats_output[0] = '\0';
|
||||
char stats_output[16000] = {0};
|
||||
dump_mac_stats(RC.nrmac[module_idP], stats_output, sizeof(stats_output), true);
|
||||
LOG_I(NR_MAC, "Frame.Slot %d.%d\n%s\n", frame, slot, stats_output);
|
||||
}
|
||||
|
||||
@@ -1145,8 +1145,6 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||
NR_SearchSpace_t *ss = ra->ra_ss;
|
||||
|
||||
NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = dl_bwp->tdaList;
|
||||
|
||||
long BWPStart = 0;
|
||||
long BWPSize = 0;
|
||||
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config = NULL;
|
||||
@@ -1161,10 +1159,8 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
|
||||
// Calculate number of symbols
|
||||
int time_domain_assignment = get_dl_tda(nr_mac, scc, slotP);
|
||||
int startSymbolIndex, nrOfSymbols;
|
||||
const int startSymbolAndLength = pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength;
|
||||
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
|
||||
AssertFatal(startSymbolIndex >= 0, "StartSymbolIndex is negative\n");
|
||||
NR_tda_info_t tda_info = nr_get_pdsch_tda_info(dl_bwp,
|
||||
time_domain_assignment);
|
||||
|
||||
NR_ControlResourceSet_t *coreset = ra->coreset;
|
||||
|
||||
@@ -1172,7 +1168,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
|
||||
uint16_t *vrb_map = cc[CC_id].vrb_map;
|
||||
for (int i = 0; (i < rbSize) && (rbStart <= (BWPSize - rbSize)); i++) {
|
||||
if (vrb_map[BWPStart + rbStart + i]&SL_to_bitmap(startSymbolIndex, nrOfSymbols)) {
|
||||
if (vrb_map[BWPStart + rbStart + i]&SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols)) {
|
||||
rbStart += i;
|
||||
i = 0;
|
||||
}
|
||||
@@ -1212,9 +1208,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC,"Msg2 startSymbolIndex.nrOfSymbols %d.%d\n",startSymbolIndex,nrOfSymbols);
|
||||
|
||||
int mappingtype = pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->mappingType;
|
||||
LOG_D(NR_MAC,"Msg2 startSymbolIndex.nrOfSymbols %d.%d\n",tda_info.startSymbolIndex,tda_info.nrOfSymbols);
|
||||
|
||||
// look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it. This is especially
|
||||
// important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them
|
||||
@@ -1244,16 +1238,12 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
// SCF222: PDU index incremented for each PDSCH PDU sent in TX control message. This is used to associate control
|
||||
// information to data and is reset every slot.
|
||||
const int pduindex = nr_mac->pdu_index[CC_id]++;
|
||||
|
||||
NR_PDSCH_Config_t *pdsch_Config = dl_bwp->pdsch_Config;
|
||||
uint8_t mcsTableIdx = dl_bwp->mcsTableIdx;
|
||||
|
||||
int dmrsConfigType=0;
|
||||
if (pdsch_Config &&
|
||||
pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA &&
|
||||
pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup &&
|
||||
pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type)
|
||||
dmrsConfigType = 1;
|
||||
NR_pdsch_dmrs_t dmrs_parms = get_dl_dmrs_params(scc,
|
||||
dl_bwp,
|
||||
&tda_info,
|
||||
1);
|
||||
|
||||
pdsch_pdu_rel15->pduBitmap = 0;
|
||||
pdsch_pdu_rel15->rnti = ra->RA_rnti;
|
||||
@@ -1269,37 +1259,22 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
pdsch_pdu_rel15->nrOfLayers = 1;
|
||||
pdsch_pdu_rel15->transmissionScheme = 0;
|
||||
pdsch_pdu_rel15->refPoint = 0;
|
||||
pdsch_pdu_rel15->dmrsConfigType = dmrsConfigType;
|
||||
pdsch_pdu_rel15->dmrsConfigType = dmrs_parms.dmrsConfigType;
|
||||
pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId;
|
||||
pdsch_pdu_rel15->SCID = 0;
|
||||
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = nrOfSymbols <= 2 ? 1 : 2;
|
||||
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = dmrs_parms.numDmrsCdmGrpsNoData;
|
||||
pdsch_pdu_rel15->dmrsPorts = 1;
|
||||
pdsch_pdu_rel15->resourceAlloc = 1;
|
||||
pdsch_pdu_rel15->rbStart = rbStart;
|
||||
pdsch_pdu_rel15->rbSize = rbSize;
|
||||
pdsch_pdu_rel15->VRBtoPRBMapping = 0;
|
||||
pdsch_pdu_rel15->StartSymbolIndex = startSymbolIndex;
|
||||
pdsch_pdu_rel15->NrOfSymbols = nrOfSymbols;
|
||||
pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(pdsch_Config,
|
||||
nr_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position,
|
||||
nrOfSymbols,
|
||||
startSymbolIndex,
|
||||
mappingtype,
|
||||
1);
|
||||
pdsch_pdu_rel15->StartSymbolIndex = tda_info.startSymbolIndex;
|
||||
pdsch_pdu_rel15->NrOfSymbols = tda_info.nrOfSymbols;
|
||||
pdsch_pdu_rel15->dlDmrsSymbPos = dmrs_parms.dl_dmrs_symb_pos;
|
||||
|
||||
uint8_t tb_scaling = 0;
|
||||
int R, Qm;
|
||||
uint8_t N_PRB_DMRS;
|
||||
uint32_t TBS=0;
|
||||
if (dmrsConfigType == NFAPI_NR_DMRS_TYPE1) {
|
||||
// if no data in dmrs cdm group is 1 only even REs have no data
|
||||
// if no data in dmrs cdm group is 2 both odd and even REs have no data
|
||||
N_PRB_DMRS = pdsch_pdu_rel15->numDmrsCdmGrpsNoData*6;
|
||||
}
|
||||
else {
|
||||
N_PRB_DMRS = pdsch_pdu_rel15->numDmrsCdmGrpsNoData*4;
|
||||
}
|
||||
uint16_t dmrs_length = get_num_dmrs(pdsch_pdu_rel15->dlDmrsSymbPos);
|
||||
|
||||
while(TBS<9) { // min TBS for RAR is 9 bytes
|
||||
mcsIndex++;
|
||||
@@ -1308,8 +1283,8 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
TBS = nr_compute_tbs(Qm,
|
||||
R,
|
||||
rbSize,
|
||||
nrOfSymbols,
|
||||
N_PRB_DMRS*dmrs_length,
|
||||
tda_info.nrOfSymbols,
|
||||
dmrs_parms.N_PRB_DMRS*dmrs_parms.N_DMRS_SLOT,
|
||||
0, // overhead
|
||||
tb_scaling, // tb scaling
|
||||
1)>>3; // layers
|
||||
@@ -1414,7 +1389,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
CCEIndex,
|
||||
aggregation_level);
|
||||
for (int rb = 0; rb < rbSize; rb++) {
|
||||
vrb_map[BWPStart + rb + rbStart] |= SL_to_bitmap(startSymbolIndex, nrOfSymbols);
|
||||
vrb_map[BWPStart + rb + rbStart] |= SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols);
|
||||
}
|
||||
|
||||
ra->state = WAIT_Msg3;
|
||||
@@ -1437,8 +1412,6 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
NR_SearchSpace_t *ss = ra->ra_ss;
|
||||
|
||||
NR_ControlResourceSet_t *coreset = ra->coreset;
|
||||
NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = dl_bwp->tdaList;
|
||||
|
||||
AssertFatal(coreset!=NULL,"Coreset cannot be null for RA-Msg4\n");
|
||||
|
||||
rnti_t tc_rnti = ra->rnti;
|
||||
@@ -1554,48 +1527,12 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate number of symbols
|
||||
int startSymbolIndex, nrOfSymbols;
|
||||
const int startSymbolAndLength = pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength;
|
||||
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
|
||||
AssertFatal(startSymbolIndex >= 0, "StartSymbolIndex is negative\n");
|
||||
NR_tda_info_t msg4_tda = nr_get_pdsch_tda_info(dl_bwp, time_domain_assignment);
|
||||
|
||||
int mappingtype = pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->mappingType;
|
||||
|
||||
uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL,
|
||||
scc->dmrs_TypeA_Position,
|
||||
nrOfSymbols,
|
||||
startSymbolIndex,
|
||||
mappingtype,
|
||||
1);
|
||||
|
||||
uint16_t N_DMRS_SLOT = get_num_dmrs(dlDmrsSymbPos);
|
||||
|
||||
NR_PDSCH_Config_t *pdsch_Config = dl_bwp->pdsch_Config;
|
||||
int dmrsConfigType=0;
|
||||
if (pdsch_Config &&
|
||||
pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA &&
|
||||
pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup &&
|
||||
pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type)
|
||||
dmrsConfigType = 1;
|
||||
|
||||
nr_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData = 2;
|
||||
if (nrOfSymbols == 2) {
|
||||
nr_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData = 1;
|
||||
}
|
||||
|
||||
AssertFatal(nr_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData == 1
|
||||
|| nr_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData == 2,
|
||||
"nr_mac->schedCtrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData %d is not possible",
|
||||
nr_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData);
|
||||
|
||||
uint8_t N_PRB_DMRS = 0;
|
||||
if (dmrsConfigType==NFAPI_NR_DMRS_TYPE1) {
|
||||
N_PRB_DMRS = nr_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData * 6;
|
||||
}
|
||||
else {
|
||||
N_PRB_DMRS = nr_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData * 4;
|
||||
}
|
||||
NR_pdsch_dmrs_t dmrs_info = get_dl_dmrs_params(scc,
|
||||
dl_bwp,
|
||||
&msg4_tda,
|
||||
1);
|
||||
|
||||
uint8_t mcsTableIdx = dl_bwp->mcsTableIdx;
|
||||
|
||||
@@ -1609,17 +1546,17 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
rbSize++;
|
||||
else
|
||||
mcsIndex++;
|
||||
LOG_D(NR_MAC,"Calling nr_compute_tbs with N_PRB_DMRS %d, N_DMRS_SLOT %d\n",N_PRB_DMRS,N_DMRS_SLOT);
|
||||
LOG_D(NR_MAC,"Calling nr_compute_tbs with N_PRB_DMRS %d, N_DMRS_SLOT %d\n",dmrs_info.N_PRB_DMRS,dmrs_info.N_DMRS_SLOT);
|
||||
harq->tb_size = nr_compute_tbs(nr_get_Qm_dl(mcsIndex, mcsTableIdx),
|
||||
nr_get_code_rate_dl(mcsIndex, mcsTableIdx),
|
||||
rbSize, nrOfSymbols, N_PRB_DMRS * N_DMRS_SLOT, 0, tb_scaling,1) >> 3;
|
||||
rbSize, msg4_tda.nrOfSymbols, dmrs_info.N_PRB_DMRS * dmrs_info.N_DMRS_SLOT, 0, tb_scaling,1) >> 3;
|
||||
} while (harq->tb_size < ra->mac_pdu_length && mcsIndex<=28);
|
||||
|
||||
AssertFatal(harq->tb_size >= ra->mac_pdu_length,"Cannot allocate Msg4\n");
|
||||
|
||||
int i = 0;
|
||||
while ((i < rbSize) && (rbStart + rbSize <= BWPSize)) {
|
||||
if (vrb_map[BWPStart + rbStart + i]&SL_to_bitmap(startSymbolIndex, nrOfSymbols)) {
|
||||
if (vrb_map[BWPStart + rbStart + i]&SL_to_bitmap(msg4_tda.startSymbolIndex, msg4_tda.nrOfSymbols)) {
|
||||
rbStart += i+1;
|
||||
i = 0;
|
||||
} else {
|
||||
@@ -1687,18 +1624,18 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
pdsch_pdu_rel15->nrOfLayers = 1;
|
||||
pdsch_pdu_rel15->transmissionScheme = 0;
|
||||
pdsch_pdu_rel15->refPoint = 0;
|
||||
pdsch_pdu_rel15->dmrsConfigType = dmrsConfigType;
|
||||
pdsch_pdu_rel15->dmrsConfigType = dmrs_info.dmrsConfigType;
|
||||
pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId;
|
||||
pdsch_pdu_rel15->SCID = 0;
|
||||
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = nrOfSymbols <= 2 ? 1 : 2;
|
||||
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = dmrs_info.numDmrsCdmGrpsNoData;
|
||||
pdsch_pdu_rel15->dmrsPorts = 1;
|
||||
pdsch_pdu_rel15->resourceAlloc = 1;
|
||||
pdsch_pdu_rel15->rbStart = rbStart;
|
||||
pdsch_pdu_rel15->rbSize = rbSize;
|
||||
pdsch_pdu_rel15->VRBtoPRBMapping = 0;
|
||||
pdsch_pdu_rel15->StartSymbolIndex = startSymbolIndex;
|
||||
pdsch_pdu_rel15->NrOfSymbols = nrOfSymbols;
|
||||
pdsch_pdu_rel15->dlDmrsSymbPos = dlDmrsSymbPos;
|
||||
pdsch_pdu_rel15->StartSymbolIndex = msg4_tda.startSymbolIndex;
|
||||
pdsch_pdu_rel15->NrOfSymbols = msg4_tda.nrOfSymbols;
|
||||
pdsch_pdu_rel15->dlDmrsSymbPos = dmrs_info.dl_dmrs_symb_pos;
|
||||
|
||||
int x_Overhead = 0;
|
||||
nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, tb_scaling);
|
||||
@@ -1811,7 +1748,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
CCEIndex,
|
||||
aggregation_level);
|
||||
for (int rb = 0; rb < pdsch_pdu_rel15->rbSize; rb++) {
|
||||
vrb_map[BWPStart + rb + pdsch_pdu_rel15->rbStart] |= SL_to_bitmap(startSymbolIndex, nrOfSymbols);
|
||||
vrb_map[BWPStart + rb + pdsch_pdu_rel15->rbStart] |= SL_to_bitmap(msg4_tda.startSymbolIndex, msg4_tda.nrOfSymbols);
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC,"BWPSize: %i\n", pdcch_pdu_rel15->BWPSize);
|
||||
|
||||
@@ -281,9 +281,8 @@ uint32_t schedule_control_sib1(module_id_t module_id,
|
||||
int CC_id,
|
||||
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config,
|
||||
int time_domain_allocation,
|
||||
int startSymbolIndex,
|
||||
int nrOfSymbols,
|
||||
uint16_t dlDmrsSymbPos,
|
||||
NR_pdsch_dmrs_t *dmrs_parms,
|
||||
NR_tda_info_t *tda_info,
|
||||
uint8_t candidate_idx,
|
||||
uint16_t num_total_bytes) {
|
||||
|
||||
@@ -309,8 +308,11 @@ uint32_t schedule_control_sib1(module_id_t module_id,
|
||||
type0_PDCCH_CSS_config);
|
||||
}
|
||||
|
||||
gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation = time_domain_allocation;
|
||||
gNB_mac->sched_ctrlCommon->sched_pdsch.mcs = 0; // starting from mcs 0
|
||||
NR_sched_pdsch_t *pdsch = &gNB_mac->sched_ctrlCommon->sched_pdsch;
|
||||
pdsch->time_domain_allocation = time_domain_allocation;
|
||||
pdsch->dmrs_parms = *dmrs_parms;
|
||||
pdsch->tda_info = *tda_info;
|
||||
pdsch->mcs = 0; // starting from mcs 0
|
||||
gNB_mac->sched_ctrlCommon->num_total_bytes = num_total_bytes;
|
||||
|
||||
uint8_t nr_of_candidates;
|
||||
@@ -333,58 +335,49 @@ uint32_t schedule_control_sib1(module_id_t module_id,
|
||||
const uint16_t bwpSize = type0_PDCCH_CSS_config->num_rbs;
|
||||
int rbStart = type0_PDCCH_CSS_config->cset_start_rb;
|
||||
|
||||
// TODO: There are exceptions to this in table 5.1.2.1.1-4,5 (Default time domain allocation tables B, C)
|
||||
int mappingtype = (startSymbolIndex <= 3)? typeA: typeB;
|
||||
|
||||
if (nrOfSymbols == 2) {
|
||||
gNB_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData = 1;
|
||||
} else {
|
||||
gNB_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData = 2;
|
||||
}
|
||||
|
||||
// Calculate number of PRB_DMRS
|
||||
uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData * 6;
|
||||
uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos);
|
||||
LOG_D(MAC,"dlDmrsSymbPos %x\n",dlDmrsSymbPos);
|
||||
uint8_t N_PRB_DMRS = pdsch->dmrs_parms.N_PRB_DMRS;
|
||||
uint16_t dmrs_length = pdsch->dmrs_parms.N_DMRS_SLOT;
|
||||
LOG_D(MAC,"dlDmrsSymbPos %x\n",pdsch->dmrs_parms.dl_dmrs_symb_pos);
|
||||
int mcsTableIdx = 0;
|
||||
int rbSize = 0;
|
||||
uint32_t TBS = 0;
|
||||
do {
|
||||
if(rbSize < bwpSize && !(vrb_map[rbStart + rbSize]&SL_to_bitmap(startSymbolIndex, nrOfSymbols)))
|
||||
if(rbSize < bwpSize && !(vrb_map[rbStart + rbSize]&SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols)))
|
||||
rbSize++;
|
||||
else{
|
||||
if (gNB_mac->sched_ctrlCommon->sched_pdsch.mcs<10)
|
||||
gNB_mac->sched_ctrlCommon->sched_pdsch.mcs++;
|
||||
if (pdsch->mcs<10)
|
||||
pdsch->mcs++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, mcsTableIdx),
|
||||
nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, mcsTableIdx),
|
||||
rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3;
|
||||
TBS = nr_compute_tbs(nr_get_Qm_dl(pdsch->mcs, mcsTableIdx),
|
||||
nr_get_code_rate_dl(pdsch->mcs, mcsTableIdx),
|
||||
rbSize, tda_info->nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3;
|
||||
} while (TBS < gNB_mac->sched_ctrlCommon->num_total_bytes);
|
||||
|
||||
AssertFatal(TBS>=gNB_mac->sched_ctrlCommon->num_total_bytes,"Couldn't allocate enough resources for %d bytes in SIB1 PDSCH\n",
|
||||
gNB_mac->sched_ctrlCommon->num_total_bytes);
|
||||
|
||||
gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize = rbSize;
|
||||
gNB_mac->sched_ctrlCommon->sched_pdsch.rbStart = 0;
|
||||
pdsch->rbSize = rbSize;
|
||||
pdsch->rbStart = 0;
|
||||
|
||||
LOG_D(NR_MAC,"mcs = %i\n", gNB_mac->sched_ctrlCommon->sched_pdsch.mcs);
|
||||
LOG_D(NR_MAC,"startSymbolIndex = %i\n", startSymbolIndex);
|
||||
LOG_D(NR_MAC,"nrOfSymbols = %i\n", nrOfSymbols);
|
||||
LOG_D(NR_MAC, "rbSize = %i\n", gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize);
|
||||
LOG_D(NR_MAC,"mcs = %i\n", pdsch->mcs);
|
||||
LOG_D(NR_MAC,"startSymbolIndex = %i\n", tda_info->startSymbolIndex);
|
||||
LOG_D(NR_MAC,"nrOfSymbols = %i\n", tda_info->nrOfSymbols);
|
||||
LOG_D(NR_MAC, "rbSize = %i\n", pdsch->rbSize);
|
||||
LOG_D(NR_MAC,"TBS = %i\n", TBS);
|
||||
LOG_D(NR_MAC,"dmrs_length %d\n",dmrs_length);
|
||||
LOG_D(NR_MAC,"N_PRB_DMRS = %d\n",N_PRB_DMRS);
|
||||
LOG_D(NR_MAC,"mappingtype = %d\n", mappingtype);
|
||||
LOG_D(NR_MAC,"mappingtype = %d\n", tda_info->mapping_type);
|
||||
// Mark the corresponding RBs as used
|
||||
fill_pdcch_vrb_map(gNB_mac,
|
||||
CC_id,
|
||||
&gNB_mac->sched_ctrlCommon->sched_pdcch,
|
||||
gNB_mac->sched_ctrlCommon->cce_index,
|
||||
gNB_mac->sched_ctrlCommon->aggregation_level);
|
||||
for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize; rb++) {
|
||||
vrb_map[rb + rbStart] |= SL_to_bitmap(startSymbolIndex, nrOfSymbols);
|
||||
for (int rb = 0; rb < pdsch->rbSize; rb++) {
|
||||
vrb_map[rb + rbStart] |= SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols);
|
||||
}
|
||||
return TBS;
|
||||
}
|
||||
@@ -395,13 +388,13 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
|
||||
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config,
|
||||
uint32_t TBS,
|
||||
int StartSymbolIndex,
|
||||
int NrOfSymbols,
|
||||
uint16_t dlDmrsSymbPos) {
|
||||
int NrOfSymbols) {
|
||||
|
||||
gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP];
|
||||
NR_COMMON_channels_t *cc = gNB_mac->common_channels;
|
||||
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||
int mcsTableIdx = 0;
|
||||
NR_sched_pdsch_t *pdsch = &gNB_mac->sched_ctrlCommon->sched_pdsch;
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
||||
memset((void*)dl_tti_pdcch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t));
|
||||
dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE;
|
||||
@@ -433,11 +426,11 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
|
||||
pdsch_pdu_rel15->CyclicPrefix = 0;
|
||||
|
||||
pdsch_pdu_rel15->NrOfCodewords = 1;
|
||||
pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, mcsTableIdx);
|
||||
pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, mcsTableIdx);
|
||||
pdsch_pdu_rel15->mcsIndex[0] = gNB_mac->sched_ctrlCommon->sched_pdsch.mcs;
|
||||
pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(pdsch->mcs, mcsTableIdx);
|
||||
pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(pdsch->mcs, mcsTableIdx);
|
||||
pdsch_pdu_rel15->mcsIndex[0] = pdsch->mcs;
|
||||
pdsch_pdu_rel15->mcsTable[0] = mcsTableIdx;
|
||||
pdsch_pdu_rel15->rvIndex[0] = 0;
|
||||
pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[0];
|
||||
pdsch_pdu_rel15->dataScramblingId = *scc->physCellId;
|
||||
pdsch_pdu_rel15->nrOfLayers = 1;
|
||||
pdsch_pdu_rel15->transmissionScheme = 0;
|
||||
@@ -445,16 +438,16 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
|
||||
pdsch_pdu_rel15->dmrsConfigType = 0;
|
||||
pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId;
|
||||
pdsch_pdu_rel15->SCID = 0;
|
||||
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = gNB_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData;
|
||||
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = pdsch->dmrs_parms.numDmrsCdmGrpsNoData;
|
||||
pdsch_pdu_rel15->dmrsPorts = 1;
|
||||
pdsch_pdu_rel15->resourceAlloc = 1;
|
||||
pdsch_pdu_rel15->rbStart = gNB_mac->sched_ctrlCommon->sched_pdsch.rbStart;
|
||||
pdsch_pdu_rel15->rbSize = gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize;
|
||||
pdsch_pdu_rel15->rbStart = pdsch->rbStart;
|
||||
pdsch_pdu_rel15->rbSize = pdsch->rbSize;
|
||||
pdsch_pdu_rel15->VRBtoPRBMapping = 0;
|
||||
pdsch_pdu_rel15->TBSize[0] = TBS;
|
||||
pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex;
|
||||
pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols;
|
||||
pdsch_pdu_rel15->dlDmrsSymbPos = dlDmrsSymbPos;
|
||||
pdsch_pdu_rel15->dlDmrsSymbPos = pdsch->dmrs_parms.dl_dmrs_symb_pos;
|
||||
LOG_D(NR_MAC,"sib1:bwpStart %d, bwpSize %d\n",pdsch_pdu_rel15->BWPStart,pdsch_pdu_rel15->BWPSize);
|
||||
LOG_D(NR_MAC,"sib1:rbStart %d, rbSize %d\n",pdsch_pdu_rel15->rbStart,pdsch_pdu_rel15->rbSize);
|
||||
LOG_D(NR_MAC,"sib1:dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos);
|
||||
@@ -485,8 +478,8 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
|
||||
dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(
|
||||
pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbStart, type0_PDCCH_CSS_config->num_rbs);
|
||||
|
||||
dci_payload.time_domain_assignment.val = gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation;
|
||||
dci_payload.mcs = gNB_mac->sched_ctrlCommon->sched_pdsch.mcs;
|
||||
dci_payload.time_domain_assignment.val = gNB_mac->sched_ctrlCommon->sched_pdsch.time_domain_allocation;
|
||||
dci_payload.mcs = pdsch->mcs;
|
||||
dci_payload.rv = pdsch_pdu_rel15->rvIndex[0];
|
||||
dci_payload.harq_pid = 0;
|
||||
dci_payload.ndi = 0;
|
||||
@@ -587,22 +580,29 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
|
||||
|
||||
AssertFatal((startSymbolIndex+nrOfSymbols)<14,"SIB1 TDA %d would cause overlap with CSI-RS. Please select a different SIB1 TDA.\n",time_domain_allocation);
|
||||
|
||||
int mappingtype = is_typeA? typeA: typeB;
|
||||
uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex, mappingtype, 1);
|
||||
NR_tda_info_t tda_info = {
|
||||
.mapping_type = is_typeA ? typeA : typeB,
|
||||
.startSymbolIndex = startSymbolIndex,
|
||||
.nrOfSymbols = nrOfSymbols
|
||||
};
|
||||
|
||||
NR_pdsch_dmrs_t dmrs_parms = get_dl_dmrs_params(scc,
|
||||
NULL,
|
||||
&tda_info,
|
||||
1);
|
||||
|
||||
// Configure sched_ctrlCommon for SIB1
|
||||
uint32_t TBS = schedule_control_sib1(module_idP, CC_id,
|
||||
type0_PDCCH_CSS_config,
|
||||
time_domain_allocation,
|
||||
startSymbolIndex,
|
||||
nrOfSymbols,
|
||||
dlDmrsSymbPos,
|
||||
&dmrs_parms,
|
||||
&tda_info,
|
||||
candidate_idx,
|
||||
sib1_sdu_length);
|
||||
|
||||
nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body;
|
||||
int pdu_index = gNB_mac->pdu_index[0]++;
|
||||
nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, pdu_index, type0_PDCCH_CSS_config, TBS, startSymbolIndex, nrOfSymbols, dlDmrsSymbPos);
|
||||
nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, pdu_index, type0_PDCCH_CSS_config, TBS, startSymbolIndex, nrOfSymbols);
|
||||
|
||||
const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs;
|
||||
nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req];
|
||||
|
||||
@@ -391,17 +391,13 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
NR_UE_DL_BWP_t *dl_bwp = &UE->current_DL_BWP;
|
||||
NR_UE_UL_BWP_t *ul_bwp = &UE->current_UL_BWP;
|
||||
NR_sched_pdsch_t *retInfo = &sched_ctrl->harq_processes[current_harq_pid].sched_pdsch;
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
NR_sched_pdsch_t *curInfo = &sched_ctrl->sched_pdsch;
|
||||
|
||||
//TODO remove this and handle retransmission with old nrOfLayers
|
||||
// once ps structure is removed
|
||||
if(ps->nrOfLayers < retInfo->nrOfLayers) {
|
||||
LOG_W(NR_MAC,"Cannot schedule retransmission. RI changed from %d to %d\n",
|
||||
retInfo->nrOfLayers, ps->nrOfLayers);
|
||||
abort_nr_dl_harq(UE, current_harq_pid);
|
||||
remove_front_nr_list(&sched_ctrl->retrans_dl_harq);
|
||||
return false;
|
||||
}
|
||||
// If the RI changed between current rtx and a previous transmission
|
||||
// we need to verify if it is not decreased
|
||||
// othwise it wouldn't be possible to transmit the same TBS
|
||||
int layers = (curInfo->nrOfLayers < retInfo->nrOfLayers) ? curInfo->nrOfLayers : retInfo->nrOfLayers;
|
||||
int pm_index = (curInfo->nrOfLayers < retInfo->nrOfLayers) ? curInfo->pm_index : retInfo->pm_index;
|
||||
|
||||
const int coresetid = sched_ctrl->coreset->controlResourceSetId;
|
||||
const uint16_t bwpSize = coresetid == 0 ? RC.nrmac[module_id]->cset0_bwp_size : dl_bwp->BWPSize;
|
||||
@@ -411,13 +407,16 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
const int tda = get_dl_tda(RC.nrmac[module_id], scc, slot);
|
||||
AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n");
|
||||
|
||||
if (tda == retInfo->time_domain_allocation) {
|
||||
if (tda == retInfo->time_domain_allocation &&
|
||||
layers == retInfo->nrOfLayers) {
|
||||
|
||||
NR_tda_info_t *tda_info = &retInfo->tda_info;
|
||||
/* Check that there are enough resources for retransmission */
|
||||
while (rbSize < retInfo->rbSize) {
|
||||
rbStart += rbSize; /* last iteration rbSize was not enough, skip it */
|
||||
rbSize = 0;
|
||||
|
||||
const int slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols);
|
||||
const int slbitmap = SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols);
|
||||
while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
|
||||
rbStart++;
|
||||
|
||||
@@ -431,30 +430,16 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
rbSize < retInfo->rbSize)
|
||||
rbSize++;
|
||||
}
|
||||
|
||||
/* check whether we need to switch the TDA allocation since the last
|
||||
* (re-)transmission */
|
||||
if (ps->time_domain_allocation != tda) {
|
||||
nr_set_pdsch_semi_static(dl_bwp,
|
||||
scc,
|
||||
tda,
|
||||
ps->nrOfLayers,
|
||||
sched_ctrl,
|
||||
ps);
|
||||
}
|
||||
} else {
|
||||
/* the retransmission will use a different time domain allocation, check
|
||||
* that we have enough resources */
|
||||
NR_pdsch_semi_static_t temp_ps = *ps;
|
||||
NR_tda_info_t temp_tda = nr_get_pdsch_tda_info(dl_bwp, tda);
|
||||
NR_pdsch_dmrs_t temp_dmrs = get_dl_dmrs_params(scc,
|
||||
dl_bwp,
|
||||
&temp_tda,
|
||||
layers);
|
||||
|
||||
nr_set_pdsch_semi_static(dl_bwp,
|
||||
scc,
|
||||
tda,
|
||||
ps->nrOfLayers,
|
||||
sched_ctrl,
|
||||
&temp_ps);
|
||||
|
||||
const uint16_t slbitmap = SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols);
|
||||
const uint16_t slbitmap = SL_to_bitmap(temp_tda.startSymbolIndex, temp_tda.nrOfSymbols);
|
||||
while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
|
||||
rbStart++;
|
||||
|
||||
@@ -465,9 +450,9 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
uint16_t new_rbSize;
|
||||
bool success = nr_find_nb_rb(retInfo->Qm,
|
||||
retInfo->R,
|
||||
temp_ps.nrOfLayers,
|
||||
temp_ps.nrOfSymbols,
|
||||
temp_ps.N_PRB_DMRS * temp_ps.N_DMRS_SLOT,
|
||||
layers,
|
||||
temp_tda.nrOfSymbols,
|
||||
temp_dmrs.N_PRB_DMRS * temp_dmrs.N_DMRS_SLOT,
|
||||
retInfo->tb_size,
|
||||
1, /* minimum of 1RB: need to find exact TBS, don't preclude any number */
|
||||
rbSize,
|
||||
@@ -484,7 +469,10 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
retInfo->tb_size = new_tbs;
|
||||
retInfo->rbSize = new_rbSize;
|
||||
retInfo->time_domain_allocation = tda;
|
||||
sched_ctrl->pdsch_semi_static = temp_ps;
|
||||
retInfo->nrOfLayers = layers;
|
||||
retInfo->pm_index = pm_index;
|
||||
retInfo->dmrs_parms = temp_dmrs;
|
||||
retInfo->tda_info = temp_tda;
|
||||
}
|
||||
|
||||
/* Find a free CCE */
|
||||
@@ -544,7 +532,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
|
||||
*n_rb_sched -= sched_ctrl->sched_pdsch.rbSize;
|
||||
|
||||
for (int rb = 0; rb < sched_ctrl->sched_pdsch.rbSize; rb++)
|
||||
rballoc_mask[rb + sched_ctrl->sched_pdsch.rbStart] ^= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols);
|
||||
rballoc_mask[rb + sched_ctrl->sched_pdsch.rbStart] ^= SL_to_bitmap(retInfo->tda_info.startSymbolIndex, retInfo->tda_info.nrOfSymbols);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -585,10 +573,8 @@ void pf_dl(module_id_t module_id,
|
||||
|
||||
const NR_mac_dir_stats_t *stats = &UE->mac_stats.dl;
|
||||
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
/* get the PID of a HARQ process awaiting retrnasmission, or -1 otherwise */
|
||||
sched_pdsch->dl_harq_pid = sched_ctrl->retrans_dl_harq.head;
|
||||
UE->layers = ps->nrOfLayers; // initialization of layers to the previous value in the structure
|
||||
/* Calculate Throughput */
|
||||
const float a = 0.0005f; // corresponds to 200ms window
|
||||
const uint32_t b = UE->mac_stats.dl.current_bytes;
|
||||
@@ -633,7 +619,10 @@ void pf_dl(module_id_t module_id,
|
||||
sched_pdsch->mcs = max_mcs;
|
||||
else
|
||||
sched_pdsch->mcs = get_mcs_from_bler(bo, stats, &sched_ctrl->dl_bler_stats, max_mcs, frame);
|
||||
UE->layers = set_dl_nrOfLayers(sched_ctrl);
|
||||
sched_pdsch->nrOfLayers = get_dl_nrOfLayers(sched_ctrl, current_BWP->dci_format);
|
||||
sched_pdsch->pm_index = get_pm_index(UE,
|
||||
sched_pdsch->nrOfLayers,
|
||||
mac->xp_pdsch_antenna_ports);
|
||||
const uint8_t Qm = nr_get_Qm_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx);
|
||||
const uint16_t R = nr_get_code_rate_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx);
|
||||
uint32_t tbs = nr_compute_tbs(Qm,
|
||||
@@ -643,7 +632,7 @@ void pf_dl(module_id_t module_id,
|
||||
0, /* N_PRB_DMRS * N_DMRS_SLOT */
|
||||
0 /* N_PRB_oh, 0 for initialBWP */,
|
||||
0 /* tb_scaling */,
|
||||
UE->layers) >> 3;
|
||||
sched_pdsch->nrOfLayers) >> 3;
|
||||
float coeff_ue = (float) tbs / UE->dl_thr_ue;
|
||||
LOG_D(NR_MAC,"UE %04x b %d, thr_ue %f, tbs %d, coeff_ue %f\n",
|
||||
UE->rnti, b, UE->dl_thr_ue, tbs, coeff_ue);
|
||||
@@ -732,21 +721,14 @@ void pf_dl(module_id_t module_id,
|
||||
sched_ctrl->aggregation_level);
|
||||
|
||||
/* MCS has been set above */
|
||||
const int tda = get_dl_tda(RC.nrmac[module_id], scc, slot);
|
||||
AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n");
|
||||
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
sched_pdsch->time_domain_allocation = get_dl_tda(RC.nrmac[module_id], scc, slot);
|
||||
AssertFatal(sched_pdsch->time_domain_allocation>=0,"Unable to find PDSCH time domain allocation in list\n");
|
||||
|
||||
if (ps->nrOfLayers != iterator->UE->layers || ps->time_domain_allocation != tda ) {
|
||||
nr_set_pdsch_semi_static(dl_bwp,
|
||||
scc,
|
||||
tda,
|
||||
iterator->UE->layers,
|
||||
sched_ctrl,
|
||||
ps);
|
||||
}
|
||||
sched_pdsch->tda_info = nr_get_pdsch_tda_info(dl_bwp, sched_pdsch->time_domain_allocation);
|
||||
NR_tda_info_t *tda_info = &sched_pdsch->tda_info;
|
||||
|
||||
const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols);
|
||||
const uint16_t slbitmap = SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols);
|
||||
|
||||
// Freq-demain allocation
|
||||
while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
|
||||
@@ -757,6 +739,10 @@ void pf_dl(module_id_t module_id,
|
||||
while (rbStart + max_rbSize < bwpSize && (rballoc_mask[rbStart + max_rbSize] & slbitmap) == slbitmap)
|
||||
max_rbSize++;
|
||||
|
||||
sched_pdsch->dmrs_parms = get_dl_dmrs_params(scc,
|
||||
dl_bwp,
|
||||
tda_info,
|
||||
sched_pdsch->nrOfLayers);
|
||||
sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, dl_bwp->mcsTableIdx);
|
||||
sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, dl_bwp->mcsTableIdx);
|
||||
sched_pdsch->pucch_allocation = alloc;
|
||||
@@ -770,9 +756,9 @@ void pf_dl(module_id_t module_id,
|
||||
//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,
|
||||
ps->nrOfSymbols,
|
||||
ps->N_PRB_DMRS * ps->N_DMRS_SLOT,
|
||||
sched_pdsch->nrOfLayers,
|
||||
tda_info->nrOfSymbols,
|
||||
sched_pdsch->dmrs_parms.N_PRB_DMRS * sched_pdsch->dmrs_parms.N_DMRS_SLOT,
|
||||
sched_ctrl->num_total_bytes + oh,
|
||||
min_rbSize,
|
||||
max_rbSize,
|
||||
@@ -912,12 +898,9 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
continue;
|
||||
|
||||
const rnti_t rnti = UE->rnti;
|
||||
/* pre-computed PDSCH values that only change if time domain
|
||||
* allocation/DMRS parameters change. Updated in the preprocessor through
|
||||
* nr_set_pdsch_semi_static() */
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
|
||||
/* POST processing */
|
||||
const uint8_t nrOfLayers = ps->nrOfLayers;
|
||||
const uint8_t nrOfLayers = sched_pdsch->nrOfLayers;
|
||||
const uint16_t R = sched_pdsch->R;
|
||||
const uint8_t Qm = sched_pdsch->Qm;
|
||||
const uint32_t TBS = sched_pdsch->tb_size;
|
||||
@@ -941,6 +924,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
remove_nr_list(&sched_ctrl->retrans_dl_harq, current_harq_pid);
|
||||
}
|
||||
|
||||
NR_tda_info_t *tda_info = &sched_pdsch->tda_info;
|
||||
NR_pdsch_dmrs_t *dmrs_parms = &sched_pdsch->dmrs_parms;
|
||||
NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid];
|
||||
DevAssert(!harq->is_waiting);
|
||||
add_tail_nr_list(&sched_ctrl->feedback_dl_harq, current_harq_pid);
|
||||
@@ -957,9 +942,9 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
sched_ctrl->aggregation_level,
|
||||
sched_pdsch->rbStart,
|
||||
sched_pdsch->rbSize,
|
||||
ps->startSymbolIndex,
|
||||
ps->nrOfSymbols,
|
||||
ps->dl_dmrs_symb_pos,
|
||||
tda_info->startSymbolIndex,
|
||||
tda_info->nrOfSymbols,
|
||||
dmrs_parms->dl_dmrs_symb_pos,
|
||||
sched_pdsch->mcs,
|
||||
nrOfLayers,
|
||||
TBS,
|
||||
@@ -1033,11 +1018,11 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
pdsch_pdu->transmissionScheme = 0;
|
||||
pdsch_pdu->refPoint = 0; // Point A
|
||||
// DMRS
|
||||
pdsch_pdu->dlDmrsSymbPos = ps->dl_dmrs_symb_pos;
|
||||
pdsch_pdu->dmrsConfigType = ps->dmrsConfigType;
|
||||
pdsch_pdu->dlDmrsSymbPos = dmrs_parms->dl_dmrs_symb_pos;
|
||||
pdsch_pdu->dmrsConfigType = dmrs_parms->dmrsConfigType;
|
||||
pdsch_pdu->dlDmrsScramblingId = *scc->physCellId;
|
||||
pdsch_pdu->SCID = 0;
|
||||
pdsch_pdu->numDmrsCdmGrpsNoData = ps->numDmrsCdmGrpsNoData;
|
||||
pdsch_pdu->numDmrsCdmGrpsNoData = dmrs_parms->numDmrsCdmGrpsNoData;
|
||||
pdsch_pdu->dmrsPorts = (1<<nrOfLayers)-1; // FIXME with a better implementation
|
||||
// Pdsch Allocation in frequency domain
|
||||
pdsch_pdu->resourceAlloc = 1;
|
||||
@@ -1045,20 +1030,11 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
pdsch_pdu->rbSize = sched_pdsch->rbSize;
|
||||
pdsch_pdu->VRBtoPRBMapping = 1; // non-interleaved, check if this is ok for initialBWP
|
||||
// Resource Allocation in time domain
|
||||
pdsch_pdu->StartSymbolIndex = ps->startSymbolIndex;
|
||||
pdsch_pdu->NrOfSymbols = ps->nrOfSymbols;
|
||||
pdsch_pdu->StartSymbolIndex = tda_info->startSymbolIndex;
|
||||
pdsch_pdu->NrOfSymbols = tda_info->nrOfSymbols;
|
||||
// Precoding
|
||||
if (sched_ctrl->set_pmi) {
|
||||
const int report_id = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.csi_report_id;
|
||||
nr_csi_report_t *csi_report = &UE->csi_report_template[report_id];
|
||||
pdsch_pdu->precodingAndBeamforming.prg_size = pdsch_pdu->rbSize;
|
||||
pdsch_pdu->precodingAndBeamforming.prgs_list[0].pm_idx = set_pm_index(sched_ctrl,
|
||||
nrOfLayers,
|
||||
csi_report->N1,
|
||||
csi_report->N2,
|
||||
gNB_mac->xp_pdsch_antenna_ports,
|
||||
csi_report->codebook_mode);
|
||||
}
|
||||
pdsch_pdu->precodingAndBeamforming.prg_size = pdsch_pdu->rbSize;
|
||||
pdsch_pdu->precodingAndBeamforming.prgs_list[0].pm_idx = sched_pdsch->pm_index;
|
||||
// TBS_LBRM according to section 5.4.2.1 of 38.212
|
||||
// TODO: verify the case where pdsch_servingcellconfig is NULL, in which case
|
||||
// in principle maxMIMO_layers should be given by the maximum number of layers
|
||||
@@ -1130,7 +1106,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
pdsch_pdu->rbStart,
|
||||
pdsch_pdu->BWPSize);
|
||||
dci_payload.format_indicator = 1;
|
||||
dci_payload.time_domain_assignment.val = ps->time_domain_allocation;
|
||||
dci_payload.time_domain_assignment.val = sched_pdsch->time_domain_allocation;
|
||||
dci_payload.mcs = sched_pdsch->mcs;
|
||||
dci_payload.rv = pdsch_pdu->rvIndex[0];
|
||||
dci_payload.harq_pid = current_harq_pid;
|
||||
@@ -1139,7 +1115,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
dci_payload.tpc = sched_ctrl->tpc1; // TPC for PUCCH: table 7.2.1-1 in 38.213
|
||||
dci_payload.pucch_resource_indicator = pucch->resource_indicator;
|
||||
dci_payload.pdsch_to_harq_feedback_timing_indicator.val = pucch->timing_indicator; // PDSCH to HARQ TI
|
||||
dci_payload.antenna_ports.val = ps->dmrs_ports_id;
|
||||
dci_payload.antenna_ports.val = dmrs_parms->dmrs_ports_id;
|
||||
dci_payload.dmrs_sequence_initialization.val = pdsch_pdu->SCID;
|
||||
LOG_D(NR_MAC,
|
||||
"%4d.%2d DCI type 1 payload: freq_alloc %d (%d,%d,%d), "
|
||||
@@ -1319,9 +1295,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
harq->sched_pdsch = *sched_pdsch;
|
||||
/* save which time allocation has been used, to be used on
|
||||
* retransmissions */
|
||||
harq->sched_pdsch.time_domain_allocation = ps->time_domain_allocation;
|
||||
/* save nr of layers for retransmissions */
|
||||
harq->sched_pdsch.nrOfLayers = ps->nrOfLayers;
|
||||
harq->sched_pdsch.time_domain_allocation = sched_pdsch->time_domain_allocation;
|
||||
|
||||
// ta command is sent, values are reset
|
||||
if (sched_ctrl->ta_apply) {
|
||||
|
||||
@@ -179,8 +179,6 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
|
||||
}
|
||||
}
|
||||
|
||||
extern int getNrOfSymbols(NR_BWP_Downlink_t *bwp, int tda);
|
||||
extern uint8_t getN_PRB_DMRS(NR_BWP_Downlink_t *bwp, int numDmrsCdmGrpsNoData);
|
||||
uint32_t target_dl_mcs = 9;
|
||||
uint32_t target_dl_Nl = 1;
|
||||
uint32_t target_dl_bw = 50;
|
||||
@@ -199,10 +197,9 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
const int CC_id = 0;
|
||||
|
||||
const int tda = get_dl_tda(RC.nrmac[module_id], scc, slot);
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
ps->nrOfLayers = target_dl_Nl;
|
||||
if (ps->time_domain_allocation != tda || ps->nrOfLayers != target_dl_Nl)
|
||||
nr_set_pdsch_semi_static(dl_bwp, scc, tda, target_dl_Nl,sched_ctrl , ps);
|
||||
NR_tda_info_t tda_info = nr_get_pdsch_tda_info(dl_bwp, tda);
|
||||
sched_ctrl->sched_pdsch.tda_info = tda_info;
|
||||
sched_ctrl->sched_pdsch.time_domain_allocation = tda;
|
||||
|
||||
/* find largest unallocated chunk */
|
||||
const int bwpSize = dl_bwp->BWPSize;
|
||||
@@ -217,12 +214,12 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
while (true) {
|
||||
/* advance to first free RB */
|
||||
while (rbStart < bwpSize &&
|
||||
(vrb_map[rbStart + BWPStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols)))
|
||||
(vrb_map[rbStart + BWPStart]&SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols)))
|
||||
rbStart++;
|
||||
rbSize = 1;
|
||||
/* iterate until we are at target_dl_bw or no available RBs */
|
||||
while (rbStart + rbSize < bwpSize &&
|
||||
!(vrb_map[rbStart + rbSize + BWPStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols)) &&
|
||||
!(vrb_map[rbStart + rbSize + BWPStart]&SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols)) &&
|
||||
rbSize < target_dl_bw)
|
||||
rbSize++;
|
||||
/* found target_dl_bw? */
|
||||
@@ -308,18 +305,24 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
sched_pdsch->rbStart = rbStart;
|
||||
sched_pdsch->rbSize = rbSize;
|
||||
|
||||
sched_pdsch->dmrs_parms = get_dl_dmrs_params(scc,
|
||||
dl_bwp,
|
||||
&tda_info,
|
||||
target_dl_Nl);
|
||||
|
||||
sched_pdsch->mcs = target_dl_mcs;
|
||||
sched_pdsch->nrOfLayers = target_dl_Nl;
|
||||
sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, dl_bwp->mcsTableIdx);
|
||||
sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, dl_bwp->mcsTableIdx);
|
||||
sched_ctrl->dl_bler_stats.mcs = target_dl_mcs; /* for logging output */
|
||||
sched_pdsch->tb_size = nr_compute_tbs(sched_pdsch->Qm,
|
||||
sched_pdsch->R,
|
||||
sched_pdsch->rbSize,
|
||||
ps->nrOfSymbols,
|
||||
ps->N_PRB_DMRS * ps->N_DMRS_SLOT,
|
||||
tda_info.nrOfSymbols,
|
||||
sched_pdsch->dmrs_parms.N_PRB_DMRS * sched_pdsch->dmrs_parms.N_DMRS_SLOT,
|
||||
0 /* N_PRB_oh, 0 for initialBWP */,
|
||||
0 /* tb_scaling */,
|
||||
ps->nrOfLayers)
|
||||
sched_pdsch->nrOfLayers)
|
||||
>> 3;
|
||||
|
||||
/* get the PID of a HARQ process awaiting retransmission, or -1 otherwise */
|
||||
@@ -327,7 +330,7 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
|
||||
/* mark the corresponding RBs as used */
|
||||
for (int rb = 0; rb < sched_pdsch->rbSize; rb++)
|
||||
vrb_map[rb + sched_pdsch->rbStart + BWPStart] = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols);
|
||||
vrb_map[rb + sched_pdsch->rbStart + BWPStart] = SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols);
|
||||
|
||||
if ((frame&127) == 0) LOG_D(MAC,"phytest: %d.%d DL mcs %d, DL rbStart %d, DL rbSize %d\n", frame, slot, sched_pdsch->mcs, rbStart,rbSize);
|
||||
}
|
||||
@@ -378,14 +381,6 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
if (!is_xlsch_in_slot(ulsch_slot_bitmap, sched_slot))
|
||||
return false;
|
||||
|
||||
/* we want to avoid a lengthy deduction of DMRS and other parameters in
|
||||
* every TTI if we can save it, so check whether TDA, or
|
||||
* num_dmrs_cdm_grps_no_data has changed and only then recompute */
|
||||
NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static;
|
||||
if (ps->time_domain_allocation != tda
|
||||
|| ps->nrOfLayers != target_ul_Nl)
|
||||
nr_set_pusch_semi_static(ul_bwp, scc, tda, target_ul_Nl,ps);
|
||||
|
||||
uint16_t rbStart = 0;
|
||||
uint16_t rbSize;
|
||||
|
||||
@@ -397,10 +392,13 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
else
|
||||
rbSize = target_ul_bw;
|
||||
|
||||
NR_tda_info_t tda_info = nr_get_pusch_tda_info(ul_bwp, tda);
|
||||
sched_ctrl->sched_pusch.tda_info = tda_info;
|
||||
|
||||
uint16_t *vrb_map_UL =
|
||||
&RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE];
|
||||
for (int i = rbStart; i < rbStart + rbSize; ++i) {
|
||||
if ((vrb_map_UL[i+BWPStart] & SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols)) != 0) {
|
||||
if ((vrb_map_UL[i+BWPStart] & SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols)) != 0) {
|
||||
LOG_E(MAC,
|
||||
"%s(): %4d.%2d RB %d is already reserved, cannot schedule UE\n",
|
||||
__func__,
|
||||
@@ -452,7 +450,7 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
sched_pusch->ul_harq_pid = sched_ctrl->retrans_ul_harq.head;
|
||||
|
||||
/* Calculate TBS from MCS */
|
||||
ps->nrOfLayers = target_ul_Nl;
|
||||
sched_pusch->nrOfLayers = target_ul_Nl;
|
||||
sched_pusch->R = nr_get_code_rate_ul(mcs, ul_bwp->mcs_table);
|
||||
sched_pusch->Qm = nr_get_Qm_ul(mcs, ul_bwp->mcs_table);
|
||||
if (ul_bwp->pusch_Config->tp_pi2BPSK
|
||||
@@ -460,14 +458,21 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
sched_pusch->R >>= 1;
|
||||
sched_pusch->Qm <<= 1;
|
||||
}
|
||||
|
||||
NR_pusch_dmrs_t dmrs = get_ul_dmrs_params(scc,
|
||||
ul_bwp,
|
||||
&tda_info,
|
||||
sched_pusch->nrOfLayers);
|
||||
sched_ctrl->sched_pusch.dmrs_info = dmrs;
|
||||
|
||||
sched_pusch->tb_size = nr_compute_tbs(sched_pusch->Qm,
|
||||
sched_pusch->R,
|
||||
sched_pusch->rbSize,
|
||||
ps->nrOfSymbols,
|
||||
ps->N_PRB_DMRS * ps->num_dmrs_symb,
|
||||
tda_info.nrOfSymbols,
|
||||
dmrs.N_PRB_DMRS * dmrs.num_dmrs_symb,
|
||||
0, // nb_rb_oh
|
||||
0,
|
||||
ps->nrOfLayers /* NrOfLayers */)
|
||||
sched_pusch->nrOfLayers /* NrOfLayers */)
|
||||
>> 3;
|
||||
|
||||
/* mark the corresponding RBs as used */
|
||||
@@ -478,6 +483,6 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
sched_ctrl->aggregation_level);
|
||||
|
||||
for (int rb = rbStart; rb < rbStart + rbSize; rb++)
|
||||
vrb_map_UL[rb+BWPStart] |= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols);
|
||||
vrb_map_UL[rb+BWPStart] |= SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -142,31 +142,39 @@ static inline uint8_t get_max_cces(uint8_t scs) {
|
||||
return (nr_max_number_of_cces_per_slot[scs]);
|
||||
}
|
||||
|
||||
uint8_t set_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl) {
|
||||
uint8_t get_dl_nrOfLayers(const NR_UE_sched_ctrl_t *sched_ctrl,
|
||||
const nr_dci_format_t dci_format) {
|
||||
|
||||
// TODO check this but it should be enough for now
|
||||
// if there is not csi report RI is 0 from initialization
|
||||
return (sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.ri + 1);
|
||||
// if there is not csi report activated RI is 0 from initialization
|
||||
if(dci_format == NR_DL_DCI_FORMAT_1_0)
|
||||
return 1;
|
||||
else
|
||||
return (sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.ri + 1);
|
||||
|
||||
}
|
||||
|
||||
uint16_t set_pm_index(NR_UE_sched_ctrl_t *sched_ctrl,
|
||||
uint16_t get_pm_index(const NR_UE_info_t *UE,
|
||||
int layers,
|
||||
int N1, int N2,
|
||||
int xp_pdsch_antenna_ports,
|
||||
int codebook_mode) {
|
||||
int xp_pdsch_antenna_ports) {
|
||||
|
||||
if (layers == 1) return 0;
|
||||
|
||||
const NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
const int report_id = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.csi_report_id;
|
||||
const nr_csi_report_t *csi_report = &UE->csi_report_template[report_id];
|
||||
const int N1 = csi_report->N1;
|
||||
const int N2 = csi_report->N2;
|
||||
const int antenna_ports = (N1*N2)<<1;
|
||||
|
||||
int antenna_ports = (N1*N2)<<1;
|
||||
if (xp_pdsch_antenna_ports == 1 &&
|
||||
antenna_ports>1)
|
||||
return 0; //identity matrix (basic 5G configuration handled by PMI report is with XP antennas)
|
||||
|
||||
int x1 = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1;
|
||||
int x2 = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2;
|
||||
const int x1 = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1;
|
||||
const int x2 = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2;
|
||||
LOG_D(NR_MAC,"PMI report: x1 %d x2 %d\n",x1,x2);
|
||||
|
||||
sched_ctrl->set_pmi = false;
|
||||
|
||||
if (antenna_ports == 2)
|
||||
return x2;
|
||||
else
|
||||
@@ -214,41 +222,68 @@ uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx)
|
||||
return 9;
|
||||
}
|
||||
|
||||
NR_pdsch_dmrs_t get_dl_dmrs_params(const NR_ServingCellConfigCommon_t *scc,
|
||||
const NR_UE_DL_BWP_t *dl_bwp,
|
||||
const NR_tda_info_t *tda_info,
|
||||
const int Layers) {
|
||||
|
||||
void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) {
|
||||
|
||||
//TODO first basic implementation of dmrs port selection
|
||||
// only vaild for a single codeword
|
||||
// for now it assumes a selection of Nl consecutive dmrs ports
|
||||
// and a single front loaded symbol
|
||||
// dmrs_ports_id is the index of Tables 7.3.1.2.2-1/2/3/4
|
||||
// number of front loaded symbols need to be consistent with maxLength
|
||||
// when a more complete implementation is done
|
||||
|
||||
switch (ps->nrOfLayers) {
|
||||
case 1:
|
||||
ps->dmrs_ports_id = 0;
|
||||
ps->numDmrsCdmGrpsNoData = 1;
|
||||
ps->frontloaded_symb = 1;
|
||||
break;
|
||||
case 2:
|
||||
ps->dmrs_ports_id = 2;
|
||||
ps->numDmrsCdmGrpsNoData = 1;
|
||||
ps->frontloaded_symb = 1;
|
||||
break;
|
||||
case 3:
|
||||
ps->dmrs_ports_id = 9;
|
||||
ps->numDmrsCdmGrpsNoData = 2;
|
||||
ps->frontloaded_symb = 1;
|
||||
break;
|
||||
case 4:
|
||||
ps->dmrs_ports_id = 10;
|
||||
ps->numDmrsCdmGrpsNoData = 2;
|
||||
ps->frontloaded_symb = 1;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Number of layers %d\n not supported or not valid\n",ps->nrOfLayers);
|
||||
NR_pdsch_dmrs_t dmrs = {0};
|
||||
int frontloaded_symb = 1; // default value
|
||||
nr_dci_format_t dci_format = dl_bwp ? dl_bwp->dci_format : NR_DL_DCI_FORMAT_1_0;
|
||||
if (dci_format == NR_DL_DCI_FORMAT_1_0) {
|
||||
dmrs.numDmrsCdmGrpsNoData = tda_info->nrOfSymbols == 2 ? 1 : 2;
|
||||
dmrs.dmrs_ports_id = 0;
|
||||
}
|
||||
else {
|
||||
//TODO first basic implementation of dmrs port selection
|
||||
// only vaild for a single codeword
|
||||
// for now it assumes a selection of Nl consecutive dmrs ports
|
||||
// and a single front loaded symbol
|
||||
// dmrs_ports_id is the index of Tables 7.3.1.2.2-1/2/3/4
|
||||
// number of front loaded symbols need to be consistent with maxLength
|
||||
// when a more complete implementation is done
|
||||
|
||||
switch (Layers) {
|
||||
case 1:
|
||||
dmrs.dmrs_ports_id = 0;
|
||||
dmrs.numDmrsCdmGrpsNoData = 1;
|
||||
frontloaded_symb = 1;
|
||||
break;
|
||||
case 2:
|
||||
dmrs.dmrs_ports_id = 2;
|
||||
dmrs.numDmrsCdmGrpsNoData = 1;
|
||||
frontloaded_symb = 1;
|
||||
break;
|
||||
case 3:
|
||||
dmrs.dmrs_ports_id = 9;
|
||||
dmrs.numDmrsCdmGrpsNoData = 2;
|
||||
frontloaded_symb = 1;
|
||||
break;
|
||||
case 4:
|
||||
dmrs.dmrs_ports_id = 10;
|
||||
dmrs.numDmrsCdmGrpsNoData = 2;
|
||||
frontloaded_symb = 1;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Number of layers %d\n not supported or not valid\n",Layers);
|
||||
}
|
||||
}
|
||||
|
||||
NR_PDSCH_Config_t *pdsch_Config = dl_bwp ? dl_bwp->pdsch_Config : NULL;
|
||||
if (pdsch_Config) {
|
||||
if (tda_info->mapping_type == typeB)
|
||||
dmrs.dmrsConfigType = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->dmrs_Type != NULL;
|
||||
else
|
||||
dmrs.dmrsConfigType = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type != NULL;
|
||||
}
|
||||
else
|
||||
dmrs.dmrsConfigType = NFAPI_NR_DMRS_TYPE1;
|
||||
|
||||
dmrs.N_PRB_DMRS = dmrs.numDmrsCdmGrpsNoData * (dmrs.dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6 : 4);
|
||||
dmrs.dl_dmrs_symb_pos = fill_dmrs_mask(pdsch_Config, scc->dmrs_TypeA_Position, tda_info->nrOfSymbols, tda_info->startSymbolIndex, tda_info->mapping_type, frontloaded_symb);
|
||||
dmrs.N_DMRS_SLOT = get_num_dmrs(dmrs.dl_dmrs_symb_pos);
|
||||
LOG_D(NR_MAC,"Filling dmrs info, ps->N_PRB_DMRS %d, ps->dl_dmrs_symb_pos %x, ps->N_DMRS_SLOT %d\n",dmrs.N_PRB_DMRS,dmrs.dl_dmrs_symb_pos,dmrs.N_DMRS_SLOT);
|
||||
return dmrs;
|
||||
}
|
||||
|
||||
NR_ControlResourceSet_t *get_coreset(gNB_MAC_INST *nrmac,
|
||||
@@ -514,109 +549,70 @@ bool nr_find_nb_rb(uint16_t Qm,
|
||||
return *tbs >= bytes && *nb_rb <= nb_rb_max;
|
||||
}
|
||||
|
||||
void nr_set_pdsch_semi_static(const NR_UE_DL_BWP_t *dl_bwp,
|
||||
const NR_ServingCellConfigCommon_t *scc,
|
||||
int tda,
|
||||
uint8_t layers,
|
||||
NR_UE_sched_ctrl_t *sched_ctrl,
|
||||
NR_pdsch_semi_static_t *ps)
|
||||
{
|
||||
bool reset_dmrs = false;
|
||||
NR_tda_info_t nr_get_pdsch_tda_info(const NR_UE_DL_BWP_t *dl_bwp,
|
||||
const int tda) {
|
||||
|
||||
NR_PDSCH_Config_t *pdsch_Config = dl_bwp->pdsch_Config;
|
||||
LOG_D(NR_MAC,"tda %d, ps->time_domain_allocation %d,layers %d, ps->nrOfLayers %d, pdsch_config %p\n",tda,ps->time_domain_allocation,layers,ps->nrOfLayers,pdsch_Config);
|
||||
reset_dmrs = true;
|
||||
ps->time_domain_allocation = tda;
|
||||
NR_tda_info_t tda_info = {0};
|
||||
NR_PDSCH_TimeDomainResourceAllocationList_t *tdaList = dl_bwp->tdaList;
|
||||
AssertFatal(tda < tdaList->list.count, "time_domain_allocation %d>=%d\n", tda, tdaList->list.count);
|
||||
ps->mapping_type = tdaList->list.array[tda]->mappingType;
|
||||
if (pdsch_Config) {
|
||||
if (ps->mapping_type == NR_PDSCH_TimeDomainResourceAllocation__mappingType_typeB)
|
||||
ps->dmrsConfigType = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->dmrs_Type != NULL;
|
||||
else
|
||||
ps->dmrsConfigType = pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type != NULL;
|
||||
}
|
||||
else
|
||||
ps->dmrsConfigType = NFAPI_NR_DMRS_TYPE1;
|
||||
tda_info.mapping_type = tdaList->list.array[tda]->mappingType;
|
||||
const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength;
|
||||
SLIV2SL(startSymbolAndLength, &ps->startSymbolIndex, &ps->nrOfSymbols);
|
||||
|
||||
if (dl_bwp->dci_format == NR_DL_DCI_FORMAT_1_0) {
|
||||
if (ps->nrOfSymbols == 2)
|
||||
ps->numDmrsCdmGrpsNoData = 1;
|
||||
else
|
||||
ps->numDmrsCdmGrpsNoData = 2;
|
||||
ps->dmrs_ports_id = 0;
|
||||
ps->frontloaded_symb = 1;
|
||||
ps->nrOfLayers = 1;
|
||||
}
|
||||
else {
|
||||
LOG_D(NR_MAC,"checking layers\n");
|
||||
if (ps->nrOfLayers != layers || ps->numDmrsCdmGrpsNoData == 0) {
|
||||
reset_dmrs = true;
|
||||
ps->nrOfLayers = layers;
|
||||
set_dl_dmrs_ports(ps);
|
||||
}
|
||||
}
|
||||
|
||||
ps->N_PRB_DMRS = ps->numDmrsCdmGrpsNoData * (ps->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6 : 4);
|
||||
|
||||
if (reset_dmrs) {
|
||||
ps->dl_dmrs_symb_pos = fill_dmrs_mask(pdsch_Config, scc ? scc->dmrs_TypeA_Position : 0, ps->nrOfSymbols, ps->startSymbolIndex, ps->mapping_type, ps->frontloaded_symb);
|
||||
ps->N_DMRS_SLOT = get_num_dmrs(ps->dl_dmrs_symb_pos);
|
||||
}
|
||||
LOG_D(NR_MAC,"Filling dmrs info, ps->N_PRB_DMRS %d, ps->dl_dmrs_symb_pos %x, ps->N_DMRS_SLOT %d\n",ps->N_PRB_DMRS,ps->dl_dmrs_symb_pos,ps->N_DMRS_SLOT);
|
||||
SLIV2SL(startSymbolAndLength, &tda_info.startSymbolIndex, &tda_info.nrOfSymbols);
|
||||
return tda_info;
|
||||
}
|
||||
|
||||
void nr_set_pusch_semi_static(const NR_UE_UL_BWP_t *ul_bwp,
|
||||
const NR_ServingCellConfigCommon_t *scc,
|
||||
int tda,
|
||||
uint8_t nrOfLayers,
|
||||
NR_pusch_semi_static_t *ps) {
|
||||
NR_tda_info_t nr_get_pusch_tda_info(const NR_UE_UL_BWP_t *ul_bwp,
|
||||
const int tda) {
|
||||
|
||||
ps->time_domain_allocation = tda;
|
||||
NR_tda_info_t tda_info = {0};
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList = ul_bwp->tdaList;
|
||||
AssertFatal(tda < tdaList->list.count, "time_domain_allocation %d>=%d\n", tda, tdaList->list.count);
|
||||
tda_info.mapping_type = tdaList->list.array[tda]->mappingType;
|
||||
const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength;
|
||||
SLIV2SL(startSymbolAndLength, &tda_info.startSymbolIndex, &tda_info.nrOfSymbols);
|
||||
return tda_info;
|
||||
}
|
||||
|
||||
const int startSymbolAndLength = ul_bwp->tdaList->list.array[tda]->startSymbolAndLength;
|
||||
SLIV2SL(startSymbolAndLength,
|
||||
&ps->startSymbolIndex,
|
||||
&ps->nrOfSymbols);
|
||||
NR_pusch_dmrs_t get_ul_dmrs_params(const NR_ServingCellConfigCommon_t *scc,
|
||||
const NR_UE_UL_BWP_t *ul_bwp,
|
||||
const NR_tda_info_t *tda_info,
|
||||
const int Layers) {
|
||||
|
||||
ps->nrOfLayers = nrOfLayers;
|
||||
NR_pusch_dmrs_t dmrs = {0};
|
||||
// TODO setting of cdm groups with no data to be redone for MIMO
|
||||
if (ul_bwp->transform_precoding || nrOfLayers<3)
|
||||
ps->num_dmrs_cdm_grps_no_data = (ul_bwp->dci_format == NR_UL_DCI_FORMAT_0_1) ? 1 : (ps->nrOfSymbols == 2 ? 1 : 2);
|
||||
if (ul_bwp->transform_precoding || Layers<3)
|
||||
dmrs.num_dmrs_cdm_grps_no_data = ul_bwp->dci_format == NR_UL_DCI_FORMAT_0_1 || tda_info->nrOfSymbols == 2 ? 1 : 2;
|
||||
else
|
||||
ps->num_dmrs_cdm_grps_no_data = 2;
|
||||
dmrs.num_dmrs_cdm_grps_no_data = 2;
|
||||
|
||||
NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = ul_bwp->pusch_Config ?
|
||||
(tda_info->mapping_type == typeA ?
|
||||
ul_bwp->pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup :
|
||||
ul_bwp->pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup) : NULL;
|
||||
|
||||
dmrs.dmrs_config_type = NR_DMRS_UplinkConfig && NR_DMRS_UplinkConfig->dmrs_Type ? 1 : 0;
|
||||
|
||||
const pusch_dmrs_AdditionalPosition_t additional_pos = (NR_DMRS_UplinkConfig && NR_DMRS_UplinkConfig->dmrs_AdditionalPosition) ?
|
||||
(*NR_DMRS_UplinkConfig->dmrs_AdditionalPosition ==
|
||||
NR_DMRS_UplinkConfig__dmrs_AdditionalPosition_pos3 ?
|
||||
3 : *NR_DMRS_UplinkConfig->dmrs_AdditionalPosition) : 2;
|
||||
|
||||
const pusch_maxLength_t pusch_maxLength = NR_DMRS_UplinkConfig ? (NR_DMRS_UplinkConfig->maxLength == NULL ? 1 : 2) : 1;
|
||||
dmrs.ul_dmrs_symb_pos = get_l_prime(tda_info->nrOfSymbols,
|
||||
tda_info->mapping_type,
|
||||
additional_pos,
|
||||
pusch_maxLength,
|
||||
tda_info->startSymbolIndex,
|
||||
scc->dmrs_TypeA_Position);
|
||||
|
||||
/* DMRS calculations */
|
||||
ps->mapping_type = ul_bwp->tdaList->list.array[tda]->mappingType;
|
||||
ps->NR_DMRS_UplinkConfig = ul_bwp->pusch_Config ?
|
||||
(ps->mapping_type == NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeA ?
|
||||
ul_bwp->pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup :
|
||||
ul_bwp->pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup) : NULL;
|
||||
ps->dmrs_config_type = ps->NR_DMRS_UplinkConfig ? ((ps->NR_DMRS_UplinkConfig->dmrs_Type == NULL ? 0 : 1)) : 0;
|
||||
const pusch_dmrs_AdditionalPosition_t additional_pos =
|
||||
ps->NR_DMRS_UplinkConfig ? (ps->NR_DMRS_UplinkConfig->dmrs_AdditionalPosition == NULL
|
||||
? 2
|
||||
: (*ps->NR_DMRS_UplinkConfig->dmrs_AdditionalPosition ==
|
||||
NR_DMRS_UplinkConfig__dmrs_AdditionalPosition_pos3
|
||||
? 3
|
||||
: *ps->NR_DMRS_UplinkConfig->dmrs_AdditionalPosition)):2;
|
||||
const pusch_maxLength_t pusch_maxLength =
|
||||
ps->NR_DMRS_UplinkConfig ? (ps->NR_DMRS_UplinkConfig->maxLength == NULL ? 1 : 2) : 1;
|
||||
ps->ul_dmrs_symb_pos = get_l_prime(ps->nrOfSymbols,
|
||||
ps->mapping_type,
|
||||
additional_pos,
|
||||
pusch_maxLength,
|
||||
ps->startSymbolIndex,
|
||||
scc->dmrs_TypeA_Position);
|
||||
uint8_t num_dmrs_symb = 0;
|
||||
for(int i = ps->startSymbolIndex; i < ps->startSymbolIndex + ps->nrOfSymbols; i++)
|
||||
num_dmrs_symb += (ps->ul_dmrs_symb_pos >> i) & 1;
|
||||
ps->num_dmrs_symb = num_dmrs_symb;
|
||||
ps->N_PRB_DMRS = ps->dmrs_config_type == 0
|
||||
? ps->num_dmrs_cdm_grps_no_data * 6
|
||||
: ps->num_dmrs_cdm_grps_no_data * 4;
|
||||
for(int i = tda_info->startSymbolIndex; i < tda_info->startSymbolIndex + tda_info->nrOfSymbols; i++)
|
||||
num_dmrs_symb += (dmrs.ul_dmrs_symb_pos >> i) & 1;
|
||||
dmrs.num_dmrs_symb = num_dmrs_symb;
|
||||
dmrs.N_PRB_DMRS = dmrs.num_dmrs_cdm_grps_no_data * (dmrs.dmrs_config_type == 0 ? 6 : 4);
|
||||
|
||||
dmrs.NR_DMRS_UplinkConfig = NR_DMRS_UplinkConfig;
|
||||
return dmrs;
|
||||
}
|
||||
|
||||
#define BLER_UPDATE_FRAME 10
|
||||
@@ -2501,8 +2497,8 @@ NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConf
|
||||
configure_UE_BWP(nr_mac, scc, sched_ctrl, NULL, UE);
|
||||
|
||||
/* set illegal time domain allocation to force recomputation of all fields */
|
||||
sched_ctrl->pdsch_semi_static.time_domain_allocation = -1;
|
||||
sched_ctrl->pusch_semi_static.time_domain_allocation = -1;
|
||||
sched_ctrl->sched_pdsch.time_domain_allocation = -1;
|
||||
sched_ctrl->sched_pusch.time_domain_allocation = -1;
|
||||
|
||||
/* Set default BWPs */
|
||||
sched_ctrl->next_dl_bwp_id = -1;
|
||||
@@ -2957,28 +2953,6 @@ void nr_mac_update_timers(module_id_t module_id,
|
||||
// add all available DL HARQ processes for this UE in SA
|
||||
create_dl_harq_list(sched_ctrl, UE->current_DL_BWP.pdsch_servingcellconfig);
|
||||
}
|
||||
|
||||
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
|
||||
const uint8_t layers = set_dl_nrOfLayers(sched_ctrl);
|
||||
const int tda = get_dl_tda(RC.nrmac[module_id], scc, slot);
|
||||
|
||||
nr_set_pdsch_semi_static(&UE->current_DL_BWP,
|
||||
scc,
|
||||
tda,
|
||||
layers,
|
||||
sched_ctrl,
|
||||
ps);
|
||||
|
||||
|
||||
NR_pusch_semi_static_t *ups = &sched_ctrl->pusch_semi_static;
|
||||
const uint8_t nrOfLayers = 1;
|
||||
const int utda = get_ul_tda(RC.nrmac[module_id], scc, slot);
|
||||
|
||||
nr_set_pusch_semi_static(&UE->current_UL_BWP,
|
||||
scc,
|
||||
utda,
|
||||
nrOfLayers,
|
||||
ups);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -707,7 +707,6 @@ uint8_t evaluate_pmi_report(uint8_t *payload,
|
||||
sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1,
|
||||
sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2);
|
||||
|
||||
sched_ctrl->set_pmi = true;
|
||||
return tot_bitlen;
|
||||
|
||||
}
|
||||
|
||||
@@ -53,30 +53,28 @@ const int get_ul_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon
|
||||
return 0; // if FDD or not mixed slot in TDD, for now use default TDA (TODO handle CSI-RS slots)
|
||||
}
|
||||
|
||||
int compute_bw_factor(int mu, int rb) {
|
||||
// 38.213 7.1.1
|
||||
return (10 * log10(rb << mu));
|
||||
}
|
||||
|
||||
int compute_delta_tf(int tbs_bits,
|
||||
int rb,
|
||||
int n_layers,
|
||||
int n_symbols,
|
||||
int n_dmrs,
|
||||
long *deltaMCS) {
|
||||
int compute_ph_factor(int mu,
|
||||
int tbs_bits,
|
||||
int rb,
|
||||
int n_layers,
|
||||
int n_symbols,
|
||||
int n_dmrs,
|
||||
long *deltaMCS) {
|
||||
|
||||
// 38.213 7.1.1
|
||||
// if the PUSCH transmission is over more than one layer delta_tf = 0
|
||||
if(deltaMCS == NULL || n_layers>1)
|
||||
return 0;
|
||||
else
|
||||
AssertFatal(1==0,"Compute DeltaTF not yet fully supported\n");
|
||||
int delta_tf = 0;
|
||||
if(deltaMCS != NULL && n_layers == 1) {
|
||||
const int n_re = (NR_NB_SC_PER_RB * n_symbols - n_dmrs) * rb;
|
||||
const int BPRE = tbs_bits/n_re; //TODO change for PUSCH with CSI
|
||||
const float f = pow(2, (float) BPRE * 1.25);
|
||||
const float beta = 1.0f; //TODO change for PUSCH with CSI
|
||||
delta_tf = (10 * log10((f - 1) * beta));
|
||||
}
|
||||
|
||||
const int n_re = (NR_NB_SC_PER_RB * n_symbols - n_dmrs) * rb;
|
||||
const int BPRE = tbs_bits/n_re; //TODO change for PUSCH with CSI
|
||||
const float f = pow(2, (float) BPRE * 1.25);
|
||||
const float beta = 1.0f; //TODO change for PUSCH with CSI
|
||||
return(10 * log10((f - 1) * beta));
|
||||
const int bw_factor = 10 * log10(rb << mu);
|
||||
|
||||
return (delta_tf + bw_factor);
|
||||
}
|
||||
|
||||
// For both UL-SCH except:
|
||||
@@ -114,7 +112,6 @@ int nr_process_mac_pdu(instance_t module_idP,
|
||||
{
|
||||
|
||||
uint8_t done = 0;
|
||||
|
||||
int sdus = 0;
|
||||
NR_UE_UL_BWP_t *ul_bwp = &UE->current_UL_BWP;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
@@ -247,13 +244,13 @@ int nr_process_mac_pdu(instance_t module_idP,
|
||||
// in sched_ctrl we set normalized PH wrt MCS and PRBs
|
||||
long *deltaMCS = ul_bwp->pusch_Config ? ul_bwp->pusch_Config->pusch_PowerControl->deltaMCS : NULL;
|
||||
sched_ctrl->ph = PH +
|
||||
compute_bw_factor(sched_pusch->mu, sched_pusch->rbSize) +
|
||||
compute_delta_tf(sched_pusch->tb_size<<3,
|
||||
sched_pusch->rbSize,
|
||||
0, //n_layers
|
||||
0, //n_symbols
|
||||
0, //n_dmrs
|
||||
deltaMCS);
|
||||
compute_ph_factor(sched_pusch->mu,
|
||||
sched_pusch->tb_size<<3,
|
||||
sched_pusch->rbSize,
|
||||
sched_pusch->nrOfLayers,
|
||||
sched_pusch->tda_info.nrOfSymbols, //n_symbols
|
||||
sched_pusch->dmrs_info.num_dmrs_symb*sched_pusch->dmrs_info.N_PRB_DMRS, //n_dmrs
|
||||
deltaMCS);
|
||||
/* 38.133 Table10.1.18.1-1 */
|
||||
sched_ctrl->pcmax = PCMAX - 29;
|
||||
LOG_D(NR_MAC, "SINGLE ENTRY PHR R1 %d PH %d (%d dB) R2 %d PCMAX %d (%d dBm)\n",
|
||||
@@ -263,6 +260,7 @@ int nr_process_mac_pdu(instance_t module_idP,
|
||||
case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT:
|
||||
//38.321 section 6.1.3.9
|
||||
// varialbe length
|
||||
AssertFatal(1==0,"Multi entry PHR not supported\n");
|
||||
if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
|
||||
return 0;
|
||||
/* Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */
|
||||
@@ -271,6 +269,7 @@ int nr_process_mac_pdu(instance_t module_idP,
|
||||
case UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT:
|
||||
//38.321 section 6.1.3.9
|
||||
// varialbe length
|
||||
AssertFatal(1==0,"Multi entry PHR not supported\n");
|
||||
if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
|
||||
return 0;
|
||||
/* Extract MULTI ENTRY PHR elements from four octets bitmap for PHR calculation */
|
||||
@@ -795,8 +794,8 @@ void handle_nr_srs_measurements(const module_id_t module_id,
|
||||
const uint8_t num_symbols,
|
||||
const uint8_t wide_band_snr,
|
||||
const uint8_t num_reported_symbols,
|
||||
nfapi_nr_srs_indication_reported_symbol_t* reported_symbol_list) {
|
||||
|
||||
nfapi_nr_srs_indication_reported_symbol_t *reported_symbol_list)
|
||||
{
|
||||
LOG_D(NR_MAC, "(%d.%d) Received SRS indication for rnti: 0x%04x\n", frame, slot, rnti);
|
||||
|
||||
#ifdef SRS_IND_DEBUG
|
||||
@@ -805,32 +804,39 @@ void handle_nr_srs_measurements(const module_id_t module_id,
|
||||
LOG_I(NR_MAC, "rnti = 0x%04x\n", rnti);
|
||||
LOG_I(NR_MAC, "timing_advance = %i\n", timing_advance);
|
||||
LOG_I(NR_MAC, "num_symbols = %i\n", num_symbols);
|
||||
LOG_I(NR_MAC, "wide_band_snr = %i (%i dB)\n", wide_band_snr, (wide_band_snr>>1)-64);
|
||||
LOG_I(NR_MAC, "wide_band_snr = %i (%i dB)\n", wide_band_snr, (wide_band_snr >> 1) - 64);
|
||||
LOG_I(NR_MAC, "num_reported_symbols = %i\n", num_reported_symbols);
|
||||
LOG_I(NR_MAC, "reported_symbol_list[0].num_rbs = %i\n", reported_symbol_list[0].num_rbs);
|
||||
for(int rb = 0; rb < reported_symbol_list[0].num_rbs; rb++) {
|
||||
LOG_I(NR_MAC, "reported_symbol_list[0].rb_list[%3i].rb_snr = %i (%i dB)\n",
|
||||
rb, reported_symbol_list[0].rb_list[rb].rb_snr, (reported_symbol_list[0].rb_list[rb].rb_snr>>1)-64);
|
||||
for (int rb = 0; rb < reported_symbol_list[0].num_rbs; rb++) {
|
||||
LOG_I(NR_MAC, "reported_symbol_list[0].rb_list[%3i].rb_snr = %i (%i dB)\n", rb, reported_symbol_list[0].rb_list[rb].rb_snr, (reported_symbol_list[0].rb_list[rb].rb_snr >> 1) - 64);
|
||||
}
|
||||
#endif
|
||||
|
||||
NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[module_id]->UE_info, rnti);
|
||||
if (!UE) {
|
||||
LOG_W(NR_MAC, "Could not find UE for RNTI 0x%04x\n", rnti);
|
||||
LOG_E(NR_MAC, "Could not find UE for RNTI %04x\n", rnti);
|
||||
return;
|
||||
}
|
||||
|
||||
if (wide_band_snr == 0xFF) {
|
||||
LOG_W(NR_MAC, "Invalid wide_band_snr for RNTI %04x\n", rnti);
|
||||
return;
|
||||
}
|
||||
|
||||
int wide_band_snr_dB = (wide_band_snr >> 1) - 64;
|
||||
|
||||
gNB_MAC_INST *nr_mac = RC.nrmac[module_id];
|
||||
NR_mac_stats_t *stats = &UE->mac_stats;
|
||||
stats->srs_wide_band_snr = (wide_band_snr>>1)-64;
|
||||
stats->srs_wide_band_snr = wide_band_snr_dB;
|
||||
|
||||
const int ul_prbblack_SNR_threshold = nr_mac->ul_prbblack_SNR_threshold;
|
||||
uint16_t *ulprbbl = nr_mac->ulprbbl;
|
||||
|
||||
memset(ulprbbl, 0, reported_symbol_list[0].num_rbs*sizeof(uint16_t));
|
||||
memset(ulprbbl, 0, reported_symbol_list[0].num_rbs * sizeof(uint16_t));
|
||||
|
||||
for (int rb = 0; rb < reported_symbol_list[0].num_rbs; rb++) {
|
||||
int snr = (reported_symbol_list[0].rb_list[rb].rb_snr>>1)-64;
|
||||
if (snr < ul_prbblack_SNR_threshold) {
|
||||
int snr = (reported_symbol_list[0].rb_list[rb].rb_snr >> 1) - 64;
|
||||
if (snr < wide_band_snr_dB - ul_prbblack_SNR_threshold) {
|
||||
ulprbbl[rb] = 0x3FFF; // all symbols taken
|
||||
}
|
||||
LOG_D(NR_MAC, "ulprbbl[%3i] = 0x%x\n", rb, ulprbbl[rb]);
|
||||
@@ -903,8 +909,7 @@ void update_ul_ue_R_Qm(int mcs, int mcs_table, const NR_PUSCH_Config_t *pusch_Co
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void nr_ue_max_mcs_min_rb(int mu, int ph_limit, NR_pusch_semi_static_t *ps, NR_UE_UL_BWP_t *ul_bwp, uint16_t minRb, uint32_t tbs, uint16_t *Rb, uint8_t *mcs)
|
||||
void nr_ue_max_mcs_min_rb(int mu, int ph_limit, NR_sched_pusch_t *sched_pusch, NR_UE_UL_BWP_t *ul_bwp, uint16_t minRb, uint32_t tbs, uint16_t *Rb, uint8_t *mcs)
|
||||
{
|
||||
AssertFatal(*Rb >= minRb, "illegal Rb %d < minRb %d\n", *Rb, minRb);
|
||||
AssertFatal(*mcs >= 0 && *mcs <= 28, "illegal MCS %d\n", *mcs);
|
||||
@@ -915,35 +920,35 @@ void nr_ue_max_mcs_min_rb(int mu, int ph_limit, NR_pusch_semi_static_t *ps, NR_U
|
||||
update_ul_ue_R_Qm(*mcs, ul_bwp->mcs_table, ul_bwp->pusch_Config, &R, &Qm);
|
||||
|
||||
long *deltaMCS = ul_bwp->pusch_Config ? ul_bwp->pusch_Config->pusch_PowerControl->deltaMCS : NULL;
|
||||
int tx_power = compute_bw_factor(mu, *Rb) +
|
||||
compute_delta_tf(tbs_bits,
|
||||
*Rb,
|
||||
ps->nrOfLayers,
|
||||
ps->nrOfSymbols,
|
||||
ps->N_PRB_DMRS*ps->num_dmrs_symb,
|
||||
deltaMCS);
|
||||
int tx_power = compute_ph_factor(mu,
|
||||
tbs_bits,
|
||||
*Rb,
|
||||
sched_pusch->nrOfLayers,
|
||||
sched_pusch->tda_info.nrOfSymbols,
|
||||
sched_pusch->dmrs_info.N_PRB_DMRS*sched_pusch->dmrs_info.num_dmrs_symb,
|
||||
deltaMCS);
|
||||
|
||||
while (ph_limit < tx_power && *Rb >= minRb) {
|
||||
(*Rb)--;
|
||||
tx_power = compute_bw_factor(mu, *Rb) +
|
||||
compute_delta_tf(tbs_bits,
|
||||
*Rb,
|
||||
ps->nrOfLayers,
|
||||
ps->nrOfSymbols,
|
||||
ps->N_PRB_DMRS*ps->num_dmrs_symb,
|
||||
deltaMCS);
|
||||
tx_power = compute_ph_factor(mu,
|
||||
tbs_bits,
|
||||
*Rb,
|
||||
sched_pusch->nrOfLayers,
|
||||
sched_pusch->tda_info.nrOfSymbols,
|
||||
sched_pusch->dmrs_info.N_PRB_DMRS*sched_pusch->dmrs_info.num_dmrs_symb,
|
||||
deltaMCS);
|
||||
}
|
||||
|
||||
while (ph_limit < tx_power && *mcs > 6) {
|
||||
(*mcs)--;
|
||||
update_ul_ue_R_Qm(*mcs, ul_bwp->mcs_table, ul_bwp->pusch_Config, &R, &Qm);
|
||||
tx_power = compute_bw_factor(mu, *Rb) +
|
||||
compute_delta_tf(tbs_bits,
|
||||
*Rb,
|
||||
ps->nrOfLayers,
|
||||
ps->nrOfSymbols,
|
||||
ps->N_PRB_DMRS*ps->num_dmrs_symb,
|
||||
deltaMCS);
|
||||
tx_power = compute_ph_factor(mu,
|
||||
tbs_bits,
|
||||
*Rb,
|
||||
sched_pusch->nrOfLayers,
|
||||
sched_pusch->tda_info.nrOfSymbols,
|
||||
sched_pusch->dmrs_info.N_PRB_DMRS*sched_pusch->dmrs_info.num_dmrs_symb,
|
||||
deltaMCS);
|
||||
}
|
||||
|
||||
if (ph_limit < tx_power)
|
||||
@@ -971,22 +976,11 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac,
|
||||
const uint8_t nrOfLayers = 1;
|
||||
LOG_D(NR_MAC,"retInfo->time_domain_allocation = %d, tda = %d\n", retInfo->time_domain_allocation, tda);
|
||||
LOG_D(NR_MAC,"tbs %d\n",retInfo->tb_size);
|
||||
if (tda == retInfo->time_domain_allocation) {
|
||||
/* check whether we need to switch the TDA allocation since tha last
|
||||
* (re-)transmission */
|
||||
NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static;
|
||||
|
||||
if (ps->time_domain_allocation != tda
|
||||
|| ps->nrOfLayers != nrOfLayers) {
|
||||
nr_set_pusch_semi_static(&UE->current_UL_BWP,
|
||||
scc,
|
||||
tda,
|
||||
nrOfLayers,
|
||||
ps);
|
||||
}
|
||||
if (tda == retInfo->time_domain_allocation &&
|
||||
nrOfLayers == retInfo->nrOfLayers) {
|
||||
|
||||
/* Check the resource is enough for retransmission */
|
||||
const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols);
|
||||
const uint16_t slbitmap = SL_to_bitmap(retInfo->tda_info.startSymbolIndex, retInfo->tda_info.nrOfSymbols);
|
||||
while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
|
||||
rbStart++;
|
||||
if (rbStart + retInfo->rbSize > bwpSize) {
|
||||
@@ -995,15 +989,15 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac,
|
||||
}
|
||||
LOG_D(NR_MAC, "%s(): retransmission keeping TDA %d and TBS %d\n", __func__, tda, retInfo->tb_size);
|
||||
} else {
|
||||
NR_pusch_semi_static_t temp_ps;
|
||||
nr_set_pusch_semi_static(&UE->current_UL_BWP,
|
||||
scc,
|
||||
tda,
|
||||
nrOfLayers,
|
||||
&temp_ps);
|
||||
|
||||
NR_tda_info_t tda_info = nr_get_pusch_tda_info(&UE->current_UL_BWP, tda);
|
||||
NR_pusch_dmrs_t dmrs_info = get_ul_dmrs_params(scc,
|
||||
&UE->current_UL_BWP,
|
||||
&tda_info,
|
||||
nrOfLayers);
|
||||
/* the retransmission will use a different time domain allocation, check
|
||||
* that we have enough resources */
|
||||
const uint16_t slbitmap = SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols);
|
||||
const uint16_t slbitmap = SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols);
|
||||
while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
|
||||
rbStart++;
|
||||
int rbSize = 0;
|
||||
@@ -1014,8 +1008,8 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac,
|
||||
bool success = nr_find_nb_rb(retInfo->Qm,
|
||||
retInfo->R,
|
||||
1, // layers
|
||||
temp_ps.nrOfSymbols,
|
||||
temp_ps.N_PRB_DMRS * temp_ps.num_dmrs_symb,
|
||||
tda_info.nrOfSymbols,
|
||||
dmrs_info.N_PRB_DMRS * dmrs_info.num_dmrs_symb,
|
||||
retInfo->tb_size,
|
||||
1, /* minimum of 1RB: need to find exact TBS, don't preclude any number */
|
||||
rbSize,
|
||||
@@ -1031,7 +1025,8 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac,
|
||||
retInfo->tb_size = new_tbs;
|
||||
retInfo->rbSize = new_rbSize;
|
||||
retInfo->time_domain_allocation = tda;
|
||||
sched_ctrl->pusch_semi_static = temp_ps;
|
||||
retInfo->dmrs_info = dmrs_info;
|
||||
retInfo->tda_info = tda_info;
|
||||
}
|
||||
|
||||
/* Find a free CCE */
|
||||
@@ -1089,7 +1084,7 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac,
|
||||
/* Mark the corresponding RBs as used */
|
||||
n_rb_sched -= sched_pusch->rbSize;
|
||||
for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++)
|
||||
rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= SL_to_bitmap(sched_ctrl->pusch_semi_static.startSymbolIndex, sched_ctrl->pusch_semi_static.nrOfSymbols);
|
||||
rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= SL_to_bitmap(sched_pusch->tda_info.startSymbolIndex, sched_pusch->tda_info.nrOfSymbols);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1136,7 +1131,6 @@ void pf_ul(module_id_t module_id,
|
||||
|
||||
const uint16_t bwpSize = current_BWP->BWPSize;
|
||||
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
|
||||
NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static;
|
||||
const NR_mac_dir_stats_t *stats = &UE->mac_stats.ul;
|
||||
|
||||
/* Calculate throughput */
|
||||
@@ -1228,24 +1222,17 @@ void pf_ul(module_id_t module_id,
|
||||
if (remainUEs == 0)
|
||||
return;
|
||||
|
||||
/* Save PUSCH field */
|
||||
/* we want to avoid a lengthy deduction of DMRS and other parameters in
|
||||
* every TTI if we can save it, so check whether TDA, or
|
||||
* num_dmrs_cdm_grps_no_data has changed and only then recompute */
|
||||
const uint8_t nrOfLayers = 1;
|
||||
const int tda = get_ul_tda(nrmac, scc, sched_pusch->slot);
|
||||
if (ps->time_domain_allocation != tda
|
||||
|| ps->nrOfLayers != nrOfLayers) {
|
||||
nr_set_pusch_semi_static(current_BWP,
|
||||
scc,
|
||||
tda,
|
||||
nrOfLayers,
|
||||
ps);
|
||||
}
|
||||
sched_pusch->nrOfLayers = 1;
|
||||
sched_pusch->time_domain_allocation = get_ul_tda(nrmac, scc, sched_pusch->slot);
|
||||
sched_pusch->tda_info = nr_get_pusch_tda_info(current_BWP, sched_pusch->time_domain_allocation);
|
||||
sched_pusch->dmrs_info = get_ul_dmrs_params(scc,
|
||||
current_BWP,
|
||||
&sched_pusch->tda_info,
|
||||
sched_pusch->nrOfLayers);
|
||||
|
||||
LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d num_dmrs_cdm_grps_no_data %d\n",
|
||||
min_rb, rbStart, ps->num_dmrs_cdm_grps_no_data);
|
||||
const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols);
|
||||
min_rb, rbStart, sched_pusch->dmrs_info.num_dmrs_cdm_grps_no_data);
|
||||
const uint16_t slbitmap = SL_to_bitmap(sched_pusch->tda_info.startSymbolIndex, sched_pusch->tda_info.nrOfSymbols);
|
||||
while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
|
||||
rbStart++;
|
||||
if (rbStart + min_rb >= bwpSize) {
|
||||
@@ -1269,11 +1256,11 @@ void pf_ul(module_id_t module_id,
|
||||
sched_pusch->tb_size = nr_compute_tbs(sched_pusch->Qm,
|
||||
sched_pusch->R,
|
||||
sched_pusch->rbSize,
|
||||
ps->nrOfSymbols,
|
||||
ps->N_PRB_DMRS * ps->num_dmrs_symb,
|
||||
sched_pusch->tda_info.nrOfSymbols,
|
||||
sched_pusch->dmrs_info.N_PRB_DMRS * sched_pusch->dmrs_info.num_dmrs_symb,
|
||||
0, // nb_rb_oh
|
||||
0,
|
||||
ps->nrOfLayers)
|
||||
sched_pusch->nrOfLayers)
|
||||
>> 3;
|
||||
|
||||
/* Mark the corresponding RBs as used */
|
||||
@@ -1333,26 +1320,19 @@ void pf_ul(module_id_t module_id,
|
||||
|
||||
const uint16_t bwpSize = current_BWP->BWPSize;
|
||||
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
|
||||
NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static;
|
||||
|
||||
/* Save PUSCH field */
|
||||
/* we want to avoid a lengthy deduction of DMRS and other parameters in
|
||||
* every TTI if we can save it, so check whether TDA, or
|
||||
* num_dmrs_cdm_grps_no_data has changed and only then recompute */
|
||||
const uint8_t nrOfLayers = 1;
|
||||
const int tda = get_ul_tda(nrmac, scc, sched_pusch->slot);
|
||||
if (ps->time_domain_allocation != tda
|
||||
|| ps->nrOfLayers != nrOfLayers) {
|
||||
nr_set_pusch_semi_static(current_BWP,
|
||||
scc,
|
||||
tda,
|
||||
nrOfLayers,
|
||||
ps);
|
||||
}
|
||||
sched_pusch->nrOfLayers = 1;
|
||||
sched_pusch->time_domain_allocation = get_ul_tda(nrmac, scc, sched_pusch->slot);
|
||||
sched_pusch->tda_info = nr_get_pusch_tda_info(current_BWP, sched_pusch->time_domain_allocation);
|
||||
sched_pusch->dmrs_info = get_ul_dmrs_params(scc,
|
||||
current_BWP,
|
||||
&sched_pusch->tda_info,
|
||||
sched_pusch->nrOfLayers);
|
||||
|
||||
update_ul_ue_R_Qm(sched_pusch->mcs, current_BWP->mcs_table, current_BWP->pusch_Config, &sched_pusch->R, &sched_pusch->Qm);
|
||||
|
||||
int rbStart = 0;
|
||||
const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols);
|
||||
const uint16_t slbitmap = SL_to_bitmap(sched_pusch->tda_info.startSymbolIndex, sched_pusch->tda_info.nrOfSymbols);
|
||||
while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
|
||||
rbStart++;
|
||||
sched_pusch->rbStart = rbStart;
|
||||
@@ -1374,7 +1354,7 @@ void pf_ul(module_id_t module_id,
|
||||
sched_pusch->mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing;
|
||||
if(sched_ctrl->pcmax!=0 ||
|
||||
sched_ctrl->ph!=0) // verify if the PHR related parameter have been initialized
|
||||
nr_ue_max_mcs_min_rb(sched_pusch->mu, sched_ctrl->ph, ps, current_BWP, min_rbSize, B, &max_rbSize, &sched_pusch->mcs);
|
||||
nr_ue_max_mcs_min_rb(current_BWP->scs, sched_ctrl->ph, sched_pusch, current_BWP, min_rbSize, B, &max_rbSize, &sched_pusch->mcs);
|
||||
|
||||
if (sched_pusch->mcs < sched_ctrl->ul_bler_stats.mcs)
|
||||
sched_ctrl->ul_bler_stats.mcs = sched_pusch->mcs; /* force estimated MCS down */
|
||||
@@ -1385,8 +1365,8 @@ void pf_ul(module_id_t module_id,
|
||||
nr_find_nb_rb(sched_pusch->Qm,
|
||||
sched_pusch->R,
|
||||
1, // layers
|
||||
ps->nrOfSymbols,
|
||||
ps->N_PRB_DMRS * ps->num_dmrs_symb,
|
||||
sched_pusch->tda_info.nrOfSymbols,
|
||||
sched_pusch->dmrs_info.N_PRB_DMRS * sched_pusch->dmrs_info.num_dmrs_symb,
|
||||
B,
|
||||
min_rbSize,
|
||||
max_rbSize,
|
||||
@@ -1396,7 +1376,8 @@ void pf_ul(module_id_t module_id,
|
||||
sched_pusch->rbSize = rbSize;
|
||||
sched_pusch->tb_size = TBS;
|
||||
LOG_D(NR_MAC,"rbSize %d (max_rbSize %d), TBS %d, est buf %d, sched_ul %d, B %d, CCE %d, num_dmrs_symb %d, N_PRB_DMRS %d\n",
|
||||
rbSize, max_rbSize,sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B,sched_ctrl->cce_index,ps->num_dmrs_symb,ps->N_PRB_DMRS);
|
||||
rbSize, max_rbSize,sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B,
|
||||
sched_ctrl->cce_index,sched_pusch->dmrs_info.num_dmrs_symb,sched_pusch->dmrs_info.N_PRB_DMRS);
|
||||
|
||||
/* Mark the corresponding RBs as used */
|
||||
|
||||
@@ -1621,11 +1602,6 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
|
||||
int rnti_types[2] = { NR_RNTI_C, 0 };
|
||||
|
||||
/* pre-computed PUSCH values that only change if time domain allocation,
|
||||
* DCI format, or DMRS parameters change. Updated in the preprocessor
|
||||
* through nr_set_pusch_semi_static() */
|
||||
NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static;
|
||||
|
||||
/* Statistics */
|
||||
AssertFatal(cur_harq->round < nr_mac->ul_bler.harq_round_max, "Indexing ulsch_rounds[%d] is out of bounds\n", cur_harq->round);
|
||||
UE->mac_stats.ul.rounds[cur_harq->round]++;
|
||||
@@ -1636,7 +1612,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
cur_harq->sched_pusch = *sched_pusch;
|
||||
/* save which time allocation has been used, to be used on
|
||||
* retransmissions */
|
||||
cur_harq->sched_pusch.time_domain_allocation = ps->time_domain_allocation;
|
||||
cur_harq->sched_pusch.time_domain_allocation = sched_pusch->time_domain_allocation;
|
||||
sched_ctrl->sched_ul_bytes += sched_pusch->tb_size;
|
||||
UE->mac_stats.ul.total_rbs += sched_pusch->rbSize;
|
||||
|
||||
@@ -1668,12 +1644,12 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
sched_ctrl->aggregation_level,
|
||||
sched_pusch->rbStart,
|
||||
sched_pusch->rbSize,
|
||||
ps->startSymbolIndex,
|
||||
ps->nrOfSymbols,
|
||||
ps->ul_dmrs_symb_pos,
|
||||
sched_pusch->tda_info.startSymbolIndex,
|
||||
sched_pusch->tda_info.nrOfSymbols,
|
||||
sched_pusch->dmrs_info.ul_dmrs_symb_pos,
|
||||
sched_pusch->mcs,
|
||||
ps->nrOfLayers,
|
||||
ps->num_dmrs_cdm_grps_no_data,
|
||||
sched_pusch->nrOfLayers,
|
||||
sched_pusch->dmrs_info.num_dmrs_cdm_grps_no_data,
|
||||
sched_pusch->tb_size,
|
||||
harq_id,
|
||||
cur_harq->round,
|
||||
@@ -1728,18 +1704,19 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
pusch_pdu->data_scrambling_id = *current_BWP->pusch_Config->dataScramblingIdentityPUSCH;
|
||||
else
|
||||
pusch_pdu->data_scrambling_id = *scc->physCellId;
|
||||
pusch_pdu->nrOfLayers = ps->nrOfLayers;
|
||||
pusch_pdu->num_dmrs_cdm_grps_no_data = ps->num_dmrs_cdm_grps_no_data;
|
||||
pusch_pdu->nrOfLayers = sched_pusch->nrOfLayers;
|
||||
pusch_pdu->num_dmrs_cdm_grps_no_data = sched_pusch->dmrs_info.num_dmrs_cdm_grps_no_data;
|
||||
|
||||
/* FAPI: DMRS */
|
||||
pusch_pdu->ul_dmrs_symb_pos = ps->ul_dmrs_symb_pos;
|
||||
pusch_pdu->dmrs_config_type = ps->dmrs_config_type;
|
||||
pusch_pdu->ul_dmrs_symb_pos = sched_pusch->dmrs_info.ul_dmrs_symb_pos;
|
||||
pusch_pdu->dmrs_config_type = sched_pusch->dmrs_info.dmrs_config_type;
|
||||
const NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = sched_pusch->dmrs_info.NR_DMRS_UplinkConfig;
|
||||
if (pusch_pdu->transform_precoding) { // transform precoding disabled
|
||||
long *scramblingid=NULL;
|
||||
if (ps->NR_DMRS_UplinkConfig && pusch_pdu->scid == 0)
|
||||
scramblingid = ps->NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID0;
|
||||
else if (ps->NR_DMRS_UplinkConfig)
|
||||
scramblingid = ps->NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID1;
|
||||
if (NR_DMRS_UplinkConfig && pusch_pdu->scid == 0)
|
||||
scramblingid = NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID0;
|
||||
else if (NR_DMRS_UplinkConfig)
|
||||
scramblingid = NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID1;
|
||||
if (scramblingid == NULL)
|
||||
pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId;
|
||||
else
|
||||
@@ -1747,14 +1724,14 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
}
|
||||
else {
|
||||
pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId;
|
||||
if (ps->NR_DMRS_UplinkConfig && ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity != NULL)
|
||||
pusch_pdu->pusch_identity = *ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity;
|
||||
else if (ps->NR_DMRS_UplinkConfig)
|
||||
if (NR_DMRS_UplinkConfig && NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity != NULL)
|
||||
pusch_pdu->pusch_identity = *NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity;
|
||||
else if (NR_DMRS_UplinkConfig)
|
||||
pusch_pdu->pusch_identity = *scc->physCellId;
|
||||
}
|
||||
pusch_pdu->scid = 0; // DMRS sequence initialization [TS38.211, sec 6.4.1.1.1]
|
||||
pusch_pdu->num_dmrs_cdm_grps_no_data = ps->num_dmrs_cdm_grps_no_data;
|
||||
pusch_pdu->dmrs_ports = ((1<<ps->nrOfLayers) - 1);
|
||||
pusch_pdu->num_dmrs_cdm_grps_no_data = sched_pusch->dmrs_info.num_dmrs_cdm_grps_no_data;
|
||||
pusch_pdu->dmrs_ports = ((1<<sched_pusch->nrOfLayers) - 1);
|
||||
|
||||
/* FAPI: Pusch Allocation in frequency domain */
|
||||
pusch_pdu->resource_alloc = 1; //type 1
|
||||
@@ -1767,8 +1744,8 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
pusch_pdu->frequency_hopping = 1;
|
||||
|
||||
/* FAPI: Resource Allocation in time domain */
|
||||
pusch_pdu->start_symbol_index = ps->startSymbolIndex;
|
||||
pusch_pdu->nr_of_symbols = ps->nrOfSymbols;
|
||||
pusch_pdu->start_symbol_index = sched_pusch->tda_info.startSymbolIndex;
|
||||
pusch_pdu->nr_of_symbols = sched_pusch->tda_info.nrOfSymbols;
|
||||
|
||||
/* PUSCH PDU */
|
||||
AssertFatal(cur_harq->round < nr_mac->ul_bler.harq_round_max, "Indexing nr_rv_round_map[%d] is out of bounds\n", cur_harq->round%4);
|
||||
@@ -1804,8 +1781,8 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
pusch_pdu->dfts_ofdm.low_papr_group_number = pusch_pdu->pusch_identity % 30;
|
||||
|
||||
// V as specified in section 6.4.1.1.1.2 in 38.211 V = 0 if sequence hopping and group hopping are disabled
|
||||
if ((ps->NR_DMRS_UplinkConfig==NULL) || ((ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceGroupHopping == NULL) &&
|
||||
(ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceHopping == NULL)))
|
||||
if ((NR_DMRS_UplinkConfig==NULL) || ((NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceGroupHopping == NULL) &&
|
||||
(NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceHopping == NULL)))
|
||||
pusch_pdu->dfts_ofdm.low_papr_sequence_number = 0;
|
||||
else
|
||||
AssertFatal(1==0,"SequenceGroupHopping or sequenceHopping are NOT Supported\n");
|
||||
@@ -1816,10 +1793,10 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
|
||||
/* PUSCH PTRS */
|
||||
if (ps->NR_DMRS_UplinkConfig && ps->NR_DMRS_UplinkConfig->phaseTrackingRS != NULL) {
|
||||
if (NR_DMRS_UplinkConfig && NR_DMRS_UplinkConfig->phaseTrackingRS != NULL) {
|
||||
bool valid_ptrs_setup = false;
|
||||
pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t));
|
||||
valid_ptrs_setup = set_ul_ptrs_values(ps->NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup,
|
||||
valid_ptrs_setup = set_ul_ptrs_values(NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup,
|
||||
pusch_pdu->rb_size, pusch_pdu->mcs_index, pusch_pdu->mcs_table,
|
||||
&pusch_pdu->pusch_ptrs.ptrs_freq_density,&pusch_pdu->pusch_ptrs.ptrs_time_density,
|
||||
&pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset,&pusch_pdu->pusch_ptrs.num_ptrs_ports,
|
||||
@@ -1875,7 +1852,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
scc,
|
||||
pusch_pdu,
|
||||
&uldci_payload,
|
||||
ps->time_domain_allocation,
|
||||
sched_pusch->time_domain_allocation,
|
||||
UE->UE_sched_ctrl.tpc0,
|
||||
current_BWP);
|
||||
fill_dci_pdu_rel15(scc,
|
||||
|
||||
@@ -87,9 +87,8 @@ uint32_t schedule_control_sib1(module_id_t module_id,
|
||||
int CC_id,
|
||||
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config,
|
||||
int time_domain_allocation,
|
||||
int startSymbolIndex,
|
||||
int nrOfSymbols,
|
||||
uint16_t dlDmrsSymbPos,
|
||||
NR_pdsch_dmrs_t *dmrs_parms,
|
||||
NR_tda_info_t *tda_info,
|
||||
uint8_t candidate_idx,
|
||||
uint16_t num_total_bytes);
|
||||
|
||||
@@ -325,18 +324,16 @@ long get_K2(NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList,
|
||||
int time_domain_assignment,
|
||||
int mu);
|
||||
|
||||
void nr_set_pdsch_semi_static(const NR_UE_DL_BWP_t *dl_bwp,
|
||||
const NR_ServingCellConfigCommon_t *scc,
|
||||
int tda,
|
||||
uint8_t layers,
|
||||
NR_UE_sched_ctrl_t *sched_ctrl,
|
||||
NR_pdsch_semi_static_t *ps);
|
||||
NR_tda_info_t nr_get_pdsch_tda_info(const NR_UE_DL_BWP_t *dl_bwp,
|
||||
const int tda);
|
||||
|
||||
void nr_set_pusch_semi_static(const NR_UE_UL_BWP_t *ul_bwp,
|
||||
const NR_ServingCellConfigCommon_t *scc,
|
||||
int tda,
|
||||
uint8_t nrOfLayers,
|
||||
NR_pusch_semi_static_t *ps);
|
||||
NR_tda_info_t nr_get_pusch_tda_info(const NR_UE_UL_BWP_t *ul_bwp,
|
||||
const int tda);
|
||||
|
||||
NR_pusch_dmrs_t get_ul_dmrs_params(const NR_ServingCellConfigCommon_t *scc,
|
||||
const NR_UE_UL_BWP_t *ul_bwp,
|
||||
const NR_tda_info_t *tda_info,
|
||||
const int Layers);
|
||||
|
||||
uint8_t nr_get_tpc(int target, uint8_t cqi, int incr);
|
||||
|
||||
@@ -460,16 +457,18 @@ int16_t ssb_index_from_prach(module_id_t module_idP,
|
||||
|
||||
void find_SSB_and_RO_available(module_id_t module_idP);
|
||||
|
||||
void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps);
|
||||
NR_pdsch_dmrs_t get_dl_dmrs_params(const NR_ServingCellConfigCommon_t *scc,
|
||||
const NR_UE_DL_BWP_t *BWP,
|
||||
const NR_tda_info_t *tda_info,
|
||||
const int Layers);
|
||||
|
||||
uint16_t set_pm_index(NR_UE_sched_ctrl_t *sched_ctrl,
|
||||
uint16_t get_pm_index(const NR_UE_info_t *UE,
|
||||
int layers,
|
||||
int N1, int N2,
|
||||
int xp_pdsch_antenna_ports,
|
||||
int codebook_mode);
|
||||
int xp_pdsch_antenna_ports);
|
||||
|
||||
uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx);
|
||||
uint8_t set_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl);
|
||||
|
||||
uint8_t get_dl_nrOfLayers(const NR_UE_sched_ctrl_t *sched_ctrl, const nr_dci_format_t dci_format);
|
||||
|
||||
const int get_dl_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot);
|
||||
const int get_ul_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot);
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
|
||||
#define MACSTATSSTRLEN 65536
|
||||
#define MACSTATSSTRLEN 16000
|
||||
|
||||
void *nrmac_stats_thread(void *arg) {
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <string.h>
|
||||
|
||||
/* Commmon */
|
||||
#include "targets/ARCH/COMMON/common_lib.h"
|
||||
#include "sdr/COMMON/common_lib.h"
|
||||
#include "COMMON/platform_constants.h"
|
||||
#include "common/ran_context.h"
|
||||
#include "collection/linear_alloc.h"
|
||||
@@ -373,23 +373,20 @@ typedef struct NR_sched_pucch {
|
||||
int start_symb;
|
||||
} NR_sched_pucch_t;
|
||||
|
||||
/* PUSCH semi-static configuration: as long as the TDA and DCI format remain
|
||||
* the same over the same uBWP and search space, there is no need to
|
||||
* recalculate all S/L, MCS table, or DMRS-related parameters over and over
|
||||
* again. Hence, we store them in this struct for easy reference. */
|
||||
typedef struct NR_pusch_semi_static_t {
|
||||
int time_domain_allocation;
|
||||
uint8_t nrOfLayers;
|
||||
uint8_t num_dmrs_cdm_grps_no_data;
|
||||
typedef struct NR_tda_info {
|
||||
mappingType_t mapping_type;
|
||||
int startSymbolIndex;
|
||||
int nrOfSymbols;
|
||||
long mapping_type;
|
||||
NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig;
|
||||
uint16_t dmrs_config_type;
|
||||
uint16_t ul_dmrs_symb_pos;
|
||||
uint8_t num_dmrs_symb;
|
||||
} NR_tda_info_t;
|
||||
|
||||
typedef struct NR_pusch_dmrs {
|
||||
uint8_t N_PRB_DMRS;
|
||||
} NR_pusch_semi_static_t;
|
||||
uint8_t num_dmrs_symb;
|
||||
uint16_t ul_dmrs_symb_pos;
|
||||
uint8_t num_dmrs_cdm_grps_no_data;
|
||||
nfapi_nr_dmrs_type_e dmrs_config_type;
|
||||
NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig;
|
||||
} NR_pusch_dmrs_t;
|
||||
|
||||
typedef struct NR_sched_pusch {
|
||||
int frame;
|
||||
@@ -411,10 +408,11 @@ typedef struct NR_sched_pusch {
|
||||
/// UL HARQ PID to use for this UE, or -1 for "any new"
|
||||
int8_t ul_harq_pid;
|
||||
|
||||
/// the Time Domain Allocation used for this transmission. Note that this is
|
||||
/// only important for retransmissions; otherwise, the TDA in
|
||||
/// NR_pusch_semi_static_t has precedence
|
||||
uint8_t nrOfLayers;
|
||||
// time_domain_allocation is the index of a list of tda
|
||||
int time_domain_allocation;
|
||||
NR_tda_info_t tda_info;
|
||||
NR_pusch_dmrs_t dmrs_info;
|
||||
} NR_sched_pusch_t;
|
||||
|
||||
typedef struct NR_sched_srs {
|
||||
@@ -423,24 +421,14 @@ typedef struct NR_sched_srs {
|
||||
bool srs_scheduled;
|
||||
} NR_sched_srs_t;
|
||||
|
||||
/* PDSCH semi-static configuratio: as long as the TDA/DMRS/mcsTable remains the
|
||||
* same, there is no need to recalculate all S/L or DMRS-related parameters
|
||||
* over and over again. Hence, we store them in this struct for easy
|
||||
* reference. */
|
||||
typedef struct NR_pdsch_semi_static {
|
||||
int time_domain_allocation;
|
||||
uint8_t numDmrsCdmGrpsNoData;
|
||||
uint8_t frontloaded_symb;
|
||||
int mapping_type;
|
||||
int startSymbolIndex;
|
||||
int nrOfSymbols;
|
||||
uint8_t nrOfLayers;
|
||||
typedef struct NR_pdsch_dmrs {
|
||||
uint8_t dmrs_ports_id;
|
||||
uint8_t N_PRB_DMRS;
|
||||
uint8_t N_DMRS_SLOT;
|
||||
uint16_t dl_dmrs_symb_pos;
|
||||
uint8_t numDmrsCdmGrpsNoData;
|
||||
nfapi_nr_dmrs_type_e dmrsConfigType;
|
||||
} NR_pdsch_semi_static_t;
|
||||
} NR_pdsch_dmrs_t;
|
||||
|
||||
typedef struct NR_sched_pdsch {
|
||||
/// RB allocation within active BWP
|
||||
@@ -461,11 +449,13 @@ typedef struct NR_sched_pdsch {
|
||||
// pucch format allocation
|
||||
uint8_t pucch_allocation;
|
||||
|
||||
/// the Time Domain Allocation used for this transmission. Note that this is
|
||||
/// only important for retransmissions; otherwise, the TDA in
|
||||
/// NR_pdsch_semi_static_t has precedence
|
||||
int time_domain_allocation;
|
||||
uint16_t pm_index;
|
||||
uint8_t nrOfLayers;
|
||||
|
||||
NR_pdsch_dmrs_t dmrs_parms;
|
||||
// time_domain_allocation is the index of a list of tda
|
||||
int time_domain_allocation;
|
||||
NR_tda_info_t tda_info;
|
||||
} NR_sched_pdsch_t;
|
||||
|
||||
typedef struct NR_UE_harq {
|
||||
@@ -578,8 +568,6 @@ typedef struct {
|
||||
/// CSI in second. This order is important for nr_acknack_scheduling()!
|
||||
NR_sched_pucch_t sched_pucch[2];
|
||||
|
||||
/// PUSCH semi-static configuration: is not cleared across TTIs
|
||||
NR_pusch_semi_static_t pusch_semi_static;
|
||||
/// Sched PUSCH: scheduling decisions, copied into HARQ and cleared every TTI
|
||||
NR_sched_pusch_t sched_pusch;
|
||||
|
||||
@@ -596,8 +584,6 @@ typedef struct {
|
||||
/// PHR info: nominal UE transmit power levels (dBm)
|
||||
int pcmax;
|
||||
|
||||
/// PDSCH semi-static configuration: is not cleared across TTIs
|
||||
NR_pdsch_semi_static_t pdsch_semi_static;
|
||||
/// Sched PDSCH: scheduling decisions, copied into HARQ and cleared every TTI
|
||||
NR_sched_pdsch_t sched_pdsch;
|
||||
/// UE-estimated maximum MCS (from CSI-RS)
|
||||
@@ -632,7 +618,6 @@ typedef struct {
|
||||
int ul_failure;
|
||||
struct CSI_Report CSI_report;
|
||||
bool SR;
|
||||
bool set_pmi;
|
||||
/// information about every HARQ process
|
||||
NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES];
|
||||
/// HARQ processes that are free
|
||||
@@ -720,7 +705,6 @@ typedef struct {
|
||||
NR_gNB_UCI_STATS_t uci_statS;
|
||||
float ul_thr_ue;
|
||||
float dl_thr_ue;
|
||||
int layers;
|
||||
} NR_UE_info_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -590,7 +590,7 @@ void rlc_data_ind (
|
||||
T(T_ENB_RLC_UL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_sizeP));
|
||||
#endif
|
||||
const ngran_node_t type = RC.rrc[ctxt_pP->module_id]->node_type;
|
||||
AssertFatal(type != ngran_eNB_CU && type != ngran_ng_eNB_CU && type != ngran_gNB_CU,
|
||||
AssertFatal(!NODE_IS_CU(type),
|
||||
"Can't be CU, bad node type %d\n", type);
|
||||
|
||||
if (NODE_IS_DU(type) && srb_flagP == 1) {
|
||||
|
||||
@@ -514,7 +514,7 @@ rb_found:
|
||||
T_INT(ue->rnti), T_INT(rb_id), T_INT(size));
|
||||
|
||||
const ngran_node_t type = RC.nrrrc[0 /*ctxt_pP->module_id*/]->node_type;
|
||||
AssertFatal(type != ngran_eNB_CU && type != ngran_ng_eNB_CU && type != ngran_gNB_CU,
|
||||
AssertFatal(!NODE_IS_CU(type),
|
||||
"Can't be CU, bad node type %d\n", type);
|
||||
|
||||
// if (NODE_IS_DU(type) && is_srb == 0) {
|
||||
@@ -1102,7 +1102,7 @@ void nr_rlc_tick(int frame, int subframe)
|
||||
}
|
||||
|
||||
/* This is a hack, to compile the gNB.
|
||||
* TODO: remove it. The solution is to cleanup cmake_targets/CMakeLists.txt
|
||||
* TODO: remove it. The solution is to cleanup CMakeLists.txt
|
||||
*/
|
||||
void rlc_tick(int a, int b)
|
||||
{
|
||||
|
||||
@@ -415,7 +415,7 @@ rb_found:
|
||||
T_INT(ue->rnti), T_INT(rb_id), T_INT(size));
|
||||
|
||||
const ngran_node_t type = RC.rrc[0 /*ctxt_pP->module_id*/]->node_type;
|
||||
AssertFatal(type != ngran_eNB_CU && type != ngran_ng_eNB_CU && type != ngran_gNB_CU,
|
||||
AssertFatal(!NODE_IS_CU(type),
|
||||
"Can't be CU, bad node type %d\n", type);
|
||||
|
||||
if (NODE_IS_DU(type)) {
|
||||
|
||||
Reference in New Issue
Block a user