Commit 1ec934f9 authored by David Price's avatar David Price

Works up to message 3 reception at VNF

parent 5be8cf7b
This diff is collapsed.
......@@ -294,24 +294,10 @@ extern void init_eNB_afterRU(void);
void oai_create_enb(void)
{
static int bodge_counter = 0;
PHY_VARS_eNB *eNB;
int bodge_counter=0;
PHY_VARS_eNB *eNB = RC.eNB[0][0];
if (RC.eNB && RC.eNB[0] && RC.eNB[0][0])
{
eNB = RC.eNB[0][0];
printf("[VNF] RC.eNB[0][0]. Mod_id:%d CC_id:%d\n", eNB->Mod_id, eNB->CC_id);
}
else
{
printf("[VNF] DJP ***** RC.eNB[] and RC.eNB[%d][%d] RC.nb_CC[%d]=1 MALLOCING structure and zeroing *******\n", bodge_counter, bodge_counter, bodge_counter);
RC.eNB[bodge_counter] = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB**));
RC.eNB[bodge_counter][bodge_counter] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB));
memset((void*)RC.eNB[bodge_counter][bodge_counter],0,sizeof(PHY_VARS_eNB));
eNB = RC.eNB[bodge_counter][bodge_counter];
}
printf("[VNF] RC.eNB[0][0]. Mod_id:%d CC_id:%d nb_CC[0]:%d abstraction_flag:%d single_thread_flag:%d td:%p te:%p if_inst:%p\n", eNB->Mod_id, eNB->CC_id, RC.nb_CC[0], eNB->abstraction_flag, eNB->single_thread_flag, eNB->td, eNB->te, eNB->if_inst);
eNB->Mod_id = bodge_counter;
eNB->CC_id = bodge_counter;
......@@ -326,8 +312,6 @@ void oai_create_enb(void)
eNB->if_inst = IF_Module_init(bodge_counter);
}
//init_eNB_proc(bodge_counter);
// This will cause phy_config_request to be installed. That will result in RRC configuring the PHY
// that will result in eNB->configured being set to TRUE.
// See we need to wait for that to happen otherwise the NFAPI message exchanges won't contain the right parameter values
......@@ -343,7 +327,6 @@ void oai_create_enb(void)
} while(eNB->configured != 1);
}
void oai_enb_init(void)
{
init_eNB_afterRU();
......@@ -598,9 +581,6 @@ int phy_sync_indication(struct nfapi_vnf_p7_config* config, uint8_t sync)
}
}
//if (RC.eNB && RC.eNB[0][0]->configured)
//wake_eNB_rxtx(RC.eNB[0][0], 0, 0);
return(0);
}
......@@ -679,22 +659,101 @@ int phy_rach_indication(struct nfapi_vnf_p7_config* config, nfapi_rach_indicatio
int phy_harq_indication(struct nfapi_vnf_p7_config* config, nfapi_harq_indication_t* ind)
{
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_harq_ind(p7_vnf->mac, ind);
return 1;
LOG_E(MAC, "%s() NFAPI SFN/SF:%d number_of_preambles:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->harq_indication_body.number_of_harqs);
for (int i=0; i<ind->harq_indication_body.number_of_harqs; i++)
{
harq_indication(
0, // DJP - fixme
0, // DJP - fixme
NFAPI_SFNSF2SFN(ind->sfn_sf),
NFAPI_SFNSF2SF(ind->sfn_sf),
&ind->harq_indication_body.harq_pdu_list[i]
);
}
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_harq_ind(p7_vnf->mac, ind);
return 1;
}
int phy_crc_indication(struct nfapi_vnf_p7_config* config, nfapi_crc_indication_t* ind)
{
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
pthread_mutex_lock(&eNB->UL_INFO_mutex);
eNB->UL_INFO.crc_ind = *ind;
nfapi_crc_indication_t *dest_ind = &eNB->UL_INFO.crc_ind;
nfapi_crc_indication_pdu_t *dest_pdu_list = eNB->crc_pdu_list;
*dest_ind = *ind;
dest_ind->crc_indication_body.crc_pdu_list = dest_pdu_list;
LOG_E(MAC, "%s() NFAPI SFN/SF:%d IND:number_of_crcs:%u UL_INFO:crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->crc_indication_body.number_of_crcs, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs);
for (int i=0; i<ind->crc_indication_body.number_of_crcs; i++)
{
LOG_D(MAC, "%s() PDU[%d] rnti:%04x UL_INFO:rnti:%04x\n",
__FUNCTION__,
i,
ind->crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti,
eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list[i].rx_ue_information.rnti);
memcpy(&dest_ind->crc_indication_body.crc_pdu_list[i], &ind->crc_indication_body.crc_pdu_list[i], sizeof(ind->crc_indication_body.crc_pdu_list[0]));
}
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_crc_ind(p7_vnf->mac, ind);
return 1;
return 1;
}
int phy_rx_indication(struct nfapi_vnf_p7_config* config, nfapi_rx_indication_t* ind)
{
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_rx_ind(p7_vnf->mac, ind);
return 1;
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
LOG_E(MAC, "%s() NFAPI SFN/SF:%d number_of_pdus:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus);
pthread_mutex_lock(&eNB->UL_INFO_mutex);
nfapi_rx_indication_t *dest_ind = &eNB->UL_INFO.rx_ind;
nfapi_rx_indication_pdu_t *dest_pdu_list = eNB->rx_pdu_list;
*dest_ind = *ind;
dest_ind->rx_indication_body.rx_pdu_list = dest_pdu_list;
for(int i=0; i<ind->rx_indication_body.number_of_pdus; i++)
{
nfapi_rx_indication_pdu_t *dest_pdu = &dest_ind->rx_indication_body.rx_pdu_list[i];
nfapi_rx_indication_pdu_t *src_pdu = &ind->rx_indication_body.rx_pdu_list[i];
memcpy(dest_pdu, src_pdu, sizeof(*src_pdu));
// DJP - TODO FIXME - intentional memory leak
dest_pdu->data = malloc(dest_pdu->rx_indication_rel8.length);
memcpy(dest_pdu->data, src_pdu->data, dest_pdu->rx_indication_rel8.length);
LOG_E(PHY, "%s() handle:%d rnti:%04x length:%d offset:%d ul_cqi:%d ta:%d data:%p\n",
__FUNCTION__,
dest_pdu->rx_ue_information.handle,
dest_pdu->rx_ue_information.rnti,
dest_pdu->rx_indication_rel8.length,
dest_pdu->rx_indication_rel8.offset,
dest_pdu->rx_indication_rel8.ul_cqi,
dest_pdu->rx_indication_rel8.timing_advance,
dest_pdu->data
);
}
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_rx_ind(p7_vnf->mac, ind);
return 1;
}
int phy_srs_indication(struct nfapi_vnf_p7_config* config, nfapi_srs_indication_t* ind)
{
......@@ -710,10 +769,21 @@ int phy_sr_indication(struct nfapi_vnf_p7_config* config, nfapi_sr_indication_t*
}
int phy_cqi_indication(struct nfapi_vnf_p7_config* config, nfapi_cqi_indication_t* ind)
{
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_cqi_ind(p7_vnf->mac, ind);
return 1;
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_cqi_ind(p7_vnf->mac, ind);
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
LOG_E(MAC, "%s() NFAPI SFN/SF:%d number_of_cqis:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis);
pthread_mutex_lock(&eNB->UL_INFO_mutex);
eNB->UL_INFO.cqi_ind = ind->cqi_indication_body;
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
return 1;
}
int phy_lbt_dl_indication(struct nfapi_vnf_p7_config* config, nfapi_lbt_dl_indication_t* ind)
{
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
......@@ -1024,6 +1094,7 @@ printf("[VNF] DJP local_addr:%s\n", p7_vnf->local_addr);
req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG;
req->nfapi_config.timing_window.value = p7_vnf->timing_window;
printf("[VNF] Timing window:%d\n", p7_vnf->timing_window);
req->num_tlv++;
if(p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled)
......@@ -1300,3 +1371,49 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
}
return retval;
}
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req)
{
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
hi_dci0_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() HI_DCI0_REQ p7_config:%p phy_id:%d message_id:%d sfn_sf:%d number_of_dci:%d number_of_hi:%d\n", __FUNCTION__, p7_config, hi_dci0_req->header.phy_id, hi_dci0_req->header.message_id, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi);
int retval = nfapi_vnf_p7_hi_dci0_req(p7_config, hi_dci0_req);
if (retval!=0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
}
return retval;
}
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req)
{
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
//NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() header message_id:%d\n", __FUNCTION__, ul_config_req->header.message_id);
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() UL_CONFIG p7_config:%p phy_id:%d message_id:%d sfn_sf:%d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n",
__FUNCTION__, p7_config, ul_config_req->header.phy_id, ul_config_req->header.message_id, NFAPI_SFNSF2DEC(ul_config_req->sfn_sf),
ul_config_req->ul_config_request_body.number_of_pdus,
ul_config_req->ul_config_request_body.rach_prach_frequency_resources,
ul_config_req->ul_config_request_body.srs_present);
int retval = nfapi_vnf_p7_ul_config_req(p7_config, ul_config_req);
if (retval!=0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
}
else
{
// Reset number of PDUs so that it is not resent
ul_config_req->ul_config_request_body.number_of_pdus=0;
}
return retval;
}
This diff is collapsed.
......@@ -39,6 +39,10 @@
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req);
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req);
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req);
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req);
extern uint8_t nfapi_pnf;
void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB,
......@@ -640,7 +644,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
handle_nfapi_dci_dl_pdu(eNB,proc,dl_config_pdu);
eNB->pdcch_vars[subframe&1].num_dci++;
LOG_D(PHY,"Incremented num_dci:%d but already set??? dl_config:num_dci:%d\n", eNB->pdcch_vars[subframe&1].num_dci, number_dci);
LOG_E(PHY,"Incremented num_dci:%d but already set??? dl_config:num_dci:%d\n", eNB->pdcch_vars[subframe&1].num_dci, number_dci);
do_oai=1;
break;
case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
......@@ -661,7 +665,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
// handle_nfapi_mch_dl_pdu(eNB,dl_config_pdu);
break;
case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
LOG_D(PHY,"%s() NFAPI_DL_CONFIG_DLSCH_PDU_TYPE TX:%d/%d RX:%d/%d transport_blocks:%d pdu_index:%d data:%p\n", __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->frame_rx, proc->subframe_rx, dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks, dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index, TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data);
LOG_E(PHY,"%s() NFAPI_DL_CONFIG_DLSCH_PDU_TYPE TX:%d/%d RX:%d/%d transport_blocks:%d pdu_index:%d data:%p\n", __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->frame_rx, proc->subframe_rx, dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks, dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index, TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data);
/*
AssertFatal(dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index<TX_req->tx_request_body.number_of_pdus,
......@@ -712,14 +716,17 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
}
}
#if 1
if (do_oai)
if (nfapi_pnf && do_oai)
{
oai_nfapi_tx_req(Sched_INFO->TX_req);
oai_nfapi_dl_config_req(Sched_INFO->DL_req); // DJP - .dl_config_request_body.dl_config_pdu_list[0]); // DJP - FIXME TODO - yuk - only copes with 1 pdu
}
#endif
if (nfapi_pnf && number_hi_dci0_pdu!=0)
{
oai_nfapi_hi_dci0_req(HI_DCI0_req);
}
for (i=0;i<number_hi_dci0_pdu;i++) {
......@@ -731,7 +738,9 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
case NFAPI_HI_DCI0_DCI_PDU_TYPE:
handle_nfapi_hi_dci0_dci_pdu(eNB,proc,hi_dci0_req_pdu);
eNB->pdcch_vars[subframe&1].num_dci++;
break;
......@@ -742,6 +751,20 @@ void schedule_response(Sched_Rsp_t *Sched_INFO)
}
}
if (nfapi_pnf)
{
for (int future_subframe=0;future_subframe<10;future_subframe++)
{
// DJP - indexing directly into the mac - not good - ??????
if (RC.mac[0]->UL_req_tmp[CC_id][future_subframe].ul_config_request_body.number_of_pdus > 0)
{
LOG_D(PHY,"UL_CONFIG for the future future_subframe:%d PDUs:%d\n", future_subframe, RC.mac[0]->UL_req_tmp[CC_id][future_subframe].ul_config_request_body.number_of_pdus);
oai_nfapi_ul_config_req(&RC.mac[0]->UL_req_tmp[CC_id][future_subframe]);
}
}
}
for (i=0;i<number_ul_pdu;i++) {
ul_config_pdu = &UL_req->ul_config_request_body.ul_config_pdu_list[i];
LOG_D(PHY,"NFAPI: ul_pdu %d : type %d\n",i,ul_config_pdu->pdu_type);
......
......@@ -477,8 +477,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
num_dci = eNB->pdcch_vars[subframe&1].num_dci;
// LOG_D(PHY,"num_pdcch_symbols %"PRIu8",(dci common %"PRIu8", dci uespec %"PRIu8"\n",num_pdcch_symbols,
// DCI_pdu->Num_common_dci,DCI_pdu->Num_ue_spec_dci);
LOG_D(PHY,"num_pdcch_symbols %"PRIu8",(number dci %"PRIu8"\n",num_pdcch_symbols,
num_dci);
//LOG_D(PHY,"num_pdcch_symbols %"PRIu8",number dci %"PRIu8"\n",num_pdcch_symbols, num_dci);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO,num_pdcch_symbols);
......@@ -487,10 +486,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
if (num_dci > 0)
LOG_D(PHY,"[eNB %"PRIu8"] Frame %d, subframe %d: Calling generate_dci_top (pdcch) (num_dci %"PRIu8") num_pdcch_symbols:%d\n",eNB->Mod_id,frame, subframe, num_dci, num_pdcch_symbols);
LOG_D(PHY,"Before generate_dci_top num_pdcch_symbols:%d num_dci:%d dci_alloc:dci_length:%d\n",
num_pdcch_symbols,
num_dci,
eNB->pdcch_vars[subframe&1].dci_alloc[0].dci_length);
//LOG_D(PHY,"Before generate_dci_top num_pdcch_symbols:%d num_dci:%d dci_alloc:dci_length:%d\n", num_pdcch_symbols, num_dci, eNB->pdcch_vars[subframe&1].dci_alloc[0].dci_length);
generate_dci_top(num_pdcch_symbols,
num_dci,
......@@ -786,6 +782,7 @@ void fill_sr_indication(PHY_VARS_eNB *eNB,uint16_t rnti,int frame,int subframe,u
pdu->instance_length = 0; // don't know what to do with this
// pdu->rx_ue_information.handle = handle;
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
pdu->rx_ue_information.rnti = rnti;
int SNRtimes10 = dB_fixed_times10(stat) - 200;//(10*eNB->measurements.n0_power_dB[0]);
......@@ -1386,7 +1383,7 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
stop_meas(&eNB->ulsch_decoding_stats);
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d RNTI %x RX power (%d,%d) N0 (%d,%d) dB ACK (%d,%d), decoding iter %d\n",
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d RNTI %x RX power (%d,%d) N0 (%d,%d) dB ACK (%d,%d), decoding iter %d ulsch_harq->cqi_crc_status:%d ackBits:%d\n",
eNB->Mod_id,harq_pid,
frame,subframe,
ulsch->rnti,
......@@ -1396,7 +1393,9 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
20,//eNB->measurements.n0_power_dB[1],
ulsch_harq->o_ACK[0],
ulsch_harq->o_ACK[1],
ret);
ret,
ulsch_harq->cqi_crc_status,
ulsch_harq->O_ACK);
//compute the expected ULSCH RX power (for the stats)
......@@ -1445,6 +1444,9 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) {
);
#endif
} // ulsch in error
else {
fill_crc_indication(eNB,i,frame,subframe,0); // indicate ACK to MAC
fill_rx_indication(eNB,i,frame,subframe); // indicate SDU to MAC
......@@ -1561,12 +1563,18 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe) {
frame,subframe);
pthread_mutex_lock(&eNB->UL_INFO_mutex);
pdu = &eNB->UL_INFO.rx_ind.rx_pdu_list[eNB->UL_INFO.rx_ind.number_of_pdus];
eNB->UL_INFO.rx_ind.sfn_sf = frame<<4| subframe;
eNB->UL_INFO.rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
pdu = &eNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list[eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus];
// pdu->rx_ue_information.handle = eNB->ulsch[UE_id]->handle;
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
pdu->rx_ue_information.rnti = eNB->ulsch[UE_id]->rnti;
pdu->rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
pdu->rx_indication_rel8.length = eNB->ulsch[UE_id]->harq_processes[harq_pid]->TBS>>3;
pdu->rx_indication_rel8.offset = 0; // filled in at the end of the UL_INFO formation
pdu->rx_indication_rel8.offset = 1; // DJP - I dont understand - but broken unless 1 ???? 0; // filled in at the end of the UL_INFO formation
pdu->data = eNB->ulsch[UE_id]->harq_processes[harq_pid]->b;
// estimate timing advance for MAC
sync_pos = lte_est_timing_advance_pusch(eNB,UE_id);
......@@ -1613,7 +1621,7 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe) {
harq_pid,SNRtimes10,pdu->rx_indication_rel8.ul_cqi,pdu->rx_indication_rel8.timing_advance,
timing_advance_update);
eNB->UL_INFO.rx_ind.number_of_pdus++;
eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus++;
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
}
......@@ -1709,11 +1717,13 @@ void fill_ulsch_cqi_indication(PHY_VARS_eNB *eNB,uint16_t frame,uint8_t subframe
nfapi_cqi_indication_pdu_t *pdu = &eNB->UL_INFO.cqi_ind.cqi_pdu_list[eNB->UL_INFO.cqi_ind.number_of_cqis];
nfapi_cqi_indication_raw_pdu_t *raw_pdu = &eNB->UL_INFO.cqi_ind.cqi_raw_pdu_list[eNB->UL_INFO.cqi_ind.number_of_cqis];
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
pdu->rx_ue_information.rnti = rnti;
if (ulsch_harq->cqi_crc_status != 1) pdu->cqi_indication_rel9.data_offset = 0;
else pdu->cqi_indication_rel9.data_offset = 1; // fill in after all cqi_indications have been generated when non-zero
// by default set O to rank 1 value
pdu->cqi_indication_rel9.tl.tag = NFAPI_CQI_INDICATION_REL9_TAG;
pdu->cqi_indication_rel9.length = (ulsch_harq->Or1>>3) + ((ulsch_harq->Or1&7) > 0 ? 1 : 0);
pdu->cqi_indication_rel9.ri[0] = 0;
......@@ -1728,6 +1738,8 @@ void fill_ulsch_cqi_indication(PHY_VARS_eNB *eNB,uint16_t frame,uint8_t subframe
pdu->ul_cqi_information.channel = 1; // PUSCH
memcpy((void*)raw_pdu->pdu,ulsch_harq->o,pdu->cqi_indication_rel9.length);
eNB->UL_INFO.cqi_ind.number_of_cqis++;
LOG_E(PHY,"eNB->UL_INFO.cqi_ind.number_of_cqis:%d\n", eNB->UL_INFO.cqi_ind.number_of_cqis);
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
}
......@@ -1747,6 +1759,7 @@ void fill_ulsch_harq_indication(PHY_VARS_eNB *eNB,LTE_UL_eNB_HARQ_t *ulsch_harq,
pdu->rx_ue_information.rnti = rnti;
if (eNB->frame_parms.frame_type == FDD) {
pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
pdu->harq_indication_fdd_rel13.mode = 0;
pdu->harq_indication_fdd_rel13.number_of_ack_nack = ulsch_harq->O_ACK;
......@@ -1772,6 +1785,7 @@ void fill_ulsch_harq_indication(PHY_VARS_eNB *eNB,LTE_UL_eNB_HARQ_t *ulsch_harq,
M=ul_ACK_subframe2_M(&eNB->frame_parms,
subframe);
pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG;
pdu->harq_indication_fdd_rel13.mode = 1-bundling;
pdu->harq_indication_fdd_rel13.number_of_ack_nack = ulsch_harq->O_ACK;
......@@ -1791,7 +1805,9 @@ void fill_ulsch_harq_indication(PHY_VARS_eNB *eNB,LTE_UL_eNB_HARQ_t *ulsch_harq,
}
}
LOG_E(PHY,"eNB->UL_INFO.harq_ind.number_of_harqs:%d\n", eNB->UL_INFO.harq_ind.number_of_harqs);
eNB->UL_INFO.harq_ind.number_of_harqs++;
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
}
......@@ -1951,6 +1967,7 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
eNB->UL_INFO.harq_ind.number_of_harqs++;
LOG_E(PHY,"Incremented eNB->UL_INFO.harq_ind.number_of_harqs:%d\n", eNB->UL_INFO.harq_ind.number_of_harqs);
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
}
......@@ -1959,14 +1976,22 @@ void fill_uci_harq_indication(PHY_VARS_eNB *eNB,
void fill_crc_indication(PHY_VARS_eNB *eNB,int UE_id,int frame,int subframe,uint8_t crc_flag) {
pthread_mutex_lock(&eNB->UL_INFO_mutex);
nfapi_crc_indication_pdu_t *pdu = &eNB->UL_INFO.crc_ind.crc_pdu_list[eNB->UL_INFO.crc_ind.number_of_crcs];
nfapi_crc_indication_pdu_t *pdu = &eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list[eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs];
eNB->UL_INFO.crc_ind.sfn_sf = frame<<4 | subframe;
eNB->UL_INFO.crc_ind.crc_indication_body.tl.tag = NFAPI_CRC_INDICATION_BODY_TAG;
pdu->instance_length = 0; // don't know what to do with this
// pdu->rx_ue_information.handle = handle;
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
pdu->rx_ue_information.rnti = eNB->ulsch[UE_id]->rnti;
pdu->crc_indication_rel8.tl.tag = NFAPI_CRC_INDICATION_REL8_TAG;
pdu->crc_indication_rel8.crc_flag = crc_flag;
eNB->UL_INFO.crc_ind.number_of_crcs++;
eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs++;
LOG_D(PHY, "%s() rnti:%04x pdus:%d\n", __FUNCTION__, pdu->rx_ue_information.rnti, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs);
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
}
......@@ -1996,10 +2021,6 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
eNB->rb_mask_ul[2]=0;
eNB->rb_mask_ul[3]=0;
// Fix me here, these should be locked
eNB->UL_INFO.rx_ind.number_of_pdus = 0;
eNB->UL_INFO.crc_ind.number_of_crcs = 0;
// Call SRS first since all others depend on presence of SRS or lack thereof
srs_procedures(eNB,proc);
......
......@@ -245,6 +245,8 @@ void schedule_SR(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
ul_req = &RC.mac[module_idP]->UL_req[CC_id].ul_config_request_body;
LOG_E(MAC, "UE active UE_id:%d ul_req->number_of_pdus:%d\n", UE_id, ul_req->number_of_pdus);
AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated != NULL, "physicalConfigDedicated is null for UE %d\n",UE_id);
// drop the allocation if the UE hasn't send RRCConnectionSetupComplete yet
......@@ -417,23 +419,29 @@ void copy_ulreq(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP)
{
int CC_id;
eNB_MAC_INST *eNB;
nfapi_ul_config_request_body_t *ul_req_tmp;
nfapi_ul_config_request_body_t *ul_req;
nfapi_ul_config_request_body_t *ul_req_body_tmp;
nfapi_ul_config_request_body_t *ul_req_body;
eNB = RC.mac[module_idP];
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
ul_req_tmp = &eNB->UL_req_tmp[CC_id][subframeP].ul_config_request_body;
ul_req = &eNB->UL_req[CC_id].ul_config_request_body;
ul_req_body_tmp = &eNB->UL_req_tmp[CC_id][subframeP].ul_config_request_body;
ul_req_body = &eNB->UL_req[CC_id].ul_config_request_body;
eNB->UL_req[CC_id].sfn_sf = (frameP<<4) + subframeP;
ul_req->number_of_pdus = ul_req_tmp->number_of_pdus;
ul_req_tmp->number_of_pdus = 0;
eNB->UL_req[CC_id].header = eNB->UL_req_tmp[CC_id][subframeP].header;
ul_req_body->number_of_pdus = ul_req_body_tmp->number_of_pdus;
ul_req_body_tmp->number_of_pdus = 0;
if (ul_req_body->number_of_pdus>0)
{
LOG_E(PHY, "%s() Copy ul_req pdus:%d\n", __FUNCTION__, ul_req_body->number_of_pdus);
}
memcpy((void*)ul_req->ul_config_pdu_list,
(void*)ul_req_tmp->ul_config_pdu_list,
ul_req->number_of_pdus*sizeof(nfapi_ul_config_request_pdu_t));
memcpy((void*)ul_req_body->ul_config_pdu_list,
(void*)ul_req_body_tmp->ul_config_pdu_list,
ul_req_body->number_of_pdus*sizeof(nfapi_ul_config_request_pdu_t));
}
}
......
......@@ -62,6 +62,35 @@
#include "T.h"
void add_subframe(int *frameP, int *subframeP, int offset)
{
*frameP = *frameP + ((*subframeP + offset) / 10);
*subframeP = ((*subframeP + offset) % 10);
}
uint16_t sfnsf_add_subframe(int frameP, int subframeP, int offset)
{
add_subframe(&frameP, &subframeP, offset);
return frameP<<4|subframeP;
}
void subtract_subframe(int *frameP, int *subframeP, int offset)
{
if (*subframeP < offset)
{
*frameP = (*frameP+1024-1)%1024;
}
*subframeP = (*subframeP+10-offset)%10;
}
uint16_t sfnsf_subtrace_subframe(int frameP, int subframeP, int offset)
{
subtract_subframe(&frameP, &subframeP, offset);
return frameP<<4|subframeP;
}
void add_msg3(module_id_t module_idP,int CC_id, RA_TEMPLATE *RA_template, frame_t frameP, sub_frame_t subframeP) {
eNB_MAC_INST *eNB = RC.mac[module_idP];
......@@ -112,12 +141,18 @@ void add_msg3(module_id_t module_idP,int CC_id, RA_TEMPLATE *RA_template, frame_
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size = get_TBS_UL(RA_template->msg3_mcs,
RA_template->msg3_nb_rb);
// Re13 fields
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.ue_type = RA_template->rach_resource_type>2 ? 2 : 1;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.total_number_of_repetitions = 1;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.repetition_number = 1;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel13.initial_transmission_sf_io = (RA_template->Msg3_frame*10)+RA_template->Msg3_subframe;
ul_req_body->number_of_pdus++;
ul_req_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
// nFAPI on PNF is running at TX SFN/SF (so 4 ahead), so we need to add 4 to the SFN/SF so that the receive happens at the right time
ul_req->sfn_sf = sfnsf_add_subframe(RA_template->Msg3_frame, RA_template->Msg3_subframe, 4);
ul_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
} // if (RA_template->rach_resource_type>0) {
else
#endif
......@@ -153,6 +188,8 @@ void add_msg3(module_id_t module_idP,int CC_id, RA_TEMPLATE *RA_template, frame_
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size = get_TBS_UL(10,RA_template->msg3_nb_rb);
ul_req_body->number_of_pdus++;
ul_req_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
ul_req->sfn_sf = sfnsf_add_subframe(RA_template->Msg3_frame, RA_template->Msg3_subframe, 4);
ul_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
// save UL scheduling information for preprocessor
for (j=0;j<RA_template->msg3_nb_rb;j++) cc->vrb_map_UL[RA_template->msg3_first_rb+j]=1;
......@@ -167,6 +204,11 @@ void add_msg3(module_id_t module_idP,int CC_id, RA_TEMPLATE *RA_template, frame_
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.cyclic_shift_2_for_drms = 0;
hi_dci0_pdu->hi_pdu.hi_pdu_rel8.hi_value = 0;
hi_dci0_req->number_of_hi++;
eNB->HI_DCI0_req[CC_id].sfn_sf = sfnsf_add_subframe(RA_template->Msg3_frame, RA_template->Msg3_subframe, 4);
eNB->HI_DCI0_req[CC_id].hi_dci0_request_body.tl.tag = NFAPI_HI_DCI0_REQUEST_BODY_TAG;
eNB->HI_DCI0_req[CC_id].header.message_id = NFAPI_HI_DCI0_REQUEST;
// save UL scheduling information for preprocessor
for (j=0;j<RA_template->msg3_nb_rb;j++) cc->vrb_map_UL[RA_template->msg3_first_rb+j]=1;
......@@ -320,6 +362,9 @@ void generate_Msg2(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
RA_template->Msg2_subframe = (RA_template->Msg2_subframe+9)%10;
eNB->DL_req[CC_idP].sfn_sf = sfnsf_add_subframe(RA_template->Msg2_frame, RA_template->Msg2_subframe, 4); // nFAPI is runnning at TX SFN/SF - ie 4 ahead
eNB->DL_req[CC_idP].header.message_id = NFAPI_DL_CONFIG_REQUEST;
} //repetition_count==0 && SF condition met
if (RA_template->msg2_mpdcch_repetition_cnt>0) { // we're in a stream of repetitions
LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, MPDCCH repetition %d\n",
......@@ -537,7 +582,8 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
nfapi_tx_request_pdu_t *TX_req;
UE_list_t *UE_list=&eNB->UE_list;
nfapi_dl_config_request_body_t *dl_req;
nfapi_ul_config_request_body_t *ul_req;
nfapi_ul_config_request_body_t *ul_req_body;
nfapi_ul_config_request_t *ul_req;
uint8_t lcid;
uint8_t offset;
......@@ -709,6 +755,9 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
dl_req->number_pdu++;
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
eNB->DL_req[CC_idP].sfn_sf = (frameP<<4)+subframeP;
eNB->DL_req[CC_idP].header.message_id = NFAPI_DL_CONFIG_REQUEST;
} //repetition_count==0 && SF condition met
else if (RA_template->msg4_mpdcch_repetition_cnt>0) { // we're in a stream of repetitions
RA_template->msg4_mpdcch_repetition_cnt++;
......@@ -769,6 +818,9 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = 0;
dl_req->number_pdu++;
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
eNB->DL_req[CC_idP].sfn_sf = (frameP<<4)+subframeP;
eNB->DL_req[CC_idP].header.message_id = NFAPI_DL_CONFIG_REQUEST;
RA_template->generate_Msg4=0;
RA_template->wait_ack_Msg4=1;
......@@ -805,9 +857,10 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
rrc_sdu_length);
// DL request
eNB->TX_req[CC_idP].sfn_sf = (frameP<<4)+subframeP;
eNB->TX_req[CC_idP].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
eNB->TX_req[CC_idP].header.message_id = NFAPI_TX_REQUEST;
eNB->TX_req[CC_idP].sfn_sf = (frameP<<4)+subframeP;
eNB->TX_req[CC_idP].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
eNB->TX_req[CC_idP].header.message_id = NFAPI_TX_REQUEST;
TX_req = &eNB->TX_req[CC_idP].tx_request_body.tx_pdu_list[eNB->TX_req[CC_idP].tx_request_body.number_of_pdus];
TX_req->pdu_length = rrc_sdu_length;
TX_req->pdu_index = eNB->pdu_index[CC_idP]++;
......@@ -821,17 +874,26 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
// see Section 10.2 from 36.213
int ackNAK_absSF = absSF + reps + 4;
AssertFatal(reps>2,"Have to handle programming of ACK when PDSCH repetitions is > 2\n");
ul_req = &eNB->UL_req_tmp[CC_idP][ackNAK_absSF%10].ul_config_request_body;
ul_config_pdu = &ul_req->ul_config_pdu_list[ul_req->number_of_pdus];
ul_req = &eNB->UL_req_tmp[CC_idP][ackNAK_absSF%10];
ul_req_body = &ul_req->ul_config_request_body;
ul_config_pdu = &ul_req_body->ul_config_pdu_list[ul_req_body->number_of_pdus];
ul_config_pdu->pdu_type = NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE;
ul_config_pdu->pdu_size = (uint8_t)(2+sizeof(nfapi_ul_config_uci_harq_pdu));
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG;
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.handle = 0; // don't know how to use this
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti = RA_template->rnti;
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.tl.tag = NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG;
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.ue_type = (RA_template->rach_resource_type < 3) ? 1 : 2;
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.empty_symbols = 0;
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.total_number_of_repetitions = pucchreps[RA_template->rach_resource_type-1];
ul_config_pdu->uci_harq_pdu.ue_information.ue_information_rel13.repetition_number = 0;
ul_req_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
ul_req->sfn_sf = sfnsf_add_subframe(RA_template->Msg3_frame, RA_template->Msg3_subframe, 4); // this is for +4 frame, but nFAPI already running at +4 (because 4 is latency of Tx)
ul_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
// Note need to keep sending this across reptitions!!!! Not really for PUCCH, to ask small-cell forum, we'll see for the other messages, maybe parameters change across repetitions and FAPI has to provide for that
if (cc[CC_idP].tdd_Config==NULL) { // FDD case
ul_config_pdu->uci_harq_pdu.harq_information.harq_information_rel8_fdd.n_pucch_1_0 = n1pucchan[RA_template->rach_resource_type-1];
......@@ -844,7 +906,7 @@ void generate_Msg4(module_id_t module_idP,int CC_idP,frame_t frameP,sub_frame_t
else {