Commit 60a9d41b authored by Melissa Elkadi's avatar Melissa Elkadi

UCI ACK/NACK most of the way working

We have gotten rid of filling the ACK/NACK with
the DLSCH and now only fill with the PUCCH. This
assumes that the MAC layer is properly decoding the
dl_tti_req and tx_data_req and allows us to
simply use the MAC layers scheduled SNF/Slot
to return the ACK NACK. There are some hacks added
in this commit which ensure that the PDCP packet
has the correct header (1st byte = 80) and now with
15Mbps we are seeing about 20% packet loss and
a gNB bug on the edge case (current frame is 1023
and the gNB schduler wants an ACK in frame 0 but the
scheduled UL_TTI_REQ has a frame of 1023).
parent f336cbc6
......@@ -32,6 +32,7 @@
#include "LAYER2/nr_pdcp/nr_pdcp_entity.h"
#include "SCHED_NR_UE/pucch_uci_ue_nr.h"
#include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h"
#include <pthread.h>
/*
* NR SLOT PROCESSING SEQUENCE
......@@ -199,31 +200,16 @@ static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot)
nfapi_nr_rach_indication_t *rach_ind = unqueue_matching(&nr_rach_ind_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot);
nfapi_nr_dl_tti_request_t *dl_tti_request = get_queue(&nr_dl_tti_req_queue);
nfapi_nr_ul_dci_request_t *ul_dci_request = get_queue(&nr_ul_dci_req_queue);
LOG_D(NR_MAC, "Try to get a ul_tti_req for HARQ sfn/slot %d %d from queue with %lu items\n",
NFAPI_SFNSLOT2SFN(mac->nr_ue_emul_l1.active_harq_sfn_slot),
NFAPI_SFNSLOT2SLOT(mac->nr_ue_emul_l1.active_harq_sfn_slot), nr_ul_tti_req_queue.num_items);
nfapi_nr_ul_tti_request_t *ul_tti_request_harq = unqueue_matching(&nr_ul_tti_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &mac->nr_ue_emul_l1.active_harq_sfn_slot);
if (ul_tti_request_harq && ul_tti_request_harq->n_pdus > 0)
{
check_and_process_dci(NULL, NULL, NULL, ul_tti_request_harq);
}
LOG_D(NR_MAC, "Try to get a ul_tti_req by matching CSI active SFN %d/SLOT %d from queue with %lu items\n",
NFAPI_SFNSLOT2SFN(mac->nr_ue_emul_l1.active_uci_sfn_slot),
NFAPI_SFNSLOT2SLOT(mac->nr_ue_emul_l1.active_uci_sfn_slot), nr_ul_tti_req_queue.num_items);
nfapi_nr_ul_tti_request_t *ul_tti_request_uci = unqueue_matching(&nr_ul_tti_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &mac->nr_ue_emul_l1.active_uci_sfn_slot);
if (ul_tti_request_uci && ul_tti_request_uci->n_pdus > 0)
{
check_and_process_dci(NULL, NULL, NULL, ul_tti_request_uci);
}
LOG_D(NR_MAC, "Try to get a ul_tti_req by matching CRC active SFN %d/SLOT %d from queue with %lu items\n",
NFAPI_SFNSLOT2SFN(mac->nr_ue_emul_l1.crc_rx_ind_sfn_slot),
NFAPI_SFNSLOT2SLOT(mac->nr_ue_emul_l1.crc_rx_ind_sfn_slot), nr_ul_tti_req_queue.num_items);
nfapi_nr_ul_tti_request_t *ul_tti_request_crc = unqueue_matching(&nr_ul_tti_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &mac->nr_ue_emul_l1.crc_rx_ind_sfn_slot);
if (ul_tti_request_crc && ul_tti_request_crc->n_pdus > 0)
{
check_and_process_dci(NULL, NULL, NULL, ul_tti_request_crc);
for (int i = 0; i < 16; i++) {
LOG_D(NR_MAC, "Try to get a ul_tti_req by matching CRC active SFN %d/SLOT %d from queue with %lu items\n",
NFAPI_SFNSLOT2SFN(mac->nr_ue_emul_l1.harq[i].crc_rx_ind_sfn_slot),
NFAPI_SFNSLOT2SLOT(mac->nr_ue_emul_l1.harq[i].crc_rx_ind_sfn_slot), nr_ul_tti_req_queue.num_items);
nfapi_nr_ul_tti_request_t *ul_tti_request_crc = unqueue_matching(&nr_ul_tti_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &mac->nr_ue_emul_l1.harq[i].crc_rx_ind_sfn_slot);
if (ul_tti_request_crc && ul_tti_request_crc->n_pdus > 0)
{
check_and_process_dci(NULL, NULL, NULL, ul_tti_request_crc);
}
}
if (rach_ind && rach_ind->number_of_pdus > 0)
......@@ -389,6 +375,8 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
ul_info.slot_tx = (slot + slot_ahead) % slots_per_frame;
ul_info.frame_tx = (ul_info.slot_rx + slot_ahead >= slots_per_frame) ? ul_info.frame_rx + 1 : ul_info.frame_rx;
ul_info.ue_sched_mode = SCHED_ALL;
LOG_I(NR_MAC, "frame_rx %d, slot rx %d, frame tx %d, slot tx %d, slot_ahead %d\n",
ul_info.frame_rx, ul_info.slot_rx, ul_info.frame_tx, ul_info.slot_tx, slot_ahead);
if (pthread_mutex_lock(&mac->mutex_dl_info)) abort();
......@@ -417,8 +405,9 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
mac->scc_SIB->tdd_UL_DL_ConfigurationCommon,
ul_info.slot_tx, mac->frame_type))
{
LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind() from %s\n", ul_info.slot_tx, __FUNCTION__);
LOG_I(NR_MAC, "Slot %d. calling nr_ue_ul_ind() and nr_ue_pucch_scheduler from %s\n", ul_info.slot_tx, __FUNCTION__);
nr_ue_ul_indication(&ul_info);
nr_ue_pucch_scheduler(0, ul_info.frame_tx, ul_info.slot_tx, ul_info.thread_id);
check_nr_prach(mac, &ul_info, &prach_resources);
}
if (!IS_SOFTMODEM_NOS1 && get_softmodem_params()->sa) {
......
......@@ -36,10 +36,11 @@
#include "fapi_nr_ue_l1.h"
#include "harq_nr.h"
//#include "PHY/phy_vars_nr_ue.h"
#include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h"
#include "PHY/defs_nr_UE.h"
#include "PHY/impl_defs_nr.h"
#include "utils.h"
#include "openair2/PHY_INTERFACE/queue_t.h"
extern PHY_VARS_NR_UE ***PHY_vars_UE_g;
......@@ -103,6 +104,8 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
rx_ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION;
rx_ind->sfn = scheduled_response->ul_config->sfn;
rx_ind->slot = scheduled_response->ul_config->slot;
LOG_I(NR_MAC, "This is sched sfn/sl [%d %d] and rx sfn/sl [%d %d]\n",
scheduled_response->frame, scheduled_response->slot, rx_ind->sfn, rx_ind->slot);
rx_ind->number_of_pdus = scheduled_response->tx_request->number_of_pdus;
rx_ind->pdu_list = CALLOC(rx_ind->number_of_pdus, sizeof(*rx_ind->pdu_list));
for (int j = 0; j < rx_ind->number_of_pdus; j++)
......@@ -122,20 +125,20 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
crc_ind->number_crcs = scheduled_response->ul_config->number_pdus;
crc_ind->sfn = scheduled_response->ul_config->sfn;
crc_ind->slot = scheduled_response->ul_config->slot;
mac->nr_ue_emul_l1.crc_rx_ind_sfn_slot = NFAPI_SFNSLOT2HEX(crc_ind->sfn, crc_ind->slot);
crc_ind->crc_list = CALLOC(crc_ind->number_crcs, sizeof(*crc_ind->crc_list));
for (int j = 0; j < crc_ind->number_crcs; j++)
{
crc_ind->crc_list[j].handle = pusch_config_pdu->handle;
crc_ind->crc_list[j].harq_id = pusch_config_pdu->pusch_data.harq_process_id;
LOG_D(NR_MAC, "This is the harq pid %d for crc_list[%d]\n", crc_ind->crc_list[j].harq_id, j);
LOG_D(NR_MAC, "This is sched sfn/sl [%d %d] and crc sfn/sl [%d %d]\n",
LOG_I(NR_MAC, "This is the harq pid %d for crc_list[%d]\n", crc_ind->crc_list[j].harq_id, j);
LOG_I(NR_MAC, "This is sched sfn/sl [%d %d] and crc sfn/sl [%d %d]\n",
scheduled_response->frame, scheduled_response->slot, crc_ind->sfn, crc_ind->slot);
crc_ind->crc_list[j].num_cb = pusch_config_pdu->pusch_data.num_cb;
crc_ind->crc_list[j].rnti = pusch_config_pdu->rnti;
crc_ind->crc_list[j].tb_crc_status = 0;
crc_ind->crc_list[j].timing_advance = scheduled_response->tx_request->tx_config.timing_advance;
crc_ind->crc_list[j].ul_cqi = 255;
mac->nr_ue_emul_l1.harq[crc_ind->crc_list[j].harq_id].crc_rx_ind_sfn_slot = NFAPI_SFNSLOT2HEX(crc_ind->sfn, crc_ind->slot);
LOG_D(NR_MAC, "This is sched sfn/sl [%d %d] and crc sfn/sl [%d %d] with mcs_index in ul_cqi -> %d\n",
scheduled_response->frame, scheduled_response->slot, crc_ind->sfn, crc_ind->slot,pusch_config_pdu->mcs_index);
}
......@@ -163,7 +166,8 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
crc_ind = NULL;
}
LOG_D(PHY, "In %s: Filled queue rx/crc_ind which was filled by ulconfig. \n", __FUNCTION__);
LOG_I(PHY, "In %s: [%d, %d] Filled queue rx/crc_ind which was filled by ulconfig. \n", __FUNCTION__,
scheduled_response->frame, scheduled_response->slot);
scheduled_response->tx_request->number_of_pdus = 0;
}
......@@ -200,65 +204,58 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
pdu_0_1->ul_cqi = 255;
pdu_0_1->timing_advance = 0;
pdu_0_1->rssi = 0;
LOG_I(NR_PHY, "In %s: UCI SFN/SLOT: [%d, %d] and mac->nr_ue_emul_l1.num_harq %d\n",
__FUNCTION__, uci_ind->sfn, uci_ind->slot, mac->nr_ue_emul_l1.num_harqs);
if (mac->nr_ue_emul_l1.num_harqs > 0) {
int harq_index = 0;
pdu_0_1->pduBitmap = 2; // (value->pduBitmap >> 1) & 0x01) == HARQ and (value->pduBitmap) & 0x01) == SR
pdu_0_1->harq = CALLOC(1, sizeof(*pdu_0_1->harq));
pdu_0_1->harq->num_harq = 1;
pdu_0_1->harq->num_harq = mac->nr_ue_emul_l1.num_harqs;
pdu_0_1->harq->harq_confidence_level = 0;
pdu_0_1->harq->harq_list = CALLOC(pdu_0_1->harq->num_harq, sizeof(*pdu_0_1->harq->harq_list));
int harq_pid = -1;
for (int k = 0; k < 16; k++)
{
LOG_D(NR_MAC, "dl_frame = %d sl_slot = %d feedback_to_ul = %d active_harq_sfn_slot = %d.%d\n",
mac->dl_harq_info[k].dl_frame,
mac->dl_harq_info[k].dl_slot,
mac->dl_harq_info[k].feedback_to_ul,
NFAPI_SFNSLOT2SFN(mac->nr_ue_emul_l1.active_harq_sfn_slot),
NFAPI_SFNSLOT2SLOT(mac->nr_ue_emul_l1.active_harq_sfn_slot));
int sfn_slot = NFAPI_SFNSLOT2HEX(mac->dl_harq_info[k].dl_frame,
(mac->dl_harq_info[k].dl_slot +
mac->dl_harq_info[k].feedback_to_ul));
if (!mac->dl_harq_info[k].active &&
(sfn_slot == mac->nr_ue_emul_l1.active_harq_sfn_slot ||
sfn_slot == mac->nr_ue_emul_l1.active_uci_sfn_slot))
LOG_I(NR_MAC, "HARQ PID %d active = %d saved sfn_slot = %d.%d vs current sfn.slot %d.%d\n",
k, mac->nr_ue_emul_l1.harq[k].active,
mac->nr_ue_emul_l1.harq[k].active_harq_sfn,
mac->nr_ue_emul_l1.harq[k].active_harq_slot,
uci_ind->sfn,
uci_ind->slot);
if (mac->nr_ue_emul_l1.harq[k].active &&
mac->nr_ue_emul_l1.harq[k].active_harq_sfn == uci_ind->sfn &&
mac->nr_ue_emul_l1.harq[k].active_harq_slot == uci_ind->slot)
{
mac->nr_ue_emul_l1.harq[k].active = false;
harq_pid = k;
LOG_D(NR_MAC, "Setting harq_pid = %d\n", k);
LOG_I(NR_MAC, "Setting harq_pid = %d and num_harqs %d for %d.%d\n", k, pdu_0_1->harq->num_harq,
uci_ind->sfn, uci_ind->slot);
pdu_0_1->harq->harq_list[harq_index].harq_value = !mac->dl_harq_info[k].ack;
harq_index++;
LOG_I(NR_PHY, "In %s: Building uci_ind_%d with num_harqs %d and pdu_bitmap %d\n"
"uci_num %d, SFN/SLOT: [%d, %d]\n",
__FUNCTION__, uci_ind->uci_list[0].pdu_type,
pdu_0_1->harq->num_harq, pdu_0_1->pduBitmap,
uci_ind->num_ucis, uci_ind->sfn, uci_ind->slot);
}
}
pdu_0_1->harq->harq_list = CALLOC(pdu_0_1->harq->num_harq, sizeof(*pdu_0_1->harq->harq_list));
for (int k = 0; k < pdu_0_1->harq->num_harq; k++)
{
AssertFatal(harq_pid != -1, "No active harq_pid, sfn_slot = %u.%u", uci_ind->sfn, uci_ind->slot);
pdu_0_1->harq->harq_list[k].harq_value = !mac->dl_harq_info[harq_pid].ack;
}
AssertFatal(harq_pid != -1, "No active harq_pid, sfn_slot = %u.%u", uci_ind->sfn, uci_ind->slot);
}
}
int sfn_slot = NFAPI_SFNSLOT2HEX(uci_ind->sfn, uci_ind->slot);
nfapi_nr_uci_indication_t *queued_uci_ind = unqueue_matching(&nr_uci_ind_queue,
MAX_QUEUE_SIZE,
sfn_slot_matcher,
&sfn_slot);
if (queued_uci_ind)
{
LOG_I(NR_MAC, "There was a matching UCI with sfn %d, slot %d in queue\n",
NFAPI_SFNSLOT2SFN(sfn_slot), NFAPI_SFNSLOT2SLOT(sfn_slot));
free(queued_uci_ind);
break;
}
}
LOG_I(NR_PHY, "In %s: Filled queue uci_ind_%d which was filled by ulconfig.\n"
"uci_num %d, SFN/SLOT: [%d, %d]\n",
LOG_I(NR_PHY, "In %s: Sending uci_ind_%d which was filled by ulconfig.\n"
"uci_num %d, SFN/SLOT: [%d, %d] and pdu_bitmap %d\n",
__FUNCTION__, uci_ind->uci_list[0].pdu_type,
uci_ind->num_ucis, uci_ind->sfn, uci_ind->slot);
if (!put_queue(&nr_uci_ind_queue, uci_ind))
{
LOG_E(NR_MAC, "Put_queue failed for uci_ind\n");
free(uci_ind->uci_list);
free(uci_ind);
}
uci_ind->num_ucis, uci_ind->sfn, uci_ind->slot,
uci_ind->uci_list[0].pucch_pdu_format_0_1.pduBitmap);
LOG_I(NR_MAC, "Sending UCI with %d PDUs in sfn.slot %d/%d\n",
uci_ind->num_ucis, uci_ind->sfn, uci_ind->slot);
NR_UL_IND_t UL_INFO = {
.uci_ind = *uci_ind,
};
send_nsa_standalone_msg(&UL_INFO, uci_ind->header.message_id);
free_uci_inds(uci_ind);
break;
}
......@@ -269,93 +266,6 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
}
scheduled_response->ul_config->number_pdus = 0;
}
if (scheduled_response->dl_config != NULL)
{
fapi_nr_dl_config_request_t *dl_config = scheduled_response->dl_config;
AssertFatal(dl_config->number_pdus < sizeof(dl_config->dl_config_list) / sizeof(dl_config->dl_config_list[0]),
"Too many dl_config pdus %d", dl_config->number_pdus);
for (int i = 0; i < dl_config->number_pdus; ++i)
{
LOG_D(PHY, "In %s: processing %s PDU of %d total DL PDUs (dl_config %p) \n",
__FUNCTION__, dl_pdu_type[dl_config->dl_config_list[i].pdu_type - 1], dl_config->number_pdus, dl_config);
uint8_t pdu_type = dl_config->dl_config_list[i].pdu_type;
switch (pdu_type)
{
case (FAPI_NR_DL_CONFIG_TYPE_DLSCH):
{
nfapi_nr_uci_indication_t *uci_ind = CALLOC(1, sizeof(*uci_ind));
uci_ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION;
uci_ind->sfn = scheduled_response->frame;
uci_ind->slot = NFAPI_SFNSLOT2SLOT(mac->nr_ue_emul_l1.active_harq_sfn_slot);
uci_ind->num_ucis = 1;
uci_ind->uci_list = CALLOC(uci_ind->num_ucis, sizeof(*uci_ind->uci_list));
for (int j = 0; j < uci_ind->num_ucis; j++)
{
nfapi_nr_uci_pucch_pdu_format_0_1_t *pdu_0_1 = &uci_ind->uci_list[j].pucch_pdu_format_0_1;
uci_ind->uci_list[j].pdu_type = NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE;
uci_ind->uci_list[j].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_0_1_t);
memset(pdu_0_1, 0, sizeof(*pdu_0_1));
pdu_0_1->handle = 0;
pdu_0_1->rnti = dl_config->dl_config_list[i].dlsch_config_pdu.rnti;
pdu_0_1->pucch_format = 1;
pdu_0_1->ul_cqi = 255;
pdu_0_1->timing_advance = 0;
pdu_0_1->rssi = 0;
pdu_0_1->pduBitmap = 2; // (value->pduBitmap >> 1) & 0x01) == HARQ and (value->pduBitmap) & 0x01) == SR
pdu_0_1->harq = CALLOC(1, sizeof(*pdu_0_1->harq));
pdu_0_1->harq->num_harq = 1;
pdu_0_1->harq->harq_confidence_level = 0;
int harq_pid = -1;
for (int k = 0; k < 16; k++)
{
LOG_D(NR_MAC, "dl_frame = %d dl_slot = %d feedback_to_ul = %d active = %d k = %d "
"active_harq_sfn_slot = %d.%d "
"active_uci_sfn_slot = %d.%d\n",
mac->dl_harq_info[k].dl_frame,
mac->dl_harq_info[k].dl_slot,
mac->dl_harq_info[k].feedback_to_ul,
mac->dl_harq_info[k].active,
k,
NFAPI_SFNSLOT2SFN(mac->nr_ue_emul_l1.active_harq_sfn_slot),
NFAPI_SFNSLOT2SLOT(mac->nr_ue_emul_l1.active_harq_sfn_slot),
NFAPI_SFNSLOT2SFN(mac->nr_ue_emul_l1.active_uci_sfn_slot),
NFAPI_SFNSLOT2SLOT(mac->nr_ue_emul_l1.active_uci_sfn_slot));
int sfn_slot = NFAPI_SFNSLOT2HEX(mac->dl_harq_info[k].dl_frame,
(mac->dl_harq_info[k].dl_slot +
mac->dl_harq_info[k].feedback_to_ul));
if (mac->dl_harq_info[k].active &&
sfn_slot == mac->nr_ue_emul_l1.active_harq_sfn_slot)
{
harq_pid = k;
LOG_D(NR_MAC, "Setting harq_pid = %d\n", k);
}
}
pdu_0_1->harq->harq_list = CALLOC(pdu_0_1->harq->num_harq, sizeof(*pdu_0_1->harq->harq_list));
for (int k = 0; k < pdu_0_1->harq->num_harq; k++)
{
AssertFatal(harq_pid != -1, "No active harq_pid, sfn_slot = %u.%u", uci_ind->sfn, uci_ind->slot);
pdu_0_1->harq->harq_list[k].harq_value = !mac->dl_harq_info[harq_pid].ack;
}
}
LOG_I(NR_PHY, "In %s: Filled queue uci_ind which was filled by dlconfig.\n"
"uci_num %d, SFN/SLOT: [%d, %d]\n",
__FUNCTION__, uci_ind->num_ucis, uci_ind->sfn, uci_ind->slot);
if (!put_queue(&nr_uci_ind_queue, uci_ind))
{
LOG_E(NR_MAC, "Put_queue failed for uci_ind\n");
free(uci_ind->uci_list);
free(uci_ind);
}
break;
}
}
}
}
}
return 0;
}
......
......@@ -264,6 +264,17 @@ typedef struct {
uint8_t nbits;
} dci_field_t;
typedef struct {
/* The active harq sfn/slot field was created to save the
scheduled SFN/Slot transmission for the ACK/NAK. If we
do not save it, then we have to calculate it again as the
NRUE MAC layer already does in get_downlink_ack(). */
int active_harq_sfn;
int active_harq_slot;
int crc_rx_ind_sfn_slot;
bool active;
} emul_l1_harq_t;
typedef struct {
bool expected_sib;
bool index_has_sib[16];
......@@ -271,9 +282,8 @@ typedef struct {
bool index_has_rar[16];
bool expected_dci;
bool index_has_dci[16];
int active_harq_sfn_slot;
emul_l1_harq_t harq[16];
int active_uci_sfn_slot;
int crc_rx_ind_sfn_slot;
int num_srs;
int num_harqs;
int num_csi_reports;
......
......@@ -599,14 +599,19 @@ int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_in
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
dci_pdu_rel15_t *def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[dci->dci_format];
LOG_D(MAC,"Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n",
dci->rnti,dci->dci_format,dci->n_CCE,dci->payloadSize,*(unsigned long long*)dci->payloadBits);
LOG_I(MAC,"Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx, pid %d)\n",
dci->rnti, dci->dci_format,
dci->n_CCE, dci->payloadSize,
*(unsigned long long*)dci->payloadBits,
def_dci_pdu_rel15->harq_pid);
int8_t ret = nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15);
if ((ret&1) == 1) return -1;
else if (ret == 2) {
dci->dci_format = NR_UL_DCI_FORMAT_0_0;
def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[dci->dci_format];
}
LOG_I(MAC,"After extracting dci info. dci format %d, pid %d\n",
dci->dci_format, def_dci_pdu_rel15->harq_pid);
int8_t ret_proc = nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, def_dci_pdu_rel15, dci);
return ret_proc;
}
......@@ -631,7 +636,8 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
else if (mac->scc_SIB) n_RB_DLBWP = NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth,MAX_BWP_SIZE);
else n_RB_DLBWP = mac->type0_PDCCH_CSS_config.num_rbs;
LOG_D(MAC, "In %s: Processing received DCI format %s (DL BWP %d)\n", __FUNCTION__, dci_formats[dci_format], n_RB_DLBWP);
LOG_I(MAC, "In %s: Processing received DCI format %s (DL BWP %d) harq_pid %d\n",
__FUNCTION__, dci_formats[dci_format], n_RB_DLBWP, dci->harq_pid);
switch(dci_format){
case NR_UL_DCI_FORMAT_0_0: {
......@@ -947,6 +953,8 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
if(rnti != ra->ra_rnti && rnti != SI_RNTI)
AssertFatal(1+dci->pdsch_to_harq_feedback_timing_indicator.val>=DURATION_RX_TO_TX,"PDSCH to HARQ feedback time (%d) cannot be less than DURATION_RX_TO_TX (%d).\n",
1+dci->pdsch_to_harq_feedback_timing_indicator.val,DURATION_RX_TO_TX);
LOG_I(MAC,"(nr_ue_procedures.c) dci->pdsch_to_harq_feedback_timing_indicator.val=%d \n",
dci->pdsch_to_harq_feedback_timing_indicator.val);
// set the harq status at MAC for feedback
set_harq_status(mac,dci->pucch_resource_indicator,
......@@ -1118,6 +1126,9 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
valid = 0;
pucch_res_set_cnt = ubwpd->pucch_Config->choice.setup->resourceSetToAddModList->list.count;
for (int id = 0; id < pucch_res_set_cnt; id++) {
LOG_I(NR_MAC, "pucch_resource_indicator %d, ubwpd[%d].resource.list.count %d\n",
dci->pucch_resource_indicator, id,
ubwpd->pucch_Config->choice.setup->resourceSetToAddModList->list.array[id]->resourceList.list.count);
if (dci->pucch_resource_indicator < ubwpd->pucch_Config->choice.setup->resourceSetToAddModList->list.array[id]->resourceList.list.count) {
valid = 1;
break;
......@@ -1235,7 +1246,9 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
// according to TS 38.213 Table 9.2.3-1
uint8_t feedback_ti =
ubwpd->pucch_Config->choice.setup->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0];
LOG_I(MAC,"(nr_ue_procedures.c) 1237 feedback_ti=%d and dci->pdsch_to_harq_feedback_timing_indicator.val %d, pdsch_to_harq_feedback_time_ind %d\n",
feedback_ti, dci->pdsch_to_harq_feedback_timing_indicator.val,
dlsch_config_pdu_1_1->pdsch_to_harq_feedback_time_ind);
AssertFatal(feedback_ti>=DURATION_RX_TO_TX,"PDSCH to HARQ feedback time (%d) cannot be less than DURATION_RX_TO_TX (%d). Min feedback time set in config file (min_rxtxtime).\n",
feedback_ti,DURATION_RX_TO_TX);
......@@ -1334,10 +1347,21 @@ void set_harq_status(NR_UE_MAC_INST_t *mac,
// FIXME k0 != 0 currently not taken into consideration
current_harq->dl_frame = frame;
current_harq->dl_slot = slot;
mac->nr_ue_emul_l1.active_harq_sfn_slot = NFAPI_SFNSLOT2HEX(frame, (slot + data_toul_fb));
// TODO: if (get_softmodem_params()->emaulte_l1)
// in downlink: 0-7, 10-17
if (data_toul_fb + slot > 19) {
if (frame + 1 < 1024)
frame++;
else
frame = 0;
slot = (data_toul_fb + slot) - 20;
}
else {
slot = data_toul_fb + slot;
}
LOG_D(NR_PHY,"Setting harq_status for harq_id %d, dl %d.%d, sched ul %d.%d\n",
harq_id, frame, slot, frame, (slot + data_toul_fb));
LOG_I(NR_PHY,"Setting harq_status for harq_id %d, dl %d.%d, sched ul %d.%d\n",
harq_id, current_harq->dl_frame, current_harq->dl_slot, frame, slot);
}
......@@ -1819,18 +1843,24 @@ int find_pucch_resource_set(NR_UE_MAC_INST_t *mac, int uci_size) {
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup &&
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList &&
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id] != NULL)) {
if (uci_size <= 2) {
if (uci_size <= 3) {
pucch_resource_set_id = 0;
LOG_I(NR_MAC, "Melissa %s()%d, we are setting resource_set_id = %d",
__FUNCTION__, __LINE__, pucch_resource_set_id);
return (pucch_resource_set_id);
break;
}
else {
pucch_resource_set_id = 1;
LOG_I(NR_MAC, "Melissa %s()%d, we are setting resource_set_id = %d",
__FUNCTION__, __LINE__, pucch_resource_set_id);
return (pucch_resource_set_id);
break;
}
}
pucch_resource_set_id++;
LOG_I(NR_MAC, "Melissa %s()%d, we are setting resource_set_id = %d",
__FUNCTION__, __LINE__, pucch_resource_set_id);
}
pucch_resource_set_id = MAX_NB_OF_PUCCH_RESOURCE_SETS;
......@@ -1915,6 +1945,13 @@ void select_pucch_resource(NR_UE_MAC_INST_t *mac,
pucch->pucch_resource = NULL;
return;
}
LOG_I(MAC,"Melissa resourceSetToAddModList %p\n", resourceSetToAddModList);
LOG_I(MAC,"Melissa resourceSetToAddModList->list.array[0] %p\n", resourceSetToAddModList->list.array[0]);
LOG_I(MAC,"Melissa pucch->resource_set_id %d\n", pucch->resource_set_id);
LOG_I(MAC,"Melissa resourceSetToAddModList->list.array[pucch->resource_set_id] %p\n", resourceSetToAddModList->list.array[pucch->resource_set_id]);
LOG_I(MAC,"Melissa resourceSetToAddModList->list.array[pucch->resource_set_id]->resourceList %p\n", resourceSetToAddModList->list.array[pucch->resource_set_id]->resourceList);
LOG_I(MAC,"Melissa resourceSetToAddModList->list.array[pucch->resource_set_id]->resourceList.list.count %d\n", resourceSetToAddModList->list.array[pucch->resource_set_id]->resourceList.list.count);
n_list = resourceSetToAddModList->list.array[pucch->resource_set_id]->resourceList.list.count;
if (pucch->resource_indicator > n_list) {
LOG_E(MAC,"Invalid PUCCH resource id %d\n",pucch->resource_indicator);
......@@ -2015,16 +2052,33 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac,
current_harq = &mac->dl_harq_info[dl_harq_pid];
if (current_harq->active) {
sched_slot = current_harq->dl_slot + current_harq->feedback_to_ul;
sched_frame = current_harq->dl_frame;
if (sched_slot>=slots_per_frame){
sched_slot %= slots_per_frame;
sched_frame++;
if (current_harq->feedback_to_ul + current_harq->dl_slot > 19) {
if (sched_frame + 1 < 1024)
sched_frame++;
else
sched_frame = 0;
sched_slot = (current_harq->feedback_to_ul + current_harq->dl_slot) - slots_per_frame;
}
else {
sched_slot = current_harq->feedback_to_ul + current_harq->dl_slot;
}
LOG_D(PHY,"HARQ pid %d is active for %d.%d (dl_slot %d, feedback_to_ul %d, is_common %d\n",dl_harq_pid, sched_frame,sched_slot,current_harq->dl_slot,current_harq->feedback_to_ul,current_harq->is_common);
LOG_I(PHY,"HARQ pid %d is active for %d.%d and inputted %d.%d (dl_slot %d, feedback_to_ul %d, is_common %d active %d\n",
dl_harq_pid,
sched_frame,
sched_slot, frame, slot,
current_harq->dl_slot,
current_harq->feedback_to_ul,
current_harq->is_common,
current_harq->active);
/* check if current tx slot should transmit downlink acknowlegment */
if (sched_frame == frame && sched_slot == slot) {
if (get_softmodem_params()->emulate_l1) {
mac->nr_ue_emul_l1.harq[dl_harq_pid].active = true;
mac->nr_ue_emul_l1.harq[dl_harq_pid].active_harq_sfn = frame;
mac->nr_ue_emul_l1.harq[dl_harq_pid].active_harq_slot = slot;
}
if (current_harq->dai > NR_DL_MAX_DAI) {
LOG_E(MAC,"PUCCH Downlink DAI has an invalid value : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
......@@ -2045,6 +2099,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac,
}
number_harq_feedback++;
LOG_I(NR_MAC, "number_harq_feedback = %d\n", number_harq_feedback);
if (current_harq->ack_received)
ack_data[code_word][dai_current - 1] = current_harq->ack;
else
......@@ -2132,6 +2187,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac,
V_temp2 = dai[1][m]; /* second code word has been received */
O_bit_number_cw1 = (8 * j) + 2*(V_temp - 1) + 1;
o_ACK = o_ACK | (ack_data[1][m] << O_bit_number_cw1);
LOG_I(NR_MAC, "%s():%d o_ACK = %d\n", __FUNCTION__, __LINE__, o_ACK);
}
if (two_transport_blocks == TRUE) {
......@@ -2141,6 +2197,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac,
O_bit_number_cw0 = (4 * j) + (V_temp - 1);
}
LOG_I(NR_MAC, "%s():%d o_ACK = %d\n", __FUNCTION__, __LINE__, o_ACK);
o_ACK = o_ACK | (ack_data[0][m] << O_bit_number_cw0);
LOG_D(MAC,"m %d bit number %d o_ACK %d\n",m,O_bit_number_cw0,o_ACK);
}
......@@ -2154,14 +2211,16 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac,
}
else {
O_ACK = 4 * j + V_temp2; /* only one transport block */
LOG_I(NR_MAC, "%s():%d O_ACK = %d\n", __FUNCTION__, __LINE__, O_ACK);
}
if (number_harq_feedback != O_ACK) {
LOG_E(MAC,"PUCCH Error for number of bits for acknowledgment : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
return (0);
LOG_E(MAC,"PUCCH Error for number of bits for acknowledgment. number_harq_feedback %d, O_ACK %d \n",
number_harq_feedback, O_ACK);
number_harq_feedback = O_ACK; //return (0);
}
reverse_n_bits(&o_ACK,number_harq_feedback);
LOG_I(NR_MAC, "%s():%d o_ACK = %d\n", __FUNCTION__, __LINE__, o_ACK);
pucch->ack_payload = o_ACK;
LOG_D(MAC,"frame %d slot %d pucch acknack payload %d\n",frame,slot,o_ACK);
......@@ -3837,6 +3896,8 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
#endif
if (ra->RA_RAPID_found) {
// if (rarh->RAPID != preamble_index)
// return 0;
RAR_grant_t rar_grant;
......
......@@ -220,6 +220,9 @@ int nr_process_mac_pdu(module_id_t module_idP,
LOG_D(NR_MAC, "In %s: received UL-SCH sub-PDU with LCID 0x%x in %d.%d (remaining PDU length %d)\n", __func__, rx_lcid, frameP, slot, pdu_len);
if (pdu_len < 7) {
break;
}
unsigned char *ce_ptr;
int n_Lcg = 0;
......
......@@ -465,7 +465,7 @@ static void fill_rx_ind(nfapi_nr_pdu_t *pdu_list, fapi_nr_rx_indication_t *rx_in
{
length += pdu_list->TLVs[j].length;
}
LOG_I(NR_PHY, "%s: num_tlv %d and length %d, pdu index %d\n",
LOG_I(NR_PHY, "Elkadi %s: num_tlv %d and length %d, pdu index %d\n",
__FUNCTION__, pdu_list->num_TLV, length, pdu_idx);
uint8_t *pdu = malloc(length);
AssertFatal(pdu != NULL, "%s: Out of memory in malloc", __FUNCTION__);
......@@ -540,7 +540,7 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi
dl_info->rx_ind->number_pdus = pdu_idx;
}
static void free_uci_inds(nfapi_nr_uci_indication_t *uci_ind)
void free_uci_inds(nfapi_nr_uci_indication_t *uci_ind)
{
for (int k = 0; k < uci_ind->num_ucis; k++)
{
......@@ -618,6 +618,7 @@ static void copy_ul_dci_data_req_to_dl_info(nr_downlink_indication_t *dl_info, n
static bool send_crc_ind_and_rx_ind(int sfn_slot)
{
bool sent_crc_rx = true;
LOG_I(NR_MAC, "Melissa, This is the num items in crc %d and rx %d\n", nr_crc_ind_queue.num_items, nr_rx_ind_queue.num_items);
nfapi_nr_rx_data_indication_t *rx_ind = unqueue_matching(&nr_rx_ind_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot);
nfapi_nr_crc_indication_t *crc_ind = unqueue_matching(&nr_crc_ind_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot);
......@@ -655,102 +656,18 @@ static void copy_ul_tti_data_req_to_dl_info(nr_downlink_indication_t *dl_info, n
AssertFatal(num_pdus >= 0, "Invalid ul_tti_request number of PDUS\n");
AssertFatal(num_pdus <= sizeof(ul_tti_req->pdus_list) / sizeof(ul_tti_req->pdus_list[0]),
"Too many pdus %d in ul_tti_req\n", num_pdus);
bool sent_crc_rx = send_crc_ind_and_rx_ind(sfn_slot);
bool sent_uci = false;
for (int i = 0; i < num_pdus; i++)
{
nfapi_nr_ul_tti_request_number_of_pdus_t *pdu_list = &ul_tti_req->pdus_list[i];
LOG_D(NR_PHY, "This is the pdu type %d and rnti %x and SR flag %d and harq_pdu_len %d in in ul_tti_req\n",
pdu_list->pdu_type, ul_tti_req->pdus_list[i].pucch_pdu.rnti, pdu_list->pucch_pdu.sr_flag, pdu_list->pucch_pdu.bit_len_harq);
if (pdu_list->pdu_type == NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE && pdu_list->pucch_pdu.rnti == mac->crnti)
{
AssertFatal(nr_uci_ind_queue.num_items >= 0, "Invalid num_items in UCI_ind queue %lu\n",
nr_uci_ind_queue.num_items);
nfapi_nr_uci_indication_t *uci_ind = unqueue_matching(&nr_uci_ind_queue,
MAX_QUEUE_SIZE,
sfn_slot_matcher,
&sfn_slot);
if (!uci_ind)
{
LOG_I(NR_MAC, "There was not a matching UCI with sfn %d, slot %d in queue\n",
NFAPI_SFNSLOT2SFN(sfn_slot), NFAPI_SFNSLOT2SLOT(sfn_slot));
return;
}
if (uci_ind && uci_ind->num_ucis > 0)
{
uci_ind->sfn = ul_tti_req->SFN;
uci_ind->slot = ul_tti_req->Slot;
LOG_D(NR_MAC, "This is the SFN/SF [%d, %d] and RNTI %x of the UCI ind. ul_tti_req.pdu[%d]->rnti = %x \n",
uci_ind->sfn, uci_ind->slot, uci_ind->uci_list[0].pucch_pdu_format_0_1.rnti, i, ul_tti_req->pdus_list[i].pucch_pdu.rnti);
for (int j = 0; j < uci_ind->num_ucis; j++)
{
if (uci_ind->uci_list[j].pdu_type == NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE)
{
nfapi_nr_uci_pucch_pdu_format_0_1_t *pdu_0_1 = &uci_ind->uci_list[j].pucch_pdu_format_0_1;
if (pdu_list->pucch_pdu.sr_flag)
{
pdu_0_1->pduBitmap = 1; // (value->pduBitmap >> 1) & 0x01) == HARQ and (value->pduBitmap) & 0x01) == SR
if (pdu_list->pucch_pdu.bit_len_harq > 0)
pdu_0_1->pduBitmap = 3;
pdu_0_1->sr = CALLOC(1, sizeof(*pdu_0_1->sr));
pdu_0_1->sr->sr_confidence_level = 0;
pdu_0_1->sr->sr_indication = 1;
}
}
if (uci_ind->uci_list[j].pdu_type == NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE)
{
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *pdu_2_3_4 = &uci_ind->uci_list[j].pucch_pdu_format_2_3_4;
if (pdu_list->pucch_pdu.sr_flag)
{
pdu_2_3_4->pduBitmap = 5;
pdu_2_3_4->sr.sr_bit_len = 0;
AssertFatal(!pdu_2_3_4->sr.sr_payload, "pdu_2_3_4->sr.sr_payload != NULL\n");
pdu_2_3_4->sr.sr_payload = CALLOC((int)((pdu_2_3_4->sr.sr_bit_len / 8) + 1),
sizeof(*pdu_2_3_4->sr.sr_payload));
}
if (pdu_list->pucch_pdu.bit_len_harq > 0)
{
pdu_2_3_4->pduBitmap = 6;
if (pdu_list->pucch_pdu.sr_flag)
{
pdu_2_3_4->pduBitmap = 7;
}
pdu_2_3_4->harq.harq_bit_len = pdu_list->pucch_pdu.bit_len_harq;
LOG_D(NR_MAC, "This is bit_len_harq %d and pdu_2_3_4->pduBitmap %d\n",
pdu_list->pucch_pdu.bit_len_harq, pdu_2_3_4->pduBitmap);
pdu_2_3_4->harq.harq_crc = 0;
AssertFatal(!pdu_2_3_4->harq.harq_payload, "pdu_2_3_4->harq.harq_payload != NULL\n");
pdu_2_3_4->harq.harq_payload = CALLOC((int)((pdu_2_3_4->harq.harq_bit_len / 8) + 1),
sizeof(*pdu_2_3_4->harq.harq_payload));
/* TODO: Later, when abstracting, we can set particular bits in the
payload to 0 to indicate a NACK. For now, we memset all bits to 1. */
memset(pdu_2_3_4->harq.harq_payload, 0xff, sizeof(*pdu_2_3_4->harq.harq_payload));
}
}
}
LOG_I(NR_MAC, "We have dequeued the previously filled uci_ind and updated the snf/slot to %d/%d.\n",
uci_ind->sfn, uci_ind->slot);
NR_UL_IND_t UL_INFO = {
.uci_ind = *uci_ind,
};
send_nsa_standalone_msg(&UL_INFO, uci_ind->header.message_id);
sent_uci = true;
free_uci_inds(uci_ind);
}
}
}
if (!sent_uci && !sent_crc_rx)
if (!send_crc_ind_and_rx_ind(sfn_slot))
{
LOG_E(NR_MAC, "UCI and CRC_RX ind not sent\n");
LOG_E(NR_MAC, "CRC_RX ind not sent\n");
if (!put_queue(&nr_ul_tti_req_queue, ul_tti_req))
{
LOG_E(NR_PHY, "put_queue failed for ul_tti_req.\n");
free(ul_tti_req);
ul_tti_req = NULL;
}
return;
}
free(ul_tti_req);
}
static void fill_dci_from_dl_config(nr_downlink_indication_t*dl_ind, fapi_nr_dl_config_request_t *dl_config)
......@@ -784,17 +701,19 @@ static void fill_dci_from_dl_config(nr_downlink_indication_t*dl_ind, fapi_nr_dl_
"dl_config->number_pdus %d > dci_ind->dci_list array\n", num_dcis);
for (int k = 0; k < num_dcis; k++)
{
LOG_I(NR_PHY, "Received len %d, length options[%d] %d, format assigned %d, format options[%d] %d\n",
LOG_D(NR_PHY, "Received len %d, length options[%d] %d, format assigned %d, format options[%d] %d\n",
dl_ind->dci_ind->dci_list[k].payloadSize, j, rel15_dci->dci_length_options[j],
dl_ind->dci_ind->dci_list[k].dci_format, j, rel15_dci->dci_format_options[j]);
if (rel15_dci->dci_length_options[j] == dl_ind->dci_ind->dci_list[k].payloadSize)
{
dl_ind->dci_ind->dci_list[k].dci_format = rel15_dci->dci_format_options[j];
LOG_I(NR_PHY, "format assigned dl_ind->dci_ind->dci_list[k].dci_format %d\n",
dl_ind->dci_ind->dci_list[k].dci_format);
int CCEind = rel15_dci->CCE[j];
int L = rel15_dci->L[j];
dl_ind->dci_ind->dci_list[k].n_CCE = CCEind;
dl_ind->dci_ind->dci_list[k].N_CCE = L;
}
int CCEind = rel15_dci->CCE[j];
int L = rel15_dci->L[j];
dl_ind->dci_ind->dci_list[k].n_CCE = CCEind;
dl_ind->dci_ind->dci_list[k].N_CCE = L;
}
}
}
......@@ -877,8 +796,10 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request,
mac->scc->tdd_UL_DL_ConfigurationCommon :
mac->scc_SIB->tdd_UL_DL_ConfigurationCommon,
ul_info.slot_tx,
mac->frame_type))
mac->frame_type)) {
LOG_I(NR_MAC, "Slot %d. calling nr_ue_ul_ind() from %s\n", ul_info.slot_tx, __FUNCTION__);
nr_ue_ul_indication(&ul_info);
}
}
}
......@@ -921,7 +842,7 @@ void save_nr_measurement_info(nfapi_nr_dl_tti_request_t *dl_tti_request)
static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_header_t header)
{
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
switch (header.message_id)
{
case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
......@@ -999,11 +920,32 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea
}
LOG_I(NR_PHY, "Received an NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST message in SFN/slot %d %d.\n",
ul_tti_request->SFN, ul_tti_request->Slot);
if (!put_queue(&nr_ul_tti_req_queue, ul_tti_request))
{
LOG_E(NR_PHY, "put_queue failed for ul_tti_request.\n");
nfapi_nr_ul_tti_request_t *evicted_ul_tti_req = put_queue_replace(&nr_ul_tti_req_queue, ul_tti_request);
free(evicted_ul_tti_req);
for (int i = 0; i < ul_tti_request->n_pdus; i++) {
LOG_I(NR_PHY, "Received an NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST pdu_type %d, ra_state %d.\n",
ul_tti_request->pdus_list[i].pdu_type, mac->ra.ra_state);
if (ul_tti_request->pdus_list[i].pdu_type == 1 &&
mac->ra.ra_state >= RA_SUCCEEDED) {
LOG_I(NR_PHY, "Received an NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST that were queueing with rnti %x!\n",
ul_tti_request->pdus_list[i].pucch_pdu.rnti);
if (!put_queue(&nr_ul_tti_req_queue, ul_tti_request))
{
LOG_I(NR_PHY, "put_queue failed for ul_tti_request, calling put_queue_replace.\n");
nfapi_nr_ul_tti_request_t *evicted_ul_tti_req = put_queue_replace(&nr_ul_tti_req_queue, ul_tti_request);
free(evicted_ul_tti_req);
}
break;
}
else if (mac->ra.ra_state < RA_SUCCEEDED) {
LOG_I(NR_PHY, "Received an NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST before RA_SUCEEDED that were queueing with rnti %x!\n",
ul_tti_request->pdus_list[i].pucch_pdu.rnti);
if (!put_queue(&nr_ul_tti_req_queue, ul_tti_request))
{
LOG_I(NR_PHY, "put_queue failed for ul_tti_request, calling put_queue_replace.\n");
nfapi_nr_ul_tti_request_t *evicted_ul_tti_req = put_queue_replace(&nr_ul_tti_req_queue, ul_tti_request);
free(evicted_ul_tti_req);
}
}
}
break;
}
......@@ -1204,8 +1146,10 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type) && !get_softmodem_params()->phy_test)
nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id);
if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type))
LOG_I(NR_MAC, "In %s():%d calling nr_ue_pucch_scheduler in %d.%d\n",
__FUNCTION__, __LINE__, ul_info->frame_tx, ul_info->slot_tx);
if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type) &&
!get_softmodem_params()->emulate_l1)
nr_ue_pucch_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id);
switch(ret){
......@@ -1239,20 +1183,23 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
if (dl_info && dl_info->dci_ind && dl_info->dci_ind->number_of_dcis) {
LOG_D(MAC,"[L2][IF MODULE][DL INDICATION][DCI_IND]\n");
for (int i = 0; i < dl_info->dci_ind->number_of_dcis; i++) {
LOG_D(MAC,">>>NR_IF_Module i=%d, dl_info->dci_ind->number_of_dcis=%d\n",i,dl_info->dci_ind->number_of_dcis);
fapi_nr_dci_indication_pdu_t *dci_index = dl_info->dci_ind->dci_list+i;
LOG_I(MAC,">>>NR_IF_Module i=%d, dl_info->dci_ind->number_of_dcis=%d, format %d, harq_pid %d\n",
i,
dl_info->dci_ind->number_of_dcis,
dci_index->dci_format,
mac->def_dci_pdu_rel15[dci_index->dci_format].harq_pid);
nr_scheduled_response_t scheduled_response;
int8_t ret = handle_dci(dl_info->module_id,
dl_info->cc_id,
dl_info->gNB_index,
dl_info->frame,
dl_info->slot,
dl_info->dci_ind->dci_list+i);
fapi_nr_dci_indication_pdu_t *dci_index = dl_info->dci_ind->dci_list+i;
dci_index);
/* The check below filters out UL_DCIs (format 7) which are being processed as DL_DCIs. */
if (dci_index->dci_format == 7 && mac->ra.ra_state == RA_SUCCEEDED) {
LOG_D(NR_MAC, "We are filtering a UL_DCI to prevent it from being treated like a DL_DCI\n");
LOG_I(NR_MAC, "We are filtering a UL_DCI to prevent it from being treated like a DL_DCI\n");
break;
}
dci_pdu_rel15_t *def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[dci_index->dci_format];
......@@ -1266,7 +1213,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, dl_info->module_id, dl_info->cc_id, dl_info->frame, dl_info->slot, dl_info->thread_id);
nr_ue_if_module_inst[module_id]->scheduled_response(&scheduled_response);
}
memset(def_dci_pdu_rel15, 0, sizeof(*def_dci_pdu_rel15));
//memset(def_dci_pdu_rel15, 0, sizeof(*def_dci_pdu_rel15));
}
free(dl_info->dci_ind);
dl_info->dci_ind = NULL;
......
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