diff --git a/nfapi/nfapi.c b/nfapi/nfapi.c index 4bae644c5f740c6e980ecd71e38f6709da7cc781..1c4e917e65baf0d08bfeba0bdebc3f6de9f4646b 100644 --- a/nfapi/nfapi.c +++ b/nfapi/nfapi.c @@ -1,5 +1,4 @@ -//#include "fapi_stub.h" #include <stdlib.h> #include <stdio.h> #include <stdarg.h> @@ -146,522 +145,7 @@ extern "C" #if defined(__cplusplus) } #endif - -#if 0 -//DJP -void send_uplink_indications(fapi_internal_t* instance, uint16_t sfn_sf) -{ - fapi_harq_ind_t harq_ind; - (instance->callbacks.fapi_harq_ind)(&(instance->_public), &harq_ind); - - fapi_crc_ind_t crc_ind; - crc_ind.header.message_id = FAPI_CRC_INDICATION; - crc_ind.header.length = 0; //??; - crc_ind.sfn_sf = sfn_sf; - crc_ind.body.number_of_crcs = 1; - crc_ind.body.pdus[0].rx_ue_info.handle = 0; //?? - crc_ind.body.pdus[0].rx_ue_info.rnti = 0; //?? - crc_ind.body.pdus[0].rel8_pdu.crc_flag = 1; - - (instance->callbacks.fapi_crc_ind)(&(instance->_public), &crc_ind); - - if(!instance->fapi->rx_buffer_empty()) - { - fapi_rx_ulsch_ind_t rx_ind; - memset(&rx_ind, 0, sizeof(rx_ind)); - rx_ind.header.message_id = FAPI_RX_ULSCH_INDICATION; - rx_ind.sfn_sf = sfn_sf; - - - phy_pdu* buff = 0; - int i = 0; - std::list<phy_pdu*> free_list; - do - { - buff = instance->fapi->pop_rx_buffer(); - if(buff != 0) - { - if(buff->len == 0) - { - printf("[FAPI] Buffer length = 0\n"); - } - - rx_ind.body.pdus[i].rx_ue_info.handle = 0xDEADBEEF; - rx_ind.body.pdus[i].rx_ue_info.rnti = 0x4242; - - rx_ind.body.pdus[i].rel8_pdu.length = buff->len; - //rx_ind.pdus[i].rel8_pdu.data_offset; - //rx_ind.pdus[i].rel8_pdu.ul_cqi; - //rx_ind.pdus[i].rel8_pdu.timing_advance; - - rx_ind.body.data[i] = buff->buffer; - - rx_ind.body.number_of_pdus++; - i++; - - instance->fapi->byte_count += buff->len; - - free_list.push_back(buff); - } - }while(buff != 0 && i < 8); - - (instance->callbacks.fapi_rx_ulsch_ind)(&(instance->_public), &rx_ind); - - for(phy_pdu* pdu : free_list) - { - instance->fapi->release_phy_pdu(pdu); - //free(tx_req.tx_request_body.tx_pdu_list[j].segments[0].segment_data); - } - } - else - { - fapi_rx_ulsch_ind_t rx_ind; - memset(&rx_ind, 0, sizeof(rx_ind)); - rx_ind.header.message_id = FAPI_RX_ULSCH_INDICATION; - rx_ind.sfn_sf = sfn_sf; - (instance->callbacks.fapi_rx_ulsch_ind)(&(instance->_public), &rx_ind); - } - - - fapi_rx_cqi_ind_t cqi_ind; - cqi_ind.sfn_sf = sfn_sf; - (instance->callbacks.fapi_rx_cqi_ind)(&(instance->_public), &cqi_ind); - - fapi_rx_sr_ind_t sr_ind; - sr_ind.sfn_sf = sfn_sf; - (instance->callbacks.fapi_rx_sr_ind)(&(instance->_public), &sr_ind); - - fapi_rach_ind_t rach_ind; - rach_ind.sfn_sf = sfn_sf; - (instance->callbacks.fapi_rach_ind)(&(instance->_public), &rach_ind); - - fapi_srs_ind_t srs_ind; - srs_ind.sfn_sf = sfn_sf; - (instance->callbacks.fapi_srs_ind)(&(instance->_public), &srs_ind); - /* - nfapi_lbt_dl_indication_t lbt_ind; - memset(&lbt_ind, 0, sizeof(lbt_ind)); - lbt_ind.header.message_id = NFAPI_LBT_DL_INDICATION; - lbt_ind.header.phy_id = config->phy_id; - lbt_ind.sfn_sf = sfn_sf; - nfapi_pnf_p7_lbt_dl_ind(config, &lbt_ind); - - vendor_ext_p7_ind ve_p7_ind; - memset(&ve_p7_ind, 0, sizeof(ve_p7_ind)); - ve_p7_ind.header.message_id = P7_VENDOR_EXT_IND; - ve_p7_ind.header.phy_id = config->phy_id; - ve_p7_ind.error_code = NFAPI_MSG_OK; - nfapi_pnf_p7_vendor_extension(config, &(ve_p7_ind.header)); - */ - - fapi_nb_harq_ind_t nb_harq_ind; - nb_harq_ind.sfn_sf = sfn_sf; - (instance->callbacks.fapi_nb_harq_ind)(&(instance->_public), &nb_harq_ind); - - fapi_nrach_ind_t nrach_ind; - nrach_ind.sfn_sf = sfn_sf; - (instance->callbacks.fapi_nrach_ind)(&(instance->_public), &nrach_ind); - -} -#endif - -#if 0 -void* fapi_thread_start(void* ptr) -{ - set_thread_priority(81); - - fapi_internal_t* instance = (fapi_internal_t*)ptr; - uint16_t sfn_sf_dec = 0; - uint32_t last_tv_usec = 0; - uint32_t last_tv_sec = 0; - - uint32_t millisec; - uint32_t last_millisec = -1; - uint16_t catchup = 0; - - while(1) - { - // get the time - struct timeval sf_start; - (void)gettimeofday(&sf_start, NULL); - - uint16_t sfn_sf = ((((sfn_sf_dec) / 10) << 4) | (((sfn_sf_dec) - (((sfn_sf_dec) / 10) * 10)) & 0xF)); - // increment the sfn/sf - for the next subframe - sfn_sf_dec++; - if(sfn_sf_dec > 10239) - sfn_sf_dec = 0; - - - fapi_subframe_ind_t ind; - ind.sfn_sf = sfn_sf; - - if(instance->fapi->first_dl_config) - { - //DJP send_uplink_indications(instance, sfn_sf); - } - - if(instance->tick == 1000) - { - if(instance->tx_byte_count > 0) - { - printf("[FAPI] Tx rate %d bytes/sec\n", instance->tx_byte_count); - instance->tx_byte_count = 0; - } - - instance->tick = 0; - } - - instance->tick++; - - (instance->callbacks.fapi_subframe_ind)(&(instance->_public), &ind); - - { - //DJP phy_pdu* pdu = instance->fapi->allocate_phy_pdu(); - phy_pdu* pdu = (phy_pdu*)malloc(sizeof(phy_pdu)); - int len = recvfrom(instance->rx_sock, pdu->buffer, pdu->buffer_len, MSG_DONTWAIT, 0, 0); - if(len > 0) - { - pdu->len = len; - //DJP instance->fapi->push_rx_buffer(pdu); - } - else - { - //DJP instance->fapi->release_phy_pdu(pdu); - } - } - - - if(catchup) - { - catchup--; - } - else - { - struct timespec now_ts; - struct timespec sleep_ts; - struct timespec sleep_rem_ts; - - // get the current time - clock_gettime(CLOCK_MONOTONIC, &now_ts); - - - // determine how long to sleep before the start of the next 1ms - sleep_ts.tv_sec = 0; - sleep_ts.tv_nsec = 1e6 - (now_ts.tv_nsec % 1000000); - - int nanosleep_result = nanosleep(&sleep_ts, &sleep_rem_ts); - - if(nanosleep_result != 0) - printf("*** nanosleep failed or was interrupted\n"); - - - clock_gettime(CLOCK_MONOTONIC, &now_ts); - millisec = now_ts.tv_nsec / 1e6; - - if(last_millisec != -1 && ((last_millisec + 1 ) % 1000) != millisec) - { - printf("*** missing millisec %d %d\n", last_millisec, millisec); - catchup = millisec - last_millisec - 1; - } - - last_millisec = millisec; - } - } -} -#endif - -#if defined(__cplusplus) -extern "C" { -#endif -#if 0 - fapi_t* fapi_create(fapi_cb_t* callbacks, fapi_config_t* config) - { - fapi_internal_t* instance = (fapi_internal_t*)calloc(1, sizeof(fapi_internal_t)); - instance->callbacks = *callbacks; - instance->config = *config; - instance->state = 0; - - // DJP instance->fapi = new fapi_private(); - instance->fapi = (fapi_t*)malloc(sizeof(fapi_private)); - - return (fapi_t*)instance; - } #endif - -#if 0 - void fapi_destroy(fapi_t* fapi) - { - fapi_internal_t* instance = (fapi_internal_t*)fapi; - - //DJP delete instance->fapi; - free(instance); - } -#endif - -#if 0 - void* fapi_rx_thread_start(void* ptr) - { - set_thread_priority(60); - - fapi_internal_t* instance = (fapi_internal_t*)ptr; - - while(1) - { - //DJP phy_pdu* pdu = instance->fapi->allocate_phy_pdu(); - phy_pdu* pdu = (phy_pdu*)malloc(sizeof(phy_pdu)); - int len = recvfrom(instance->rx_sock, pdu->buffer, pdu->buffer_len, 0, 0, 0); - if(len > 0) - { - pdu->len = len; - //instance->fapi->push_rx_buffer(pdu); - } - else - { - //instance->fapi->release_phy_pdu(pdu); - } - - } - } -#endif - -#if 0 - void fapi_start_data(fapi_t* fapi, unsigned rx_port, const char* tx_address, unsigned tx_port) - { - fapi_internal_t* instance = (fapi_internal_t*)fapi; - - printf("[FAPI] Rx Data from %d\n", rx_port); - printf("[FAPI] Tx Data to %s:%d\n", tx_address, tx_port); - - instance->rx_sock = socket(AF_INET, SOCK_DGRAM, 0); - - if(instance->rx_sock < 0) - { - printf("[FAPI] Failed to create socket\n"); - return; - } - - struct sockaddr_in addr; - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_port = htons(rx_port); - addr.sin_addr.s_addr = INADDR_ANY; - - int bind_result = bind(instance->rx_sock, (struct sockaddr *)&addr, sizeof(struct sockaddr_in)); - - if(bind_result == -1) - { - printf("[FAPI] Failed to bind to port %d\n", rx_port); - close(instance->rx_sock); - return ; - } - - instance->tx_sock = socket(AF_INET, SOCK_DGRAM, 0); - instance->tx_addr.sin_family = AF_INET; - instance->tx_addr.sin_port = htons(tx_port); - instance->tx_addr.sin_addr.s_addr = inet_addr(tx_address); - } -#endif - - - void fill_tlv(fapi_tlv_t tlvs[], uint8_t count, uint8_t tag, uint8_t len, uint16_t value) - { - tlvs[count].tag = tag; - tlvs[count].value = value; - tlvs[count].length = len; - } - -#if 0 - int fapi_param_request(fapi_t* fapi, fapi_param_req_t* req) - { - fapi_internal_t* instance = (fapi_internal_t*)fapi; - - fapi_param_resp_t resp; - resp.header.message_id = FAPI_PARAM_RESPONSE; - - resp.error_code = FAPI_MSG_OK; - - resp.number_of_tlvs = 0; - fill_tlv(resp.tlvs, resp.number_of_tlvs++, FAPI_PHY_STATE_TAG, 2, instance->state); -#if 0 -//DJP - if(instance->state == 0) - { - if(instance->config.duplex_mode == 0) - { - // -- TDD - // Downlink Bandwidth Support - // Uplink Bandwidth Support - // Downlink Modulation Support - // Uplink Modulation Support - // PHY Antenna Capability - // Release Capability - // MBSFN Capability - } - else if(instance->config.duplex_mode == 1) - { - // -- FDD - // Downlink Bandwidth Support - fill_tlv(resp.tlvs, resp.number_of_tlvs++, FAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG, 2, instance->config.dl_channel_bw_support); - // Uplink Bandwidth Support - fill_tlv(resp.tlvs, resp.number_of_tlvs++, FAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG, 2, instance->config.ul_channel_bw_support); - // Downlink Modulation Support - // Uplink Modulation Support - // PHY Antenna Capability - // Release Capability - // MBSFN Capability - // LAA Capability - } - } - else - { - if(instance->config.duplex_mode == 0) - { - // -- TDD - // Downlink Bandwidth Support - // Uplink Bandwidth Support - // Downlink Modulation Support - // Uplink Modulation Support - // PHY Antenna Capability - // Release Capability - // MBSFN Capability - // Duplexing Mode - // PCFICH Power Offset - // P-B - // DL Cyclic Prefix Type - // UL Cyclic Prefix Type - // RF Config - // PHICH Config - // SCH Config - // PRACH Config - // PUSCH Config - // PUCCH Config - // SRS Config - // Uplink Reference Signal Config - // TDD Frame Structure Config - // Data Report Mode - } - else if(instance->config.duplex_mode == 1) - { - // FDD - // Downlink Bandwidth Support - // Uplink Bandwidth Support - // Downlink Modulation Support - // Uplink Modulation Support - // PHY Antenna Capability - // Release Capability - // MBSFN Capability - // LAA Capability - // Duplexing Mode - // PCFICH Power Offset - // P-B - // DL Cyclic Prefix Type - // UL Cyclic Prefix Type - // RF Config - // PHICH Config - // SCH Config - // PRACH Config - // PUSCH Config - // PUCCH Config - // SRS Config - // Uplink Reference Signal Config - // Data Report Mode - } - } -#endif - - - //todo fill - (instance->callbacks.fapi_param_response)(fapi, &resp); - - return 0; - } -#endif - -#if 0 - int fapi_config_request(fapi_t* fapi, fapi_config_req_t* req) - { - fapi_internal_t* instance = (fapi_internal_t*)fapi; - - fapi_config_resp_t resp; - resp.header.message_id = FAPI_CONFIG_RESPONSE; - resp.error_code = FAPI_MSG_OK; - - (instance->callbacks.fapi_config_response)(fapi, &resp); - return 0; - } -#endif - -#if 0 - int fapi_start_request(fapi_t* fapi, fapi_start_req_t* req) - { - fapi_internal_t* instance = (fapi_internal_t*)fapi; - - pthread_t fapi_thread; - pthread_create(&fapi_thread, NULL, &fapi_thread_start, instance); - - return 0; - } -#endif - -#if 0 - int fapi_dl_config_request(fapi_t* fapi, fapi_dl_config_req_t* req) - { - fapi_internal_t* instance = (fapi_internal_t*)fapi; - - //DJP instance->fapi->first_dl_config = true; - instance->fapi->first_dl_config = 1; - - return 0; - } -#endif - -#if 0 - int fapi_ul_config_request(fapi_t* fapi, fapi_ul_config_req_t* req) - { - fapi_internal_t* instance = (fapi_internal_t*)fapi; - - return 0; - } -#endif -#if 0 - int fapi_hi_dci0_request(fapi_t* fapi, fapi_hi_dci0_req_t* req) - { - fapi_internal_t* instance = (fapi_internal_t*)fapi; - - return 0; - } -#endif -#if 0 - int fapi_tx_request(fapi_t* fapi, fapi_tx_req_t* req) - { - fapi_internal_t* instance = (fapi_internal_t*)fapi; - - for(int i = 0; i < req->body.number_of_pdus; ++i) - { - uint16_t len = req->body.pdus[i].pdu_length; - uint32_t* data = req->body.pdus[i].tlvs[0].value; - //printf("[FAPI] sfnsf:%d len:%d\n", req->sfn_sf,len); - // - instance->tx_byte_count += len; - - int sendto_result = sendto(instance->tx_sock, data, len, 0, (struct sockaddr*)&(instance->tx_addr), sizeof(instance->tx_addr)); - - if(sendto_result == -1) - { - // error - } - } - - return 0; - } -#endif - -#if defined(__cplusplus) -} -#endif -#endif - - void set_thread_priority(int priority) { @@ -690,4 +174,3 @@ void set_thread_priority(int priority) printf("failed to set sched param\n"); } } - diff --git a/nfapi/nfapi_pnf.c b/nfapi/nfapi_pnf.c index ca554b74105f546b31de022da10b387f74ee0ce0..2df35143a846ce0eb962613bf95a8fd7bcd38feb 100644 --- a/nfapi/nfapi_pnf.c +++ b/nfapi/nfapi_pnf.c @@ -26,6 +26,7 @@ extern RAN_CONTEXT_t RC; #define NUM_P5_PHY 2 extern void phy_init_RU(RU_t*); +extern int mac_top_init_eNB(void); @@ -575,7 +576,6 @@ int param_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi nfapi_resp.header.phy_id = req->header.phy_id; nfapi_resp.error_code = 0; // DJP - what value??? - char local_addr[80]; struct sockaddr_in pnf_p7_sockaddr; pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(pnf->phys[0].local_addr); @@ -866,18 +866,37 @@ void pnf_phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t* header) free(header); } +int pnf_phy_ul_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req) +{ + //printf("[PNF] ul config request\n"); + //phy_info* phy = (phy_info*)(pnf_p7->user_data); + + return 0; +} + +int pnf_phy_hi_dci0_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t* req) +{ + //printf("[PNF] hi dci0 request\n"); + //phy_info* phy = (phy_info*)(pnf_p7->user_data); + + return 0; +} + +nfapi_dl_config_request_pdu_t* dlsch_pdu=0; + int pnf_phy_dl_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request_t* req) { -#if 0 - printf("[PNF] dl config request sfn_sf:%d(%d) pdcch:%u dci:%u pdu:%d pdsch_rnti:%d pcfich:%u - DO NOTHING\n", - req->sfn_sf, - NFAPI_SFNSF2DEC(req->sfn_sf), - req->dl_config_request_body.number_pdcch_ofdm_symbols, - req->dl_config_request_body.number_dci, - req->dl_config_request_body.number_pdu, - req->dl_config_request_body.number_pdsch_rnti, - req->dl_config_request_body.transmission_power_pcfich - ); +#if 1 + if (NFAPI_SFNSF2SF(req->sfn_sf)==5) + printf("[PNF] dl config request sfn_sf:%d(%d) pdcch:%u dci:%u pdu:%d pdsch_rnti:%d pcfich:%u\n", + req->sfn_sf, + NFAPI_SFNSF2DEC(req->sfn_sf), + req->dl_config_request_body.number_pdcch_ofdm_symbols, + req->dl_config_request_body.number_dci, + req->dl_config_request_body.number_pdu, + req->dl_config_request_body.number_pdsch_rnti, + req->dl_config_request_body.transmission_power_pcfich + ); #endif if (RC.ru == 0) @@ -901,31 +920,55 @@ int pnf_phy_dl_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request } //int sfn = NFAPI_SFNSF2SFN(req->sfn_sf); - //int sf = NFAPI_SFNSF2SF(req->sfn_sf); + int sf = NFAPI_SFNSF2SF(req->sfn_sf); - //struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; - //int num_pdcch_symbols = eNB->pdcch_vars[sf&1].num_pdcch_symbols; + struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; + eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0]; + nfapi_dl_config_request_pdu_t* dl_config_pdu_list = req->dl_config_request_body.dl_config_pdu_list; + int total_number_of_pdus = req->dl_config_request_body.number_pdu; + eNB->pdcch_vars[sf&1].num_pdcch_symbols = req->dl_config_request_body.number_pdcch_ofdm_symbols; + eNB->pdcch_vars[sf&1].num_dci = 0; + NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sfn_sf:%d DCI:%d PDU:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), req->dl_config_request_body.number_dci, req->dl_config_request_body.number_pdu); - if(req->vendor_extension) - free(req->vendor_extension); + // DJP - force proc to look like current frame! + proc->frame_tx = NFAPI_SFNSF2SFN(req->sfn_sf); + proc->subframe_tx = NFAPI_SFNSF2SF(req->sfn_sf); - return 0; -} + for (int i=0;i<total_number_of_pdus;i++) + { + NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PDU[%d]:\n", __FUNCTION__, i); -int pnf_phy_ul_config_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req) -{ - //printf("[PNF] ul config request\n"); - //phy_info* phy = (phy_info*)(pnf_p7->user_data); + if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) + { + NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() DCI:\n", __FUNCTION__); - return 0; -} + handle_nfapi_dci_dl_pdu(eNB,proc,&dl_config_pdu_list[i]); -int pnf_phy_hi_dci0_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t* req) -{ - //printf("[PNF] hi dci0 request\n"); - //phy_info* phy = (phy_info*)(pnf_p7->user_data); + eNB->pdcch_vars[sf&1].num_dci++; // Is actually number of DCI PDUs + } + else if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_BCH_PDU_TYPE) + { + NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH:\n", __FUNCTION__); + } + else if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) + { + NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() DLSCH:\n", __FUNCTION__); + + + dlsch_pdu = &dl_config_pdu_list[i]; + + //handle_nfapi_dlsch_pdu(eNB,proc,dl_config_pdu, dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks-1, TX_req->tx_request_body.tx_pdu_list[dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data); + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() UNKNOWN:%d\n", __FUNCTION__, dl_config_pdu_list[i].pdu_type); + } + } + + if(req->vendor_extension) + free(req->vendor_extension); return 0; } @@ -967,19 +1010,27 @@ int pnf_phy_tx_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req) uint16_t sfn = NFAPI_SFNSF2SFN(req->sfn_sf); uint16_t sf = NFAPI_SFNSF2SF(req->sfn_sf); LTE_DL_FRAME_PARMS *fp = &RC.ru[0]->frame_parms; - //int ONE_SUBFRAME_OF_SAMPLES = fp->ofdm_symbol_size*fp->symbols_per_tti; + int ONE_SUBFRAME_OF_SAMPLES = fp->ofdm_symbol_size*fp->symbols_per_tti; //int ONE_SUBFRAME_OF_SAMPLES = fp->symbols_per_tti; //int ONE_SUBFRAME_OF_SAMPLES = fp->ofdm_symbol_size*fp->symbols_per_tti*sizeof(int32_t); - //int offset = sf * ONE_SUBFRAME_OF_SAMPLES; + int offset = sf * ONE_SUBFRAME_OF_SAMPLES; struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; - //int aa; + + //DJP - the proc does not seem to be getting filled - so let fill it + + eNB->proc.proc_rxtx[0].frame_tx = sfn; + eNB->proc.proc_rxtx[0].subframe_tx = sf; // clear the transmit data array for the current subframe -#if 0 - for (aa=0; aa<fp->nb_antenna_ports_eNB; aa++) { - memset(&eNB->common_vars.txdataF[aa][offset], 0, ONE_SUBFRAME_OF_SAMPLES); + for (int aa=0; aa<fp->nb_antenna_ports_eNB; aa++) { + memset(&eNB->common_vars.txdataF[aa][offset], 0, ONE_SUBFRAME_OF_SAMPLES * sizeof(int32_t)); + } + + // clear previous allocation information for all UEs + for (int i=0; i<NUMBER_OF_UE_MAX; i++) { + if (eNB->dlsch[i][0]) + eNB->dlsch[i][0]->subframe_tx[sf] = 0; } -#endif if ( 0 @@ -1000,12 +1051,12 @@ int pnf_phy_tx_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req) eNB->pbch_pdu[1] = req->tx_request_body.tx_pdu_list[i].segments[j].segment_data[1]; eNB->pbch_pdu[0] = req->tx_request_body.tx_pdu_list[i].segments[j].segment_data[2]; - eNB->pbch_configured=1; + eNB->pbch_configured=1; if ( - 1 - //&& NFAPI_SFNSF2DEC(req->sfn_sf) % 500 == 0 - ) + 1 + //&& NFAPI_SFNSF2DEC(req->sfn_sf) % 500 == 0 + ) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() [PDU:%u] len:%u pdu_index:%u num_segments:%u segment[0]_length:%u pbch_pdu:%x %x %x\n", __FUNCTION__, i, req->tx_request_body.tx_pdu_list[i].pdu_length, req->tx_request_body.tx_pdu_list[i].pdu_index, req->tx_request_body.tx_pdu_list[i].num_segments, req->tx_request_body.tx_pdu_list[i].segments[0].segment_length, @@ -1016,45 +1067,36 @@ int pnf_phy_tx_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req) } else { - int num_dci = 1; // DJP -HACK!!!! - int frame = sfn; - int subframe = sf; - int num_pdcch_symbols = 1; // DJP HARD CODe HACK - this is zero - eNB->pdcch_vars[subframe&1].num_pdcch_symbols; - - if (num_dci > 0) - LOG_E(PHY,"SFN/SF:%d/%d num_dci:%d num_pdcch_symbols:%d\n", frame, subframe, num_dci, num_pdcch_symbols); - - generate_dci_top(num_pdcch_symbols, - num_dci, - &eNB->pdcch_vars[subframe&1].dci_alloc[0], - 0, - AMP, - fp, - eNB->common_vars.txdataF, - subframe); + // Not bch + handle_nfapi_dlsch_pdu( + eNB, + &eNB->proc.proc_rxtx[0], + dlsch_pdu, + dlsch_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks-1, + req->tx_request_body.tx_pdu_list[dlsch_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data + ); } } } -#if 0 - { - int sched_sfn = sf==0?sfn-1:sfn-0; - int sched_sf = sf==0?9:sf-1; - - NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sfn_sf:%u sfn:%u sf:%u SCHED:%d/%d calling common_signal_procedures\n", - __FUNCTION__, - NFAPI_SFNSF2DEC(req->sfn_sf), - sfn, sf, - sched_sfn, sched_sf - ); - - common_signal_procedures(eNB, sched_sfn, sched_sf); + common_signal_procedures(eNB, sfn, sf); + if (eNB->pdcch_vars[sf&1].num_dci > 0) + { + LOG_E(PHY,"SFN/SF:%d/%d eNB->pdcch_vars[sf&1].num_dci:%d num_pdcch_symbols:%d\n", sfn, sf, eNB->pdcch_vars[sf&1].num_dci, eNB->pdcch_vars[sf&1].num_pdcch_symbols); } -#else - common_signal_procedures(eNB, sfn, sf); -#endif + generate_dci_top( + eNB->pdcch_vars[sf&1].num_pdcch_symbols, + 2, // DJP - not dci - pdus!!! eNB->pdcch_vars[sf&1].num_dci, + &eNB->pdcch_vars[sf&1].dci_alloc[0], + 0, + AMP, + fp, + eNB->common_vars.txdataF, + sf); + +#if 1 // Now scan UE specific DLSCH for (int UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) { @@ -1069,8 +1111,9 @@ int pnf_phy_tx_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req) uint8_t harq_pid = dlsch0->harq_ids[sf]; AssertFatal(harq_pid>=0,"harq_pid is negative\n"); // generate pdsch + LOG_E(PHY,"PDSCH active %d/%d\n", sfn,sf); pdsch_procedures(eNB, - &eNB->proc.proc_rxtx[sf&1], + &eNB->proc.proc_rxtx[0], harq_pid, dlsch0, dlsch1, @@ -1086,6 +1129,7 @@ int pnf_phy_tx_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req) dlsch0->subframe_tx[sf]=0; } } +#endif if (0 && NFAPI_SFNSF2DEC(req->sfn_sf) % 500 == 0) { @@ -1111,9 +1155,9 @@ int pnf_phy_tx_req(nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req) } free(buf); } - - return 0; } + + return 0; } int pnf_phy_lbt_dl_config_req(nfapi_pnf_p7_config_t* config, nfapi_lbt_dl_config_request_t* req) @@ -1157,7 +1201,7 @@ int pnf_phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_ //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__); vendor_ext_p7_req* req = (vendor_ext_p7_req*)(header); if(!(pull16(ppReadPackedMessage, &req->dummy1, end) && - pull16(ppReadPackedMessage, &req->dummy2, end))) + pull16(ppReadPackedMessage, &req->dummy2, end))) return 0; return 1; } @@ -1297,6 +1341,7 @@ int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi p7_config_g = p7_config; // DJP - INIT PHY RELATED STUFF - this should be separate i think but is not currently... + // Taken mostly from init_eNB_afterRU() dont think i can call it though... { printf("[PNF] %s() Calling phy_init_lte_eNB() and setting nb_antennas_rx = 1\n", __FUNCTION__); printf("[PNF] %s() TBD create frame_parms from NFAPI message\n", __FUNCTION__); @@ -1309,6 +1354,8 @@ int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi for (int ce_level=0;ce_level<4;ce_level++) RC.eNB[0][0]->prach_vars_br.rxsigF[ce_level] = (int16_t**)malloc16(64*sizeof(int16_t*)); #endif + init_transport(RC.eNB[0][0]); + //DJP - this crashes because RC.nb_RU is 1 but RC.ru[0] is NULL - init_precoding_weights(RC.eNB[0][0]); printf("[PNF] Calling mac_top_init_eNB() so that RC.mac[] is init\n"); mac_top_init_eNB(); diff --git a/nfapi/nfapi_vnf.c b/nfapi/nfapi_vnf.c index a4310819fc9284ce6ceb5829b5dcd3cba8946781..23b4a6a7226e42499f2fd05d839904f36873dba6 100644 --- a/nfapi/nfapi_vnf.c +++ b/nfapi/nfapi_vnf.c @@ -290,7 +290,7 @@ int vnf_unpack_vendor_extension_tlv(nfapi_tl_t* tl, uint8_t **ppReadPackedMessag void install_schedule_handlers(IF_Module_t *if_inst); extern int single_thread_flag; -extern void init_eNB_afterRU(); +extern void init_eNB_afterRU(void); void oai_create_enb(void) { @@ -330,6 +330,7 @@ void oai_create_enb(void) // See we need to wait for that to happen otherwise the NFAPI message exchanges won't contain the right parameter values if (RC.eNB[0][0]->if_inst->PHY_config_req==0 || RC.eNB[0][0]->if_inst->schedule_response==0) { + printf("RC.eNB[0][0]->if_inst->PHY_config_req is not installed - install it\n"); install_schedule_handlers(RC.eNB[0][0]->if_inst); } @@ -342,17 +343,7 @@ void oai_create_enb(void) void oai_enb_init(void) { - PHY_VARS_eNB *eNB = RC.eNB[0][0]; - init_eNB_afterRU(); - - //phy_init_lte_eNB(eNB,0,0); - - printf("%s() take this out - done properly now - eNB->frame_parms.nb_antennas_rx = 1;\n", __FUNCTION__); - eNB->frame_parms.nb_antennas_rx = 1; // DJP - - //printf("%s() Mark eNB as configured\n", __FUNCTION__); - //eNB->configured = 1; } int pnf_connection_indication_cb(nfapi_vnf_config_t* config, int p5_idx) @@ -1011,114 +1002,6 @@ printf("[VNF] DJP local_addr:%s\n", p7_vnf->local_addr); } } -#if 0 - req->nfapi_config.earfcn.tl.tag = NFAPI_NFAPI_EARFCN_TAG; - req->nfapi_config.earfcn.value = phy->earfcn; - req->num_tlv++; -#endif - - //req->rf_config.dl_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG; - //req->rf_config.dl_channel_bandwidth.value = RC.eNB[0][0]->frame_parms.N_RB_DL; - //req->num_tlv++; - - //req->rf_config.ul_channel_bandwidth.tl.tag = NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG; - //req->rf_config.ul_channel_bandwidth.value = RC.eNB[0][0]->frame_parms.N_RB_UL; - //req->num_tlv++; - - //req->nfapi_config.rf_bands.tl.tag = NFAPI_NFAPI_RF_BANDS_TAG; - //req->nfapi_config.rf_bands.number_rf_bands = 1; - //req->nfapi_config.rf_bands.rf_band[0] = RC.eNB[0][0]->frame_parms.eutra_band; - //req->num_tlv++; - - //req->nfapi_config.earfcn.tl.tag = NFAPI_NFAPI_EARFCN_TAG; - //req->nfapi_config.earfcn.value = to_earfcn(RC.eNB[0][0]->frame_parms.eutra_band, RC.eNB[0][0]->frame_parms.dl_CarrierFreq, RC.eNB[0][0]->frame_parms.N_RB_DL); - //req->num_tlv++; - - NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() EARFCN:%u BAND:%u dlCarrierFreq:%u N_RB_DL:%u (NFAPI:%d)\n", - __FUNCTION__, req->nfapi_config.earfcn.value, RC.eNB[0][0]->frame_parms.eutra_band, RC.eNB[0][0]->frame_parms.dl_CarrierFreq, RC.eNB[0][0]->frame_parms.N_RB_DL, req->rf_config.ul_channel_bandwidth.value); - - - - //RC.eNB[0][0]->frame_parms.ul_CarrierFreq = req->nfapi_config.earfcn.value; - - //req->subframe_config.duplex_mode.tl.tag = NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG; - //req->subframe_config.duplex_mode.value = RC.eNB[0][0]->frame_parms.frame_type; - //req->num_tlv++; - - //req->subframe_config.dl_cyclic_prefix_type.tl.tag = NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG; - //req->subframe_config.dl_cyclic_prefix_type.value = RC.eNB[0][0]->frame_parms.Ncp; - //req->num_tlv++; - - //req->subframe_config.ul_cyclic_prefix_type.tl.tag = NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG; - //req->subframe_config.ul_cyclic_prefix_type.value = RC.eNB[0][0]->frame_parms.Ncp_UL; - //req->num_tlv++; - - //RC.eNB[0][0]->frame_parms.num_MBSFN_config = 0; // DJP - hard code alert - - //req->sch_config.physical_cell_id.tl.tag = NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG; - //req->sch_config.physical_cell_id.value = RC.eNB[0][0]->frame_parms.Nid_cell; - //req->num_tlv++; - - //req->rf_config.tx_antenna_ports.tl.tag = NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG; - //req->rf_config.tx_antenna_ports.value = RC.eNB[0][0]->frame_parms.nb_antennas_tx; - //req->num_tlv++; - //RC.eNB[0][0]->frame_parms.nb_antenna_ports_eNB = 1; - - //req->rf_config.rx_antenna_ports.tl.tag = NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG; - //req->rf_config.rx_antenna_ports.value = RC.eNB[0][0]->frame_parms.nb_antennas_rx; - - //RC.eNB[0][0]->frame_parms.nushift = 0; - - //req->phich_config.phich_resource.tl.tag = NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG; - //req->phich_config.phich_resource.value = RC.eNB[0][0]->frame_parms.phich_config_common.phich_resource; - //req->num_tlv++; - - //req->phich_config.phich_duration.tl.tag = NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG; - //req->phich_config.phich_duration.value = RC.eNB[0][0]->frame_parms.phich_config_common.phich_duration; - //req->num_tlv++; - - // DJP - not supported in OAI - //req->phich_config.phich_power_offset.tl.tag = NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG; - //req->phich_config.phich_power_offset.value = RC.eNB[0][0]->frame_parms.phich_config_common. - //req->num_tlv++; - - // UL RS Config - //req->uplink_reference_signal_config.cyclic_shift_1_for_drms.tl.tag = NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG; - //req->uplink_reference_signal_config.cyclic_shift_1_for_drms.value = RC.eNB[0][0]->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift; - //req->num_tlv++; - - //req->uplink_reference_signal_config.uplink_rs_hopping.tl.tag = NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG; - //req->uplink_reference_signal_config.uplink_rs_hopping.value = RC.eNB[0][0]->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled; - //req->num_tlv++; - - //req->uplink_reference_signal_config.group_assignment.tl.tag = NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG; - //req->uplink_reference_signal_config.group_assignment.value = RC.eNB[0][0]->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH; - //req->num_tlv++; - - //if (req->pusch_config.hopping_mode.tl.tag == NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG) { } // DJP - not being handled? - - //RC.eNB[0][0]->frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = 0; // DJP - not being handled - - //req->prach_config.configuration_index.tl.tag = NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG; - //req->prach_config.configuration_index.value = RC.eNB[0][0]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex; - //req->num_tlv++; - - //req->prach_config.root_sequence_index.tl.tag = NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG; - //req->prach_config.root_sequence_index.value = RC.eNB[0][0]->frame_parms.prach_config_common.rootSequenceIndex; - //req->num_tlv++; - - //req->prach_config.zero_correlation_zone_configuration.tl.tag = NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG; - //req->prach_config.zero_correlation_zone_configuration.value = RC.eNB[0][0]->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig; - //req->num_tlv++; - - //req->prach_config.high_speed_flag.tl.tag = NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG; - //req->prach_config.high_speed_flag.value = RC.eNB[0][0]->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag; - //req->num_tlv++; - - //req->prach_config.frequency_offset.tl.tag = NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG; - //req->prach_config.frequency_offset.value = RC.eNB[0][0]->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset; - //req->num_tlv++; - vendor_ext_tlv_2 ve2; memset(&ve2, 0, sizeof(ve2)); ve2.tl.tag = VENDOR_EXT_TLV_2_TAG; @@ -1164,240 +1047,12 @@ int config_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_response return 0; } -void test_p4_requests(nfapi_vnf_config_t* config, int p5_idx, int phy_id) -{ -#if 0 - { - nfapi_measurement_request_t req; - memset(&req, 0, sizeof(req)); - req.header.message_id = NFAPI_MEASUREMENT_REQUEST; - req.header.phy_id = phy_id; - - req.dl_rs_tx_power.tl.tag = NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG; - req.dl_rs_tx_power.value = 42; - req.received_interference_power.tl.tag = NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG; - req.received_interference_power.value = 42; - req.thermal_noise_power.tl.tag = NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG; - req.thermal_noise_power.value = 42; - - nfapi_vnf_measurement_req(config, p5_idx, &req); - } - { - nfapi_rssi_request_t lte_req; - memset(<e_req, 0, sizeof(lte_req)); - lte_req.header.message_id = NFAPI_RSSI_REQUEST; - lte_req.header.phy_id = phy_id; - - lte_req.rat_type = NFAPI_RAT_TYPE_LTE; - lte_req.lte_rssi_request.tl.tag = NFAPI_LTE_RSSI_REQUEST_TAG; - lte_req.lte_rssi_request.frequency_band_indicator = 2; - lte_req.lte_rssi_request.measurement_period = 1000; - lte_req.lte_rssi_request.bandwidth = 50; - lte_req.lte_rssi_request.timeout = 0; - lte_req.lte_rssi_request.number_of_earfcns = 2; - lte_req.lte_rssi_request.earfcn[0] = 389; - lte_req.lte_rssi_request.earfcn[1] = 123; - - nfapi_vnf_rssi_request(config, p5_idx, <e_req); - - nfapi_rssi_request_t utran_req; - memset(&utran_req, 0, sizeof(utran_req)); - utran_req.header.message_id = NFAPI_RSSI_REQUEST; - utran_req.header.phy_id = phy_id; - - utran_req.rat_type = NFAPI_RAT_TYPE_UTRAN; - utran_req.utran_rssi_request.tl.tag = NFAPI_UTRAN_RSSI_REQUEST_TAG; - utran_req.utran_rssi_request.frequency_band_indicator = 2; - utran_req.utran_rssi_request.measurement_period = 1000; - utran_req.utran_rssi_request.timeout = 0; - utran_req.utran_rssi_request.number_of_uarfcns = 2; - utran_req.utran_rssi_request.uarfcn[0] = 2348; - utran_req.utran_rssi_request.uarfcn[1] = 52; - - nfapi_vnf_rssi_request(config, p5_idx, &utran_req); - - - nfapi_rssi_request_t geran_req; - memset(&geran_req, 0, sizeof(geran_req)); - geran_req.header.message_id = NFAPI_RSSI_REQUEST; - geran_req.header.phy_id = phy_id; - - geran_req.rat_type = NFAPI_RAT_TYPE_GERAN; - geran_req.geran_rssi_request.tl.tag = NFAPI_GERAN_RSSI_REQUEST_TAG; - geran_req.geran_rssi_request.frequency_band_indicator = 2; - geran_req.geran_rssi_request.measurement_period = 1000; - geran_req.geran_rssi_request.timeout = 0; - geran_req.geran_rssi_request.number_of_arfcns = 1; - geran_req.geran_rssi_request.arfcn[0].arfcn = 34; - geran_req.geran_rssi_request.arfcn[0].direction = 0; - - nfapi_vnf_rssi_request(config, p5_idx, &geran_req); - } - { - nfapi_cell_search_request_t lte_req; - memset(<e_req, 0, sizeof(lte_req)); - lte_req.header.message_id = NFAPI_CELL_SEARCH_REQUEST; - lte_req.header.phy_id = phy_id; - - lte_req.rat_type = NFAPI_RAT_TYPE_LTE; - lte_req.lte_cell_search_request.tl.tag = NFAPI_LTE_CELL_SEARCH_REQUEST_TAG; - lte_req.lte_cell_search_request.earfcn = 1234; - lte_req.lte_cell_search_request.measurement_bandwidth = 50; - lte_req.lte_cell_search_request.exhaustive_search = 1; - lte_req.lte_cell_search_request.timeout = 1000; - lte_req.lte_cell_search_request.number_of_pci = 1; - lte_req.lte_cell_search_request.pci[0] = 234; - - nfapi_vnf_cell_search_request(config, p5_idx, <e_req); - - nfapi_cell_search_request_t utran_req; - memset(&utran_req, 0, sizeof(utran_req)); - utran_req.header.message_id = NFAPI_CELL_SEARCH_REQUEST; - utran_req.header.phy_id = phy_id; - - utran_req.rat_type = NFAPI_RAT_TYPE_UTRAN; - utran_req.utran_cell_search_request.tl.tag = NFAPI_UTRAN_CELL_SEARCH_REQUEST_TAG; - utran_req.utran_cell_search_request.uarfcn = 1234; - utran_req.utran_cell_search_request.exhaustive_search = 0; - utran_req.utran_cell_search_request.timeout = 1000; - utran_req.utran_cell_search_request.number_of_psc = 1; - utran_req.utran_cell_search_request.psc[0] = 234; - - nfapi_vnf_cell_search_request(config, p5_idx, &utran_req); - - nfapi_cell_search_request_t geran_req; - memset(&geran_req, 0, sizeof(geran_req)); - geran_req.header.message_id = NFAPI_CELL_SEARCH_REQUEST; - geran_req.header.phy_id = phy_id; - - geran_req.rat_type = NFAPI_RAT_TYPE_GERAN; - geran_req.geran_cell_search_request.tl.tag = NFAPI_GERAN_CELL_SEARCH_REQUEST_TAG; - geran_req.geran_cell_search_request.timeout = 1000; - geran_req.geran_cell_search_request.number_of_arfcn = 1; - geran_req.geran_cell_search_request.arfcn[0] = 8765; - - nfapi_vnf_cell_search_request(config, p5_idx, &geran_req); - } - { - nfapi_broadcast_detect_request_t lte_req; - memset(<e_req, 0, sizeof(lte_req)); - lte_req.header.message_id = NFAPI_BROADCAST_DETECT_REQUEST; - lte_req.header.phy_id = phy_id; - - lte_req.rat_type = NFAPI_RAT_TYPE_LTE; - lte_req.lte_broadcast_detect_request.tl.tag = NFAPI_LTE_BROADCAST_DETECT_REQUEST_TAG; - lte_req.lte_broadcast_detect_request.earfcn = 1234; - lte_req.lte_broadcast_detect_request.pci = 50; - lte_req.lte_broadcast_detect_request.timeout = 1000; - - lte_req.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG; - lte_req.pnf_cell_search_state.length = 3; - - nfapi_vnf_broadcast_detect_request(config, p5_idx, <e_req); - - nfapi_broadcast_detect_request_t utran_req; - memset(&utran_req, 0, sizeof(utran_req)); - utran_req.header.message_id = NFAPI_BROADCAST_DETECT_REQUEST; - utran_req.header.phy_id = phy_id; - - utran_req.rat_type = NFAPI_RAT_TYPE_LTE; - utran_req.utran_broadcast_detect_request.tl.tag = NFAPI_UTRAN_BROADCAST_DETECT_REQUEST_TAG; - utran_req.utran_broadcast_detect_request.uarfcn = 1234; - utran_req.utran_broadcast_detect_request.psc = 50; - utran_req.utran_broadcast_detect_request.timeout = 1000; - - utran_req.pnf_cell_search_state.tl.tag = NFAPI_PNF_CELL_SEARCH_STATE_TAG; - utran_req.pnf_cell_search_state.length = 3; - - nfapi_vnf_broadcast_detect_request(config, p5_idx, &utran_req); - } - { - nfapi_system_information_schedule_request_t lte_req; - memset(<e_req, 0, sizeof(lte_req)); - lte_req.header.message_id = NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST; - lte_req.header.phy_id = phy_id; - - lte_req.rat_type = NFAPI_RAT_TYPE_LTE; - lte_req.lte_system_information_schedule_request.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_SCHEDULE_REQUEST_TAG; - lte_req.lte_system_information_schedule_request.earfcn = 1234; - lte_req.lte_system_information_schedule_request.pci = 50; - lte_req.lte_system_information_schedule_request.downlink_channel_bandwidth = 100; - lte_req.lte_system_information_schedule_request.phich_configuration = 3; - lte_req.lte_system_information_schedule_request.number_of_tx_antenna = 2; - lte_req.lte_system_information_schedule_request.retry_count = 4; - lte_req.lte_system_information_schedule_request.timeout = 1000; - - lte_req.pnf_cell_broadcast_state.tl.tag = NFAPI_PNF_CELL_BROADCAST_STATE_TAG; - lte_req.pnf_cell_broadcast_state.length = 3; - - nfapi_vnf_system_information_schedule_request(config, p5_idx, <e_req); - } - { - nfapi_system_information_request_t lte_req; - memset(<e_req, 0, sizeof(lte_req)); - lte_req.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST; - lte_req.header.phy_id = phy_id; - - lte_req.rat_type = NFAPI_RAT_TYPE_LTE; - lte_req.lte_system_information_request.tl.tag = NFAPI_LTE_SYSTEM_INFORMATION_REQUEST_TAG; - lte_req.lte_system_information_request.earfcn = 1234; - lte_req.lte_system_information_request.pci= 456; - lte_req.lte_system_information_request.downlink_channel_bandwidth = 5; - lte_req.lte_system_information_request.phich_configuration = 2; - lte_req.lte_system_information_request.number_of_tx_antenna = 2; - lte_req.lte_system_information_request.number_of_si_periodicity = 1; - lte_req.lte_system_information_request.si_periodicity[0].si_periodicity = 3; - lte_req.lte_system_information_request.si_periodicity[0].si_index = 3; - lte_req.lte_system_information_request.si_window_length = 15; - lte_req.lte_system_information_request.timeout = 1000; - - nfapi_vnf_system_information_request(config, p5_idx, <e_req); - - nfapi_system_information_request_t utran_req; - memset(&utran_req, 0, sizeof(utran_req)); - utran_req.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST; - utran_req.header.phy_id = phy_id; - - utran_req.rat_type = NFAPI_RAT_TYPE_UTRAN; - utran_req.utran_system_information_request.tl.tag = NFAPI_UTRAN_SYSTEM_INFORMATION_REQUEST_TAG; - utran_req.utran_system_information_request.uarfcn = 1234; - utran_req.utran_system_information_request.psc = 456; - utran_req.utran_system_information_request.timeout = 1000; - - nfapi_vnf_system_information_request(config, p5_idx, &utran_req); - - nfapi_system_information_request_t geran_req; - memset(&geran_req, 0, sizeof(geran_req)); - geran_req.header.message_id = NFAPI_SYSTEM_INFORMATION_REQUEST; - geran_req.header.phy_id = phy_id; - - geran_req.rat_type = NFAPI_RAT_TYPE_GERAN; - geran_req.geran_system_information_request.tl.tag = NFAPI_GERAN_SYSTEM_INFORMATION_REQUEST_TAG; - geran_req.geran_system_information_request.arfcn = 1234; - geran_req.geran_system_information_request.bsic = 21; - geran_req.geran_system_information_request.timeout = 1000; - - nfapi_vnf_system_information_request(config, p5_idx, &geran_req); - } - { - nfapi_nmm_stop_request_t req; - memset(&req, 0, sizeof(req)); - req.header.message_id = NFAPI_NMM_STOP_REQUEST; - req.header.phy_id = phy_id; - nfapi_vnf_nmm_stop_request(config, p5_idx, &req); - } -#endif -} - int start_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_response_t* resp) { printf("[VNF] Received NFAPI_START_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id); vnf_info* vnf = (vnf_info*)(config->user_data); - if(vnf->wireshark_test_mode) - test_p4_requests(config, p5_idx, resp->header.phy_id); - #if 0 auto find_result = vnf->pnfs.find(p5_idx); if(find_result != vnf->pnfs.end()) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 832ba0ce5de236f74300366810423b92f9a9cf69..6f398f12ab38b96ab05e5b110f36362a767ad08d 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -32,6 +32,9 @@ #include "assertions.h" #include <math.h> +extern uint32_t from_earfcn(int eutra_bandP,uint32_t dl_earfcn); +extern int32_t get_uldl_offset(int eutra_bandP); + extern uint16_t prach_root_sequence_map0_3[838]; extern uint16_t prach_root_sequence_map4[138]; uint8_t dmrs1_tab[8] = {0,2,3,4,6,8,9,10}; @@ -1725,9 +1728,13 @@ int phy_init_RU(RU_t *ru) { #endif } + LOG_D(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); 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)); @@ -1739,14 +1746,14 @@ int phy_init_RU(RU_t *ru) { { ru->beam_weights[i][p][j][re] = 0x00007fff; - LOG_E(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d][%d][%d] = %d\n", i,p,j,re,ru->beam_weights[i][p][j][re]); + LOG_D(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d][%d][%d] = %d\n", i,p,j,re,ru->beam_weights[i][p][j][re]); } } else if (i>4) { for (re=0; re<fp->ofdm_symbol_size; re++) { ru->beam_weights[i][p][j][re] = 0x00007fff/ru->nb_tx; - LOG_E(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d][%d][%d] = %d\n", i,p,j,re,ru->beam_weights[i][p][j][re]); + LOG_D(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d][%d][%d] = %d\n", i,p,j,re,ru->beam_weights[i][p][j][re]); } } LOG_D(PHY,"[INIT] lte_common_vars->beam_weights[%d][%d] = %p (%lu bytes)\n", @@ -1776,7 +1783,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, #ifdef Rel14 LTE_eNB_PRACH* const prach_vars_br = &eNB->prach_vars_br; #endif - int i, eNB_id, UE_id; + int i, UE_id; LOG_I(PHY,"[eNB %d] %s() About to wait for eNB to be configured", eNB->Mod_id, __FUNCTION__); diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index 58f1ccd69db28bb9a8ca4f6368e9ee400e3e963b..9dd6de0e594a95b43f494ecaf1dbb4b3ed651385 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -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_E(PHY,"Frame %d, Subframe %d: DCI processing\n",proc->frame_tx,proc->subframe_tx); // copy dci configuration into eNB structure fill_dci_and_dlsch(eNB,proc,&pdcch_vars->dci_alloc[pdcch_vars->num_dci],pdu); @@ -643,7 +643,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\n", __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->frame_rx, proc->subframe_rx); + 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); 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", diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 63ac501ecccf11fa0ff16563fd00980fb56b7e48..13571d678ab35fed12cb545951d42e08a42d9e6a 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -192,7 +192,8 @@ void common_signal_procedures (PHY_VARS_eNB *eNB,int frame, int subframe) { /// generate PBCH if ((frame&3)==0) { - AssertFatal(eNB->pbch_configured==1,"PBCH was not configured by MAC\n"); + //AssertFatal(eNB->pbch_configured==1,"PBCH was not configured by MAC\n"); + if (eNB->pbch_configured!=1) return; eNB->pbch_configured=0; } generate_pbch(&eNB->pbch, @@ -266,9 +267,10 @@ void pdsch_procedures(PHY_VARS_eNB *eNB, int input_buffer_length = dlsch_harq->TBS/8; LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; - if (frame < 200) { + //if (frame < 200) { + if (1){ - LOG_D(PHY, + LOG_E(PHY, "[eNB %"PRIu8"][PDSCH %"PRIx16"/%"PRIu8"] Frame %d, subframe %d: Generating PDSCH/DLSCH with input size = %"PRIu16", pdsch_start %d, G %d, nb_rb %"PRIu16", rb0 %x, rb1 %x, TBS %"PRIu16", pmi_alloc %"PRIx64", rv %"PRIu8" (round %"PRIu8")\n", eNB->Mod_id, dlsch->rnti,harq_pid, frame, subframe, input_buffer_length, dlsch_harq->pdsch_start, @@ -328,7 +330,7 @@ void pdsch_procedures(PHY_VARS_eNB *eNB, } - LOG_D(PHY,"Generating DLSCH/PDSCH %d\n",ra_flag); + LOG_E(PHY,"Generating DLSCH/PDSCH %d\n",ra_flag); // 36-212 start_meas(&eNB->dlsch_encoding_stats); AssertFatal(dlsch_harq->pdu!=NULL,"dlsch_harq->pdu == NULL (rnti %x)\n",dlsch->rnti); @@ -479,8 +481,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO,(frame*10)+subframe); if (num_dci > 0) - LOG_D(PHY,"[eNB %"PRIu8"] Frame %d, subframe %d: Calling generate_dci_top (pdcch) (num_dci %"PRIu8")\n",eNB->Mod_id,frame, subframe, - num_dci); + LOG_E(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); generate_dci_top(num_pdcch_symbols, num_dci, @@ -546,7 +547,6 @@ void prach_procedures(PHY_VARS_eNB *eNB, #endif ) { - LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; uint16_t max_preamble[4],max_preamble_energy[4],max_preamble_delay[4]; uint16_t i; int frame,subframe; @@ -567,11 +567,9 @@ void prach_procedures(PHY_VARS_eNB *eNB, subframe = eNB->proc.subframe_prach; frame = eNB->proc.frame_prach; } - uint8_t CC_id = eNB->CC_id; RU_t *ru; int aa=0; int ru_aa; - LTE_eNB_PRACH *prach_vars; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,1); @@ -614,7 +612,6 @@ void prach_procedures(PHY_VARS_eNB *eNB, #ifdef Rel14 if (br_flag==1) { - prach_vars = &eNB->prach_vars_br; int prach_mask; prach_mask = is_prach_subframe(&eNB->frame_parms,eNB->proc.frame_prach_br,eNB->proc.subframe_prach_br); @@ -674,7 +671,6 @@ void prach_procedures(PHY_VARS_eNB *eNB, T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), 0, T_INT(max_preamble[0]), T_INT(max_preamble_energy[0]), T_INT(max_preamble_delay[0])); - prach_vars = &eNB->prach_vars; pthread_mutex_lock(&eNB->UL_INFO_mutex); @@ -764,11 +760,12 @@ void uci_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; uint8_t SR_payload = 0,pucch_b0b1[4][2]= {{0,0},{0,0},{0,0},{0,0}},harq_ack[4]={0,0,0,0}; - uint8_t do_SR = 0; - uint8_t pucch_sel = 0; int32_t metric[4]={0,0,0,0},metric_SR=0,max_metric; ANFBmode_t bundling_flag; +#ifdef DEBUG_PHY_PROC + uint8_t pucch_sel = 0; PUCCH_FMT_t format; +#endif const int subframe = proc->subframe_rx; const int frame = proc->frame_rx; int i; @@ -1257,19 +1254,21 @@ void uci_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { - uint32_t ret=0,i,j,k; - uint32_t harq_pid, harq_idx, round; + uint32_t ret=0,i; +#ifdef DEBUG_PHY_PROC +#ifdef DEBUG_ULSCH + uint32_t j; +#endif +#endif + + uint32_t harq_pid; uint8_t nPRS; - int sync_pos; - uint16_t rnti=0; - uint8_t access_mode; LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; LTE_eNB_ULSCH_t *ulsch; LTE_UL_eNB_HARQ_t *ulsch_harq; const int subframe = proc->subframe_rx; const int frame = proc->frame_rx; - int offset = eNB->CC_id;//(proc == &eNB->proc.proc_rxtx[0]) ? 0 : 1; if (fp->frame_type == FDD) harq_pid = ((10*frame) + subframe)&7; else harq_pid = subframe%10; @@ -1279,42 +1278,40 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { for (i=0; i<NUMBER_OF_UE_MAX; i++) { ulsch = eNB->ulsch[i]; - ulsch_harq = ulsch->harq_processes[harq_pid]; - if (ulsch->rnti>0) LOG_D(PHY,"Frame %d, subframe %d: PUSCH procedures, harq_pid %d, UE %d/%x\n", - frame,subframe,harq_pid,i,ulsch->rnti); - - if ((ulsch) && - (ulsch->rnti>0) && - (ulsch_harq->status == ACTIVE) && - (ulsch_harq->frame == frame) && - (ulsch_harq->subframe == subframe)) { - - - // UE is has ULSCH scheduling - round = ulsch_harq->round; - - for (int rb=0; - rb<=ulsch_harq->nb_rb; - rb++) { - int rb2 = rb+ulsch_harq->first_rb; - eNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31)); - } + if (ulsch) + { + ulsch_harq = ulsch->harq_processes[harq_pid]; + if (ulsch->rnti>0) LOG_D(PHY,"Frame %d, subframe %d: PUSCH procedures, harq_pid %d, UE %d/%x\n", + frame,subframe,harq_pid,i,ulsch->rnti); + + if ((ulsch) && + (ulsch->rnti>0) && + (ulsch_harq->status == ACTIVE) && + (ulsch_harq->frame == frame) && + (ulsch_harq->subframe == subframe)) { + for (int rb=0; + rb<=ulsch_harq->nb_rb; + rb++) { + int rb2 = rb+ulsch_harq->first_rb; + eNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31)); + } - LOG_D(PHY,"[eNB %d] frame %d, subframe %d: Scheduling ULSCH Reception for UE %d \n", - eNB->Mod_id, - frame, - subframe, - i); + LOG_D(PHY,"[eNB %d] frame %d, subframe %d: Scheduling ULSCH Reception for UE %d \n", + eNB->Mod_id, + frame, + subframe, + i); - nPRS = fp->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe<<1]; - ulsch->cyclicShift = (ulsch_harq->n_DMRS2 + - fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift + - nPRS)%12; + nPRS = fp->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe<<1]; - LOG_D(PHY, + ulsch->cyclicShift = (ulsch_harq->n_DMRS2 + + fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift + + nPRS)%12; + + LOG_D(PHY, "[eNB %d][PUSCH %d] Frame %d Subframe %d Demodulating PUSCH: dci_alloc %d, rar_alloc %d, round %d, first_rb %d, nb_rb %d, Qm %d, TBS %d, rv %d, cyclic_shift %d (n_DMRS2 %d, cyclicShift_common %d, nprs %d), O_ACK %d \n", eNB->Mod_id,harq_pid,frame,subframe, ulsch_harq->dci_alloc, @@ -1331,28 +1328,28 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { nPRS, ulsch_harq->O_ACK); - start_meas(&eNB->ulsch_demodulation_stats); + start_meas(&eNB->ulsch_demodulation_stats); - rx_ulsch(eNB,proc, - i); - + rx_ulsch(eNB,proc, + i); - stop_meas(&eNB->ulsch_demodulation_stats); + stop_meas(&eNB->ulsch_demodulation_stats); - start_meas(&eNB->ulsch_decoding_stats); - ret = ulsch_decoding(eNB,proc, - i, - 0, // control_only_flag - ulsch_harq->V_UL_DAI, - ulsch_harq->nb_rb>20 ? 1 : 0); - + start_meas(&eNB->ulsch_decoding_stats); + + ret = ulsch_decoding(eNB,proc, + i, + 0, // control_only_flag + ulsch_harq->V_UL_DAI, + ulsch_harq->nb_rb>20 ? 1 : 0); - 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", + 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", eNB->Mod_id,harq_pid, frame,subframe, ulsch->rnti, @@ -1365,87 +1362,87 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ret); - //compute the expected ULSCH RX power (for the stats) - ulsch_harq->delta_TF = get_hundred_times_delta_IF_eNB(eNB,i,harq_pid, 0); // 0 means bw_factor is not considered + //compute the expected ULSCH RX power (for the stats) + ulsch_harq->delta_TF = get_hundred_times_delta_IF_eNB(eNB,i,harq_pid, 0); // 0 means bw_factor is not considered - if (ulsch_harq->cqi_crc_status == 1) { + if (ulsch_harq->cqi_crc_status == 1) { #ifdef DEBUG_PHY_PROC - //if (((frame%10) == 0) || (frame < 50)) - print_CQI(ulsch_harq->o,ulsch_harq->uci_format,0,fp->N_RB_DL); + //if (((frame%10) == 0) || (frame < 50)) + print_CQI(ulsch_harq->o,ulsch_harq->uci_format,0,fp->N_RB_DL); #endif - fill_ulsch_cqi_indication(eNB,frame,subframe, - ulsch_harq, - ulsch->rnti); - } - - if (ret == (1+MAX_TURBO_ITERATIONS)) { - T(T_ENB_PHY_ULSCH_UE_NACK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(i), T_INT(ulsch->rnti), - T_INT(harq_pid)); - - fill_crc_indication(eNB,i,frame,subframe,1); // indicate NAK to MAC - - LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d UE %d Error receiving ULSCH, round %d/%d (ACK %d,%d)\n", - eNB->Mod_id,harq_pid, - frame,subframe, i, - ulsch_harq->round-1, - ulsch->Mlimit, - ulsch_harq->o_ACK[0], - ulsch_harq->o_ACK[1]); - + fill_ulsch_cqi_indication(eNB,frame,subframe, + ulsch_harq, + ulsch->rnti); + } + + if (ret == (1+MAX_TURBO_ITERATIONS)) { + T(T_ENB_PHY_ULSCH_UE_NACK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(i), T_INT(ulsch->rnti), + T_INT(harq_pid)); + + fill_crc_indication(eNB,i,frame,subframe,1); // indicate NAK to MAC + + LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d UE %d Error receiving ULSCH, round %d/%d (ACK %d,%d)\n", + eNB->Mod_id,harq_pid, + frame,subframe, i, + ulsch_harq->round-1, + ulsch->Mlimit, + ulsch_harq->o_ACK[0], + ulsch_harq->o_ACK[1]); + #if defined(MESSAGE_CHART_GENERATOR_PHY) - MSC_LOG_RX_DISCARDED_MESSAGE( - MSC_PHY_ENB,MSC_PHY_UE, - NULL,0, - "%05u:%02u ULSCH received rnti %x harq id %u round %d", - frame,subframe, - ulsch->rnti,harq_pid, - ulsch_harq->round-1 - ); + MSC_LOG_RX_DISCARDED_MESSAGE( + MSC_PHY_ENB,MSC_PHY_UE, + NULL,0, + "%05u:%02u ULSCH received rnti %x harq id %u round %d", + frame,subframe, + ulsch->rnti,harq_pid, + ulsch_harq->round-1 + ); #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 - T(T_ENB_PHY_ULSCH_UE_ACK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(i), T_INT(ulsch->rnti), - T_INT(harq_pid)); - ulsch_harq->status = SCH_IDLE; + } // 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 + T(T_ENB_PHY_ULSCH_UE_ACK, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(i), T_INT(ulsch->rnti), + T_INT(harq_pid)); + ulsch_harq->status = SCH_IDLE; #if defined(MESSAGE_CHART_GENERATOR_PHY) - MSC_LOG_RX_MESSAGE( - MSC_PHY_ENB,MSC_PHY_UE, - NULL,0, - "%05u:%02u ULSCH received rnti %x harq id %u", - frame,subframe, - ulsch->rnti,harq_pid - ); + MSC_LOG_RX_MESSAGE( + MSC_PHY_ENB,MSC_PHY_UE, + NULL,0, + "%05u:%02u ULSCH received rnti %x harq id %u", + frame,subframe, + ulsch->rnti,harq_pid + ); #endif #ifdef DEBUG_PHY_PROC #ifdef DEBUG_ULSCH - LOG_D(PHY,"[eNB] Frame %d, Subframe %d : ULSCH SDU (RX harq_pid %d) %d bytes:",frame,subframe, - harq_pid,ulsch_harq->TBS>>3); - - for (j=0; j<ulsch_harq->TBS>>3; j++) - LOG_T(PHY,"%x.",ulsch->harq_processes[harq_pid]->b[j]); - - LOG_T(PHY,"\n"); + LOG_D(PHY,"[eNB] Frame %d, Subframe %d : ULSCH SDU (RX harq_pid %d) %d bytes:",frame,subframe, + harq_pid,ulsch_harq->TBS>>3); + + for (j=0; j<ulsch_harq->TBS>>3; j++) + LOG_T(PHY,"%x.",ulsch->harq_processes[harq_pid]->b[j]); + + LOG_T(PHY,"\n"); #endif #endif - - - } // ulsch not in error - if (ulsch_harq->O_ACK>0) fill_ulsch_harq_indication(eNB,ulsch_harq,ulsch->rnti,frame,subframe,ulsch->bundling); + } // ulsch not in error - LOG_I(PHY,"[eNB %d] Frame %d subframe %d: received ULSCH harq_pid %d for UE %d, ret = %d, CQI CRC Status %d, ACK %d,%d, ulsch_errors %d/%d\n", + if (ulsch_harq->O_ACK>0) fill_ulsch_harq_indication(eNB,ulsch_harq,ulsch->rnti,frame,subframe,ulsch->bundling); + + + LOG_I(PHY,"[eNB %d] Frame %d subframe %d: received ULSCH harq_pid %d for UE %d, ret = %d, CQI CRC Status %d, ACK %d,%d, ulsch_errors %d/%d\n", eNB->Mod_id,frame,subframe, harq_pid, i, @@ -1455,11 +1452,12 @@ void pusch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { ulsch_harq->o_ACK[1], eNB->UE_stats[i].ulsch_errors[harq_pid], eNB->UE_stats[i].ulsch_decoding_attempts[harq_pid][0]); - - } // if ((ulsch) && + + } // if ((ulsch) && // (ulsch->rnti>0) && // (ulsch_harq->status == ACTIVE)) - } // for (i=0; i<NUMBER_OF_UE_MAX; i++) { + } // for (i=0; i<NUMBER_OF_UE_MAX; i++) { + } } extern int oai_exit; @@ -1647,7 +1645,6 @@ void fill_ulsch_cqi_indication(PHY_VARS_eNB *eNB,uint16_t frame,uint8_t subframe pthread_mutex_lock(&eNB->UL_INFO_mutex); 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]; - uint8_t O; pdu->rx_ue_information.rnti = rnti; if (ulsch_harq->cqi_crc_status != 1) pdu->cqi_indication_rel9.data_offset = 0; diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index cb6e997772d4bea30a2f80922aadc14912c286db..ea5b1150ab6123058a41a745035c47755b8aa60a 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -73,7 +73,8 @@ extern int oai_exit; extern double cpuf; - +void Msg1_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id); +void Msg3_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id); #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) extern uint32_t downlink_frequency[MAX_NUM_CCs][4]; diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 4761fa08c1984ae177c6b989400b38f7cdfc6481..2cfc1537110e23905676e2d3381d7f472c4eb951 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -59,6 +59,12 @@ extern unsigned char NB_eNB_INST; extern RAN_CONTEXT_t RC; +extern int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc); +extern void RCconfig_S1(MessageDef *msg_p, uint32_t i); +extern int RCconfig_gtpu(void); +extern void RCconfig_L1(void ); +extern void RCconfig_macrlc(void ); + #if defined(ENABLE_ITTI) /*------------------------------------------------------------------------------*/ @@ -100,7 +106,7 @@ static void configure_rrc(uint32_t enb_id) msg_p = itti_alloc_new_message (TASK_ENB_APP, RRC_CONFIGURATION_REQ); if (RC.rrc[enb_id]) { - RCconfig_RRC(msg_p,enb_id,&RC.rrc[enb_id]); + RCconfig_RRC(msg_p,enb_id,RC.rrc[enb_id]); /* RRC_CONFIGURATION_REQ (msg_p).cell_identity = enb_properties->properties[enb_id]->eNB_id; @@ -211,11 +217,8 @@ static void configure_rrc(uint32_t enb_id) static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//, const Enb_properties_array_t *enb_properties) { uint32_t enb_id; - uint32_t mme_id; MessageDef *msg_p; uint32_t register_enb_pending = 0; - char *str = NULL; - struct in_addr addr; # if defined(OAI_EMU) diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 4137fe5f4c7c0a54718a0dd399eb1039ca7d677e..759b22b38ba43c3ea56afc21a32738177ed94425 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -60,6 +60,7 @@ extern RAN_CONTEXT_t RC; extern int l2_init_eNB(void); extern int mac_top_init_eNB(void); extern void mac_init_cell_params(int Mod_idP,int CC_idP); +extern void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index); /* sec 5.9, 36.321: MAC Reset Procedure */ void ue_mac_reset(module_id_t module_idP,uint8_t eNB_index) diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index db91f3f7818217dd81541a2f34c1e756fc23feba..8f2fc8027fafa7e427de033dd66b97c0a21d8102 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -330,6 +330,8 @@ void check_ul_failure(module_id_t module_idP,int CC_id,int UE_id, "illegal dl_Bandwidth %d\n",(int)cc[CC_id].mib->message.dl_Bandwidth); dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = pdcch_order_table[cc[CC_id].mib->message.dl_Bandwidth]; DL_req[CC_id].dl_config_request_body.number_dci++; + LOG_E(MAC, "%s() number_dci:%u\n", __FUNCTION__, DL_req[CC_id].dl_config_request_body.number_dci); + DL_req[CC_id].dl_config_request_body.number_pdu++; /* diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c index c67a07d09a8407af057ed645289c9e3d1a01a6c5..96c5080c52551270d927df90b2b54a906de078b7 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c @@ -701,6 +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); 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; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index ba858cc5df2b97d99e9ed3003e672a8001166cbc..80ad62250a06fcd857fb79f2bce539fbf2d6832a 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -60,6 +60,8 @@ #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 +extern void add_msg3(module_id_t module_idP,int CC_id, RA_TEMPLATE *RA_template, frame_t frameP, sub_frame_t subframeP); + // This table holds the allowable PRB sizes for ULSCH transmissions uint8_t rb_table[33] = {1,2,3,4,5,6,8,9,10,12,15,16,18,20,24,25,27,30,32,36,40,45,48,50,54,60,72,75,80,81,90,96,100}; diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index c67567660680d27335d4b4ad9a6017346993a4e4..897d527297cb43c186393de05ee3f85055ccbb76 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -169,10 +169,10 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, #ifdef __AVX2__ buff_tx[i][j] = _mm256_slli_epi16(((__m256i*)buff[i])[j],4); #else - buff_tx[i][j] = _mm_slli_epi16(((__m128i*)buff128[i])[j],4); + buff_tx[i][j] = _mm_slli_epi16(((__m128i*)buff[i])[j],4); #endif #elif defined(__arm__) - buff_tx[i][j] = vshlq_n_s16(((int16x8_t*)buff128[i])[j],4); + buff_tx[i][j] = vshlq_n_s16(((int16x8_t*)buff[i])[j],4); #endif } } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf index f026017b7a3333904f835b829cf32ce0c29a7ead..842f32a70ea3dea8d747cc77290c1887b0a320fc 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf @@ -141,11 +141,7 @@ eNBs = ////////// MME parameters: -<<<<<<< HEAD mme_ip_address = ( { ipv4 = "192.168.1.78"; -======= - mme_ip_address = ( { ipv4 = "192.168.12.26"; ->>>>>>> b421d467ad96939fde41734f1e3b7bb793939063 ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -155,17 +151,10 @@ eNBs = NETWORK_INTERFACES : { -<<<<<<< HEAD ENB_INTERFACE_NAME_FOR_S1_MME = "eno1"; ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.1.74/24"; ENB_INTERFACE_NAME_FOR_S1U = "eno1"; ENB_IPV4_ADDRESS_FOR_S1U = "192.168.1.74/24"; -======= - ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.19/24"; - ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.19/24"; ->>>>>>> b421d467ad96939fde41734f1e3b7bb793939063 ENB_PORT_FOR_S1U = 2152; # Spec 2152 }; @@ -206,7 +195,6 @@ L1s = ( RUs = ( { -<<<<<<< HEAD local_rf = "yes" nb_tx = 1 nb_rx = 1 @@ -216,17 +204,5 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 125; eNB_instances = [0]; -======= - local_rf = "yes" - nb_tx = 1 - nb_rx = 1 - att_tx = 0 - att_rx = 0; - bands = [7]; - max_pdschReferenceSignalPower = -27; - max_rxgain = 125; - eNB_instances = [0]; - ->>>>>>> b421d467ad96939fde41734f1e3b7bb793939063 } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf index 1710121d78534b8539a2a1f0fa805b1334c0bdc6..f7dac83e48cb5c9c6c6988bb0083292983829200 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf @@ -3,7 +3,6 @@ L1s = ( num_cc = 1; tr_n_preference = "nfapi"; local_n_if_name = "eno1"; - #remote_n_address = "192.168.1.78"; remote_n_address = "192.168.1.28"; local_n_address = "192.168.1.74"; local_n_portc = 50000; diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index bccd5b57e7538db03991b254d42575b45bf73cbd..beed295bc044f6900fe8ab48086105d1977e4c73 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -164,26 +164,24 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam } // ******************************************************************* - //if (proc->subframe_tx==0) LOG_W(PHY, "sfn/sf:%d:%d eNB:%p eNB[0]:%p eNB[0][0]:%p dlsch:%p:%p:%p rnti:%d\n", proc->frame_tx, proc->subframe_tx, RC.eNB, RC.eNB[0], RC.eNB[0][0], RC.eNB[0][0]->dlsch, RC.eNB[0][0]->dlsch[0], RC.eNB[0][0]->dlsch[0][0], RC.eNB[0][0]->dlsch[0][0]->rnti); - if ( proc->frame_tx == 22 && proc->subframe_tx==5) { LOG_D(PHY,"22/5\n"); } - // **************************************** // Common RX procedures subframe n - // if this is IF5 or 3GPP_eNB if (eNB && eNB->RU_list && eNB->RU_list[0] && eNB->RU_list[0]->function < NGFI_RAU_IF4p5) { - LOG_D(PHY,"%s:%s() %u/%u Before wakeup_prach_eNB() proc->instance_cnt_rxtx:%d\n", thread_name, __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->instance_cnt_rxtx); + LOG_D(PHY,"%s:%s() %u/%u Before wakeup_prach_eNB() proc->instance_cnt_rxtx:%d\n", thread_name, __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->instance_cnt_rxtx); wakeup_prach_eNB(eNB,NULL,proc->frame_rx,proc->subframe_rx); - LOG_D(PHY,"%s:%s() %u/%u Before wakeup_prach_eNB_br() proc->instance_cnt_rxtx:%d\n", thread_name, __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->instance_cnt_rxtx); + LOG_D(PHY,"%s:%s() %u/%u Before wakeup_prach_eNB_br() proc->instance_cnt_rxtx:%d\n", thread_name, __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->instance_cnt_rxtx); #ifdef Rel14 wakeup_prach_eNB_br(eNB,NULL,proc->frame_rx,proc->subframe_rx); - LOG_D(PHY,"%s:%s() %u/%u proc->instance_cnt_rxtx:%d\n", thread_name, __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->instance_cnt_rxtx); + LOG_D(PHY,"%s:%s() %u/%u proc->instance_cnt_rxtx:%d\n", thread_name, __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->instance_cnt_rxtx); #endif } + // UE-specific RX processing for subframe n LOG_D(PHY,"%s:%s() %u/%u Before phy_procedures_eNB_uespec_RX() proc->instance_cnt_rxtx:%d\n", thread_name, __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->instance_cnt_rxtx); phy_procedures_eNB_uespec_RX(eNB, proc, no_relay ); + LOG_D(PHY,"%s:%s() %u/%u Before UL_INFO_mutex proc->instance_cnt_rxtx:%d\n", thread_name, __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->instance_cnt_rxtx); pthread_mutex_lock(&eNB->UL_INFO_mutex); LOG_D(PHY,"%s:%s() %u/%u After UL_INFO_mutex proc->instance_cnt_rxtx:%d\n", thread_name, __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->instance_cnt_rxtx); diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index ffced413d4b68ddeec0747caa3a34d783ea74b3c..3e24215cdd66f0954a670ac28ac427f2c87e88ab 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1734,8 +1734,16 @@ int main( int argc, char **argv ) printf("RC.nb_RU:%d\n", RC.nb_RU); // once all RUs are ready intiailize the rest of the eNBs ((dependence on final RU parameters after configuration) printf("ALL RUs ready - init eNBs\n"); - printf("DJP - commented out call to init_eNB_afterRU() will be called by nFAPI\n\n\n\n"); - init_eNB_afterRU(); + + if (nfapi_pnf != 1 && nfapi_pnf != 2) + { + printf("Not NFAPI mode - call init_eNB_afterRU()\n"); + init_eNB_afterRU(); + } + else + { + printf("NFAPI mode - DO NOT call init_eNB_afterRU()\n"); + } printf("ALL RUs ready - ALL eNBs ready\n"); }