Commit 82deb8b9 authored by Vaibhav Shrivastava's avatar Vaibhav Shrivastava

Merge branch 'temp_br' into '29_07_4G_Oai4test_Delivery'

Merge Temp_br Branch Changes to 29_07_4G_Oai4test_Delivery Branch

See merge request firecell/rdsubscription/sequansrd!35
parents 55098451 e51ca908
......@@ -107,6 +107,7 @@ typedef struct {
typedef struct {
int release;
int num_phys;
phy_info phys[2];
rf_info rfs[2];
......@@ -366,8 +367,10 @@ int pnf_param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_param_re
phy.rfs[0] = resp->pnf_phy.phy[i].rf_config[j].rf_config_index;
}
pnf->phys[0] = phy;
pnf->phys[i] = phy;
pnf->num_phys = i+1;
}
for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i) {
rf_info rf;
memset(&rf,0,sizeof(rf));
......@@ -1709,13 +1712,24 @@ int config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_config_response
}
int start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_start_response_t *resp) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[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);
pnf_info *pnf = vnf->pnfs;
phy_info *phy = pnf->phys;
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
nfapi_vnf_p7_add_pnf((p7_vnf->config), phy->remote_addr, htons(phy->remote_port), phy->id);
return 0;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[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);
pnf_info *pnf = vnf->pnfs;
phy_info *phy = pnf->phys;
vnf_p7_info *p7_vnf = vnf->p7_vnfs;
uint16_t port =htons(phy->remote_port);
char *remote_addr = (char *) malloc(strlen(phy->remote_addr));
memset(remote_addr, 0, strlen(phy->remote_addr));
strncpy(remote_addr, phy->remote_addr, strlen(phy->remote_addr));
for(int i=0; i < pnf->num_phys; i++ )
{
nfapi_vnf_p7_add_pnf((p7_vnf->config), remote_addr, (int)port, phy->id);
LOG_D(NFAPI_VNF, "MultiCell: fxn:%s phy_id added:%d\n", p5_idx, resp->header.phy_id);
phy +=1;
}
free(remote_addr);
remote_addr = NULL;
return 0;
}
int nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_start_response_scf_t *resp) {
......@@ -1890,37 +1904,52 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
}
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) {
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
dl_config_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
LOG_D(PHY, "[VNF] %s() DL_CONFIG_REQ sfn_sf:%d_%d number_of_pdus:%d\n", __FUNCTION__,
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_config_req->dl_config_request_body.number_pdu);
if (dl_config_req->dl_config_request_body.number_pdu > 0)
{
for (int i = 0; i < dl_config_req->dl_config_request_body.number_pdu; i++)
{
uint8_t pdu_type = dl_config_req->dl_config_request_body.dl_config_pdu_list[i].pdu_type;
if(pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE)
{
uint16_t dl_rnti = dl_config_req->dl_config_request_body.dl_config_pdu_list[i].dlsch_pdu.dlsch_pdu_rel8.rnti;
uint16_t numPDUs = dl_config_req->dl_config_request_body.number_pdu;
LOG_D(MAC, "(OAI eNB) Sending dl_config_req at VNF during Frame: %d and Subframe: %d,"
" with a RNTI value of: %x and with number of PDUs: %u\n",
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_rnti, numPDUs);
}
}
}
int retval = nfapi_vnf_p7_dl_config_req(p7_config, dl_config_req);
dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols = 1;
dl_config_req->dl_config_request_body.number_dci = 0;
dl_config_req->dl_config_request_body.number_pdu = 0;
dl_config_req->dl_config_request_body.number_pdsch_rnti = 0;
if (retval!=0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
}
return retval;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Created VNF NFAPI start thread %s\n", __FUNCTION__);
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
int retval = 0;
int num_phy = 0;
uint16_t sfn = 0;
uint16_t sf = 0;
sfn = dl_config_req->sfn_sf >> 4;
sf = dl_config_req->sfn_sf & 0xF;
/* Below if condition checking if dl_config_req is for MIB (sf == 0) or SIB1 ((sfn % 2 == 0) && (sf == 5)) */
if ((sf == 0) || ((sfn % 2 == 0) && (sf == 5)))
num_phy = vnf.pnfs[0].num_phys;
else
num_phy = 1;
for (int i =0; i< num_phy; i++)
{
dl_config_req->header.phy_id = i+1; // DJP HACK TODO FIXME - need to pass this around!!!!
dl_config_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
LOG_I(NFAPI_VNF, "MultiCell: fxn:%s num_phy:%d phy_id:%d sfn:%d sf:%d \n", __FUNCTION__, dl_config_req->header.phy_id, num_phy, sfn, sf);
if (dl_config_req->dl_config_request_body.number_pdu > 0)
{
for (int i = 0; i < dl_config_req->dl_config_request_body.number_pdu; i++)
{
uint8_t pdu_type = dl_config_req->dl_config_request_body.dl_config_pdu_list[i].pdu_type;
if(pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE)
{
uint16_t dl_rnti = dl_config_req->dl_config_request_body.dl_config_pdu_list[i].dlsch_pdu.dlsch_pdu_rel8.rnti;
uint16_t numPDUs = dl_config_req->dl_config_request_body.number_pdu;
LOG_D(MAC, "(OAI eNB) Sending dl_config_req at VNF during Frame: %d and Subframe: %d,"
" with a RNTI value of: %x and with number of PDUs: %u\n",
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_rnti, numPDUs);
}
}
}
retval = nfapi_vnf_p7_dl_config_req(p7_config, dl_config_req);
if (retval!=0) {
LOG_E(PHY, "%s() Problem sending dl_config_req for phy_id:%d retval:%d\n", __FUNCTION__, dl_config_req->header.phy_id, retval);
}
}
dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols = 1;
dl_config_req->dl_config_request_body.number_dci = 0;
dl_config_req->dl_config_request_body.number_pdu = 0;
dl_config_req->dl_config_request_body.number_pdsch_rnti = 0;
return retval;
}
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req)
......@@ -1962,19 +1991,34 @@ int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req)
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
{
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
tx_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
tx_req->header.message_id = NFAPI_TX_REQUEST;
//LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
int retval = nfapi_vnf_p7_tx_req(p7_config, tx_req);
if (retval!=0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
} else {
tx_req->tx_request_body.number_of_pdus = 0;
}
return retval;
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
int retval = 0;
int num_phy = 0;
uint16_t sfn = 0;
uint16_t sf = 0;
sfn = tx_req->sfn_sf >> 4;
sf = tx_req->sfn_sf & 0xF;
/* Below if condition checking if tx_req is for MIB (sf == 0) or SIB1 ((sfn % 2 == 0) && (sf == 5)) */
if ((sf == 0) || ((sfn % 2 == 0) && (sf == 5)))
num_phy = vnf.pnfs[0].num_phys;
else
num_phy = 1;
for (int i =0; i< num_phy; i++)
{
tx_req->header.phy_id = i+1; // DJP HACK TODO FIXME - need to pass this around!!!!
tx_req->header.message_id = NFAPI_TX_REQUEST;
//LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
LOG_I(NFAPI_VNF, "MultiCell: fxn:%s num_phy:%d phy_id:%d sfn:%d sf:%d \n", __FUNCTION__, num_phy, tx_req->header.phy_id, sfn, sf);
retval = nfapi_vnf_p7_tx_req(p7_config, tx_req);
if (retval!=0) {
LOG_E(PHY, "%s() Problem sending tx_req for phyId:%d :%d\n", __FUNCTION__, tx_req->header.phy_id ,retval);
}
}
tx_req->tx_request_body.number_of_pdus = 0;
return retval;
}
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req) {
......
......@@ -1142,6 +1142,7 @@ void vnf_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfapi_
return;
}
NFAPI_TRACE(NFAPI_TRACE_INFO, "received messageId:%d\n", messageHeader.message_id);
switch (messageHeader.message_id)
{
case NFAPI_PNF_PARAM_RESPONSE:
......
......@@ -204,7 +204,6 @@ extern "C"
dl_config_req.dl_config_request_body.tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
dl_config_req.dl_config_request_body.number_pdu = rand_range(4, max_num_dl_pdus);
uint16_t i = 0;
for(i = 0; i < dl_config_req.dl_config_request_body.number_pdu; ++i) {
dl_config_pdus[i].pdu_type = rand_range(0, 11);
......
......@@ -1347,11 +1347,13 @@ void *ue_standalone_pnf_task(void *context)
{
case NFAPI_DL_CONFIG_REQUEST:
{
if (dl_config_req_valid)
printf("Received NFAPI_DL_CONFIG_REQUEST from phy_id:%d frame: %u, subframe: %u\n",
header.phy_id, dl_config_req.sfn_sf >> 4, dl_config_req.sfn_sf & 15);
/* if (dl_config_req_valid)
{
LOG_W(MAC, "Received consecutive dl_config_reqs. Previous dl_config_req frame: %u, subframe: %u\n",
dl_config_req.sfn_sf >> 4, dl_config_req.sfn_sf & 15);
}
}*/
if (nfapi_p7_message_unpack((void *)buffer, len, &dl_config_req,
sizeof(dl_config_req), NULL) < 0)
{
......@@ -1385,11 +1387,13 @@ void *ue_standalone_pnf_task(void *context)
}
case NFAPI_TX_REQUEST:
{
if (tx_req_valid)
printf("Received NFAPI_TX_REQUEST from phy_id:%d frame: %u, subframe: %u\n",
header.phy_id, dl_config_req.sfn_sf >> 4, dl_config_req.sfn_sf & 15);
/* if (tx_req_valid)
{
LOG_W(MAC, "Received consecutive tx_reqs. Previous tx_req frame: %u, subframe: %u\n",
tx_req.sfn_sf >> 4, tx_req.sfn_sf & 15);
}
}*/
if (nfapi_p7_message_unpack((void *)buffer, len, &tx_req,
sizeof(tx_req), NULL) < 0)
{
......@@ -1451,41 +1455,45 @@ void *ue_standalone_pnf_task(void *context)
break;
}
case P7_CELL_SEARCH_IND:
{
vendor_nfapi_cell_search_indication_t cell_ind;
LOG_D(MAC, "CELL SEARCH IND Receievd\n");
if (nfapi_p7_message_unpack((void *)buffer, len, &cell_ind,
sizeof(vendor_nfapi_cell_search_indication_t), NULL) < 0)
{
LOG_E(MAC, "Message cell_ind failed to unpack\n");
break;
}
MessageDef *message_p;
int i;
message_p = itti_alloc_new_message(TASK_UNKNOWN, 0, PHY_FIND_CELL_IND);
for (i = 0 ; i < cell_ind.lte_cell_search_indication.number_of_lte_cells_found; i++) {
// TO DO
PHY_FIND_CELL_IND (message_p).cell_nb = i+1;
/** FIXME: What we need is EARFCN not Freq Offset. */
PHY_FIND_CELL_IND (message_p).cells[i].earfcn = cell_ind.lte_cell_search_indication.lte_found_cells[i].frequency_offset;
// TO DO
PHY_FIND_CELL_IND (message_p).cells[i].cell_id = cell_ind.lte_cell_search_indication.lte_found_cells[i].pci;
PHY_FIND_CELL_IND (message_p).cells[i].rsrp = cell_ind.lte_cell_search_indication.lte_found_cells[i].rsrp;
PHY_FIND_CELL_IND (message_p).cells[i].rsrq = cell_ind.lte_cell_search_indication.lte_found_cells[i].rsrq;
LOG_A(MAC, "Cell No: %d PCI: %d EARFCN: %d RSRP: %d RSRQ: %d \n", PHY_FIND_CELL_IND (message_p).cell_nb,
PHY_FIND_CELL_IND (message_p).cells[i].cell_id,
PHY_FIND_CELL_IND (message_p).cells[i].earfcn,
PHY_FIND_CELL_IND (message_p).cells[i].rsrp,
PHY_FIND_CELL_IND (message_p).cells[i].rsrq);
itti_send_msg_to_task(TASK_RRC_UE, INSTANCE_DEFAULT, message_p);
}
break;
}
{
vendor_nfapi_cell_search_indication_t cell_ind;
if (nfapi_p7_message_unpack((void *)buffer, len, &cell_ind,
sizeof(vendor_nfapi_cell_search_indication_t), NULL) < 0)
{
LOG_E(MAC, "Message cell_ind failed to unpack\n");
break;
}
LOG_D(MAC, "P7_CELL_SEARCH_IND Received: numlteCells:%d cell[1]:%d cell[2]:%d\n",
cell_ind.lte_cell_search_indication.number_of_lte_cells_found,
cell_ind.lte_cell_search_indication.lte_found_cells[0].pci,
cell_ind.lte_cell_search_indication.lte_found_cells[1].pci);
MessageDef *message_p;
int i;
message_p = itti_alloc_new_message(TASK_UNKNOWN, 0, PHY_FIND_CELL_IND);
// for (i = 0 ; i < cell_ind.lte_cell_search_indication.number_of_lte_cells_found; i++) {
for (i = 0 ; i < 1; i++) {
// TO DO
PHY_FIND_CELL_IND (message_p).cell_nb = i+1;
/** FIXME: What we need is EARFCN not Freq Offset. */
PHY_FIND_CELL_IND (message_p).cells[i].earfcn = cell_ind.lte_cell_search_indication.lte_found_cells[i].frequency_offset;
// TO DO
PHY_FIND_CELL_IND (message_p).cells[i].cell_id = cell_ind.lte_cell_search_indication.lte_found_cells[i].pci;
PHY_FIND_CELL_IND (message_p).cells[i].rsrp = cell_ind.lte_cell_search_indication.lte_found_cells[i].rsrp;
PHY_FIND_CELL_IND (message_p).cells[i].rsrq = cell_ind.lte_cell_search_indication.lte_found_cells[i].rsrq;
LOG_A(MAC, "Cell No: %d PCI: %d EARFCN: %d RSRP: %d RSRQ: %d \n", PHY_FIND_CELL_IND (message_p).cell_nb,
PHY_FIND_CELL_IND (message_p).cells[i].cell_id,
PHY_FIND_CELL_IND (message_p).cells[i].earfcn,
PHY_FIND_CELL_IND (message_p).cells[i].rsrp,
PHY_FIND_CELL_IND (message_p).cells[i].rsrq);
itti_send_msg_to_task(TASK_RRC_UE, INSTANCE_DEFAULT, message_p);
}
break;
}
default:
LOG_E(MAC, "Case Statement has no corresponding nfapi message\n");
break;
......
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