Commit b232c434 authored by Mahesh's avatar Mahesh

Uplink improvement

parent 39577ba0
......@@ -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
......
......@@ -1607,7 +1607,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) {
......
......@@ -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:
......
......@@ -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
{
......
......@@ -430,14 +430,14 @@ 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;
}
......
......@@ -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) && (id<NUMBER_OF_NR_PUCCH_MAX),
"invalid id found for pucch !!! rnti %04x id %d\n",pucch_pdu->rnti,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
......
......@@ -560,6 +560,8 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
for (int i=0;i<NUMBER_OF_NR_PUCCH_MAX;i++){
NR_gNB_PUCCH_t *pucch = gNB->pucch[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_pid<NR_MAX_ULSCH_HARQ_PROCESSES;harq_pid++) {
ulsch_harq = ulsch->harq_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
......
......@@ -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);
// }
// }
}
......
......@@ -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;j<UL_info->crc_ind.number_crcs;j++)
} // for (i=0;i<UL_info->rx_ind.number_of_pdus;i++)
......
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