Commit ee61cb51 authored by matzakos's avatar matzakos

Fixed the issue with synchronization but only for the case o running both eNB...

Fixed the issue with synchronization but only for the case o running both eNB (vnf) and UE (pnf) processes in the same machine. Receiving and decoding now all MIBs and SIBs1/2/3.
parent d34ac165
......@@ -645,7 +645,7 @@ int param_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi
// P7 PNF Port
nfapi_resp.nfapi_config.p7_pnf_port.tl.tag = NFAPI_NFAPI_P7_PNF_PORT_TAG;
nfapi_resp.nfapi_config.p7_pnf_port.value = 32123; // DJP - hard code alert!!!! FIXME TODO
nfapi_resp.nfapi_config.p7_pnf_port.value = 32123; // 32123; // DJP - hard code alert!!!! FIXME TODO
nfapi_resp.num_tlv++;
nfapi_pnf_param_resp(config, &nfapi_resp);
......@@ -1326,7 +1326,7 @@ int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi
p7_config->remote_p7_port = phy_info->remote_port;
p7_config->remote_p7_addr = phy_info->remote_addr;
p7_config->local_p7_port = 32123; // DJP - good grief cannot seem to get the right answer phy_info->local_port;
p7_config->local_p7_port = 32123; //32123; // DJP - good grief cannot seem to get the right answer phy_info->local_port;
//DJP p7_config->local_p7_addr = (char*)phy_info->local_addr.c_str();
p7_config->local_p7_addr = phy_info->local_addr;
......@@ -1353,6 +1353,7 @@ int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi
if(phy_info->timing_info_mode & 0x2)
{
LOG_I(MAC, "Panos-D: Configure timing info aperiodic");
p7_config->timing_info_mode_aperiodic = 1;
}
......@@ -1846,6 +1847,7 @@ void oai_subframe_ind(uint16_t sfn, uint16_t sf)
//printf("Panos-D: oai_subframe_ind 1, buffer size:%d", p7_config_g->subframe_buffer_size);
uint16_t sfn_sf_tx = sfn<<4 | sf;
//LOG_I(MAC, " Panos-D: oai_subframe_ind SFN/SF: %d.%d, SFN_Tx: %d \n", sfn, sf, sfn_sf_tx);
if ((sfn % 100 == 0) && sf==0)
{
......
......@@ -1362,7 +1362,7 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port)
vnf.p7_vnfs[0].timing_window = 32;
vnf.p7_vnfs[0].periodic_timing_enabled = 1;
vnf.p7_vnfs[0].aperiodic_timing_enabled = 0;
vnf.p7_vnfs[0].aperiodic_timing_enabled = 1;
vnf.p7_vnfs[0].periodic_timing_period = 10;
vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
......
......@@ -746,7 +746,7 @@ int tx_req_UE_MAC(nfapi_tx_request_t* req)
LOG_D(PHY,"%s() SFN/SF:%d/%d PDUs:%d\n", __FUNCTION__, sfn, sf, req->tx_request_body.number_of_pdus);
LOG_I(MAC, "Panos-D: tx_req_UE_MAC 1 \n");
//LOG_I(MAC, "Panos-D: tx_req_UE_MAC 1 \n");
//printf("Panos-D: tx_req_UE_MAC 1 \n");
//if (req->tx_request_body.tl.tag==NFAPI_TX_REQUEST_BODY_TAG)
//{
......@@ -774,7 +774,7 @@ int tx_req_UE_MAC(nfapi_tx_request_t* req)
int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req)
{
LOG_I(MAC, "Panos-D: dl_config_req_UE_MAC 1 \n");
//LOG_I(MAC, "Panos-D: dl_config_req_UE_MAC 1 \n");
int sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
int sf = NFAPI_SFNSF2SF(req->sfn_sf);
module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
......@@ -799,7 +799,8 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req)
for (int i=0;i<req->dl_config_request_body.number_pdu;i++)
{
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sfn/sf:%d PDU[%d] size:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size);
LOG_E(MAC, "%s() sfn/sf:%d PDU[%d] size:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size);
LOG_E(MAC, "dl_config_req_UE_MAC 2 Received real ones: sfn/sf:%d.%d PDU[%d] size:%d\n", sfn, sf, i, dl_config_pdu_list[i].pdu_size);
if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
{
if (dl_config_pdu_list[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type == 1) {
......@@ -807,6 +808,7 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req)
dl_config_pdu_tmp = &dl_config_pdu_list[i+1];
if (dl_config_pdu_tmp->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE){
if(tx_request_pdu_list + dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index!= NULL){
LOG_E(MAC, "dl_config_req_UE_MAC 2 Received data: sfn/sf:%d PDU[%d] size:%d\n", NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size);
ue_send_sdu(Mod_id, 0, sfn, sf,
tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data,
tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_length,
......@@ -822,8 +824,8 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req)
dl_config_pdu_tmp = &dl_config_pdu_list[i+1];
if(dl_config_pdu_tmp->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE && dl_config_pdu_list[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti == 0xFFFF){
//pdu = Tx_req->tx_request_body.tx_pdu_list[dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data;
LOG_D(PHY,"%s() [PDU:%d] NFAPI_DL_CONFIG_DLSCH_PDU_TYPE TX:%d/%d RX:%d/%d transport_blocks:%d pdu_index:%d sdu:%p\n",
__FUNCTION__, i, sfn, sf, sfn, sf, dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.transport_blocks, dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index, tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data);
LOG_E(MAC,"dl_config_req_UE_MAC 3 Received SI: [PDU:%d] NFAPI_DL_CONFIG_DLSCH_PDU_TYPE TX:%d/%d RX:%d/%d transport_blocks:%d pdu_index:%d sdu:%p\n",
i, sfn, sf, sfn, sf, dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.transport_blocks, dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index, tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data);
if(tx_request_pdu_list + dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index!= NULL){
ue_decode_si(Mod_id, 0, sfn, 0,
tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data,
......@@ -873,6 +875,7 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req)
// BCH case
// Last parameter is 1 if first time synchronization and zero otherwise. Not sure which value to put
// for our case.
LOG_E(MAC,"dl_config_req_UE_MAC 4 Received MIB: sfn/sf: %d.%d \n", sfn, sf);
dl_phy_sync_success(Mod_id,sfn,0, 0);
}
......@@ -957,9 +960,6 @@ int memcpy_dl_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request
UE_mac_inst[Mod_id].dl_config_req = (nfapi_dl_config_request_t*)malloc(sizeof(nfapi_dl_config_request_t));
LOG_I(MAC, "Panos-D: memcpy_dl_config_req 1 \n");
/*if(req->header!=NULL){
UE_mac_inst[Mod_id].dl_config_req->header = req->header;
}*/
UE_mac_inst[Mod_id].dl_config_req->sfn_sf = req->sfn_sf;
UE_mac_inst[Mod_id].dl_config_req->vendor_extension = req->vendor_extension;
......@@ -982,6 +982,7 @@ int memcpy_dl_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request
int memcpy_ul_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req)
{
LOG_I(MAC, "Panos-D: memcpy_ul_config_req 1 \n");
module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
UE_mac_inst[Mod_id].ul_config_req = req;
return 0;
......@@ -989,18 +990,19 @@ int memcpy_ul_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request
int memcpy_tx_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req)
{
LOG_I(MAC, "Panos-D: memcpy_tx_req 1, req->tx_request_body.number_of_pdus: %d \n", req->tx_request_body.number_of_pdus);
LOG_I(MAC, "Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].pdu_length: %d \n", req->tx_request_body.tx_pdu_list[0].pdu_length);
LOG_I(MAC, "Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].pdu_index: %d \n", req->tx_request_body.tx_pdu_list[0].pdu_index);
LOG_I(MAC, "Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].num_segments: %d \n", req->tx_request_body.tx_pdu_list[0].num_segments);
LOG_I(MAC, "Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].segments[j].segment_data: %d \n", *req->tx_request_body.tx_pdu_list[0].segments[0].segment_data);
module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
//LOG_I(MAC, "Panos-D: memcpy_tx_req 1, req->tx_request_body.number_of_pdus: %d \n", req->tx_request_body.number_of_pdus);
//LOG_I(MAC, "Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].pdu_length: %d \n", req->tx_request_body.tx_pdu_list[0].pdu_length);
//LOG_I(MAC, "Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].pdu_index: %d \n", req->tx_request_body.tx_pdu_list[0].pdu_index);
//LOG_I(MAC, "Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].num_segments: %d \n", req->tx_request_body.tx_pdu_list[0].num_segments);
//LOG_I(MAC, "Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].segments[j].segment_data: %d \n", *req->tx_request_body.tx_pdu_list[0].segments[0].segment_data);
//printf("Panos-D: memcpy_tx_req 1, req->tx_request_body.number_of_pdus: %d \n", req->tx_request_body.number_of_pdus);
//printf("Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].pdu_length: %d \n", req->tx_request_body.tx_pdu_list[0].pdu_length);
//printf("Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].pdu_index: %d \n", req->tx_request_body.tx_pdu_list[0].pdu_index);
//printf("Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].num_segments: %d \n", req->tx_request_body.tx_pdu_list[0].num_segments);
//printf("Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].segments[j].segment_data: %d \n", *req->tx_request_body.tx_pdu_list[0].segments[0].segment_data);
module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change.
int num_elem = req->tx_request_body.number_of_pdus;
tx_request_pdu_list = (nfapi_tx_request_pdu_t*) malloc(num_elem*sizeof(nfapi_tx_request_pdu_t));
......
......@@ -35,9 +35,12 @@ L1s = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "enp0s31f6";
remote_n_address = "10.0.0.2";
local_n_address = "10.0.0.1";
#local_n_if_name = "enp0s31f6";
#remote_n_address = "10.0.0.2";
#local_n_address = "10.0.0.1";
local_n_if_name = "lo";
remote_n_address = "127.0.0.2";
local_n_address = "127.0.0.1";
local_n_portc = 50000;
remote_n_portc = 50001;
local_n_portd = 50010;
......
......@@ -1356,6 +1356,8 @@ int main( int argc, char **argv )
}
// Panos: Call init_UE_stub instead of init_UE as we are always on nfapi_mode=3
//phy_stub_ticking = (SF_ticking*)malloc(sizeof(SF_ticking));
init_timer_thread();
init_UE_stub(1,eMBMS_active,uecap_xer_in);
......
......@@ -789,6 +789,7 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
UE_rxtx_proc_t *proc = rtd->proc;
PHY_VARS_UE *UE = rtd->UE;
int ret;
double t_diff;
// Panos: Call (Sched_Rsp_t) get_nfapi_sched_response(UE->Mod_ID) to get all
//sched_response config messages which concern the specific UE. Inside this
......@@ -816,8 +817,9 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
wait_sync("UE_phy_stub_thread_rxn_txnp4");
while (!oai_exit) {
if (pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) != 0) {
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" );
LOG_E( MAC, "[SCHED][UE] error locking mutex for UE RXTX\n" );
exit_fun("nothing to add");
}
while (phy_stub_ticking->ticking_var < 0) {
......@@ -825,15 +827,20 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
//pthread_cond_wait( &proc->cond_rxtx, &proc->mutex_rxtx );
pthread_cond_wait( &phy_stub_ticking->cond_ticking, &phy_stub_ticking->mutex_ticking);
}
phy_stub_ticking->ticking_var--;
if (pthread_mutex_unlock(&phy_stub_ticking->mutex_ticking) != 0) {
LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE RXn_TXnp4\n" );
LOG_E( MAC, "[SCHED][UE] error unlocking mutex for UE RXn_TXnp4\n" );
exit_fun("nothing to add");
}
LOG_I(MAC," Panos-D [UE_phy_stub_thread_rxn_txnp4 1] Frame: %d, Subframe: %d \n" "\n" "\n", timer_frame, timer_subframe);
proc->subframe_rx=timer_subframe;
proc->frame_rx = timer_frame;
proc->subframe_tx=(timer_subframe+2)%10;
proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0);
proc->frame_tx = proc->frame_rx + (proc->subframe_rx>7?1:0);
//oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
// Panos: Guessing that the next 4 lines are not needed for the phy_stub mode.
......@@ -866,6 +873,8 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
(sf_type==SF_S ? "SF_S" : "UNKNOWN_SF_TYPE"))));
}
/*
#ifdef UE_SLOT_PARALLELISATION
phy_procedures_slot_parallelization_UE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL );
......@@ -876,8 +885,14 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
// Hardcode Mod_id for now. Will be changed later.
// Panos: is this the right place to call oai_subframe_indication to invoke p7 nfapi callbacks here?
oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
LOG_I( MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind \n");
//oai_subframe_ind(proc->frame_rx, proc->subframe_rx);
//oai_subframe_ind(timer_frame, timer_subframe);
//start_meas(&UE->timer_stats);
//oai_subframe_ind(proc->frame_tx, proc->subframe_tx);
oai_subframe_ind(timer_frame, timer_subframe);
//LOG_I( MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind \n");
//printf("Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind \n");
/*if(UE_mac_inst[Mod_id].tx_req!= NULL){
printf("Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind 2\n");
......@@ -891,6 +906,9 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
LOG_I( MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind 4 \n");
hi_dci0_req_UE_MAC(UE_mac_inst[Mod_id].hi_dci0_req);
}
//stop_meas(&UE->timer_stats);
//t_diff = get_time_meas_us(&UE->timer_stats);
//LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff);
//#endif
}
......@@ -962,7 +980,7 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
}
//proc->instance_cnt_rxtx--;
phy_stub_ticking->ticking_var--;
//if (pthread_mutex_unlock(&proc->mutex_rxtx) != 0) {
if (pthread_mutex_unlock(&phy_stub_ticking->mutex_ticking) != 0) {
LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE RXTX\n" );
......@@ -1466,6 +1484,9 @@ static void* timer_thread( void* param ) {
exit_fun("nothing to add");
}
}
else{
LOG_I(MAC," Panos-D: Problemmm");
}
AssertFatal(pthread_mutex_unlock(&phy_stub_ticking->mutex_ticking) ==0,"");
start_meas(&UE->timer_stats);
......@@ -1485,9 +1506,14 @@ static void* timer_thread( void* param ) {
stop_meas(&UE->timer_stats);
t_diff = get_time_meas_us(&UE->timer_stats);
//printf("Panos-D: Absolute time: %lld, diff: %lld, diff_now: %lld \n",UE->timer_stats.p_time, UE->timer_stats.diff, UE->timer_stats.diff_now);
//LOG_I(MAC,"[UE%d] Applying default macMainConfig\n",module_idP);
if (t_diff > 1100) LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff);
//if (t_diff > 1100)
LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff);
//printf("Panos-D: Absolute time: %f", t_diff);
//UE->proc.ticking_var++;
......
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