Fixed errors in nFAPI after first merge
This commit is contained in:
+33
-7
@@ -252,8 +252,25 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
|
||||
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
|
||||
|
||||
// RX processing
|
||||
int tx_slot_type = nr_slot_select(cfg,frame_tx,slot_tx);
|
||||
int rx_slot_type = nr_slot_select(cfg,frame_rx,slot_rx);
|
||||
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;
|
||||
}
|
||||
}
|
||||
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
|
||||
@@ -400,15 +417,21 @@ 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 );
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 0 );
|
||||
int frame_rx = L1_proc->frame_rx;
|
||||
int 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;
|
||||
if(NFAPI_MODE==NFAPI_MODE_VNF)
|
||||
if (gNB->CC_id==0) {
|
||||
int next_slot;
|
||||
next_slot = (slot_rx + 1) % 20;
|
||||
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;
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 1 );
|
||||
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_TX0_GNB,slot_tx);
|
||||
@@ -422,9 +445,12 @@ static void *gNB_L1_thread( void *param ) {
|
||||
if (rxtx(gNB,frame_rx,slot_rx,frame_tx,slot_tx,thread_name) < 0) break;
|
||||
}
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC,&t);
|
||||
//printf("\n %d.%d",t.tv_sec,t.tv_nsec);
|
||||
|
||||
if (release_thread(&L1_proc->mutex,&L1_proc->instance_cnt,thread_name)<0) break;
|
||||
|
||||
if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) wakeup_tx(gNB,frame_rx,slot_rx,frame_tx,slot_tx,timestamp_tx);
|
||||
|
||||
if (get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) wakeup_tx(gNB,frame_rx,slot_rx,frame_tx,slot_tx,timestamp_tx);
|
||||
else if(get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT) wakeup_txfh(gNB,L1_proc,frame_tx,slot_tx,timestamp_tx);
|
||||
} // while !oai_exit
|
||||
|
||||
|
||||
+30
-2
@@ -97,7 +97,8 @@ static int DEFBFW[] = {0x00007fff};
|
||||
|
||||
extern volatile int oai_exit;
|
||||
|
||||
|
||||
extern struct timespec timespec_sub(struct timespec lhs, struct timespec rhs);
|
||||
extern struct timespec timespec_add(struct timespec lhs, struct timespec rhs);
|
||||
extern void nr_phy_free_RU(RU_t *);
|
||||
extern void nr_phy_config_request(NR_PHY_Config_t *gNB);
|
||||
#include "executables/thread-common.h"
|
||||
@@ -710,6 +711,7 @@ void rx_rf(RU_t *ru,int *frame,int *slot) {
|
||||
|
||||
|
||||
void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
|
||||
|
||||
RU_proc_t *proc = &ru->proc;
|
||||
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
|
||||
nfapi_nr_config_request_scf_t *cfg = &ru->config;
|
||||
@@ -1541,9 +1543,35 @@ void *ru_thread( void *param ) {
|
||||
pthread_cond_signal(&proc->cond_FH1);
|
||||
|
||||
// This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices
|
||||
struct timespec slot_start;
|
||||
clock_gettime(CLOCK_MONOTONIC, &slot_start);
|
||||
|
||||
struct timespec slot_duration;
|
||||
slot_duration.tv_sec = 0;
|
||||
//slot_duration.tv_nsec = 0.5e6;
|
||||
slot_duration.tv_nsec = 0.5e6;
|
||||
|
||||
|
||||
|
||||
while (!oai_exit) {
|
||||
// these are local subframe/frame counters to check that we are in synch with the fronthaul timing.
|
||||
// They are set on the first rx/tx in the underly FH routines.
|
||||
slot_start = timespec_add(slot_start,slot_duration);
|
||||
struct timespec curr_time;
|
||||
clock_gettime(CLOCK_MONOTONIC, &curr_time);
|
||||
|
||||
struct timespec sleep_time;
|
||||
|
||||
if((slot_start.tv_sec > curr_time.tv_sec) || (slot_start.tv_sec == curr_time.tv_sec && slot_start.tv_nsec > curr_time.tv_nsec)){
|
||||
sleep_time = timespec_sub(slot_start,curr_time);
|
||||
|
||||
usleep(sleep_time.tv_nsec * 1e-3);
|
||||
}
|
||||
else{//continue
|
||||
}
|
||||
|
||||
// clock_gettime(CLOCK_MONOTONIC, &curr_time);
|
||||
//printf("sfn:%d, slot:%d, start time %d.%d slot start %d.%d \n",frame,slot,curr_time.tv_sec,curr_time.tv_nsec,slot_start.tv_sec,slot_start.tv_nsec);
|
||||
if (slot==(fp->slots_per_frame-1)) {
|
||||
slot=0;
|
||||
frame++;
|
||||
@@ -1562,7 +1590,7 @@ void *ru_thread( void *param ) {
|
||||
proc->frame_rx,proc->tti_rx,
|
||||
proc->frame_tx,proc->tti_tx,
|
||||
RC.gNB[0]->proc.frame_rx,RC.gNB[0]->proc.slot_rx,
|
||||
RC.gNB[0]->proc.frame_tx);
|
||||
RC.gNB[0]->proc.frame_tx);
|
||||
/*
|
||||
LOG_D(PHY,"RU thread (do_prach %d, is_prach_subframe %d), received frame %d, subframe %d\n",
|
||||
ru->do_prach,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1242,6 +1242,8 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu=&dl_tti_pdu_list[i];
|
||||
memcpy(dl_tti_pdu,&dl_tti_pdu_list[i],sizeof(nfapi_nr_dl_tti_request_pdu_t));
|
||||
int SFN=sfn+2;
|
||||
//if(!&dl_tti_pdu->pdcch_pdu)
|
||||
printf("interleaversize = %d, coreset_type = %d. \n",dl_tti_pdu->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize,dl_tti_pdu->pdcch_pdu.pdcch_pdu_rel15.CoreSetType);
|
||||
handle_nfapi_nr_pdcch_pdu(gNB, SFN, slot, &dl_tti_pdu->pdcch_pdu);
|
||||
//dl_tti_pdu_list[i].pdcch_pdu.pdcch_pdu_rel15.numDlDci++; // ?
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() pdcch_vars->num_dci:%d\n", __FUNCTION__, pdcch_vars->num_dci);
|
||||
|
||||
@@ -277,9 +277,9 @@ static uint8_t pack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppWritePac
|
||||
|
||||
push8(value->dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) &&
|
||||
push16(value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) &&
|
||||
pusharray8(value->dci_pdu[i].Payload, DCI_PAYLOAD_BYTE_LEN, value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end));
|
||||
|
||||
pusharray8(value->dci_pdu[i].Payload, DCI_PAYLOAD_BYTE_LEN, value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
// TODO: resolve the packaging of array (currently sending a single element)
|
||||
@@ -307,6 +307,7 @@ static uint8_t pack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppWritePac
|
||||
|
||||
static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
{
|
||||
printf("packing pdsch pdu. \n");
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv;
|
||||
|
||||
// TODO: resolve the packaging of array (currently sending a single element)
|
||||
@@ -360,6 +361,7 @@ static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppWritePac
|
||||
|
||||
static uint8_t pack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
{
|
||||
printf("Packing ssb. \n");
|
||||
nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv;
|
||||
|
||||
return(
|
||||
@@ -909,7 +911,7 @@ static uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_
|
||||
//pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
|
||||
|
||||
int arr[12];
|
||||
for(int i=0;i<pNfapiMsg->dl_tti_request_body.nGroup;i++)
|
||||
{
|
||||
@@ -3394,6 +3396,7 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe
|
||||
{
|
||||
case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
|
||||
result = pack_dl_tti_request(pMessageHeader, &pWritePackedMessage, end, config);
|
||||
printf("result of pack dl_tti_req is %d. \n",result);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
|
||||
@@ -3749,7 +3752,7 @@ static uint8_t unpack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppReadP
|
||||
|
||||
|
||||
static uint8_t unpack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
|
||||
{
|
||||
{
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv;
|
||||
|
||||
for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
|
||||
@@ -3765,7 +3768,7 @@ static uint8_t unpack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppReadPa
|
||||
pull8(ppReadPackedMsg, &value->dci_pdu[i].powerControlOffsetSS, end) &&
|
||||
pull16(ppReadPackedMsg, &value->dci_pdu[i].PayloadSizeBits, end) &&
|
||||
|
||||
pullarray8(ppReadPackedMsg, value->dci_pdu[i].Payload, DCI_PAYLOAD_BYTE_LEN, value->dci_pdu[i].PayloadSizeBits, end));
|
||||
pullarray8(ppReadPackedMsg, value->dci_pdu[i].Payload, DCI_PAYLOAD_BYTE_LEN, value->dci_pdu[i].PayloadSizeBits, end))
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -3847,7 +3850,8 @@ static uint8_t unpack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppReadPa
|
||||
|
||||
|
||||
static uint8_t unpack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
|
||||
{
|
||||
{
|
||||
printf("ssb received and unpacked. \n");
|
||||
nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv;
|
||||
|
||||
return(
|
||||
|
||||
@@ -1495,7 +1495,7 @@ uint8_t is_nr_p7_request_in_window(uint16_t sfn,uint16_t slot, const char* name,
|
||||
{
|
||||
uint32_t recv_sfn_slot_dec = NFAPI_SFNSLOT2DEC(sfn,slot);
|
||||
uint32_t current_sfn_slot_dec = NFAPI_SFNSLOT2DEC(phy->sfn,phy->slot);
|
||||
printf("p7_msg_sfn: %d, p7_msg_slot: %d, phy_sfn:%d , phy_slot:%d \n",sfn,slot,phy->sfn,phy->slot);
|
||||
//printf("p7_msg_sfn: %d, p7_msg_slot: %d, phy_sfn:%d , phy_slot:%d \n",sfn,slot,phy->sfn,phy->slot);
|
||||
uint8_t in_window = 0;
|
||||
uint8_t timing_window = phy->_public.slot_buffer_size;
|
||||
|
||||
@@ -1630,7 +1630,6 @@ void pnf_handle_dl_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_dl_tti_request structure\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int unpack_result = nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, req, sizeof(nfapi_nr_dl_tti_request_t), &(pnf_p7->_public.codec_config));
|
||||
|
||||
if(unpack_result == 0)
|
||||
@@ -2989,13 +2988,11 @@ void pnf_nr_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_tim
|
||||
struct sockaddr_in remote_addr;
|
||||
socklen_t remote_addr_size = sizeof(remote_addr);
|
||||
remote_addr.sin_family = 2; //hardcoded
|
||||
|
||||
do
|
||||
{
|
||||
// peek the header
|
||||
uint8_t header_buffer[NFAPI_P7_HEADER_LENGTH];
|
||||
recvfrom_result = recvfrom(pnf_p7->p7_sock, header_buffer, NFAPI_P7_HEADER_LENGTH, MSG_DONTWAIT | MSG_PEEK, (struct sockaddr*)&remote_addr, &remote_addr_size);
|
||||
|
||||
if(recvfrom_result > 0)
|
||||
{
|
||||
// get the segment size
|
||||
|
||||
@@ -533,6 +533,7 @@ int vnf_nr_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t*
|
||||
nfapi_p7_update_transmit_timestamp(buffer, calculate_transmit_timestamp(p7_connection->sfn, p7_connection->slot, vnf_p7->slot_start_time_hr));
|
||||
|
||||
send_result = vnf_send_p7_msg(vnf_p7, p7_connection, &tx_buffer[0], segment_size);
|
||||
//printf("segment %d \n", segment);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
*/
|
||||
|
||||
#include "nr_dlsch.h"
|
||||
#include "../../../nfapi/oai_integration/vendor_ext.h"
|
||||
|
||||
extern void set_taus_seed(unsigned int seed_type);
|
||||
|
||||
@@ -263,13 +264,21 @@ int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) {
|
||||
for (i=0; i<NUMBER_OF_NR_DLSCH_MAX; i++) {
|
||||
AssertFatal(gNB->dlsch[i]!=NULL,"gNB->dlsch[%d] is null\n",i);
|
||||
AssertFatal(gNB->dlsch[i][0]!=NULL,"gNB->dlsch[%d][0] is null\n",i);
|
||||
LOG_D(PHY,"searching for rnti %x : dlsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,
|
||||
gNB->dlsch[i][0]->harq_mask,gNB->dlsch[i][0]->rnti,first_free_index);
|
||||
//LOG_D(PHY,"searching for rnti %x : dlsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,
|
||||
//gNB->dlsch[i][0]->harq_mask,gNB->dlsch[i][0]->rnti,first_free_index);
|
||||
LOG_D(PHY,"searching for harq_mask %x, rnti %x, gNB->dlsch[i][0]->rnti %x\n", gNB->dlsch[i][0]->harq_mask, rnti, gNB->dlsch[i][0]->rnti);
|
||||
if ((gNB->dlsch[i][0]->harq_mask >0) &&
|
||||
(gNB->dlsch[i][0]->rnti==rnti)) return i;
|
||||
else if ((gNB->dlsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i;
|
||||
else if ((gNB->dlsch[i][0]->harq_mask == 0) && (first_free_index==-1)) {
|
||||
//printf("gNB->dlsch[i][0]->harq_mask = %d \n", gNB->dlsch[i][0]->harq_mask);;
|
||||
first_free_index=i;
|
||||
}
|
||||
|
||||
}
|
||||
if (type == SEARCH_EXIST) {
|
||||
printf("type = %d \n", type);
|
||||
return -1;
|
||||
}
|
||||
if (type == SEARCH_EXIST) return -1;
|
||||
if (first_free_index != -1)
|
||||
gNB->dlsch[first_free_index][0]->rnti = 0;
|
||||
return first_free_index;
|
||||
@@ -284,7 +293,10 @@ void nr_fill_dlsch(PHY_VARS_gNB *gNB,
|
||||
uint8_t *sdu) {
|
||||
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &pdsch_pdu->pdsch_pdu_rel15;
|
||||
|
||||
if (NFAPI_MODE == NFAPI_MODE_PNF) {
|
||||
gNB->dlsch[0][0]->harq_mask = 1;
|
||||
gNB->dlsch[0][0]->rnti = 4660;
|
||||
}
|
||||
int dlsch_id = find_nr_dlsch(rel15->rnti,gNB,SEARCH_EXIST);
|
||||
AssertFatal( (dlsch_id>=0) && (dlsch_id<NUMBER_OF_NR_DLSCH_MAX),
|
||||
"illegal or no dlsch_id found!!! rnti %04x dlsch_id %d\n",rel15->rnti,dlsch_id);
|
||||
|
||||
@@ -577,7 +577,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
|
||||
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
|
||||
if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) {
|
||||
LOG_D(PHY,"Segment %u CRC OK\n\033[0m",r);
|
||||
LOG_I(PHY,"Segment %u CRC OK\n\033[0m",r);
|
||||
if (r==0) {
|
||||
for (int i=0;i<10;i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t*)llrProcBuf)[i]);
|
||||
}
|
||||
@@ -587,7 +587,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
ret = no_iteration_ldpc;
|
||||
}
|
||||
else {
|
||||
LOG_D(PHY,"CRC NOT OK\n\033[0m");
|
||||
LOG_I(PHY,"CRC NOT OK\n\033[0m");
|
||||
ret = 1 + dlsch->max_ldpc_iterations;
|
||||
}
|
||||
|
||||
|
||||
@@ -104,8 +104,6 @@ void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB,
|
||||
|
||||
nr_fill_dci(gNB,frame,slot,pdcch_pdu);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB,
|
||||
@@ -182,26 +180,30 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
||||
break;
|
||||
|
||||
case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE:
|
||||
|
||||
AssertFatal(pdcch_received == 0, "pdcch_received is not 0, we can only handle one PDCCH PDU per slot\n");
|
||||
if(NFAPI_MODE != NFAPI_MODE_VNF)
|
||||
if(NFAPI_MODE != NFAPI_MODE_VNF){
|
||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot);
|
||||
handle_nfapi_nr_pdcch_pdu(gNB,
|
||||
frame, slot,
|
||||
&dl_tti_pdu->pdcch_pdu);
|
||||
|
||||
}
|
||||
pdcch_received = 1;
|
||||
|
||||
break;
|
||||
case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE:
|
||||
|
||||
{
|
||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot);
|
||||
LOG_I(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot);
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdu->pdsch_pdu.pdsch_pdu_rel15;
|
||||
uint16_t pduIndex = pdsch_pdu_rel15->pduIndex;
|
||||
AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, "TX_req->pdu_list[%d].num_TLV %d != 1\n",
|
||||
pduIndex,TX_req->pdu_list[pduIndex].num_TLV);
|
||||
uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct;
|
||||
if(NFAPI_MODE != NFAPI_MODE_VNF)
|
||||
if(NFAPI_MODE != NFAPI_MODE_VNF){
|
||||
LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE for %d.%d\n",frame,slot,DL_req->SFN,DL_req->Slot);
|
||||
handle_nr_nfapi_pdsch_pdu(gNB,frame,slot,&dl_tti_pdu->pdsch_pdu, sdu);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -232,15 +234,15 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
||||
}
|
||||
}
|
||||
|
||||
if(NFAPI_MODE != NFAPI_MONOLITHIC && number_ul_tti_pdu>0)
|
||||
{
|
||||
oai_nfapi_ul_tti_req(UL_tti_req);
|
||||
}
|
||||
// if(NFAPI_MODE != NFAPI_MONOLITHIC && number_ul_tti_pdu>0)
|
||||
// {
|
||||
// oai_nfapi_ul_tti_req(UL_tti_req);
|
||||
// }
|
||||
|
||||
if (NFAPI_MODE != NFAPI_MONOLITHIC && Sched_INFO->UL_dci_req->numPdus!=0)
|
||||
{
|
||||
oai_nfapi_ul_dci_req(Sched_INFO->UL_dci_req);
|
||||
}
|
||||
// if (NFAPI_MODE != NFAPI_MONOLITHIC && Sched_INFO->UL_dci_req->numPdus!=0)
|
||||
// {
|
||||
// oai_nfapi_ul_dci_req(Sched_INFO->UL_dci_req);
|
||||
// }
|
||||
|
||||
if (NFAPI_MODE != NFAPI_MONOLITHIC)
|
||||
{
|
||||
@@ -248,6 +250,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
|
||||
{
|
||||
Sched_INFO->DL_req->SFN = frame;
|
||||
Sched_INFO->DL_req->Slot = slot;
|
||||
printf("DL tti Frame = %d, slot = %d. \n",frame,slot);
|
||||
oai_nfapi_dl_tti_req(Sched_INFO->DL_req);
|
||||
}
|
||||
if (Sched_INFO->TX_req->Number_of_PDUs > 0)
|
||||
|
||||
@@ -315,7 +315,7 @@ int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_slot
|
||||
if (cfg->cell_config.frame_duplex_type.value == FDD) {
|
||||
return (NR_UPLINK_SLOT | NR_DOWNLINK_SLOT );
|
||||
}
|
||||
|
||||
|
||||
if (nr_frame%2 == 0) {
|
||||
for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
|
||||
if (cfg->tdd_table.max_tdd_periodicity_list[nr_slot].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1) {
|
||||
|
||||
@@ -547,6 +547,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
LOG_D(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)
|
||||
fill_ul_rb_mask(gNB, frame_rx, slot_rx);
|
||||
|
||||
gNB_I0_measurements(gNB);
|
||||
|
||||
@@ -121,6 +121,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
|
||||
dlsch0_harq->Nl=1;
|
||||
dlsch0_harq->mcs_table=dlsch_config_pdu->mcs_table;
|
||||
dlsch0_harq->harq_ack.rx_status = downlink_harq_process(dlsch0_harq, dlsch0->current_harq_pid, dlsch_config_pdu->ndi, dlsch0->rnti_type);
|
||||
dlsch0_harq->status = ACTIVE; //Gokul
|
||||
if (dlsch0_harq->status != ACTIVE) {
|
||||
// dlsch0_harq->status not ACTIVE may be due to false retransmission. Reset the
|
||||
// following flag to skip PDSCH procedures in that case.
|
||||
|
||||
@@ -104,7 +104,10 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
|
||||
nfapi_nr_tx_data_request_t *TX_req = &gNB->TX_req[0];
|
||||
|
||||
gNB->pdu_index[CC_idP] = 0;
|
||||
|
||||
if (NFAPI_MODE == NFAPI_MODE_VNF)
|
||||
{
|
||||
memset(pdcch, 0, sizeof(**pdcch) * MAX_NUM_BWP * MAX_NUM_CORESET);
|
||||
}
|
||||
if (NFAPI_MODE == NFAPI_MONOLITHIC || NFAPI_MODE == NFAPI_MODE_PNF) { // monolithic or PNF
|
||||
|
||||
DL_req[CC_idP].SFN = frameP;
|
||||
@@ -303,14 +306,13 @@ bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) {
|
||||
void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
frame_t frame,
|
||||
sub_frame_t slot){
|
||||
|
||||
gNB_MAC_INST *mac = RC.nrmac[module_idP];
|
||||
nfapi_nr_config_request_scf_t *cfg = &mac->config[0];
|
||||
protocol_ctxt_t ctxt;
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame, slot,module_idP);
|
||||
|
||||
int nb_periods_per_frame;
|
||||
|
||||
const int bwp_id = 1;
|
||||
|
||||
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
|
||||
NR_COMMON_channels_t *cc = gNB->common_channels;
|
||||
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
|
||||
@@ -356,7 +358,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
int num_slots_per_tdd = (nr_slots_per_frame[*scc->ssbSubcarrierSpacing])/nb_periods_per_frame;
|
||||
|
||||
const int nr_ulmix_slots = tdd_pattern->nrofUplinkSlots + (tdd_pattern->nrofUplinkSymbols!=0);
|
||||
|
||||
start_meas(&RC.nrmac[module_idP]->eNB_scheduler);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_IN);
|
||||
|
||||
@@ -387,9 +388,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
// clear last scheduled slot's content (only)!
|
||||
const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
|
||||
const int last_slot = (slot + num_slots - 1) % num_slots;
|
||||
const int two_slots_back = (slot + num_slots - 2) % num_slots;
|
||||
uint16_t *vrb_map_UL = cc[CC_id].vrb_map_UL;
|
||||
memset(&vrb_map_UL[last_slot * MAX_BWP_SIZE], 0, sizeof(uint16_t) * MAX_BWP_SIZE);
|
||||
|
||||
memset(&vrb_map_UL[two_slots_back * MAX_BWP_SIZE], 0, sizeof(uint16_t) * MAX_BWP_SIZE);
|
||||
clear_nr_nfapi_information(RC.nrmac[module_idP], CC_id, frame, slot);
|
||||
}
|
||||
|
||||
@@ -434,15 +436,19 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
|
||||
// This schedules the DCI for Uplink and subsequently PUSCH
|
||||
{
|
||||
nr_schedule_ulsch(module_idP, frame, slot, num_slots_per_tdd, nr_ulmix_slots, ulsch_in_slot_bitmap);
|
||||
if(NFAPI_MODE == NFAPI_MODE_VNF){
|
||||
gNB->UL_tti_req_ahead[0][7].SFN = frame;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 7
|
||||
gNB->UL_tti_req_ahead[0][8].SFN = frame;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 8
|
||||
gNB->UL_tti_req_ahead[0][9].SFN = frame;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 9
|
||||
gNB->UL_tti_req[0] = &gNB->UL_tti_req_ahead[0][slot];
|
||||
}
|
||||
//nr_schedule_ulsch(module_idP, frame, slot, num_slots_per_tdd, nr_ulmix_slots, ulsch_in_slot_bitmap);
|
||||
}
|
||||
|
||||
// This schedules the DCI for Downlink and PDSCH
|
||||
if (is_xlsch_in_slot(dlsch_in_slot_bitmap, slot))
|
||||
nr_schedule_ue_spec(module_idP, frame, slot);
|
||||
|
||||
|
||||
nr_schedule_pucch(module_idP, frame, slot);
|
||||
//nr_schedule_pucch(module_idP, frame, slot);
|
||||
|
||||
stop_meas(&RC.nrmac[module_idP]->eNB_scheduler);
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
|
||||
/*Softmodem params*/
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "../../../nfapi/oai_integration/vendor_ext.h"
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
/////* DLSCH MAC PDU generation (6.1.2 TS 38.321) */////
|
||||
@@ -651,7 +652,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
frame_t frame,
|
||||
sub_frame_t slot) {
|
||||
gNB_MAC_INST *gNB_mac = RC.nrmac[module_id];
|
||||
|
||||
|
||||
/* PREPROCESSOR */
|
||||
gNB_mac->pre_processor_dl(module_id, frame, slot);
|
||||
|
||||
@@ -716,6 +717,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
int8_t current_harq_pid = sched_ctrl->dl_harq_pid;
|
||||
if (current_harq_pid < 0) {
|
||||
/* PP has not selected a specific HARQ Process, get a new one */
|
||||
if (NFAPI_MODE == NFAPI_MODE_VNF)
|
||||
sched_ctrl->available_dl_harq.head = 0;
|
||||
current_harq_pid = sched_ctrl->available_dl_harq.head;
|
||||
AssertFatal(current_harq_pid >= 0,
|
||||
"no free HARQ process available for UE %d\n",
|
||||
@@ -732,6 +735,9 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
remove_nr_list(&sched_ctrl->retrans_dl_harq, current_harq_pid);
|
||||
}
|
||||
NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid];
|
||||
if (NFAPI_MODE == NFAPI_MODE_VNF) {
|
||||
harq->is_waiting = false;
|
||||
}
|
||||
DevAssert(!harq->is_waiting);
|
||||
add_tail_nr_list(&sched_ctrl->feedback_dl_harq, current_harq_pid);
|
||||
NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[0];
|
||||
@@ -765,7 +771,15 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
const int bwpid = sched_ctrl->active_bwp->bwp_Id;
|
||||
const int coresetid = sched_ctrl->coreset->controlResourceSetId;
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid];
|
||||
//nfapi_nr_dl_tti_pdcch_pdu_rel15_t temp;
|
||||
// if(NFAPI_MODE == NFAPI_MODE_VNF){
|
||||
// memcpy(temp,gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid],sizeof(nfapi_nr_dl_tti_pdcch_pdu_rel15_t));
|
||||
// pdcch_pdu = temp;
|
||||
|
||||
// }
|
||||
|
||||
if (!pdcch_pdu) {
|
||||
printf("creating pdcch pdu, pdcch_pdu = NULL. \n");
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
||||
memset(dl_tti_pdcch_pdu, 0, sizeof(nfapi_nr_dl_tti_request_pdu_t));
|
||||
dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE;
|
||||
|
||||
@@ -1666,6 +1666,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secon
|
||||
const NR_PDSCH_ServingCellConfig_t *pdsch = servingCellConfig->pdsch_ServingCellConfig->choice.setup;
|
||||
const int nrofHARQ = pdsch->nrofHARQ_ProcessesForPDSCH ?
|
||||
get_nrofHARQ_ProcessesForPDSCH(*pdsch->nrofHARQ_ProcessesForPDSCH) : 8;
|
||||
printf("nrofHARQ = %d\n", nrofHARQ);
|
||||
// add all available DL HARQ processes for this UE
|
||||
create_nr_list(&sched_ctrl->available_dl_harq, nrofHARQ);
|
||||
for (int harq = 0; harq < nrofHARQ; harq++)
|
||||
|
||||
@@ -235,6 +235,8 @@ void nr_csi_meas_reporting(int Mod_idP,
|
||||
// find free PUCCH that is in order with possibly existing PUCCH
|
||||
// schedulings (other CSI, SR)
|
||||
NR_sched_pucch_t *curr_pucch = &sched_ctrl->sched_pucch[2];
|
||||
if(NFAPI_MODE == NFAPI_MODE_VNF)
|
||||
curr_pucch->csi_bits = 0;
|
||||
AssertFatal(curr_pucch->csi_bits == 0
|
||||
&& !curr_pucch->sr_flag
|
||||
&& curr_pucch->dai_c == 0,
|
||||
@@ -458,11 +460,19 @@ bool nr_acknack_scheduling(int mod_id,
|
||||
"illegal number of bits in PUCCH of UE %d\n",
|
||||
UE_id);
|
||||
/* if the currently allocated PUCCH of this UE is full, allocate it */
|
||||
pucch->sr_flag = 1; pucch->dai_c = 1;
|
||||
if (pucch->sr_flag + pucch->dai_c == max_acknacks) {
|
||||
/* advance the UL slot information in PUCCH by one so we won't schedule in
|
||||
* the same slot again */
|
||||
const int f = pucch->frame;
|
||||
const int s = pucch->ul_slot;
|
||||
if(NFAPI_MODE == NFAPI_MODE_VNF){
|
||||
gNB_MAC_INST *gNB = RC.nrmac[mod_id];
|
||||
gNB->UL_tti_req_ahead[0][7].SFN = f;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 7
|
||||
gNB->UL_tti_req_ahead[0][8].SFN = f;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 8
|
||||
gNB->UL_tti_req_ahead[0][9].SFN = f;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 9
|
||||
gNB->UL_tti_req[0] = &gNB->UL_tti_req_ahead[0][slot];
|
||||
}
|
||||
nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id);
|
||||
memset(pucch, 0, sizeof(*pucch));
|
||||
pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f;
|
||||
@@ -481,6 +491,7 @@ bool nr_acknack_scheduling(int mod_id,
|
||||
UE_id);
|
||||
nr_fill_nfapi_pucch(mod_id, frame, slot, csi_pucch, UE_id);
|
||||
pucch->frame = s >= n_slots_frame - 2 ? (f + 1) % 1024 : f;
|
||||
printf("pucch frame filled. \n");
|
||||
pucch->ul_slot = (s + 2) % n_slots_frame;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
|
||||
//38.321 Table 6.1.3.1-1
|
||||
const uint32_t NR_SHORT_BSR_TABLE[32] = {
|
||||
@@ -882,6 +883,8 @@ void nr_schedule_ulsch(module_id_t module_id,
|
||||
if (harq_id < 0) {
|
||||
/* PP has not selected a specific HARQ Process, get a new one */
|
||||
harq_id = sched_ctrl->available_ul_harq.head;
|
||||
// if(NFAPI_MODE == NFAPI_MODE_VNF)
|
||||
// harq_id = 1;
|
||||
AssertFatal(harq_id >= 0,
|
||||
"no free HARQ process available for UE %d\n",
|
||||
UE_id);
|
||||
|
||||
@@ -105,7 +105,7 @@ 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;
|
||||
@@ -181,6 +181,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];
|
||||
nfapi_nr_config_request_scf_t *cfg = &mac->config[CC_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",
|
||||
UL_info->frame,UL_info->slot,
|
||||
module_id,CC_id, UL_info->rach_ind.number_of_pdus,
|
||||
@@ -199,8 +200,9 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
|
||||
}
|
||||
|
||||
handle_nr_rach(UL_info);
|
||||
|
||||
|
||||
handle_nr_uci(UL_info);
|
||||
|
||||
// clear HI prior to handling ULSCH
|
||||
mac->UL_dci_req[CC_id].numPdus = 0;
|
||||
handle_nr_ulsch(UL_info);
|
||||
@@ -212,12 +214,12 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) {
|
||||
(UL_info->frame+((UL_info->slot>(9-sl_ahead))?1:0)) % 1024,
|
||||
(UL_info->slot+sl_ahead)%10);
|
||||
*/
|
||||
nfapi_nr_config_request_scf_t *cfg = &mac->config[CC_id];
|
||||
|
||||
int spf = get_spf(cfg);
|
||||
gNB_dlsch_ulsch_scheduler(module_id,
|
||||
(UL_info->frame+((UL_info->slot>(spf-1-sl_ahead))?1:0)) % 1024,
|
||||
(UL_info->slot+sl_ahead)%spf);
|
||||
|
||||
|
||||
ifi->CC_mask = 0;
|
||||
sched_info->module_id = module_id;
|
||||
sched_info->CC_id = CC_id;
|
||||
|
||||
Reference in New Issue
Block a user