Commit 8820a575 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/fix-ue-ul-retransmissions-payload-copy'...

Merge remote-tracking branch 'origin/fix-ue-ul-retransmissions-payload-copy' into integration_2024_w21c
parents c76a9d43 00e883c5
...@@ -175,7 +175,7 @@ typedef struct { ...@@ -175,7 +175,7 @@ typedef struct {
typedef struct { typedef struct {
uint16_t pdu_length; uint16_t pdu_length;
uint8_t* pdu; uint8_t* fapiTxPdu;
} fapi_nr_tx_request_body_t; } fapi_nr_tx_request_body_t;
/// ///
......
...@@ -119,7 +119,22 @@ static bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -119,7 +119,22 @@ static bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue,
LOG_D(PHY, "DLSCH received nok \n"); LOG_D(PHY, "DLSCH received nok \n");
return true; //stop return true; //stop
} }
const int sz=A/8;
if (b[sz] == 0 && b[sz + 1] == 0) { // We search only a reccuring OAI error that propagates all 0 packets with a 0 CRC, so we
// do the check only if the 2 first bytes of the CRC are 0 (it can be CRC16 or CRC24)
int i = 0;
while (b[i] == 0 && i < sz)
i++;
if (i == sz) {
LOG_E(PHY,
"received all 0 pdu, consider it false reception, even if the TS 38.212 7.2.1 says only we should attach the "
"corresponding CRC, and nothing prevents to have a all 0 packet\n");
dlsch->last_iteration_cnt = dlsch->max_ldpc_iterations + 1;
return true; // stop
}
}
} }
//LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for nr_slot_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n", //LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for nr_slot_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n",
// phy_vars_ue->Mod_id,nr_slot_rx,harq_process->TBS,harq_process->mcs,harq_process->nb_rb, harq_process->round); // phy_vars_ue->Mod_id,nr_slot_rx,harq_process->TBS,harq_process->mcs,harq_process->nb_rb, harq_process->round);
harq_process->status = SCH_IDLE; harq_process->status = SCH_IDLE;
......
...@@ -104,8 +104,6 @@ typedef struct { ...@@ -104,8 +104,6 @@ typedef struct {
uint8_t first_rx; uint8_t first_rx;
/// DLSCH status flag indicating /// DLSCH status flag indicating
SCH_status_t status; SCH_status_t status;
/// Transport block size
uint32_t TBS;
/// Pointers to transport block segments /// Pointers to transport block segments
uint8_t **c; uint8_t **c;
/// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15) /// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
......
...@@ -142,7 +142,7 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response ...@@ -142,7 +142,7 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
nfapi_nr_rx_data_indication_t *rx_ind = CALLOC(1, sizeof(*rx_ind)); nfapi_nr_rx_data_indication_t *rx_ind = CALLOC(1, sizeof(*rx_ind));
nfapi_nr_crc_indication_t *crc_ind = CALLOC(1, sizeof(*crc_ind)); nfapi_nr_crc_indication_t *crc_ind = CALLOC(1, sizeof(*crc_ind));
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &it->pusch_config_pdu; nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &it->pusch_config_pdu;
if (pusch_config_pdu->tx_request_body.pdu) { if (pusch_config_pdu->tx_request_body.fapiTxPdu) {
rx_ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION; rx_ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION;
rx_ind->sfn = frame; rx_ind->sfn = frame;
rx_ind->slot = slot; rx_ind->slot = slot;
...@@ -154,7 +154,7 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response ...@@ -154,7 +154,7 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
rx_ind->pdu_list[j].harq_id = pusch_config_pdu->pusch_data.harq_process_id; rx_ind->pdu_list[j].harq_id = pusch_config_pdu->pusch_data.harq_process_id;
rx_ind->pdu_list[j].pdu_length = tx_req_body->pdu_length; rx_ind->pdu_list[j].pdu_length = tx_req_body->pdu_length;
rx_ind->pdu_list[j].pdu = CALLOC(tx_req_body->pdu_length, sizeof(*rx_ind->pdu_list[j].pdu)); rx_ind->pdu_list[j].pdu = CALLOC(tx_req_body->pdu_length, sizeof(*rx_ind->pdu_list[j].pdu));
memcpy(rx_ind->pdu_list[j].pdu, tx_req_body->pdu, tx_req_body->pdu_length * sizeof(*rx_ind->pdu_list[j].pdu)); memcpy(rx_ind->pdu_list[j].pdu, tx_req_body->fapiTxPdu, tx_req_body->pdu_length * sizeof(*rx_ind->pdu_list[j].pdu));
rx_ind->pdu_list[j].rnti = pusch_config_pdu->rnti; rx_ind->pdu_list[j].rnti = pusch_config_pdu->rnti;
/* TODO: Implement channel modeling to abstract TA and CQI. For now, /* TODO: Implement channel modeling to abstract TA and CQI. For now,
we hard code the values below since they are set in L1 and we are we hard code the values below since they are set in L1 and we are
...@@ -461,7 +461,7 @@ static void nr_ue_scheduled_response_ul(PHY_VARS_NR_UE *phy, fapi_nr_ul_config_r ...@@ -461,7 +461,7 @@ static void nr_ue_scheduled_response_ul(PHY_VARS_NR_UE *phy, fapi_nr_ul_config_r
pdu->pusch_config_pdu.num_dmrs_cdm_grps_no_data); pdu->pusch_config_pdu.num_dmrs_cdm_grps_no_data);
memcpy(pusch_pdu, &pdu->pusch_config_pdu, sizeof(*pusch_pdu)); memcpy(pusch_pdu, &pdu->pusch_config_pdu, sizeof(*pusch_pdu));
if (pdu->pusch_config_pdu.tx_request_body.pdu) { if (pdu->pusch_config_pdu.tx_request_body.fapiTxPdu) {
LOG_D(PHY, LOG_D(PHY,
"%d.%d Copying %d bytes to harq_process_ul_ue->a (harq_pid %d)\n", "%d.%d Copying %d bytes to harq_process_ul_ue->a (harq_pid %d)\n",
ul_config->frame, ul_config->frame,
...@@ -469,7 +469,7 @@ static void nr_ue_scheduled_response_ul(PHY_VARS_NR_UE *phy, fapi_nr_ul_config_r ...@@ -469,7 +469,7 @@ static void nr_ue_scheduled_response_ul(PHY_VARS_NR_UE *phy, fapi_nr_ul_config_r
pdu->pusch_config_pdu.tx_request_body.pdu_length, pdu->pusch_config_pdu.tx_request_body.pdu_length,
current_harq_pid); current_harq_pid);
memcpy(harq_process_ul_ue->payload_AB, memcpy(harq_process_ul_ue->payload_AB,
pdu->pusch_config_pdu.tx_request_body.pdu, pdu->pusch_config_pdu.tx_request_body.fapiTxPdu,
pdu->pusch_config_pdu.tx_request_body.pdu_length); pdu->pusch_config_pdu.tx_request_body.pdu_length);
} }
......
...@@ -116,7 +116,6 @@ static uint32_t get_ssb_arfcn(NR_DL_FRAME_PARMS *frame_parms) ...@@ -116,7 +116,6 @@ static uint32_t get_ssb_arfcn(NR_DL_FRAME_PARMS *frame_parms)
uint64_t ssb_freq = frame_parms->dl_CarrierFreq - (band_size_hz / 2) + frame_parms->subcarrier_spacing * ssb_center_sc; uint64_t ssb_freq = frame_parms->dl_CarrierFreq - (band_size_hz / 2) + frame_parms->subcarrier_spacing * ssb_center_sc;
return to_nrarfcn(frame_parms->nr_band, ssb_freq, frame_parms->numerology_index, band_size_hz); return to_nrarfcn(frame_parms->nr_band, ssb_freq, frame_parms->numerology_index, band_size_hz);
} }
void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
uint8_t pdu_type, uint8_t pdu_type,
PHY_VARS_NR_UE *ue, PHY_VARS_NR_UE *ue,
...@@ -130,72 +129,57 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, ...@@ -130,72 +129,57 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
if (n_pdus > 1){ if (n_pdus > 1){
LOG_E(PHY, "In %s: multiple number of DL PDUs not supported yet...\n", __FUNCTION__); LOG_E(PHY, "In %s: multiple number of DL PDUs not supported yet...\n", __FUNCTION__);
} }
fapi_nr_rx_indication_body_t *rx = rx_ind->rx_indication_body + n_pdus - 1;
NR_DL_UE_HARQ_t *dl_harq0 = NULL;
if ((pdu_type != FAPI_NR_RX_PDU_TYPE_SSB) && dlsch0) {
int t=WS_C_RNTI;
if (pdu_type == FAPI_NR_RX_PDU_TYPE_RAR)
t=WS_RA_RNTI;
if (pdu_type == FAPI_NR_RX_PDU_TYPE_SIB)
t=WS_SI_RNTI;
dl_harq0 = &ue->dl_harq_processes[0][dlsch0->dlsch_config.harq_process_nbr];
trace_NRpdu(DIRECTION_DOWNLINK,
b,
dlsch0->dlsch_config.TBS / 8,
t,
dlsch0->rnti,
proc->frame_rx,
proc->nr_slot_rx,
0,0);
}
switch (pdu_type){ switch (pdu_type){
case FAPI_NR_RX_PDU_TYPE_SIB: case FAPI_NR_RX_PDU_TYPE_SIB:
case FAPI_NR_RX_PDU_TYPE_RAR: case FAPI_NR_RX_PDU_TYPE_RAR:
case FAPI_NR_RX_PDU_TYPE_DLSCH: case FAPI_NR_RX_PDU_TYPE_DLSCH:
if(dlsch0) { if(dlsch0) {
dl_harq0 = &ue->dl_harq_processes[0][dlsch0->dlsch_config.harq_process_nbr]; NR_DL_UE_HARQ_t *dl_harq0 = &ue->dl_harq_processes[0][dlsch0->dlsch_config.harq_process_nbr];
rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.harq_pid = dlsch0->dlsch_config.harq_process_nbr; rx->pdsch_pdu.harq_pid = dlsch0->dlsch_config.harq_process_nbr;
rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.ack_nack = dl_harq0->ack; rx->pdsch_pdu.ack_nack = dl_harq0->ack;
rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.pdu = b; rx->pdsch_pdu.pdu = b;
rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.pdu_length = dlsch0->dlsch_config.TBS / 8; rx->pdsch_pdu.pdu_length = dlsch0->dlsch_config.TBS / 8;
if (dl_harq0->ack) {
int t = WS_C_RNTI;
if (pdu_type == FAPI_NR_RX_PDU_TYPE_RAR)
t = WS_RA_RNTI;
if (pdu_type == FAPI_NR_RX_PDU_TYPE_SIB)
t = WS_SI_RNTI;
trace_NRpdu(DIRECTION_DOWNLINK, b, rx->pdsch_pdu.pdu_length, t, dlsch0->rnti, proc->frame_rx, proc->nr_slot_rx, 0, 0);
}
} }
if(dlsch1) { if(dlsch1) {
AssertFatal(1==0,"Second codeword currently not supported\n"); AssertFatal(1==0,"Second codeword currently not supported\n");
} }
break; break;
case FAPI_NR_RX_PDU_TYPE_SSB: { case FAPI_NR_RX_PDU_TYPE_SSB: {
fapi_nr_ssb_pdu_t *ssb_pdu = &rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu; if (typeSpecific) {
if(typeSpecific) { NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; fapiPbch_t *pbch = (fapiPbch_t *)typeSpecific;
fapiPbch_t *pbch = (fapiPbch_t *)typeSpecific; memcpy(rx->ssb_pdu.pdu, pbch->decoded_output, sizeof(pbch->decoded_output));
memcpy(ssb_pdu->pdu, pbch->decoded_output, sizeof(pbch->decoded_output)); rx->ssb_pdu.additional_bits = pbch->xtra_byte;
ssb_pdu->additional_bits = pbch->xtra_byte; rx->ssb_pdu.ssb_index = (frame_parms->ssb_index) & 0x7;
ssb_pdu->ssb_index = (frame_parms->ssb_index) & 0x7; rx->ssb_pdu.ssb_length = frame_parms->Lmax;
ssb_pdu->ssb_length = frame_parms->Lmax; rx->ssb_pdu.cell_id = frame_parms->Nid_cell;
ssb_pdu->cell_id = frame_parms->Nid_cell; rx->ssb_pdu.ssb_start_subcarrier = frame_parms->ssb_start_subcarrier;
ssb_pdu->ssb_start_subcarrier = frame_parms->ssb_start_subcarrier; rx->ssb_pdu.rsrp_dBm = ue->measurements.ssb_rsrp_dBm[frame_parms->ssb_index];
ssb_pdu->rsrp_dBm = ue->measurements.ssb_rsrp_dBm[frame_parms->ssb_index]; rx->ssb_pdu.arfcn = get_ssb_arfcn(frame_parms);
ssb_pdu->arfcn = get_ssb_arfcn(frame_parms); rx->ssb_pdu.radiolink_monitoring = RLM_in_sync; // TODO to be removed from here
ssb_pdu->radiolink_monitoring = RLM_in_sync; // TODO to be removed from here rx->ssb_pdu.decoded_pdu = true;
ssb_pdu->decoded_pdu = true; } else {
} rx->ssb_pdu.radiolink_monitoring = RLM_out_of_sync; // TODO to be removed from here
else { rx->ssb_pdu.decoded_pdu = false;
ssb_pdu->radiolink_monitoring = RLM_out_of_sync; // TODO to be removed from here
ssb_pdu->decoded_pdu = false;
}
} }
break; } break;
case FAPI_NR_CSIRS_IND: case FAPI_NR_CSIRS_IND:
memcpy(&rx_ind->rx_indication_body[n_pdus - 1].csirs_measurements, memcpy(&rx->csirs_measurements, typeSpecific, sizeof(fapi_nr_csirs_measurements_t));
(fapi_nr_csirs_measurements_t*)typeSpecific,
sizeof(*(fapi_nr_csirs_measurements_t*)typeSpecific));
break; break;
default: default:
break; break;
} }
rx_ind->rx_indication_body[n_pdus -1].pdu_type = pdu_type; rx->pdu_type = pdu_type;
rx_ind->number_pdus = n_pdus; rx_ind->number_pdus = n_pdus;
} }
......
...@@ -1093,7 +1093,7 @@ int main(int argc, char *argv[]) ...@@ -1093,7 +1093,7 @@ int main(int argc, char *argv[])
ul_config0->pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; ul_config0->pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH;
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config0->pusch_config_pdu; nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config0->pusch_config_pdu;
// Config UL TX PDU // Config UL TX PDU
pusch_config_pdu->tx_request_body.pdu = ulsch_input_buffer; pusch_config_pdu->tx_request_body.fapiTxPdu = ulsch_input_buffer;
pusch_config_pdu->tx_request_body.pdu_length = TBS / 8; pusch_config_pdu->tx_request_body.pdu_length = TBS / 8;
pusch_config_pdu->rnti = n_rnti; pusch_config_pdu->rnti = n_rnti;
pusch_config_pdu->pdu_bit_map = pdu_bit_map; pusch_config_pdu->pdu_bit_map = pdu_bit_map;
......
...@@ -1306,7 +1306,6 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info) ...@@ -1306,7 +1306,6 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info)
while (ulcfg_pdu->pdu_type != FAPI_NR_END) { while (ulcfg_pdu->pdu_type != FAPI_NR_END) {
uint8_t *ulsch_input_buffer = ulsch_input_buffer_array[number_of_pdus]; uint8_t *ulsch_input_buffer = ulsch_input_buffer_array[number_of_pdus];
if (ulcfg_pdu->pdu_type == FAPI_NR_UL_CONFIG_TYPE_PUSCH) { 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; uint16_t TBS_bytes = ulcfg_pdu->pusch_config_pdu.pusch_data.tb_size;
LOG_D(NR_MAC, LOG_D(NR_MAC,
"harq_id %d, new_data_indicator %d, TBS_bytes %d (ra_state %d)\n", "harq_id %d, new_data_indicator %d, TBS_bytes %d (ra_state %d)\n",
...@@ -1314,27 +1313,26 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info) ...@@ -1314,27 +1313,26 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info)
ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator, ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator,
TBS_bytes, TBS_bytes,
ra->ra_state); ra->ra_state);
ulcfg_pdu->pusch_config_pdu.tx_request_body.fapiTxPdu = NULL;
if (ra->ra_state == nrRA_WAIT_RAR && !ra->cfra) { if (ra->ra_state == nrRA_WAIT_RAR && !ra->cfra) {
nr_get_msg3_payload(mac, ulsch_input_buffer, TBS_bytes); nr_get_msg3_payload(mac, ulsch_input_buffer, TBS_bytes);
for (int k = 0; k < TBS_bytes; k++) { 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, "(%i): 0x%x\n", k, ulsch_input_buffer[k]);
} }
mac_pdu_exist = 1; ulcfg_pdu->pusch_config_pdu.tx_request_body.fapiTxPdu = ulsch_input_buffer;
ulcfg_pdu->pusch_config_pdu.tx_request_body.pdu_length = TBS_bytes;
number_of_pdus++;
} else { } else {
if (ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator if (ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator
&& (mac->state == UE_CONNECTED || (ra->ra_state == nrRA_WAIT_RAR && ra->cfra))) { && (mac->state == UE_CONNECTED || (ra->ra_state == nrRA_WAIT_RAR && ra->cfra))) {
// Getting IP traffic to be transmitted // Getting IP traffic to be transmitted
nr_ue_get_sdu(mac, cc_id, frame_tx, slot_tx, gNB_index, ulsch_input_buffer, TBS_bytes); nr_ue_get_sdu(mac, cc_id, frame_tx, slot_tx, gNB_index, ulsch_input_buffer, TBS_bytes);
mac_pdu_exist = 1; ulcfg_pdu->pusch_config_pdu.tx_request_body.fapiTxPdu = ulsch_input_buffer;
ulcfg_pdu->pusch_config_pdu.tx_request_body.pdu_length = TBS_bytes;
number_of_pdus++;
} }
} }
// Config UL TX PDU
if (mac_pdu_exist) {
ulcfg_pdu->pusch_config_pdu.tx_request_body.pdu = ulsch_input_buffer;
ulcfg_pdu->pusch_config_pdu.tx_request_body.pdu_length = TBS_bytes;
number_of_pdus++;
}
if (ra->ra_state == nrRA_WAIT_CONTENTION_RESOLUTION && !ra->cfra) { if (ra->ra_state == nrRA_WAIT_CONTENTION_RESOLUTION && !ra->cfra) {
LOG_I(NR_MAC, "[RAPROC][%d.%d] RA-Msg3 retransmitted\n", frame_tx, slot_tx); LOG_I(NR_MAC, "[RAPROC][%d.%d] RA-Msg3 retransmitted\n", frame_tx, slot_tx);
// 38.321 restart the ra-ContentionResolutionTimer at each HARQ retransmission in the first symbol after the end of the Msg3 // 38.321 restart the ra-ContentionResolutionTimer at each HARQ retransmission in the first symbol after the end of the Msg3
......
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