From 7c6e4ed01d40292ed3e2607ef27be36e9c55e3bc Mon Sep 17 00:00:00 2001 From: David Kim Date: Thu, 18 Mar 2021 11:22:06 -0700 Subject: [PATCH] adding nfapi_new update --- .../conf_files/rcc.band7.tm1.nfapi.conf | 8 +- executables/nr-gnb.c | 43 ++++-- executables/nr-ru.c | 8 +- nfapi/oai_integration/nfapi_pnf.c | 1 + nfapi/open-nFAPI/pnf/src/pnf_p7.c | 53 ++++--- openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c | 11 +- openair1/PHY/NR_TRANSPORT/pucch_rx.c | 17 ++- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 7 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 7 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 141 +++++++++--------- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 23 +-- 11 files changed, 192 insertions(+), 127 deletions(-) diff --git a/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf b/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf index ac4d69998d..5cb094ed12 100644 --- a/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf +++ b/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf @@ -191,10 +191,10 @@ eNBs = NETWORK_INTERFACES : { - ENB_INTERFACE_NAME_FOR_S1_MME = "vpn"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "10.1.3.2"; - ENB_INTERFACE_NAME_FOR_S1U = "vpn"; - ENB_IPV4_ADDRESS_FOR_S1U = "10.1.3.2"; + ENB_INTERFACE_NAME_FOR_S1_MME = "enp67s0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "10.1.1.68"; + ENB_INTERFACE_NAME_FOR_S1U = "enp67s0"; + ENB_IPV4_ADDRESS_FOR_S1U = "10.1.1.68"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.1"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 6ffa62dd4d..8d39c314f7 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -253,25 +253,33 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t // RX processing int tx_slot_type; int rx_slot_type; - if(NFAPI_MODE == NFAPI_MODE_VNF) { - if ((slot_tx==8) || (slot_rx==8) || (slot_tx==9) || (slot_rx==9) || (slot_tx==18) || (slot_rx==18) || (slot_tx==19) || (slot_rx==19)) { - tx_slot_type = NR_UPLINK_SLOT; - rx_slot_type = NR_UPLINK_SLOT; - } - else if ((slot_tx==7) || (slot_rx==7) || (slot_tx==17) || (slot_rx==17)) { - tx_slot_type = NR_MIXED_SLOT; - rx_slot_type = NR_MIXED_SLOT; - } - else { - tx_slot_type = NR_DOWNLINK_SLOT; - rx_slot_type = NR_DOWNLINK_SLOT; - } + if(NFAPI_MODE != NFAPI_MONOLITHIC) { //slot selection routines not working properly in nfapi, so temporarily hardcoding + if ((slot_tx==8) || (slot_tx==9) || (slot_tx==18) || (slot_tx==19)) { //tx slot config + tx_slot_type = NR_UPLINK_SLOT; + } + else if ((slot_tx==7) || (slot_tx==17)) { + tx_slot_type = NR_MIXED_SLOT; + } + else { + tx_slot_type = NR_DOWNLINK_SLOT;; + } + + if ((slot_rx==8) || (slot_rx==9) || (slot_rx==18) || (slot_rx==19)) { // rx slot config + rx_slot_type = NR_UPLINK_SLOT; + } + else if ((slot_rx==7) || (slot_rx==17)) { + rx_slot_type = NR_MIXED_SLOT; + } + else { + rx_slot_type = NR_DOWNLINK_SLOT;; + } + + } else { tx_slot_type = nr_slot_select(cfg,frame_tx,slot_tx); rx_slot_type = nr_slot_select(cfg,frame_rx,slot_rx); } - if (rx_slot_type == NR_UPLINK_SLOT || rx_slot_type == NR_MIXED_SLOT) { // UE-specific RX processing for subframe n // TODO: check if this is correct for PARALLEL_RU_L1_TRX_SPLIT @@ -417,12 +425,17 @@ static void *gNB_L1_thread( void *param ) { while (!oai_exit) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 0 ); if (wait_on_condition(&L1_proc->mutex,&L1_proc->cond,&L1_proc->instance_cnt,thread_name)<0) break; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 1 ); int frame_rx = L1_proc->frame_rx; - int slot_rx = L1_proc->slot_rx; + int slot_rx; + if (NFAPI_MODE == NFAPI_MODE_PNF) + slot_rx = (L1_proc->slot_rx) + 1; + else + slot_rx = L1_proc->slot_rx; int frame_tx = L1_proc->frame_tx; int slot_tx = L1_proc->slot_tx; uint64_t timestamp_tx = L1_proc->timestamp_tx; diff --git a/executables/nr-ru.c b/executables/nr-ru.c index e768e84179..b1ceb03eb1 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1606,7 +1606,13 @@ void *ru_thread( void *param ) { // do RX front-end processing (frequency-shift, dft) if needed - int slot_type = nr_slot_select(cfg,proc->frame_rx,proc->tti_rx); + //int slot_type = nr_slot_select(cfg,proc->frame_rx,proc->tti_rx); + //if (NFAPI_MODE == NFAPI_MODE_PNF) + int slot_type; + if (slot ==7) + slot_type = NR_MIXED_SLOT; + if (slot == 8) + slot_type = NR_UPLINK_SLOT; if (slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT) { //if (proc->tti_rx==8) { diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index 6a8ab8c7fd..9219970dec 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -1475,6 +1475,7 @@ int pnf_phy_ul_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, switch (ul_tti_pdu_list[i].pdu_type) { case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE: //LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PUSCH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot); + //curr_sfn = curr_sfn + 3; //Gokul nr_fill_ulsch(gNB,curr_sfn, curr_slot, &ul_tti_pdu_list[i].pusch_pdu); break; case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE: diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c index b1d071163f..8ef0bc1952 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c +++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c @@ -1007,36 +1007,34 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl // if(tx_slot_buffer->slot == slot_tx && tx_slot_buffer->sfn == sfn_tx) // { - if(tx_slot_buffer->tx_data_req != 0) - { + if(tx_slot_buffer->tx_data_req != 0) + { - if(pnf_p7->_public.tx_data_req_fn) - { - (pnf_p7->_public.tx_data_req_fn)(&(pnf_p7->_public), tx_slot_buffer->tx_data_req); - } + if(pnf_p7->_public.tx_data_req_fn) + { + (pnf_p7->_public.tx_data_req_fn)(&(pnf_p7->_public), tx_slot_buffer->tx_data_req); } - else + } + else + { + // send dummy + if(pnf_p7->_public.tx_data_req_fn && pnf_p7->_public.dummy_slot.tx_data_req) { - // send dummy - if(pnf_p7->_public.tx_data_req_fn && pnf_p7->_public.dummy_slot.tx_data_req) - { - pnf_p7->_public.dummy_slot.tx_data_req->SFN = sfn_tx; - pnf_p7->_public.dummy_slot.tx_data_req->Slot = slot_tx; + pnf_p7->_public.dummy_slot.tx_data_req->SFN = sfn_tx; + pnf_p7->_public.dummy_slot.tx_data_req->Slot = slot_tx; - (pnf_p7->_public.tx_data_req_fn)(&(pnf_p7->_public), pnf_p7->_public.dummy_slot.tx_data_req); - } + (pnf_p7->_public.tx_data_req_fn)(&(pnf_p7->_public), pnf_p7->_public.dummy_slot.tx_data_req); } - //} + } + - if( tx_slot_buffer->dl_tti_req != 0) // ADDED & TO BYPASS ERROR + if(tx_slot_buffer->dl_tti_req != 0) { if(pnf_p7->_public.dl_tti_req_fn) { (pnf_p7->_public.dl_tti_req_fn)(NULL, &(pnf_p7->_public), tx_slot_buffer->dl_tti_req); } } - - else { // send dummy @@ -1048,6 +1046,7 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl } } + if(tx_slot_buffer->ul_dci_req!= 0) { if(pnf_p7->_public.ul_dci_req_fn) @@ -1065,6 +1064,23 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl (pnf_p7->_public.ul_dci_req_fn)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_slot.ul_dci_req); } } + if(tx_slot_buffer->ul_tti_req != 0) + { + if(pnf_p7->_public.ul_tti_req_fn) + { + (pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), tx_slot_buffer->ul_tti_req); + } + } + else + { + // send dummy + if(pnf_p7->_public.ul_tti_req_fn && pnf_p7->_public.dummy_slot.ul_tti_req) + { + pnf_p7->_public.dummy_slot.ul_tti_req->SFN = sfn_tx; + pnf_p7->_public.dummy_slot.ul_tti_req->Slot = slot_tx; + (pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_slot.ul_tti_req); + } + } if(tx_slot_buffer->dl_tti_req != 0) { deallocate_nfapi_dl_tti_request(tx_slot_buffer->dl_tti_req, pnf_p7); @@ -1101,7 +1117,6 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl { (pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), slot_buffer->ul_tti_req); } - //deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7); } else { diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index d990176d79..91f72922e2 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -430,20 +430,22 @@ void nr_processULSegment(void* arg) { p_procTime); if (check_crc((uint8_t*)llrProcBuf,length_dec,ulsch_harq->F,crc_type)) { -#ifdef PRINT_CRC_CHECK +// #ifdef PRINT_CRC_CHECK LOG_I(PHY, "Segment %d CRC OK\n",r); -#endif +// #endif rdata->decodeIterations = no_iteration_ldpc; } else { -#ifdef PRINT_CRC_CHECK +// #ifdef PRINT_CRC_CHECK LOG_I(PHY, "CRC NOK\n"); -#endif +// #endif rdata->decodeIterations = max_ldpc_iterations + 1; } for (int m=0; m < Kr>>3; m ++) { ulsch_harq->c[r][m]= (uint8_t) llrProcBuf[m]; + //printf("%x ", ulsch_harq->c[r][m]); } + //printf("\n"); //stop_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats); } @@ -510,6 +512,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, A = (harq_process->TBS)<<3; LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, n_layers %d\n",harq_pid,A,G, mcs, n_layers, nb_rb, Qm, n_layers); + //printf("ULSCH in %d.%d \n", frame, nr_tti_rx); if (R<1024) Coderate = (float) R /(float) 1024; diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 2d1fdff4be..3d2f27476a 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -47,6 +47,7 @@ #include "PHY/NR_REFSIG/nr_refsig.h" #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" +#include "nfapi/oai_integration/vendor_ext.h" #include "T.h" @@ -86,7 +87,8 @@ void nr_fill_pucch(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_pucch_pdu_t *pucch_pdu) { - + if (NFAPI_MODE == NFAPI_MODE_PNF) + gNB->pucch[0]->active = 0; //check if ture in monolithic mode int id = nr_find_pucch(pucch_pdu->rnti,frame,slot,gNB); AssertFatal( (id>=0) && (idrnti,id); @@ -164,10 +166,15 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, int slot, nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu, nfapi_nr_pucch_pdu_t* pucch_pdu) { - + printf("Inside nr_decode_pucch0. \n"); int32_t **rxdataF = gNB->common_vars.rxdataF; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; - + //Gokul + // printf("rxdataf buff: \n"); + // for(int i = 1;i<=5*7*14*512;++i){ + // if(gNB->RU_list[0]->common.rxdataF[0][i] != 0) + // printf("%d ",gNB->RU_list[0]->common.rxdataF[0][i]); + // } int nr_sequences; const uint8_t *mcs; @@ -1085,7 +1092,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, int slot, nfapi_nr_uci_pucch_pdu_format_2_3_4_t* uci_pdu, nfapi_nr_pucch_pdu_t* pucch_pdu) { - + printf("Inside nr_decode_pucch2. \n"); int32_t **rxdataF = gNB->common_vars.rxdataF; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; //pucch_GroupHopping_t pucch_GroupHopping = pucch_pdu->group_hop_flag + (pucch_pdu->sequence_hop_flag<<1); @@ -1465,7 +1472,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, } } // cw loop corr_dB = dB_fixed64((uint64_t)corr); - LOG_D(PHY,"cw_ML %d, metric %d dB\n",cw_ML,corr_dB); + LOG_I(PHY,"cw_ML %d, metric %d dB\n",cw_ML,corr_dB); decodedPayload[0]=(uint64_t)cw_ML; } else { // polar coded case diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index cd419cf8c9..24c633c1f0 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -560,6 +560,8 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) for (int i=0;ipucch[i]; if (pucch) { + if (NFAPI_MODE == NFAPI_MODE_PNF) + pucch->frame = frame_rx; if ((pucch->active == 1) && (pucch->frame == frame_rx) && (pucch->slot == slot_rx) ) { @@ -620,12 +622,15 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) for (harq_pid=0;harq_pidharq_processes[harq_pid]; AssertFatal(ulsch_harq!=NULL,"harq_pid %d is not allocated\n",harq_pid); + //printf("ulsch_harq->frame = %d, frame_rx = %d \n", ulsch_harq->frame, frame_rx); + if (NFAPI_MODE == NFAPI_MODE_PNF) + ulsch_harq->frame = frame_rx; if ((ulsch_harq->status == NR_ACTIVE) && (ulsch_harq->frame == frame_rx) && (ulsch_harq->slot == slot_rx) && (ulsch_harq->handled == 0)){ - LOG_D(PHY, "PUSCH detection started in frame %d slot %d\n", + LOG_I(PHY, "PUSCH detection started in frame %d slot %d\n", frame_rx,slot_rx); #ifdef DEBUG_RXDATA diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index e7149c5d65..00e53dd21e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -62,6 +62,7 @@ #include "common/ran_context.h" extern RAN_CONTEXT_t RC; +uint8_t count = 0; uint8_t harq_pid_ul = -1; int flag = 0; // Note the 2 scs values in the table names represent resp. scs_common and pdcch_scs /// LUT for the number of symbols in the coreset indexed by coreset index (4 MSB rmsi_pdcch_config) @@ -1248,6 +1249,11 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, case NR_UL_DCI_FORMAT_0_1: switch (rnti_type) { case NR_RNTI_C: + harq_pid_ul = (harq_pid_ul + 1) % 16; + if (harq_pid_ul == 0) + flag = !flag; + dci_pdu_rel15->ndi = flag; + // Indicating a DL DCI format 1bit pos = 1; *dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator & 0x1) << (dci_size - pos); @@ -1280,6 +1286,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, *dci_pdu |= ((uint64_t)dci_pdu_rel15->rv & 0x3) << (dci_size - pos); // HARQ process number 4bit pos += 4; + dci_pdu_rel15->harq_pid = harq_pid_ul; *dci_pdu |= ((uint64_t)dci_pdu_rel15->harq_pid & 0xf) << (dci_size - pos); // 1st Downlink assignment index pos += dci_pdu_rel15->dai[0].nbits; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 9842d9137f..3ae3707962 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -318,13 +318,15 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, frame_t frame, sub_frame_t slot, const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01) -{ +{ NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; + UE_info->active[0] = 1; + UE_info->rnti[0] = uci_01->rnti; int UE_id = find_nr_UE_id(mod_id, uci_01->rnti); if (UE_id < 0) { LOG_E(MAC, "%s(): unknown RNTI %04x in PUCCH UCI\n", __func__, uci_01->rnti); return; } - NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; + //NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; // tpc (power control) @@ -332,51 +334,55 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, uci_01->ul_cqi, 30); - NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; - const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; - if (((uci_01->pduBitmap >> 1) & 0x01)) { - // iterate over received harq bits - for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) { - const uint8_t harq_value = uci_01->harq->harq_list[harq_bit].harq_value; - const uint8_t harq_confidence = uci_01->harq->harq_confidence_level; - const int feedback_slot = (slot - 1 + num_slots) % num_slots; - /* In case of realtime problems: we can only identify a HARQ process by - * timing. If the HARQ process's feedback_slot is not the one we - * expected, we assume that processing has been aborted and we need to - * skip this HARQ process, which is what happens in the loop below. If - * you don't experience real-time problems, you might simply revert the - * commit that introduced these changes. */ - int8_t pid = sched_ctrl->feedback_dl_harq.head; - DevAssert(pid >= 0); - while (sched_ctrl->harq_processes[pid].feedback_slot != feedback_slot) { - LOG_W(MAC, - "expected feedback slot %d, but found %d instead\n", - sched_ctrl->harq_processes[pid].feedback_slot, - feedback_slot); - remove_front_nr_list(&sched_ctrl->feedback_dl_harq); - handle_dl_harq(mod_id, UE_id, pid, 0); - pid = sched_ctrl->feedback_dl_harq.head; - DevAssert(pid >= 0); - } - remove_front_nr_list(&sched_ctrl->feedback_dl_harq); - NR_UE_harq_t *harq = &sched_ctrl->harq_processes[pid]; - DevAssert(harq->is_waiting); - handle_dl_harq(mod_id, UE_id, pid, harq_value == 1 && harq_confidence == 0); - } - } + // NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; + // const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; + const int num_slots = 20; + + // if (((uci_01->pduBitmap >> 1) & 0x01)) { + // // iterate over received harq bits + // for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) { + // const uint8_t harq_value = uci_01->harq->harq_list[harq_bit].harq_value; + // const uint8_t harq_confidence = uci_01->harq->harq_confidence_level; + // const int feedback_slot = (slot - 1 + num_slots) % num_slots; + // /* In case of realtime problems: we can only identify a HARQ process by + // * timing. If the HARQ process's feedback_slot is not the one we + // * expected, we assume that processing has been aborted and we need to + // * skip this HARQ process, which is what happens in the loop below. If + // * you don't experience real-time problems, you might simply revert the + // * commit that introduced these changes. */ + // int8_t pid = sched_ctrl->feedback_dl_harq.head; + // DevAssert(pid >= 0); + // while (sched_ctrl->harq_processes[pid].feedback_slot != feedback_slot) { + // LOG_W(MAC, + // "expected feedback slot %d, but found %d instead\n", + // sched_ctrl->harq_processes[pid].feedback_slot, + // feedback_slot); + // remove_front_nr_list(&sched_ctrl->feedback_dl_harq); + // handle_dl_harq(mod_id, UE_id, pid, 0); + // pid = sched_ctrl->feedback_dl_harq.head; + // DevAssert(pid >= 0); + // } + // remove_front_nr_list(&sched_ctrl->feedback_dl_harq); + // NR_UE_harq_t *harq = &sched_ctrl->harq_processes[pid]; + // DevAssert(harq->is_waiting); + // handle_dl_harq(mod_id, UE_id, pid, harq_value == 1 && harq_confidence == 0); + // } + // } } void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, frame_t frame, sub_frame_t slot, const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234) -{ +{ NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; + UE_info->active[0] = 1; + UE_info->rnti[0] = uci_234->rnti; int UE_id = find_nr_UE_id(mod_id, uci_234->rnti); if (UE_id < 0) { LOG_E(MAC, "%s(): unknown RNTI %04x in PUCCH UCI\n", __func__, uci_234->rnti); return; } - NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; + //NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; // tpc (power control) @@ -384,37 +390,38 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, uci_234->ul_cqi, 30); - NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; - const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; - if ((uci_234->pduBitmap >> 1) & 0x01) { - // iterate over received harq bits - for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) { - const int acknack = ((uci_234->harq.harq_payload[harq_bit >> 3]) >> harq_bit) & 0x01; - const int feedback_slot = (slot - 1 + num_slots) % num_slots; - /* In case of realtime problems: we can only identify a HARQ process by - * timing. If the HARQ process's feedback_slot is not the one we - * expected, we assume that processing has been aborted and we need to - * skip this HARQ process, which is what happens in the loop below. If - * you don't experience real-time problems, you might simply revert the - * commit that introduced these changes. */ - int8_t pid = sched_ctrl->feedback_dl_harq.head; - DevAssert(pid >= 0); - while (sched_ctrl->harq_processes[pid].feedback_slot != feedback_slot) { - LOG_W(MAC, - "expected feedback slot %d, but found %d instead\n", - sched_ctrl->harq_processes[pid].feedback_slot, - feedback_slot); - remove_front_nr_list(&sched_ctrl->feedback_dl_harq); - handle_dl_harq(mod_id, UE_id, pid, 0); - pid = sched_ctrl->feedback_dl_harq.head; - DevAssert(pid >= 0); - } - remove_front_nr_list(&sched_ctrl->feedback_dl_harq); - NR_UE_harq_t *harq = &sched_ctrl->harq_processes[pid]; - DevAssert(harq->is_waiting); - handle_dl_harq(mod_id, UE_id, pid, uci_234->harq.harq_crc != 1 && acknack); - } - } + // NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; + // const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; + const int num_slots = 20; + // if ((uci_234->pduBitmap >> 1) & 0x01) { + // // iterate over received harq bits + // for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) { + // const int acknack = ((uci_234->harq.harq_payload[harq_bit >> 3]) >> harq_bit) & 0x01; + // const int feedback_slot = (slot - 1 + num_slots) % num_slots; + // /* In case of realtime problems: we can only identify a HARQ process by + // * timing. If the HARQ process's feedback_slot is not the one we + // * expected, we assume that processing has been aborted and we need to + // * skip this HARQ process, which is what happens in the loop below. If + // * you don't experience real-time problems, you might simply revert the + // * commit that introduced these changes. */ + // int8_t pid = sched_ctrl->feedback_dl_harq.head; + // DevAssert(pid >= 0); + // while (sched_ctrl->harq_processes[pid].feedback_slot != feedback_slot) { + // LOG_W(MAC, + // "expected feedback slot %d, but found %d instead\n", + // sched_ctrl->harq_processes[pid].feedback_slot, + // feedback_slot); + // remove_front_nr_list(&sched_ctrl->feedback_dl_harq); + // handle_dl_harq(mod_id, UE_id, pid, 0); + // pid = sched_ctrl->feedback_dl_harq.head; + // DevAssert(pid >= 0); + // } + // remove_front_nr_list(&sched_ctrl->feedback_dl_harq); + // NR_UE_harq_t *harq = &sched_ctrl->harq_processes[pid]; + // DevAssert(harq->is_waiting); + // handle_dl_harq(mod_id, UE_id, pid, uci_234->harq.harq_crc != 1 && acknack); + // } + // } } diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 08000aefb5..7b249da14c 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -139,17 +139,18 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) crc->tb_crc_status); /* if CRC passes, pass PDU, otherwise pass NULL as error indication */ - nr_rx_sdu(UL_info->module_id, - UL_info->CC_id, - UL_info->rx_ind.sfn, - UL_info->rx_ind.slot, - rx->rnti, - crc->tb_crc_status ? NULL : rx->pdu, - rx->pdu_length, - rx->timing_advance, - rx->ul_cqi, - rx->rssi); - handle_nr_ul_harq(UL_info->module_id, UL_info->frame, UL_info->slot, crc); + //Gokul + // nr_rx_sdu(UL_info->module_id, + // UL_info->CC_id, + // UL_info->rx_ind.sfn, + // UL_info->rx_ind.slot, + // rx->rnti, + // crc->tb_crc_status ? NULL : rx->pdu, + // rx->pdu_length, + // rx->timing_advance, + // rx->ul_cqi, + // rx->rssi); + //handle_nr_ul_harq(UL_info->module_id, UL_info->frame, UL_info->slot, crc); break; } // for (j=0;jcrc_ind.number_crcs;j++) } // for (i=0;irx_ind.number_of_pdus;i++)