Commit bdbd6989 authored by francescomani's avatar francescomani

removing pusch semi-static

parent 63327ce3
......@@ -381,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;
......@@ -400,10 +392,13 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
else
rbSize = target_ul_bw;
NR_pusch_tda_info_t *tda_info = &sched_ctrl->sched_pusch.tda_info;
nr_get_pusch_tda_info(ul_bwp, tda, 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__,
......@@ -455,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
......@@ -463,14 +458,22 @@ 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 = &sched_ctrl->sched_pusch.dmrs_info;
set_ul_dmrs_params(dmrs,
scc,
ul_bwp,
tda_info,
sched_pusch->nrOfLayers);
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 */
......@@ -481,6 +484,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;
}
......@@ -562,55 +562,58 @@ void nr_get_pdsch_tda_info(const NR_UE_DL_BWP_t *dl_bwp,
SLIV2SL(startSymbolAndLength, &tda_info->startSymbolIndex, &tda_info->nrOfSymbols);
}
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) {
void nr_get_pusch_tda_info(const NR_UE_UL_BWP_t *ul_bwp,
int tda,
NR_pusch_tda_info_t *tda_info) {
ps->time_domain_allocation = tda;
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);
}
const int startSymbolAndLength = ul_bwp->tdaList->list.array[tda]->startSymbolAndLength;
SLIV2SL(startSymbolAndLength,
&ps->startSymbolIndex,
&ps->nrOfSymbols);
void set_ul_dmrs_params(NR_pusch_dmrs_t *dmrs,
const NR_ServingCellConfigCommon_t *scc,
NR_UE_UL_BWP_t *ul_bwp,
NR_pusch_tda_info_t *tda_info,
int Layers) {
ps->nrOfLayers = nrOfLayers;
// 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) ? 1 : (tda_info->nrOfSymbols == 2 ? 1 : 2);
else
ps->num_dmrs_cdm_grps_no_data = 2;
dmrs->num_dmrs_cdm_grps_no_data = 2;
/* 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 ?
NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = ul_bwp->pusch_Config ?
(tda_info->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);
dmrs->dmrs_config_type = NR_DMRS_UplinkConfig ? ((NR_DMRS_UplinkConfig->dmrs_Type == NULL ? 0 : 1)) : 0;
const pusch_dmrs_AdditionalPosition_t additional_pos = NR_DMRS_UplinkConfig ? (NR_DMRS_UplinkConfig->dmrs_AdditionalPosition == NULL ?
2 : (*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);
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->dmrs_config_type == 0 ?
dmrs->num_dmrs_cdm_grps_no_data * 6 :
dmrs->num_dmrs_cdm_grps_no_data * 4;
dmrs->NR_DMRS_UplinkConfig = NR_DMRS_UplinkConfig;
}
#define BLER_UPDATE_FRAME 10
......@@ -2496,7 +2499,7 @@ NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConf
/* set illegal time domain allocation to force recomputation of all fields */
sched_ctrl->sched_pdsch.time_domain_allocation = -1;
sched_ctrl->pusch_semi_static.time_domain_allocation = -1;
sched_ctrl->sched_pusch.time_domain_allocation = -1;
/* Set default BWPs */
sched_ctrl->next_dl_bwp_id = -1;
......
......@@ -328,11 +328,15 @@ void nr_get_pdsch_tda_info(const NR_UE_DL_BWP_t *dl_bwp,
int tda,
NR_pdsch_tda_info_t *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);
void nr_get_pusch_tda_info(const NR_UE_UL_BWP_t *ul_bwp,
int tda,
NR_pusch_tda_info_t *tda_info);
void set_ul_dmrs_params(NR_pusch_dmrs_t *dmrs,
const NR_ServingCellConfigCommon_t *scc,
NR_UE_UL_BWP_t *ul_bwp,
NR_pusch_tda_info_t *tda_info,
int Layers);
uint8_t nr_get_tpc(int target, uint8_t cqi, int incr);
......
......@@ -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_pusch_tda_info {
int 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_pusch_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,10 @@ 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;
int time_domain_allocation;
NR_pusch_dmrs_t dmrs_info;
NR_pusch_tda_info_t tda_info;
} NR_sched_pusch_t;
typedef struct NR_sched_srs {
......@@ -457,9 +454,6 @@ 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;
......@@ -578,8 +572,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment