Commit 53e7a572 authored by David Price's avatar David Price

Network search working again. Now calling generate_dci_top every subframe,...

Network search working again.  Now calling generate_dci_top every subframe, using dummy subframe if no data to transmit. MIB and SIB2/3 coming out.  UE sees cell
parent 142d96fd
This diff is collapsed.
......@@ -1161,9 +1161,12 @@ void vnf_start_thread(void* ptr)
}
static vnf_info vnf;
extern uint8_t nfapi_pnf;
/*------------------------------------------------------------------------------*/
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port)
{
nfapi_pnf = 2;
memset(&vnf, 0, sizeof(vnf));
memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs));
......
......@@ -72,6 +72,10 @@ int l1_north_init_eNB() {
}
}
}
else
{
LOG_I(PHY,"%s() Not installing PHY callbacks - RC.nb_L1_inst:%d RC.nb_L1_CC:%p RC.eNB:%p\n", __FUNCTION__, RC.nb_L1_inst, RC.nb_L1_CC, RC.eNB);
}
return(0);
}
......@@ -1728,13 +1732,13 @@ int phy_init_RU(RU_t *ru) {
#endif
}
LOG_D(PHY,"[INIT] %s() RC.nb_inst:%d \n", __FUNCTION__, RC.nb_inst);
LOG_E(PHY,"[INIT] %s() RC.nb_inst:%d \n", __FUNCTION__, RC.nb_inst);
for (i=0; i<RC.nb_inst; i++) {
for (p=0;p<15;p++) {
LOG_D(PHY,"[INIT] %s() nb_antenna_ports_eNB:%d \n", __FUNCTION__, ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB);
if (p<ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB || p==5) {
//LOG_E(PHY,"[INIT] %s() DO BEAM WEIGHTS nb_antenna_ports_eNB:%d nb_tx:%d\n", __FUNCTION__, ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB, ru->nb_tx);
LOG_D(PHY,"[INIT] %s() DO BEAM WEIGHTS nb_antenna_ports_eNB:%d nb_tx:%d\n", __FUNCTION__, ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB, ru->nb_tx);
ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
for (j=0; j<ru->nb_tx; j++) {
ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
......@@ -1838,7 +1842,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
if (i<fp->nb_antenna_ports_eNB || i==5) {
common_vars->txdataF[i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) );
LOG_E(PHY,"[INIT] common_vars->txdataF[%d] = %p (%lu bytes)\n",
LOG_D(PHY,"[INIT] common_vars->txdataF[%d] = %p (%lu bytes)\n",
i,common_vars->txdataF[i],
fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t));
}
......
......@@ -2074,6 +2074,11 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
int Msymb2;
int split_flag=0;
if (num_dci>0)
{
LOG_D(PHY,"%s(num_pdcch_symbols:%d num_dci:%d dci_alloc:%p n_rnti:%04x amp:%d frame_parms:%p txdataF:%p subframe:%d)\n", __FUNCTION__, num_pdcch_symbols, num_dci, dci_alloc, n_rnti, amp, frame_parms, txdataF, subframe);
}
switch (frame_parms->N_RB_DL) {
case 100:
Msymb2 = Msymb;
......@@ -2148,7 +2153,9 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
}
// Scrambling
// printf("pdcch scrambling\n");
#ifdef DEBUG_DCI_ENCODING
printf("pdcch scrambling\n");
#endif
pdcch_scrambling(frame_parms,
subframe,
e,
......@@ -2232,6 +2239,18 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
// This is the REG allocation algorithm from 36-211, second part of Section 6.8.5
// printf("DCI (SF %d) : txdataF %p (0 %p)\n",subframe,&txdataF[0][512*14*subframe],&txdataF[0][0]);
#ifdef DEBUG_DCI_ENCODING
printf("kprime loop - N_RB_DL:%d lprime:num_pdcch_symbols:%d Ncp:%d pcfich:%02x,%02x,%02x,%02x ofdm_symbol_size:%d first_carrier_offset:%d nb_antenna_ports_eNB:%d\n",
frame_parms->N_RB_DL, num_pdcch_symbols,frame_parms->Ncp,
frame_parms->pcfich_reg[0],
frame_parms->pcfich_reg[1],
frame_parms->pcfich_reg[2],
frame_parms->pcfich_reg[3],
frame_parms->ofdm_symbol_size,
frame_parms->first_carrier_offset,
frame_parms->nb_antenna_ports_eNB
);
#endif
for (kprime=0; kprime<frame_parms->N_RB_DL*12; kprime++) {
for (lprime=0; lprime<num_pdcch_symbols; lprime++) {
......
......@@ -801,6 +801,29 @@ void generate_RIV_tables()
// n_tilde_PRB(0,1) = (0,2)
void check_dlsch(char *file, int line)
{
PHY_VARS_eNB *eNB = RC.eNB[0][0];
static char oldbuf[13*NUMBER_OF_UE_MAX+100]="";
char buf[13*NUMBER_OF_UE_MAX+100];
char *pbuf=buf;
for (int i=0; i<NUMBER_OF_UE_MAX; i++) {
pbuf+=sprintf(pbuf, "[%02d]:%02x:%04x ", i, eNB->dlsch[i][0]->harq_mask, eNB->dlsch[i][0]->rnti);
}
int diff_size = memcmp(oldbuf, buf, strlen(buf));
if (diff_size!=0)
{
LOG_I(PHY,"check_dlsch:%s:%d:%s\n", file, line, buf);
LOG_I(PHY,"check_dlsch:%s:%d:%s\n", file, line, oldbuf);
}
memcpy(oldbuf, buf, sizeof(buf));
}
int8_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type)
{
uint8_t i;
......@@ -1990,6 +2013,7 @@ int fill_dci_and_dlsch(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC_t *dci_
computeRhoB_eNB(&eNB->pdsch_config_dedicated[UE_id],&(fp->pdsch_config_common),fp->nb_antenna_ports_eNB,dlsch1,dlsch1_harq->dl_power_off);
}
LOG_D(PHY, "%s() dci_length:%d\n", __FUNCTION__, dci_alloc->dci_length);
}
......@@ -4485,7 +4509,7 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci)
break;
case 25:
LOG_D(PHY,"DCI format0 (FDD, 5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n",
LOG_I(PHY,"DCI format0 (FDD, 5MHz), rnti %x (%x): hopping %d, rb_alloc %x, mcs %d, ndi %d, TPC %d, cshift %d, cqi_req %d\n",
dci->rnti,
((uint32_t*)&dci->dci_pdu[0])[0],
((DCI0_5MHz_FDD_t *)&dci->dci_pdu[0])->hopping,
......
......@@ -185,7 +185,7 @@ int generate_eNB_ulsch_params_from_rar(PHY_VARS_eNB *eNB,
LOG_D(PHY,"ulsch ra (eNB): harq_pid %d\n",harq_pid);
LOG_D(PHY,"ulsch ra (eNB): round %d\n",ulsch_harq->round);
LOG_D(PHY,"ulsch ra (eNB): TBS %d\n",ulsch_harq->TBS);
LOG_D(PHY,"ulsch ra (eNB): mcs %d\n",ulsch_harq->mcs);
LOG_D(PHY,"ulsch ra (eNB): mcs %d\n",ulsch_harq->Msc_initial);
LOG_D(PHY,"ulsch ra (eNB): Or1 %d\n",ulsch_harq->Or1);
LOG_D(PHY,"ulsch ra (eNB): ORI %d\n",ulsch_harq->O_RI);
#endif
......
......@@ -49,7 +49,7 @@ void handle_nfapi_dci_dl_pdu(PHY_VARS_eNB *eNB,
LTE_eNB_PDCCH *pdcch_vars = &eNB->pdcch_vars[idx];
nfapi_dl_config_dci_dl_pdu *pdu = &dl_config_pdu->dci_dl_pdu;
LOG_D(PHY,"Frame %d, Subframe %d: DCI processing\n",proc->frame_tx,proc->subframe_tx);
LOG_D(PHY,"Frame %d, Subframe %d: DCI processing - populating pdcch_vars->dci_alloc[%d] subframe_tx:%d idx:%d pdcch_vars->num_dci:%d\n",proc->frame_tx,proc->subframe_tx, pdcch_vars->num_dci, proc->subframe_tx, idx, pdcch_vars->num_dci);
// copy dci configuration into eNB structure
fill_dci_and_dlsch(eNB,proc,&pdcch_vars->dci_alloc[pdcch_vars->num_dci],pdu);
......@@ -582,6 +582,10 @@ void schedule_response(Sched_Rsp_t *Sched_INFO) {
// DJP - AssertFatal(proc->subframe_tx == subframe, "Current subframe %d != NFAPI subframe %d\n",proc->subframe_tx,subframe);
// DJP - AssertFatal(proc->subframe_tx == subframe, "Current frame %d != NFAPI frame %d\n",proc->frame_tx,frame);
uint8_t number_dci = DL_req->dl_config_request_body.number_dci;
uint8_t number_pdcch_ofdm_symbols = DL_req->dl_config_request_body.number_pdcch_ofdm_symbols;
uint8_t number_dl_pdu = DL_req->dl_config_request_body.number_pdu;
uint8_t number_hi_dci0_pdu = HI_DCI0_req->hi_dci0_request_body.number_of_dci+HI_DCI0_req->hi_dci0_request_body.number_of_hi;
uint8_t number_ul_pdu = UL_req->ul_config_request_body.number_of_pdus;
......@@ -593,12 +597,14 @@ void schedule_response(Sched_Rsp_t *Sched_INFO) {
int i;
eNB->pdcch_vars[subframe&1].num_pdcch_symbols = DL_req->dl_config_request_body.number_pdcch_ofdm_symbols;
eNB->pdcch_vars[subframe&1].num_dci = DL_req->dl_config_request_body.number_dci;
eNB->pdcch_vars[subframe&1].num_pdcch_symbols = number_pdcch_ofdm_symbols;
eNB->pdcch_vars[subframe&1].num_dci = number_dci;
eNB->phich_vars[subframe&1].num_hi = 0;
LOG_D(PHY,"NFAPI: Frame %d, Subframe %d: received %d dl_pdu, %d tx_req, %d hi_dci0_config_req, %d UL_config \n",
frame,subframe,number_dl_pdu,TX_req->tx_request_body.number_of_pdus,number_hi_dci0_pdu,number_ul_pdu);
LOG_D(PHY,"NFAPI: Frame %d, Subframe %d: received %d dl_pdu, %d tx_req, %d hi_dci0_config_req, %d UL_config num_pdcch_symbols:%d\n",
frame,subframe,number_dl_pdu,TX_req->tx_request_body.number_of_pdus,number_hi_dci0_pdu,number_ul_pdu,
eNB->pdcch_vars[subframe&1].num_pdcch_symbols
);
int do_oai =0;
......@@ -623,6 +629,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);
do_oai=1;
break;
case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
......@@ -643,7 +650,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_E(PHY,"%s() NFAPI_DL_CONFIG_DLSCH_PDU_TYPE TX:%d/%d RX:%d/%d\n", __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->frame_rx, proc->subframe_rx);
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);
AssertFatal(dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index<TX_req->tx_request_body.number_of_pdus,
"dlsch_pdu_rel8.pdu_index>=TX_req->number_of_pdus (%d>%d)\n",
......
......@@ -141,7 +141,7 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,int frame, int subframe) {
int **txdataF = eNB->common_vars.txdataF;
uint8_t *pbch_pdu=&eNB->pbch_pdu[0];
LOG_D(PHY,"common_signal_procedures: frame %d, subframe %d\n",frame,subframe);
LOG_D(PHY,"common_signal_procedures: frame %d, subframe %d fdd:%s dir:%s\n",frame,subframe,fp->frame_type == FDD?"FDD":"TDD", subframe_select(fp,subframe) == SF_DL?"DL":"UL?");
// generate Cell-Specific Reference Signals for both slots
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_RS_TX,1);
......@@ -483,15 +483,20 @@ 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);
generate_dci_top(num_pdcch_symbols,
num_dci,
&eNB->pdcch_vars[subframe&1].dci_alloc[0],
0,
AMP,
fp,
eNB->common_vars.txdataF,
subframe);
num_dci,
&eNB->pdcch_vars[subframe&1].dci_alloc[0],
0,
AMP,
fp,
eNB->common_vars.txdataF,
subframe);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0);
......@@ -1236,14 +1241,14 @@ void uci_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
}
if (SR_payload == 1) {
LOG_D(PHY,"[eNB %d][SR %x] Frame %d subframe %d Got SR for PUSCH, transmitting to MAC\n",eNB->Mod_id,
LOG_E(PHY,"[eNB %d][SR %x] Frame %d subframe %d Got SR for PUSCH, transmitting to MAC\n",eNB->Mod_id,
uci->rnti,frame,subframe);
if (eNB->first_sr[i] == 1) { // this is the first request for uplink after Connection Setup, so clear HARQ process 0 use for Msg4
eNB->first_sr[i] = 0;
eNB->dlsch[i][0]->harq_processes[0]->round=0;
eNB->dlsch[i][0]->harq_processes[0]->status=SCH_IDLE;
LOG_D(PHY,"[eNB %d][SR %x] Frame %d subframe %d First SR\n",
LOG_E(PHY,"[eNB %d][SR %x] Frame %d subframe %d First SR\n",
eNB->Mod_id,
eNB->ulsch[i]->rnti,frame,subframe);
}
......@@ -1582,7 +1587,10 @@ void release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subf
if ((dlsch1_harq == NULL)||
((dlsch1_harq!=NULL)&&
(dlsch1_harq->status == SCH_IDLE)))
{
dlsch0->harq_mask &= ~(1<<harq_pid);
LOG_I(PHY,"%s() UE_id:%d SFN/SF:%d/%d dlsch0->harq_mask:%02x\n", __FUNCTION__, UE_id, frame, subframe,dlsch0->harq_mask);
}
}
else { // release all processes in the bundle that was acked, based on mask
// This is at most 4 for multiplexing and 9 for bundling/special bundling
......@@ -1936,7 +1944,3 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
stop_meas(&eNB->phy_proc_rx);
}
......@@ -316,10 +316,14 @@ void *eNB_app_task(void *args_p)
itti_mark_task_ready (TASK_ENB_APP);
LOG_I(PHY, "%s() Task ready initialise structures\n", __FUNCTION__);
RCconfig_L1();
RCconfig_macrlc();
LOG_I(PHY, "%s() RC.nb_L1_inst:%d\n", __FUNCTION__, RC.nb_L1_inst);
if (RC.nb_L1_inst>0) AssertFatal(l1_north_init_eNB()==0,"could not initialize L1 north interface\n");
# if defined(ENABLE_ITTI)
......@@ -342,9 +346,11 @@ void *eNB_app_task(void *args_p)
LOG_I(ENB_APP,"Allocating eNB_RRC_INST for %d instances\n",RC.nb_inst);
RC.rrc = (eNB_RRC_INST **)malloc(RC.nb_inst*sizeof(eNB_RRC_INST *));
LOG_I(PHY, "%s() RC.nb_inst:%d RC.rrc:%p\n", __FUNCTION__, RC.nb_inst, RC.rrc);
for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) {
RC.rrc[enb_id] = (eNB_RRC_INST*)malloc(sizeof(eNB_RRC_INST));
LOG_I(PHY, "%s() Creating RRC instance RC.rrc[%d]:%p (%d of %d)\n", __FUNCTION__, enb_id, RC.rrc[enb_id], enb_id+1, enb_id_end);
memset((void *)RC.rrc[enb_id],0,sizeof(eNB_RRC_INST));
configure_rrc(enb_id);
}
......
......@@ -720,20 +720,12 @@ void RCconfig_L1(void) {
if (RC.eNB == NULL) {
RC.eNB = (PHY_VARS_eNB ***)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB***));
LOG_I(PHY,"DJP - have malloced RC.eNB - RC.eNB = %p\n",RC.eNB);
LOG_I(PHY,"RC.eNB:%p\n",RC.eNB);
memset(RC.eNB,0,(1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB***));
RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int));
printf("%s() RC.eNB:%p - RC.nb_L1_CC:%p\n", __FUNCTION__, RC.eNB, RC.nb_L1_CC);
LOG_I(PHY,"%s() RC.eNB:%p RC.nb_L1_CC:%p\n", __FUNCTION__, RC.eNB, RC.nb_L1_CC);
}
#if 0
if (RC.nb_L1_inst==0)
{
RC.nb_L1_inst = 1;
printf("********\n\n\n*********** DJP - hard coding RC.nb_L1_inst = 1 \n\n\n\n");
}
#endif
setting = config_lookup(&cfg, CONFIG_STRING_L1_LIST);
printf("%s() CONFIG_STRING_L1_LIST setting:%p\n", __FUNCTION__, setting);
......@@ -754,14 +746,6 @@ void RCconfig_L1(void) {
"Failed to parse configuration file %s, L1 %d config !\n",
RC.config_file_name, j);
}
else
{
#if 0
RC.nb_L1_CC[j] = 1;
printf("****DJP - hard coding nb_L1_CC[%d] = 1 *************\n", j, RC.nb_L1_CC[j]);
#endif
}
for (i=0;i<RC.nb_L1_CC[j];i++) {
if (RC.eNB[j][i] == NULL) {
......@@ -775,14 +759,14 @@ void RCconfig_L1(void) {
printf("l1 %d/%d (nb CC %d)\n",j,RC.nb_inst,RC.nb_L1_CC[j]);
if (setting)
if (setting_l1)
{
printf("RU %d: Transport %s\n",j,tr_n_preference);
if (!(config_setting_lookup_string(setting_l1, CONFIG_STRING_L1_TRANSPORT_N_PREFERENCE, (const char **)&tr_n_preference))) {
AssertFatal (0,
"Failed to parse configuration file %s, L1 %d config !\n",
RC.config_file_name, j);
}
printf("RU %d: Transport %s\n",j,tr_n_preference);
if (strcmp(tr_n_preference, "local_mac") == 0) {
......@@ -810,14 +794,23 @@ void RCconfig_L1(void) {
RC.eNB[j][0]->eth_params_n.remote_portc = remote_n_portc;
RC.eNB[j][0]->eth_params_n.my_portd = local_n_portd;
RC.eNB[j][0]->eth_params_n.remote_portd = remote_n_portd;
RC.eNB[j][0]->eth_params_n.transp_preference = ETH_UDP_MODE;
RC.eNB[j][0]->eth_params_n.transp_preference = ETH_UDP_MODE;
configure_nfapi_pnf(RC.eNB[j][0]->eth_params_n.remote_addr, RC.eNB[j][0]->eth_params_n.remote_portc, RC.eNB[j][0]->eth_params_n.my_addr, RC.eNB[j][0]->eth_params_n.my_portd, RC.eNB[j][0]->eth_params_n.remote_portd);
{
extern uint8_t nfapi_pnf;
nfapi_pnf = 1;
}
RC.nb_macrlc_inst = 1; // This is used by mac_top_init_eNB()
// This is used by init_eNB_afterRU()
RC.nb_CC = (int *)malloc((1+RC.nb_inst)*sizeof(int));
RC.nb_CC[0]=1;
RC.nb_inst =1; // DJP - feptx_prec uses num_eNB but phy_init_RU uses nb_inst
LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_inst=1 this is because phy_init_RU() uses that to index and not RC.num_eNB - why the 2 similar variables?\n", __FUNCTION__);
LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_CC[0]=1 for init_eNB_afterRU()\n", __FUNCTION__, RC.nb_CC[0]);
LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_macrlc_inst:%d because used by mac_top_init_eNB()\n", __FUNCTION__, RC.nb_macrlc_inst);
mac_top_init_eNB();
}
else { // other midhaul
}
......@@ -854,14 +847,14 @@ void RCconfig_macrlc(void) {
libconfig_int local_n_portd = 0;
libconfig_int remote_n_portd = 0;
printf("%s() Enter\n" , __FUNCTION__);
load_config_file(&cfg);
setting = config_lookup(&cfg, CONFIG_STRING_MACRLC_LIST);
if (setting != NULL) {
if ((RC.nb_macrlc_inst=config_setting_length(setting))>0) mac_top_init_eNB();
else AssertFatal(1==0,"improper macrlc setting\n");
......@@ -950,17 +943,9 @@ void RCconfig_macrlc(void) {
RC.mac[j]->eth_params_s.remote_portd = remote_s_portd;
RC.mac[j]->eth_params_s.transp_preference = ETH_UDP_MODE;
{
extern uint8_t nfapi_pnf;
nfapi_pnf = 2;
}
{
printf("**************** vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
configure_nfapi_vnf(RC.mac[j]->eth_params_s.my_addr, RC.mac[j]->eth_params_s.my_portc);
printf("**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
}
printf("**************** vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
configure_nfapi_vnf(RC.mac[j]->eth_params_s.my_addr, RC.mac[j]->eth_params_s.my_portc);
printf("**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
}
else { // other midhaul
......@@ -968,7 +953,10 @@ void RCconfig_macrlc(void) {
}
}// j=0..num_inst
}
return;
else
{
printf("No MAC/RLC instances\n");
}
}
int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
......
......@@ -538,7 +538,7 @@ void schedule_mib(module_id_t module_idP,
module_idP,
0); // not used in this case
LOG_E(MAC,"Frame %d, subframe %d: BCH PDU length %d\n",
LOG_D(MAC,"Frame %d, subframe %d: BCH PDU length %d\n",
frameP,subframeP,mib_sdu_length);
if (mib_sdu_length > 0) {
......@@ -575,7 +575,7 @@ void schedule_mib(module_id_t module_idP,
eNB->TX_req[CC_id].tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
eNB->TX_req[CC_id].header.message_id = NFAPI_TX_REQUEST;
if (frameP%100==0) LOG_E(MAC,"%s() TX_REQ: sfn_sf:%u pdus:%u pdu_length:%u pdu_index:%u segments:%u segment_length:%u\n",
if (frameP%100==0) LOG_D(MAC,"%s() TX_REQ: sfn_sf:%u pdus:%u pdu_length:%u pdu_index:%u segments:%u segment_length:%u\n",
__FUNCTION__, eNB->TX_req[CC_id].sfn_sf, eNB->TX_req[CC_id].tx_request_body.number_of_pdus,
TX_req->pdu_length, TX_req->pdu_index, TX_req->num_segments, TX_req->segments[0].segment_length);
}
......@@ -701,7 +701,7 @@ schedule_SI(
dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE;
dl_config_pdu->pdu_size = (uint8_t)(sizeof(nfapi_dl_config_dci_dl_pdu));
dl_req->number_dci++;
LOG_E(MAC, "%s() number_dci:%u\n", __FUNCTION__, dl_req->number_dci);
LOG_D(MAC, "%s() number_dci:%u\n", __FUNCTION__, dl_req->number_dci);
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tl.tag = NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.dci_format = NFAPI_DL_DCI_FORMAT_1A;
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level = 4;
......@@ -719,8 +719,9 @@ schedule_SI(
dl_config_request->header.message_id = NFAPI_DL_CONFIG_REQUEST;
dl_config_request->sfn_sf = sfn_sf;
LOG_D(MAC, "%s() mcs:%d bcch_sdu_length:%d N_RB_DL:%d first_rb:%d resource_block_coding:%d\n", __FUNCTION__, mcs, bcch_sdu_length, N_RB_DL, first_rb, dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding);
if (!CCE_allocation_infeasible(module_idP,CC_id,1,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level,SI_RNTI)) {
// DJP - dl_req->number_dci++;
dl_req->number_pdu++;
dl_req->tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
......
......@@ -180,7 +180,7 @@ void UL_indication(UL_IND_t *UL_info)
handle_harq(UL_info);
// clear HI prior to hanling ULSCH
// clear HI prior to handling ULSCH
mac->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_hi = 0;
handle_ulsch(UL_info);
......
......@@ -469,6 +469,48 @@ int logInit (void)
return 0;
}
void nfapi_log(char *file, char *func, int line, int comp, int level, const char* format, va_list args)
{
LOG_params log_params;
int len;
len = vsnprintf(log_params.l_buff_info, MAX_LOG_INFO-1, format, args);
//2 first parameters must be passed as 'const' to the thread function
log_params.file = strdup(file);
log_params.func = strdup(func);
log_params.line = line;
log_params.comp = comp;
log_params.level = level;
log_params.format = format;
log_params.len = len;
if (pthread_mutex_lock(&log_lock) != 0) {
return;
}
log_list_tail++;
log_list[log_list_tail - 1] = log_params;
if (log_list_tail >= 1000) {
log_list_tail = 0;
}
if (log_list_nb_elements < 1000) {
log_list_nb_elements++;
}
if(pthread_cond_signal(&log_notify) != 0) {
pthread_mutex_unlock(&log_lock);
return;
}
if(pthread_mutex_unlock(&log_lock) != 0) {
return;
}
}
//log record: add to a list
void logRecord(const char *file, const char *func, int line, int comp,
int level, const char *format, ...)
......
......@@ -315,6 +315,19 @@ void *log_thread_function(void * list);
# define LOG_N(c, x...) /* */
# define LOG_F(c, x...) /* */
# else /* T_TRACER */
extern log_t *g_log;
#if 0
# define LOG_G(c, x...) do { if (g_log->log_component[c].level > g_log->level || LOG_EMERG > g_log->log_component[c].level || LOG_EMERG > g_log->level) logIt(c, LOG_EMERG, x); } while(0)
# define LOG_A(c, x...) do { if (g_log->log_component[c].level > g_log->level || LOG_ALERT > g_log->log_component[c].level || LOG_ALERT > g_log->level) logIt(c, LOG_ALERT, x); } while(0)
# define LOG_C(c, x...) do { if (g_log->log_component[c].level > g_log->level || LOG_CRIT > g_log->log_component[c].level || LOG_CRIT > g_log->level) logIt(c, LOG_CRIT, x); } while(0)
# define LOG_E(c, x...) do { if (g_log->log_component[c].level > g_log->level || LOG_ERR > g_log->log_component[c].level || LOG_ERR > g_log->level) logIt(c, LOG_ERR, x); } while(0)
# define LOG_W(c, x...) do { if (g_log->log_component[c].level > g_log->level || LOG_WARNING > g_log->log_component[c].level || LOG_WARNING > g_log->level) logIt(c, LOG_WARNING, x); } while(0)
# define LOG_N(c, x...) do { if (g_log->log_component[c].level > g_log->level || LOG_NOTICE > g_log->log_component[c].level || LOG_NOTICE > g_log->level) logIt(c, LOG_NOTICE, x); } while(0)
# define LOG_I(c, x...) do { if (g_log->log_component[c].level > g_log->level || LOG_INFO > g_log->log_component[c].level || LOG_INFO > g_log->level) logIt(c, LOG_INFO, x); } while(0)
# define LOG_D(c, x...) do { if (g_log->log_component[c].level > g_log->level || LOG_DEBUG > g_log->log_component[c].level || LOG_DEBUG > g_log->level) logIt(c, LOG_DEBUG, x); } while(0)
# define LOG_F(c, x...) do { if (g_log->log_component[c].level > g_log->level || LOG_FILE > g_log->log_component[c].level || LOG_FILE > g_log->level) logIt(c, LOG_FILE, x); } while(0)
# define LOG_T(c, x...) do { if (g_log->log_component[c].level > g_log->level || LOG_TRACE > g_log->log_component[c].level || LOG_TRACE > g_log->level) logIt(c, LOG_TRACE, x); } while(0)
#else
# define LOG_G(c, x...) logIt(c, LOG_EMERG, x)
# define LOG_A(c, x...) logIt(c, LOG_ALERT, x)
# define LOG_C(c, x...) logIt(c, LOG_CRIT, x)
......@@ -325,6 +338,7 @@ void *log_thread_function(void * list);
# define LOG_D(c, x...) logIt(c, LOG_DEBUG, x)
# define LOG_F(c, x...) logIt(c, LOG_FILE, x) // log to a file, useful for the MSC chart generation
# define LOG_T(c, x...) logIt(c, LOG_TRACE, x)
#endif
# endif /* T_TRACER */
#else /* USER_MODE */
# define LOG_G(c, x...) printk(x)
......
......@@ -37,7 +37,8 @@ eNBs =
downlink_frequency = 2685000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
N_RB_DL = 50;
// N_RB_DL = 50;
N_RB_DL = 25;
Nid_cell_mbsfn = 0;
nb_antenna_ports = 1;
nb_antennas_tx = 1;
......
......@@ -889,7 +889,7 @@ void init_transport(PHY_VARS_eNB *eNB) {
fp->pucch_config_common.deltaPUCCH_Shift = 1;
}
void init_eNB_afterRU() {
void init_eNB_afterRU(void) {
int inst,CC_id,ru_id,i,aa;
PHY_VARS_eNB *eNB;
......@@ -972,7 +972,8 @@ void init_eNB_afterRU() {
RC.ru[ru_id]->wakeup_rxtx = wakeup_rxtx;
RC.ru[ru_id]->wakeup_prach_eNB = wakeup_prach_eNB;
RC.ru[ru_id]->wakeup_prach_eNB_br = wakeup_prach_eNB_br;
RC.ru[ru_id]->eNB_top = eNB_top;
if (nfapi_pnf!=1)
RC.ru[ru_id]->eNB_top = eNB_top;
}
LOG_I(PHY,"%s() Exitting\n", __FUNCTION__);
......
......@@ -1012,22 +1012,24 @@ static void* ru_thread_prach( void* param ) {
thread_top_init("ru_thread_prach",1,500000L,1000000L,20000000L);
while (RC.ru_mask>0) {
usleep(1e6);
LOG_I(PHY,"%s() RACH waiting for RU to be configured\n");
}
LOG_I(PHY,"%s() RU configured - RACH processing thread running\n");
while (!oai_exit) {
if (oai_exit) break;
if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"ru_prach_thread") < 0) break;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 1 );
rx_prach(NULL,
ru,
NULL,
NULL,
NULL,
proc->frame_prach,
0
prach_procedures(
ru->eNB_list[0]
#ifdef Rel14
,0
,0
#endif
);
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 0 );
if (release_thread(&proc->mutex_prach,&proc->instance_cnt_prach,"ru_prach_thread") < 0) break;
}
......@@ -1252,6 +1254,7 @@ static inline int wakeup_prach_ru_br(RU_t *ru) {
#endif
void oai_subframe_ind(uint16_t frame, uint16_t subframe);
void check_dlsch(char *file, int line);
static void* ru_thread( void* param ) {
......@@ -1347,24 +1350,41 @@ ru->openair0_cfg.tx_gain[3]=0.0;
subframe++;
}
LOG_D(PHY,"RU thread (proc %p), frame %d (%p), subframe %d (%p)\n",
proc, frame,&frame,subframe,&subframe);
LOG_D(PHY,"RU thread (proc %p), frame %d (%p), subframe %d (%p)\n", proc, frame,&frame,subframe,&subframe);
ru->proc.frame_rx = frame;
ru->proc.subframe_rx = subframe;
ru->proc.frame_tx = subframe>9 ? (frame+1)&1023 : frame;
ru->proc.subframe_tx = subframe+1 % 10;
proc->frame_rx = ru->proc.frame_rx;
proc->subframe_rx = ru->proc.subframe_rx;
// synchronization on input FH interface, acquire signals/data and block
if (ru->fh_south_in) ru->fh_south_in(ru,&frame,&subframe);
else AssertFatal(1==0, "No fronthaul interface at south port");
check_dlsch(__FILE__, __LINE__);
oai_subframe_ind(frame, subframe);
check_dlsch(__FILE__, __LINE__);
LOG_D(PHY,"RU thread (do_prach %d, is_prach_subframe %d), received frame %d, subframe %d\n",
ru->do_prach,
is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx),
proc->frame_rx,proc->subframe_rx);
if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)==1)) wakeup_prach_ru(ru);
if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)==1)) {
wakeup_prach_ru(ru);
check_dlsch(__FILE__, __LINE__);
}
#ifdef Rel14
else if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)>1)) wakeup_prach_ru_br(ru);
else if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)>1)) {
wakeup_prach_ru_br(ru);
}
#endif
// adjust for timing offset between RU
......@@ -1374,33 +1394,41 @@ ru->openair0_cfg.tx_gain[3]=0.0;
// do RX front-end processing (frequency-shift, dft) if needed
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 1 );
if (ru->feprx) ru->feprx(ru);
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 0 );
check_dlsch(__FILE__, __LINE__);
T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->subframe_rx));
// At this point, all information for subframe has been received on FH interface
// If this proc is to provide synchronization, do so
wakeup_slaves(proc);
check_dlsch(__FILE__, __LINE__);
//LOG_E(PHY,"RU %d/%d frame_tx %d, subframe_tx %d\n",0,ru->idx,proc->frame_tx,proc->subframe_tx);
// wakeup all eNB processes waiting for this RU
if (ru->num_eNB>0) wakeup_eNBs(ru);
check_dlsch(__FILE__, __LINE__);
//LOG_E(PHY,"%s() Before wait_on_condition()\n", __FUNCTION__);
// wait until eNBs are finished subframe RX n and TX n+4
wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread");