Commit 4f23fa2f authored by David Kim's avatar David Kim

added queues between VNF and MAC to handle indications.

parent 7df8064b
......@@ -20,9 +20,9 @@ L1s = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "ens3";
remote_n_address = "CI_ENB_IP_ADDR";
local_n_address = "CI_UE_IP_ADDR";
local_n_if_name = "lo:";
remote_n_address = "127.0.0.2";
local_n_address = "127.0.0.1";
local_n_portc = 50600;
remote_n_portc = 50601;
local_n_portd = 50610;
......
......@@ -20,9 +20,9 @@ L1s = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "ens3";
remote_n_address = "CI_ENB_IP_ADDR";
local_n_address = "CI_UE_IP_ADDR";
local_n_if_name = "lo";
remote_n_address = "127.0.0.1";
local_n_address = "127.0.0.1";
local_n_portc = 50000;
remote_n_portc = 50001;
local_n_portd = 50010;
......
......@@ -306,7 +306,7 @@ endif()
#
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -pipe -std=gnu99 -Wall -Werror -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC")
"${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -pipe -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC")
# add autotools definitions that were maybe used!
if (CUDA_FOUND)
set(MKVER "'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'")
......@@ -314,14 +314,14 @@ if (CUDA_FOUND)
"${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D CUDA_FLAG"
)
set(CUDA_CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -Werror -fno-strict-aliasing -rdynamic -std=c++11 -D CUDA_FLAG"
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic -std=c++11 -D CUDA_FLAG"
)
set(CMAKE_C_FLAGS
"${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D${MKVER} -D CUDA_FLAG"
)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -Werror -fno-strict-aliasing -rdynamic -std=c++11 -D${MKVER} -D CUDA_FLAG"
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic -std=c++11 -D${MKVER} -D CUDA_FLAG"
)
else (CUDA_FOUND)
set(MKVER "'MAKE_VERSION(a,b,c)=((a)*256+(b)*16+c)'")
......@@ -329,7 +329,7 @@ else (CUDA_FOUND)
"${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP -D${MKVER}"
)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -Werror -fno-strict-aliasing -rdynamic -std=c++11 -D${MKVER}"
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic -std=c++11 -D${MKVER}"
)
endif ()
......@@ -2905,6 +2905,7 @@ add_executable(lte-softmodem
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
${PHY_INTERFACE_DIR}/queue.c
${GTPU_need_ITTI}
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
......@@ -3059,6 +3060,7 @@ add_executable(nr-softmodem
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${PHY_INTERFACE_DIR}/queue.c
${GTPU_need_ITTI}
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
......
......@@ -443,6 +443,7 @@ static void *gNB_L1_thread( void *param ) {
if (gNB->CC_id==0) {
int next_slot;
next_slot = (slot_rx + 1) % 20;
LOG_I(PHY, "Calling rxtx1\n");
if (rxtx(gNB,frame_rx,next_slot,frame_tx,next_slot,thread_name) < 0) break;
}
if (wait_on_condition(&L1_proc->mutex,&L1_proc->cond,&L1_proc->instance_cnt,thread_name)<0) break;
......@@ -457,6 +458,7 @@ static void *gNB_L1_thread( void *param ) {
if (oai_exit) break;
if (gNB->CC_id==0) {
LOG_I(PHY, "Calling rxtx2\n");
if (rxtx(gNB,frame_rx,slot_rx,frame_tx,slot_tx,thread_name) < 0) break;
}
......
......@@ -178,15 +178,6 @@ static void L1_nsa_prach_procedures(frame_t frame, int slot, fapi_nr_ul_config_p
LOG_I(NR_MAC, "Melissa, We have successfully filled the rach_ind queue with the recently filled rach ind\n");
}
static void reset_queue(queue_t *q)
{
void *p;
while ((p = get_queue(q)) != NULL)
{
free(p);
}
}
static bool sfn_slot_matcher(void *wanted, void *candidate)
{
nfapi_p7_message_header_t *msg = candidate;
......
This diff is collapsed.
......@@ -1501,7 +1501,7 @@ typedef enum {
//section 3.4.7 rx_data_indication
//table 3-61
#define NFAPI_NR_RX_DATA_IND_MAX_PDU 100
typedef struct
{
uint32_t handle;
......@@ -1528,6 +1528,7 @@ typedef struct
//3.4.8 crc_indication
//table 3-62
#define NFAPI_NR_CRC_IND_MAX_PDU 100
typedef struct
{
uint32_t handle;
......@@ -1669,6 +1670,7 @@ typedef enum {
NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE = 2,
} nfapi_nr_uci_pdu_type_e;
#define NFAPI_NR_UCI_IND_MAX_PDU 100
typedef struct
{
uint16_t pdu_type; // 0 for PDU on PUSCH, 1 for PUCCH format 0 or 1, 2 for PUCCH format 2 to 4
......@@ -1705,7 +1707,7 @@ typedef struct
nfapi_nr_srs_indication_reported_symbol_resource_block_t* rb_list;
}nfapi_nr_srs_indication_reported_symbol_t;
#define NFAPI_NR_SRS_IND_MAX_PDU 100
typedef struct
{
uint32_t handle;
......
......@@ -544,7 +544,7 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,1);
LOG_D(PHY,"phy_procedures_gNB_uespec_RX frame %d, slot %d\n",frame_rx,slot_rx);
LOG_I(PHY,"phy_procedures_gNB_uespec_RX frame %d, slot %d\n",frame_rx,slot_rx);
if (gNB->frame_parms.frame_type == TDD)
if(NFAPI_MODE != NFAPI_MODE_VNF)
......
......@@ -59,8 +59,8 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
"Too many ul_config pdus %d", ul_config->number_pdus);
for (int i = 0; i < ul_config->number_pdus; ++i)
{
LOG_I(PHY, "In %s: processing %s PDU of %d total UL PDUs (ul_config %p) \n",
__FUNCTION__, ul_pdu_type[ul_config->ul_config_list[i].pdu_type - 1], ul_config->number_pdus, ul_config);
//LOG_I(PHY, "In %s: processing %s PDU of %d total UL PDUs (ul_config %p) \n",
// __FUNCTION__, ul_pdu_type[ul_config->ul_config_list[i].pdu_type - 1], ul_config->number_pdus, ul_config);
uint8_t pdu_type = ul_config->ul_config_list[i].pdu_type;
switch (pdu_type)
......
......@@ -538,7 +538,7 @@ int nr_rrc_mac_config_req_ue(
mac->ul_config_request = calloc(num_slots, sizeof(*mac->ul_config_request));
config_common_ue(mac,module_id,cc_idP);
mac->crnti = cell_group_config->spCellConfig->reconfigurationWithSync->newUE_Identity;
LOG_I(MAC,"Configuring CRNTI %x\n",mac->crnti);
LOG_I(MAC,"Configuring CRNTI %x, with module_id = %d\n",mac->crnti, (int)module_id);
}
// Setup the SSB to Rach Occasions mapping according to the config
......
......@@ -737,7 +737,7 @@ void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot){
if (ra->cfra) {
LOG_I(MAC, "[UE %d][%d.%d][RAPROC] RA procedure succeeded. CF-RA: RAR successfully received.\n", mod_id, frame, slot);
LOG_I(MAC, "[UE %d][%d.%d][RAPROC] RA procedure succeeded. CF-RA: RAR successfully received, t_crnti = %x\n", mod_id, frame, slot, ra->t_crnti);
ra->RA_window_cnt = -1;
......
......@@ -69,7 +69,7 @@
int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti){
RA_config_t *ra = &mac->ra;
int rnti_type;
int rnti_type = NR_RNTI_C;
if (rnti == ra->ra_rnti) {
rnti_type = NR_RNTI_RA;
......@@ -82,7 +82,7 @@ int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti){
} else if (rnti == 0xFFFF) {
rnti_type = NR_RNTI_SI;
} else {
AssertFatal(1 == 0, "In %s: Not identified/handled rnti %d \n", __FUNCTION__, rnti);
//AssertFatal(1 == 0, "In %s: Not identified/handled rnti %x \n", __FUNCTION__, rnti);
}
LOG_D(MAC, "In %s: returning rnti_type %s \n", __FUNCTION__, rnti_types[rnti_type]);
......@@ -446,7 +446,7 @@ 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);
LOG_D(MAC,"Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n",
LOG_I(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);
uint32_t dci_format = nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15);
......@@ -2187,8 +2187,13 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); // RAR subPDU pointer
uint8_t preamble_index = mac->ra.rach_ConfigDedicated->cfra->resources.choice.ssb->ssb_ResourceList.list.array[0]->ra_PreambleIndex;
LOG_D(MAC, "In %s:[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", __FUNCTION__, frame, slot, mod_id, preamble_index);
LOG_I(MAC, "In %s:[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", __FUNCTION__, frame, slot, mod_id, preamble_index);
if( mac->crnti == ra->t_crnti )
{
LOG_I(MAC, "Discarding the received RAR.\n");
return -1;
}
while (1) {
n_subheaders++;
if (rarh->T == 1) {
......@@ -2201,7 +2206,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
LOG_D(MAC, "[UE %d][RAPROC] Got BI RAR subPDU %d\n", mod_id, ra->RA_backoff_indicator);
}
if (rarh->RAPID == preamble_index) {
LOG_I(MAC, "[UE %d][RAPROC][%d.%d] Found RAR with the intended RAPID %d\n", mod_id, frame, slot, rarh->RAPID);
LOG_I(MAC, "[UE %d][RAPROC][%d.%d] Found RAR with the intended RAPID %d, CRNTI %x, t_crnti = %x\n", mod_id, frame, slot, rarh->RAPID, mac->crnti, ra->t_crnti);
rar = (NR_MAC_RAR *) (dlsch_buffer + n_subheaders + (n_subPDUs - 1) * sizeof(NR_MAC_RAR));
ra->RA_RAPID_found = 1;
break;
......@@ -2229,7 +2234,16 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
#endif
// TC-RNTI
LOG_I(MAC, "Found RAR_01 with t_crnti %x\n", ra->t_crnti);
//if (ra->t_crnti == mac->crnti )
// return -1;
//rar->TCRNTI_1 = (uint8_t) (mac->crnti >> 8); // 8 MSBs of rnti
//rar->TCRNTI_2 = (uint8_t) (mac->crnti & 0xff); // 8 LSBs of rnti
ra->t_crnti = rar->TCRNTI_2 + (rar->TCRNTI_1 << 8);
LOG_I(MAC, "Found RAR_02 with t_crnti %x\n", rar->TCRNTI_2 + (rar->TCRNTI_1 << 8));
// TA command
ul_time_alignment->apply_ta = 1;
......@@ -2318,13 +2332,16 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
// Config Msg3 PDU
nr_config_pusch_pdu(mac, pusch_config_pdu, NULL, &rar_grant, rnti, NULL);
LOG_I(MAC, "Found RAR_0 with t_crnti %x\n", ra->t_crnti);
}
LOG_I(MAC, "Found RAR_1 with t_crnti %x\n", ra->t_crnti);
} else {
ra->t_crnti = 0;
ul_time_alignment->ta_command = (0xffff);
LOG_I(MAC, "Found RAR_2 with t_crnti %x\n", ra->t_crnti);
}
......
......@@ -434,7 +434,11 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
}
}
}
LOG_I(PHY,"Added new RA process for UE RNTI %04x with initial secondaryCellGroup\n", rnti);
LOG_I(PHY,"Added new RA process for UE RNTI %04x with initial secondaryCellGroup, ra_index %u, rnti %x\n",
rnti,
ra_index,
cc->ra[ra_index].rnti
);
} else { // secondaryCellGroup has been updated
const int UE_id = find_nr_UE_id(Mod_idP,rnti);
UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup;
......
......@@ -456,7 +456,7 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot,
}
}
uint16_t temp_preamble_index = 0;
void nr_initiate_ra_proc(module_id_t module_idP,
int CC_id,
frame_t frameP,
......@@ -486,13 +486,24 @@ void nr_initiate_ra_proc(module_id_t module_idP,
total_RApreambles = total_RApreambles/num_ssb_per_RO ;
}
for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
NR_RA_t *ra = &cc->ra[i];
LOG_I(MAC,
"[gNB %d][RAPROC] CC_id %d Frame %d, Slot %d Checking all rnti : preamble index %d, rnti %x\n",
module_idP,
CC_id,
frameP,
slotP,
preamble_index,
ra->rnti);
}
for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
NR_RA_t *ra = &cc->ra[i];
pr_found = 0;
if (ra->state == RA_IDLE) {
for(int j = 0; j < ra->preambles.num_preambles; j++) {
//check if the preamble received correspond to one of the listed or configured preambles
if (preamble_index == ra->preambles.preamble_list[j]) {
if (preamble_index == ra->preambles.preamble_list[j] && ra->rnti != 0) {
pr_found=1;
break;
}
......@@ -520,12 +531,14 @@ void nr_initiate_ra_proc(module_id_t module_idP,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 1);
LOG_I(MAC,
"[gNB %d][RAPROC] CC_id %d Frame %d, Slot %d Initiating RA procedure for preamble index %d\n",
"[gNB %d][RAPROC] CC_id %d Frame %d, Slot %d Initiating RA procedure for preamble index %d, rnti %x, ra_index %d\n",
module_idP,
CC_id,
frameP,
slotP,
preamble_index);
preamble_index,
ra->rnti,
i);
uint8_t beam_index = ssb_index_from_prach(module_idP, frameP, slotP, preamble_index, freq_index, symbol);
......@@ -716,7 +729,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
vrb_map_UL[i + ra->msg3_first_rb] = 1;
}
LOG_I(MAC, "[gNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot);
LOG_I(MAC, "[gNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d), crnti %x\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot, ra->rnti);
nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_idP]->UL_tti_req_ahead[CC_id][ra->Msg3_slot];
AssertFatal(future_ul_tti_req->SFN == ra->Msg3_frame
......@@ -738,7 +751,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
AssertFatal(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1,
"downlinkBWP_ToAddModList has %d BWP!\n", ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count);
NR_BWP_Uplink_t *ubwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id - 1];
LOG_D(MAC, "Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %d\n",
LOG_I(MAC, "Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %x\n",
frameP,
slotP,
ra->Msg3_frame,
......@@ -915,11 +928,19 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
dl_req->nPDUs+=1;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15;
LOG_I(MAC,"[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RAR DCI, state %d\n", module_idP, CC_id, frameP, slotP, ra->state);
LOG_I(MAC,"[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RAR DCI, state %d, rnti %x, new rnti %x\n",
module_idP,
CC_id,
frameP,
slotP,
ra->state,
ra->rnti,
ra->secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity
);
NR_BWP_Uplink_t *ubwp=ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id-1];
LOG_I(MAC, "[RAPROC] Scheduling common search space DCI type 1 dlBWP BW %d\n", dci10_bw);
LOG_I(MAC, "[RAPROC] Scheduling common search space DCI type 1 dlBWP BW %d, rnit %x\n", dci10_bw, ra->rnti);
// Qm>2 not allowed for RAR
if (get_softmodem_params()->do_ra)
......@@ -1022,13 +1043,14 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
const int rnti_type = NR_RNTI_RA;
LOG_I(MAC,
"[RAPROC] DCI params: rnti %d, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n",
"[RAPROC] DCI params: RA rnti %x, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d, crnti %x\n",
pdcch_pdu_rel15->dci_pdu[0].RNTI,
rnti_type,
dci_format,
(unsigned long long)pdcch_pdu_rel15->FreqDomainResource,
pdcch_pdu_rel15->StartSymbolIndex,
pdcch_pdu_rel15->DurationSymbols);
pdcch_pdu_rel15->DurationSymbols,
ra->rnti);
fill_dci_pdu_rel15(scc,
ra->secondaryCellGroup,
......@@ -1050,11 +1072,12 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
nr_mac->TX_req[CC_id].Slot = slotP;
// Program UL processing for Msg3
LOG_I(MAC, "Before Program UL processing for Msg3: rnti %x\n", ra->rnti);
nr_get_Msg3alloc(module_idP, CC_id, scc, ubwp, slotP, frameP, ra);
LOG_I(MAC, "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot);
LOG_I(MAC, "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d, crnti %x\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot, ra->rnti);
nr_add_msg3(module_idP, CC_id, frameP, slotP, ra, (uint8_t *) &tx_req->TLVs[0].value.direct[0]);
ra->state = WAIT_Msg3;
LOG_I(MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state);
LOG_I(MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d, crnti %x\n", module_idP, frameP, slotP, ra->state, ra->rnti);
x_Overhead = 0;
nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, dci_payload.tb_scaling);
......@@ -1116,7 +1139,7 @@ void nr_fill_rar(uint8_t Mod_idP,
uint8_t * dlsch_buffer,
nfapi_nr_pusch_pdu_t *pusch_pdu){
LOG_I(MAC, "[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u TA command %d \n", ra->Msg2_frame, ra-> Msg2_slot, ra->preamble_index, ra->timing_offset);
LOG_D(MAC, "[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u TA command %d \n", ra->Msg2_frame, ra-> Msg2_slot, ra->preamble_index, ra->timing_offset);
NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) dlsch_buffer;
NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1);
unsigned char csi_req = 0, tpc_command;
......@@ -1144,7 +1167,7 @@ void nr_fill_rar(uint8_t Mod_idP,
// TC-RNTI
rar->TCRNTI_1 = (uint8_t) (ra->rnti >> 8); // 8 MSBs of rnti
rar->TCRNTI_2 = (uint8_t) (ra->rnti & 0xff); // 8 LSBs of rnti
LOG_I(MAC, "[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u TA command %d with rnti = %x <---------------NOTICE in nr_fill_rar() \n", ra->Msg2_frame, ra-> Msg2_slot, ra->preamble_index, ra->timing_offset, ra->rnti);
// UL grant
ra->msg3_TPC = tpc_command;
......
......@@ -721,11 +721,12 @@ void nr_schedule_ue_spec(module_id_t module_id,
if (current_harq_pid < 0) {
/* PP has not selected a specific HARQ Process, get a new one */
current_harq_pid = sched_ctrl->available_dl_harq.head;
AssertFatal(current_harq_pid >= 0,
"no free HARQ process available for UE %d\n",
UE_id);
//AssertFatal(current_harq_pid >= 0,
// "no free HARQ process available for UE %d\n",
// UE_id);
remove_front_nr_list(&sched_ctrl->available_dl_harq);
sched_ctrl->dl_harq_pid = current_harq_pid;
return;
} else {
/* PP selected a specific HARQ process. Check whether it will be a new
* transmission or a retransmission, and remove from the corresponding
......
......@@ -1542,6 +1542,7 @@ void add_front_nr_list(NR_list_t *listP, int id)
*/
void remove_front_nr_list(NR_list_t *listP)
{
if (listP->head < 0 ) return;
AssertFatal(listP->head >= 0, "Nothing to remove\n");
const int ohead = listP->head;
listP->head = listP->next[ohead];
......@@ -1630,6 +1631,9 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secon
UE_info->num_UEs);
dump_nr_list(&UE_info->list);
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++)
LOG_I(MAC, "add_new_nr_ue UE_info->active[%d] = %d\n", i, UE_info->active[i]);
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
if (UE_info->active[i])
continue;
......@@ -1696,7 +1700,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secon
}
// printf("MAC: cannot add new UE for rnti %x\n", rntiP);
LOG_E(MAC, "error in add_new_ue(), could not find space in UE_info, Dumping UE list\n");
LOG_E(MAC, "error in add_new_nr_ue(), could not find space in UE_info, Dumping UE list\n");
dump_nr_list(&UE_info->list);
return -1;
}
......
......@@ -521,7 +521,7 @@ int nr_acknack_scheduling(int mod_id,
get_pdsch_to_harq_feedback(mod_id, UE_id, ss_type, pdsch_to_harq_feedback);
/* there is a HARQ. Check whether we can use it for this ACKNACK */
if (pucch->dai_c > 0) {
if (pucch->dai_c > 0 && pucch->frame == frame ) {
/* this UE already has a PUCCH occasion */
DevAssert(pucch->frame == frame);
......@@ -557,12 +557,14 @@ int nr_acknack_scheduling(int mod_id,
* scheduled a lot and used all AckNacks, pucch->frame might have been
* wrapped around to next frame */
if (frame != pucch->frame || pucch->ul_slot < first_ul_slot_tdd) {
/*
AssertFatal(pucch->sr_flag + pucch->dai_c == 0,
"expected no SR/AckNack for UE %d in %4d.%2d, but has %d/%d for %4d.%2d\n",
UE_id, frame, slot, pucch->sr_flag, pucch->dai_c, pucch->frame, pucch->ul_slot);
AssertFatal(frame + 1 != pucch->frame,
"frame wrap around not handled in %s() yet\n",
__func__);
*/
pucch->frame = frame;
pucch->ul_slot = first_ul_slot_tdd;
}
......
......@@ -405,6 +405,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
const int current_rnti = rntiP;
const int UE_id = find_nr_UE_id(gnb_mod_idP, current_rnti);
const int target_snrx10 = gNB_mac->pusch_target_snrx10;
LOG_I(NR_MAC, "nr_rx_sdu entered\n");
if (UE_id != -1) {
NR_UE_sched_ctrl_t *UE_scheduling_control = &UE_info->UE_sched_ctrl[UE_id];
......@@ -416,7 +417,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
T_BUFFER(sduP, sdu_lenP));
UE_info->mac_stats[UE_id].ulsch_total_bytes_rx += sdu_lenP;
LOG_D(NR_MAC, "[gNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu from PHY (rnti %x, UE_id %d) ul_cqi %d sduP %p\n",
LOG_I(NR_MAC, "[gNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu from PHY (rnti %x, UE_id %d) ul_cqi %d sduP %p\n",
gnb_mod_idP,
harq_pid,
CC_idP,
......@@ -484,8 +485,11 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
* it. */
for (int i = 0; i < NR_NB_RA_PROC_MAX; ++i) {
NR_RA_t *ra = &gNB_mac->common_channels[CC_idP].ra[i];
if (ra->state != WAIT_Msg3)
if (ra->state != WAIT_Msg3 || ra->rnti == 0)
{
LOG_I(NR_MAC, "Notice ra->state = %d (if it is 2, it is WAIT_Msg3. Else we continue), ra->rnti %x\n", ra->state, ra->rnti);
continue;
}
if(no_sig) {
LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state);
......@@ -493,8 +497,13 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP);
} else {
LOG_I(NR_MAC,
"expected TC_RNTI %04x to match current RNTI %04x\n",
ra->rnti,
current_rnti);
// random access pusch with TC-RNTI
if (ra->rnti != current_rnti) {
//ra->rnti = current_rnti;
LOG_W(NR_MAC,
"expected TC_RNTI %04x to match current RNTI %04x\n",
ra->rnti,
......@@ -961,6 +970,7 @@ void nr_schedule_ulsch(module_id_t module_id,
continue;
uint16_t rnti = UE_info->rnti[UE_id];
LOG_D(NR_MAC, "nr_schedule_ulsch UE_id_checking UE_id = %d, rnti = %x \n", UE_id, rnti);
int8_t harq_id = sched_pusch->ul_harq_pid;
if (harq_id < 0) {
......
......@@ -37,6 +37,7 @@
#include "common/ran_context.h"
#include "executables/softmodem-common.h"
#include "nfapi/oai_integration/vendor_ext.h"
#include "openair2/PHY_INTERFACE/queue.h"
#define MAX_IF_MODULES 100
//#define UL_HARQ_PRINT
......@@ -52,14 +53,29 @@ extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind);
extern uint8_t nfapi_mode;
extern uint16_t sf_ahead;
extern uint16_t sl_ahead;
extern NR_UL_IND_t UL_INFO;
extern queue_t gnb_rach_ind_queue;
extern queue_t gnb_rx_ind_queue;
extern queue_t gnb_crc_ind_queue;
extern queue_t gnb_uci_ind_queue;
void handle_nr_rach(NR_UL_IND_t *UL_info)
{
// Melissa: TODO come back and differentiate between global UL_info and passed in arg
if (gnb_rach_ind_queue.num_items ==0)
return;
LOG_I(NR_MAC, "gnb_rach_ind_queue size = %zu\n", gnb_rach_ind_queue.num_items);
nfapi_nr_rach_indication_t *rach_ind = unqueue(&gnb_rach_ind_queue);
NR_UL_IND_t UL_INFO;
UL_INFO.rach_ind = *rach_ind;
UL_INFO.frame = rach_ind->sfn;
UL_INFO.slot = rach_ind->slot;
UL_INFO.module_id = UL_info->module_id;
UL_INFO.CC_id = UL_info->CC_id;
if (UL_INFO.rach_ind.number_of_pdus>0) {
LOG_I(MAC,"UL_INFO[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",
UL_INFO.frame,UL_INFO.slot, UL_INFO.rach_ind.sfn,UL_INFO.rach_ind.slot);
LOG_I(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",
UL_info->frame, UL_info->slot, UL_INFO.rach_ind.sfn, UL_INFO.rach_ind.slot);
int npdus = UL_INFO.rach_ind.number_of_pdus;
for(int i = 0; i < npdus; i++) {
UL_INFO.rach_ind.number_of_pdus--;
......@@ -77,12 +93,26 @@ void handle_nr_rach(NR_UL_IND_t *UL_info)
UL_INFO.rach_ind.pdu_list[i].preamble_list[0].timing_advance);
}
}
if (rach_ind && rach_ind->number_of_pdus > 0)
{
for(int i = 0; i < rach_ind->number_of_pdus; i++)
free(rach_ind->pdu_list[i].preamble_list);
free(rach_ind->pdu_list);
}
free(rach_ind);
}
void handle_nr_uci(NR_UL_IND_t *UL_info)
{
const module_id_t mod_id = UL_INFO.module_id;
if (gnb_uci_ind_queue.num_items ==0)
return;
LOG_I(NR_MAC, "gnb_uci_ind_queue size = %zu\n", gnb_uci_ind_queue.num_items);
nfapi_nr_uci_indication_t *uci_ind = unqueue(&gnb_uci_ind_queue);
NR_UL_IND_t UL_INFO;
UL_INFO.uci_ind = *uci_ind;
const module_id_t mod_id = UL_info->module_id;
const frame_t frame = UL_INFO.uci_ind.sfn;
const sub_frame_t slot = UL_INFO.uci_ind.slot;
int num_ucis = UL_INFO.uci_ind.num_ucis;
......@@ -109,24 +139,92 @@ void handle_nr_uci(NR_UL_IND_t *UL_info)
}
}
UL_INFO.uci_ind.num_ucis = 0;
if(NFAPI_MODE != NFAPI_MODE_PNF)
// mark corresponding PUCCH resources as free
// NOTE: we just assume it is BWP ID 1, to be revised for multiple BWPs
RC.nrmac[mod_id]->pucch_index_used[1][slot] = 0;
for (int i = 0; i < num_ucis; i++){
switch (uci_list[i].pdu_type) {
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE:
free(uci_list[i].pucch_pdu_format_0_1.harq->harq_list);
free(uci_list[i].pucch_pdu_format_0_1.harq);
break;
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE:
free(uci_list[i].pucch_pdu_format_2_3_4.harq.harq_payload);
free(uci_list[i].pucch_pdu_format_2_3_4.csi_part1.csi_part1_payload);
free(uci_list[i].pucch_pdu_format_2_3_4.csi_part2.csi_part2_payload);
break;
}
}
if (uci_ind && num_ucis > 0)
free(uci_list);
free(uci_ind);
}
static bool crc_sfn_slot_matcher(void *wanted, void *candidate)
{
nfapi_p7_message_header_t *msg = candidate;
int sfn_sf = *(int*)wanted;
switch (msg->message_id)
{
case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
{
nfapi_nr_crc_indication_t *ind = candidate;
return NFAPI_SFNSLOT2SFN(sfn_sf) == ind->sfn && NFAPI_SFNSLOT2SLOT(sfn_sf) == ind->slot;
}
default:
LOG_E(NR_MAC, "sfn_slot_match bad ID: %d\n", msg->message_id);
}
return false;
}
void handle_nr_ulsch(NR_UL_IND_t *UL_info)
void handle_nr_ulsch(NR_UL_IND_t *UL_info)
{
// Melissa: TODO come back and differentiate between global UL_info and passed in arg
if (UL_INFO.rx_ind.number_of_pdus > 0 && UL_INFO.crc_ind.number_crcs > 0) {
if (gnb_rx_ind_queue.num_items == 0 || gnb_crc_ind_queue.num_items == 0)
return;
LOG_I(NR_MAC, "gnb_rx_ind_queue size and gnb_crc_ind_queue size = %zu and %zu\n",
gnb_rx_ind_queue.num_items,
gnb_crc_ind_queue.num_items
);
nfapi_nr_rx_data_indication_t *rx_ind = unqueue(&gnb_rx_ind_queue);
int sfn_slot = NFAPI_SFNSLOT2HEX(rx_ind->sfn, rx_ind->slot);
nfapi_nr_crc_indication_t *crc_ind = unqueue_matching(&gnb_crc_ind_queue,
MAX_QUEUE_SIZE,
crc_sfn_slot_matcher,
&sfn_slot);
if (!crc_ind)
{
LOG_I(NR_PHY, "No crc indication with the same SFN SLOT of rx indication %u %u\n", rx_ind->sfn, rx_ind->slot);
requeue(&gnb_rx_ind_queue, rx_ind);
return;
}
NR_UL_IND_t UL_INFO;
UL_INFO.rx_ind = *rx_ind;
UL_INFO.crc_ind = *crc_ind;
UL_INFO.frame = rx_ind->sfn;
UL_INFO.slot = rx_ind->slot;
UL_INFO.module_id = UL_info->module_id;
UL_INFO.CC_id = UL_info->CC_id;
LOG_I(NR_MAC, " UL_info frame slot vs rx_ind frame slot vs crc_ind slot frame slot = %u %u vs %u %u vs %u %u\n",
UL_info->frame, UL_info->slot,
rx_ind->sfn, rx_ind->slot,
crc_ind->sfn, crc_ind->slot
);
if (rx_ind && UL_INFO.rx_ind.number_of_pdus > 0 && crc_ind && UL_INFO.crc_ind.number_crcs > 0) {
for (int i = 0; i < UL_INFO.rx_ind.number_of_pdus; i++) {
for (int j = 0; j < UL_INFO.crc_ind.number_crcs; j++) {
// find crc_indication j corresponding rx_indication i
const nfapi_nr_rx_data_pdu_t *rx = &UL_INFO.rx_ind.pdu_list[i];
const nfapi_nr_crc_t *crc = &UL_INFO.crc_ind.crc_list[j];
LOG_D(NR_PHY,
LOG_I(NR_PHY,
"UL_INFO.crc_ind.pdu_list[%d].rnti:%04x "
"UL_INFO.rx_ind.pdu_list[%d].rnti:%04x\n",
j,
......@@ -135,7 +233,10 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
rx->rnti);
if (crc->rnti != rx->rnti)
{
LOG_I(NR_MAC, "mis-match between CRC rnti %04x and RX rnit %04x\n", crc->rnti, rx->rnti);
continue;
}
LOG_D(NR_MAC,
"%4d.%2d Calling rx_sdu (CRC %s/tb_crc_status %d)\n",
......@@ -144,7 +245,7 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
crc->tb_crc_status ? "error" : "ok",
crc->tb_crc_status);
/* if CRC passes, pass PDU, otherwise pass NULL as error indication */
// 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,
......@@ -160,11 +261,15 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
} // for (j=0;j<UL_INFO.crc_ind.number_crcs;j++)
} // for (i=0;i<UL_INFO.rx_ind.number_of_pdus;i++)
UL_INFO.crc_ind.number_crcs = 0;
UL_INFO.rx_ind.number_of_pdus = 0;
} else if (UL_INFO.rx_ind.number_of_pdus != 0
|| UL_INFO.crc_ind.number_crcs != 0) {
LOG_E(NR_PHY,
if (crc_ind && crc_ind->number_crcs > 0)
free(crc_ind->crc_list);
free(crc_ind);
if (rx_ind && rx_ind->number_of_pdus > 0)
free(rx_ind->pdu_list);
free(rx_ind);
} else if ((rx_ind && UL_INFO.rx_ind.number_of_pdus != 0)
|| (crc_ind && UL_INFO.crc_ind.number_crcs != 0)) {
LOG_E(NR_PHY,
"hoping not to have mis-match between CRC ind and RX ind - "
"hopefully the missing message is coming shortly "
"rx_ind:%d(SFN/SL:%d/%d) crc_ind:%d(SFN/SL:%d/%d) \n",
......@@ -172,11 +277,12 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
UL_INFO.rx_ind.sfn,
UL_INFO.rx_ind.slot,
UL_INFO.crc_ind.number_crcs,
UL_INFO.rx_ind.sfn,
UL_INFO.rx_ind.slot);
UL_INFO.crc_ind.sfn,
UL_INFO.crc_ind.slot);
}
}
void NR_UL_indication(NR_UL_IND_t *UL_info) {
AssertFatal(UL_info!=NULL,"UL_INFO is null\n");
#ifdef DUMP_FAPI
......@@ -187,7 +293,7 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
NR_Sched_Rsp_t *sched_info = &Sched_INFO[module_id][CC_id];
NR_IF_Module_t *ifi = if_inst[module_id];
gNB_MAC_INST *mac = RC.nrmac[module_id];
LOG_D(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rach_pdus:%d rx_ind:%d crcs:%d]\n",
LOG_I(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rach_pdus:%d rx_ind:%d crcs:%d]\n",
UL_info->frame,UL_info->slot,
module_id,CC_id, UL_info->rach_ind.number_of_pdus,
UL_info->rx_ind.number_of_pdus, UL_info->crc_ind.number_crcs);
......
......@@ -284,6 +284,18 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi
{
nfapi_nr_pdu_t *pdu_list = &tx_data_request->pdu_list[i];
AssertFatal(pdu_list->num_TLV < sizeof(pdu_list->TLVs) / sizeof(pdu_list->TLVs[0]), "Num TLVs exceeds TLV array size");
if (tx_data_request->Slot == 7) { //Melissa this means we have an RAR, sorta hacky though
if( get_mac_inst(dl_info->module_id)->crnti == get_mac_inst(dl_info->module_id)->ra.t_crnti )
{ LOG_I(MAC, "Discarding tx_data_requested since it includes useless RAR.\n");
continue;
}
dl_info->rx_ind->rx_indication_body[i].pdu_type = FAPI_NR_RX_PDU_TYPE_RAR;
}
else if (tx_data_request->Slot != 7 && get_softmodem_params()->nsa) {
dl_info->rx_ind->rx_indication_body[i].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH;
}
for (int j = 0; j < pdu_list->num_TLV; j++)
{
if (pdu_list->TLVs[j].tag)
......@@ -291,12 +303,6 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi
else if (!pdu_list->TLVs[j].tag)
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.pdu = (void*) pdu_list->TLVs[j].value.direct; // Melissa, fix me!
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.pdu_length = pdu_list->TLVs[j].length;
if (tx_data_request->Slot == 7) { //Melissa this means we have an RAR, sorta hacky though
dl_info->rx_ind->rx_indication_body[i].pdu_type = FAPI_NR_RX_PDU_TYPE_RAR;
}
else if (tx_data_request->Slot != 7 && get_softmodem_params()->nsa) {
dl_info->rx_ind->rx_indication_body[i].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH;
}
}
}
dl_info->slot = tx_data_request->Slot;
......@@ -316,6 +322,8 @@ static void copy_ul_dci_data_req_to_dl_info(nr_downlink_indication_t *dl_info, n
{
nfapi_nr_ul_dci_request_pdus_t *pdu_list = &ul_dci_req->ul_dci_pdu_list[i];
AssertFatal(pdu_list->PDUType == 0, "ul_dci_req pdu type != PUCCH");
if( pdu_list->pdcch_pdu.pdcch_pdu_rel15.dci_pdu->RNTI != get_mac_inst(0)->crnti)
continue;
LOG_I(NR_PHY, "[%d %d] PUCCH PDU in ul_dci for rnti %x\n", ul_dci_req->SFN, ul_dci_req->Slot, pdu_list->pdcch_pdu.pdcch_pdu_rel15.dci_pdu->RNTI);
uint16_t num_dci = pdu_list->pdcch_pdu.pdcch_pdu_rel15.numDlDci;
if (num_dci > 0)
......
......@@ -16,6 +16,15 @@ void init_queue(queue_t *q)
pthread_mutex_init(&q->mutex, NULL);
}
void reset_queue(queue_t *q)
{
void *p;
while ((p = get_queue(q)) != NULL)
{
free(p);
}
}
bool put_queue(queue_t *q, void *item)
{
assert(item != NULL);
......@@ -156,4 +165,4 @@ void *unqueue_matching(queue_t *q, size_t max_depth, queue_matcher_t *matcher, v
pthread_mutex_unlock(&q->mutex);
return item;
}
\ No newline at end of file
}
......@@ -41,6 +41,7 @@ typedef struct queue_t
} queue_t;
void init_queue(queue_t *q);
void reset_queue(queue_t *q);
bool put_queue(queue_t *q, void *item);
void *get_queue(queue_t *q);
......
......@@ -141,7 +141,7 @@ void fill_default_searchSpaceZero(NR_SearchSpace_t *ss0) {
ss0->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
}
static int unique_preamble_index_gNB;
void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
NR_CellGroupConfig_t *secondaryCellGroup,
int scg_id,
......
......@@ -974,16 +974,6 @@ uint64_t clock_usec(void)
}
return (uint64_t)t.tv_sec * 1000000 + (t.tv_nsec / 1000);
}
static void reset_queue(queue_t *q)
{
void *p;
while ((p = get_queue(q)) != NULL)
{
free(p);
}
}
/*!
* \brief This is the UE thread for RX subframe n and TX subframe n+4.
* This thread performs the phy_procedures_UE_RX() on every received slot.
......
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