Merge remote-tracking branch 'origin/ue-fix-ul-first-tx' into integration_2023_w48
This commit is contained in:
@@ -615,7 +615,6 @@ void nr_init_ul_harq_processes(NR_UL_UE_HARQ_t harq_list[NR_MAX_ULSCH_HARQ_PROCE
|
||||
DevAssert(harq_list[i].f);
|
||||
bzero(harq_list[i].f,14*num_rb*12*16);
|
||||
|
||||
harq_list[i].first_tx = 1;
|
||||
harq_list[i].round = 0;
|
||||
}
|
||||
}
|
||||
@@ -642,7 +641,6 @@ void clean_UE_harq(PHY_VARS_NR_UE *UE)
|
||||
ul_harq_process->tx_status = NEW_TRANSMISSION_HARQ;
|
||||
ul_harq_process->status = SCH_IDLE;
|
||||
ul_harq_process->round = 0;
|
||||
ul_harq_process->first_tx = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,6 @@ typedef enum {
|
||||
} harq_result_t;
|
||||
|
||||
typedef struct {
|
||||
/// Indicator of first transmission
|
||||
uint8_t first_tx;
|
||||
/// HARQ tx status
|
||||
harq_result_t tx_status;
|
||||
/// Status Flag indicating for this ULSCH (idle,active,disabled)
|
||||
@@ -57,8 +55,6 @@ typedef struct {
|
||||
uint8_t O_ACK;
|
||||
/// Index of current HARQ round for this ULSCH
|
||||
uint8_t round;
|
||||
/// Last Ndi for this harq process
|
||||
uint8_t ndi;
|
||||
/// pointer to pdu from MAC interface (TS 36.212 V15.4.0, Sec 5.1 p. 8)
|
||||
unsigned char *a;
|
||||
/// Pointer to the payload + CRC
|
||||
|
||||
@@ -71,17 +71,11 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
||||
|
||||
LOG_D(NR_PHY, "ulsch coding nb_rb %d, Nl = %d\n", nb_rb, ulsch->pusch_pdu.nrOfLayers);
|
||||
LOG_D(NR_PHY, "ulsch coding A %d G %d mod_order %d Coderate %f\n", A, G, mod_order, Coderate);
|
||||
LOG_D(NR_PHY,
|
||||
"harq_pid %d harq_process->ndi %d, pusch_data.new_data_indicator %d\n",
|
||||
harq_pid,
|
||||
harq_process->ndi,
|
||||
ulsch->pusch_pdu.pusch_data.new_data_indicator);
|
||||
if (harq_process->first_tx == 1 ||
|
||||
harq_process->ndi != ulsch->pusch_pdu.pusch_data.new_data_indicator) { // this is a new packet
|
||||
LOG_D(NR_PHY, "harq_pid %d, pusch_data.new_data_indicator %d\n", harq_pid, ulsch->pusch_pdu.pusch_data.new_data_indicator);
|
||||
if (ulsch->pusch_pdu.pusch_data.new_data_indicator) { // this is a new packet
|
||||
#ifdef DEBUG_ULSCH_CODING
|
||||
printf("encoding thinks this is a new packet \n");
|
||||
#endif
|
||||
harq_process->first_tx = 0;
|
||||
///////////////////////// a---->| add CRC |---->b /////////////////////////
|
||||
///////////
|
||||
/*
|
||||
@@ -227,8 +221,6 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
||||
|
||||
///////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
LOG_D(PHY,"setting ndi to %d from pusch_data\n", ulsch->pusch_pdu.pusch_data.new_data_indicator);
|
||||
harq_process->ndi = ulsch->pusch_pdu.pusch_data.new_data_indicator;
|
||||
}
|
||||
F = harq_process->F;
|
||||
Kr = harq_process->K;
|
||||
|
||||
@@ -98,75 +98,6 @@
|
||||
#define DL_DCI (1)
|
||||
#define UL_DCI (0)
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* NAME : uplink_harq_process
|
||||
*
|
||||
* PARAMETERS : ue context
|
||||
* slot_tx slot for transmission
|
||||
* gNB_id identifier
|
||||
* ndi from DCI
|
||||
* rnti_type from DCI
|
||||
*
|
||||
* RETURN : true it a new transmission
|
||||
* false it is a retransmission
|
||||
*
|
||||
* DESCRIPTION : manage uplink grant information for transmissions/retransmissions
|
||||
* TS 38.321 5.4.1 UL Grant reception
|
||||
* TS 38.321 5.4.2.1 HARQ Entity
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, NR_UL_UE_HARQ_t harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES], int ndi, uint8_t rnti_type)
|
||||
{
|
||||
harq_result_t result_harq = RETRANSMISSION_HARQ;
|
||||
|
||||
if (rnti_type == _CS_RNTI_) {
|
||||
LOG_E(PHY, "Fatal error in HARQ entity due to not supported CS_RNTI at line %d in function %s of file %s \n", __LINE__ , __func__, __FILE__);
|
||||
return(NEW_TRANSMISSION_HARQ);
|
||||
}
|
||||
else if ((rnti_type != _C_RNTI_) && (rnti_type != _TC_RNTI_)) {
|
||||
/* harq mechanism is not relevant for other rnti */
|
||||
return(NEW_TRANSMISSION_HARQ);
|
||||
}
|
||||
else if (harq_pid > ulsch->number_harq_processes_for_pusch) {
|
||||
LOG_E(PHY, "Fatal error in HARQ entity due to unknown process identity %d at line %d in function %s of file %s \n", harq_pid, __LINE__ , __func__, __FILE__);
|
||||
assert(0);
|
||||
}
|
||||
|
||||
/* 38.321 5.4.2.1 2> if the uplink grant was received on PDCCH for the C-RNTI and the HARQ buffer of the identified process is empty */
|
||||
if ((harq_processes[harq_pid].first_tx == 1) && (rnti_type == _C_RNTI_)) { /* no transmission yet on this process so consider its harq buffer as empty */
|
||||
harq_processes[harq_pid].first_tx = 0;
|
||||
harq_processes[harq_pid].ndi = ndi; /* store first value of ndi */
|
||||
harq_processes[harq_pid].round = 0;
|
||||
|
||||
result_harq = NEW_TRANSMISSION_HARQ;
|
||||
|
||||
LOG_D(PHY, "[HARQ-UL-PUSCH harqId : %d] first new transmission \n", harq_pid);
|
||||
}
|
||||
/* 38.321 5.4.2.1 2> if the received grant was not addressed to a Temporary C-RNTI on PDCCH, and the NDI provided in the associated HARQ */
|
||||
/* information has been toggled compared to the value in the previous transmission of this TB of this HARQ process */
|
||||
else if ((harq_processes[harq_pid].ndi != ndi) && (rnti_type != _TC_RNTI_)) { /* is ndi toogled so this is a new grant ? */
|
||||
harq_processes[harq_pid].ndi = ndi; /* store first value of ndi */
|
||||
harq_processes[harq_pid].round = 0;
|
||||
|
||||
result_harq = NEW_TRANSMISSION_HARQ;
|
||||
|
||||
LOG_D(PHY, "[HARQ-UL-PUSCH harqId : %d] new transmission due to toogle of ndi \n", harq_pid);
|
||||
}
|
||||
/* 38.321 5.4.2.1 2> else (i.e. retransmission): */
|
||||
else {
|
||||
harq_processes[harq_pid].ndi = ndi; /* ndi has not toggled si this is a retransmission */
|
||||
harq_processes[harq_pid].round++; /* increment number of retransmission */
|
||||
|
||||
result_harq = RETRANSMISSION_HARQ;
|
||||
|
||||
LOG_D(PHY, "[HARQ-UL-PUSCH harqId : %d] retransmission \n", harq_pid);
|
||||
}
|
||||
|
||||
return (result_harq);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* NAME : init_downlink_harq_status
|
||||
|
||||
@@ -55,13 +55,6 @@
|
||||
|
||||
/*************** FUNCTIONS ****************************************/
|
||||
|
||||
/** \brief This function update uplink harq context and return transmission type (new transmission or retransmission)
|
||||
@param ulsch uplink harq context
|
||||
@param harq process identifier harq_pid
|
||||
@returns retransmission or new transmission */
|
||||
|
||||
harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, NR_UL_UE_HARQ_t harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES], int ndi, uint8_t rnti_type);
|
||||
|
||||
/** \brief This function initialises downlink HARQ status
|
||||
@param pointer to downlink harq status
|
||||
@returns none */
|
||||
|
||||
@@ -1117,7 +1117,7 @@ int main(int argc, char *argv[])
|
||||
pusch_config_pdu->target_code_rate = code_rate;
|
||||
pusch_config_pdu->tbslbrm = tbslbrm;
|
||||
pusch_config_pdu->pusch_data.tb_size = TBS / 8;
|
||||
pusch_config_pdu->pusch_data.new_data_indicator = trial & 0x1;
|
||||
pusch_config_pdu->pusch_data.new_data_indicator = round == 0 ? true : false;
|
||||
pusch_config_pdu->pusch_data.rv_index = rv_index;
|
||||
pusch_config_pdu->pusch_data.harq_process_id = harq_pid;
|
||||
pusch_config_pdu->pusch_ptrs.ptrs_time_density = ptrs_time_density;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*
|
||||
* MODULE : UE test bench for hard (hybrid repeat request acknowledgment)
|
||||
*
|
||||
* DESCRIPTION : it allows unitary tests for uplink and downlink harq
|
||||
* DESCRIPTION : it allows unitary tests for downlink harq
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
@@ -39,65 +39,6 @@
|
||||
//#include "PHY/vars.h"
|
||||
//#include "LAYER2/MAC/vars.h"
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* NAME : test_harq_uplink
|
||||
*
|
||||
* PARAMETERS : none
|
||||
*
|
||||
* RETURN : none
|
||||
*
|
||||
* DESCRIPTION : test of HARQ uplink feature
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
int test_harq_uplink(PHY_VARS_NR_UE *phy_vars_ue)
|
||||
{
|
||||
int gNB_id = 0;
|
||||
int thread_number = 0;
|
||||
int code_word_idx = 0;
|
||||
int harq_pid = 0;
|
||||
int ndi = 1;
|
||||
uint8_t rnti_type = _C_RNTI_;
|
||||
int number_steps = 5;
|
||||
|
||||
printf("\nHARQ Uplink \n");
|
||||
|
||||
config_uplink_harq_process(phy_vars_ue , gNB_id, thread_number, code_word_idx, NR_DEFAULT_DLSCH_HARQ_PROCESSES);
|
||||
|
||||
NR_UE_ULSCH_t *ulsch_harq = phy_vars_ue->ulsch[gNB_id];
|
||||
|
||||
/* reach maximum number of retransmissions */
|
||||
printf("First sequence ndi does not toggle \n");
|
||||
for (int i = 0 ; i < number_steps; i++) {
|
||||
uplink_harq_process(ulsch_harq, harq_pid, ndi, rnti_type);
|
||||
}
|
||||
|
||||
harq_pid++; /* next harq */
|
||||
|
||||
/* new grant so new transmission each try */
|
||||
printf("Second sequence ndi toggle each transmission \n");
|
||||
for (int i = 0 ; i < number_steps; i++) {
|
||||
uplink_harq_process(ulsch_harq, harq_pid, ndi, rnti_type);
|
||||
ndi ^= 1; /* toogle ndi each try */
|
||||
}
|
||||
|
||||
harq_pid++; /* next harq */
|
||||
|
||||
/* new grant so new transmission each try */
|
||||
printf("Third sequence ndi toggle each two transmissions \n");
|
||||
for (int i = 0 ; i < number_steps; i++) {
|
||||
uplink_harq_process(ulsch_harq, harq_pid, ndi, rnti_type);
|
||||
if (i & 0x1) {
|
||||
ndi ^= 1; /* toogle ndi each try */
|
||||
}
|
||||
}
|
||||
|
||||
release_uplink_harq_process(phy_vars_ue , gNB_id, thread_number, code_word_idx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* NAME : test_harq_downlink
|
||||
@@ -175,11 +116,7 @@ int test_harq(PHY_VARS_NR_UE *phy_vars_ue)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
result = test_harq_uplink(phy_vars_ue);
|
||||
|
||||
if (result == 0) {
|
||||
result = test_harq_downlink(phy_vars_ue);
|
||||
}
|
||||
result = test_harq_downlink(phy_vars_ue);
|
||||
|
||||
return (result);
|
||||
}
|
||||
@@ -188,7 +125,7 @@ int test_harq(PHY_VARS_NR_UE *phy_vars_ue)
|
||||
*
|
||||
* NAME : main
|
||||
*
|
||||
* DESCRIPTION : test of uplink and downlink harq entities
|
||||
* DESCRIPTION : test of downlink harq entities
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
|
||||
@@ -505,9 +505,7 @@ typedef struct {
|
||||
fapi_nr_csirs_measurements_t csirs_measurements;
|
||||
|
||||
/// Last NDI of UL HARQ processes
|
||||
uint8_t UL_ndi[NR_MAX_HARQ_PROCESSES];
|
||||
/// first ULTX of UL HARQ processes
|
||||
int first_ul_tx[NR_MAX_HARQ_PROCESSES];
|
||||
int UL_ndi[NR_MAX_HARQ_PROCESSES];
|
||||
//// FAPI-like interface message
|
||||
fapi_nr_ul_config_request_t *ul_config_request;
|
||||
fapi_nr_dl_config_request_t *dl_config_request;
|
||||
|
||||
@@ -597,7 +597,7 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, slot
|
||||
// start contention resolution timer (cnt in slots)
|
||||
int RA_contention_resolution_timer_subframes = (nr_rach_ConfigCommon->ra_ContentionResolutionTimer + 1)<<3;
|
||||
|
||||
ra->RA_contention_resolution_target_frame = frameP + (RA_contention_resolution_timer_subframes/10);
|
||||
ra->RA_contention_resolution_target_frame = (frameP + (RA_contention_resolution_timer_subframes/10)) % MAX_FRAME_NUMBER;
|
||||
ra->RA_contention_resolution_target_slot = (slotP + (RA_contention_resolution_timer_subframes * subframes_per_slot)) % nr_slots_per_frame[mu];
|
||||
|
||||
LOG_D(MAC,"In %s: [UE %d] CB-RA: contention resolution timer set in frame.slot %d.%d and expiring in %d.%d\n",
|
||||
|
||||
@@ -197,7 +197,7 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac)
|
||||
mac->scheduling_info.lc_sched_info[i].LCID_status = LCID_EMPTY;
|
||||
mac->scheduling_info.lc_sched_info[i].LCID_buffer_remain = 0;
|
||||
for (int k = 0; k < NR_MAX_HARQ_PROCESSES; k++)
|
||||
mac->first_ul_tx[k] = 1;
|
||||
mac->UL_ndi[k] = -1; // initialize to invalid value
|
||||
}
|
||||
|
||||
memset(&mac->ssb_measurements, 0, sizeof(mac->ssb_measurements));
|
||||
|
||||
@@ -627,7 +627,8 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
}
|
||||
|
||||
/* NDI */
|
||||
pusch_config_pdu->pusch_data.new_data_indicator = dci->ndi;
|
||||
pusch_config_pdu->pusch_data.new_data_indicator = dci->ndi != mac->UL_ndi[dci->harq_pid] ? 1 : 0;
|
||||
mac->UL_ndi[dci->harq_pid] = dci->ndi;
|
||||
/* RV */
|
||||
pusch_config_pdu->pusch_data.rv_index = dci->rv;
|
||||
/* HARQ_PROCESS_NUMBER */
|
||||
@@ -1032,9 +1033,8 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info)
|
||||
if (ulcfg_pdu->pdu_type == FAPI_NR_UL_CONFIG_TYPE_PUSCH) {
|
||||
int mac_pdu_exist = 0;
|
||||
uint16_t TBS_bytes = ulcfg_pdu->pusch_config_pdu.pusch_data.tb_size;
|
||||
LOG_D(NR_MAC,"harq_id %d, NDI %d NDI_DCI %d, TBS_bytes %d (ra_state %d)\n",
|
||||
LOG_D(NR_MAC,"harq_id %d, new_data_indicator %d, TBS_bytes %d (ra_state %d)\n",
|
||||
ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id,
|
||||
mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id],
|
||||
ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator,
|
||||
TBS_bytes,ra->ra_state);
|
||||
if (ra->ra_state == WAIT_RAR && !ra->cfra) {
|
||||
@@ -1043,14 +1043,10 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info)
|
||||
for (int k = 0; k < TBS_bytes; k++) {
|
||||
LOG_D(NR_MAC,"(%i): 0x%x\n", k, ulsch_input_buffer[k]);
|
||||
}
|
||||
LOG_D(NR_MAC,"Flipping NDI for harq_id %d (Msg3)\n", ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator);
|
||||
mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator;
|
||||
mac->first_ul_tx[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = 0;
|
||||
mac_pdu_exist = 1;
|
||||
} else {
|
||||
|
||||
if ((mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] != ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator ||
|
||||
mac->first_ul_tx[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] == 1) &&
|
||||
if (ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator &&
|
||||
(mac->state == UE_CONNECTED ||
|
||||
(ra->ra_state == WAIT_RAR && ra->cfra))){
|
||||
|
||||
@@ -1059,10 +1055,6 @@ void nr_ue_ul_scheduler(nr_uplink_indication_t *ul_info)
|
||||
mac_pdu_exist = 1;
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC,"Flipping NDI for harq_id %d\n",ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator);
|
||||
mac->UL_ndi[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator;
|
||||
mac->first_ul_tx[ulcfg_pdu->pusch_config_pdu.pusch_data.harq_process_id] = 0;
|
||||
|
||||
}
|
||||
|
||||
// Config UL TX PDU
|
||||
|
||||
Reference in New Issue
Block a user