Commit c39276ca authored by Andrew Burger's avatar Andrew Burger

Added send nfapi functions including send dummy

parent 79f13e91
......@@ -33,12 +33,14 @@
#include <arpa/inet.h>
extern int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
void send_standalone_dummy();
void configure_nfapi_pnf(char *vnf_ip_addr,
int vnf_p5_port,
char *pnf_ip_addr,
int pnf_p7_port,
int vnf_p7_port);
void send_standalone_rach(nfapi_rach_indication_t *ind);
UL_IND_t *UL_INFO = NULL;
nfapi_ul_config_request_t* ul_config_req = NULL;
......@@ -243,7 +245,7 @@ void fill_rach_indication_UE_MAC(int Mod_id,
// Andrew - send proxy specific socket instead of oai_nfapi_rach_ind Send the whole UL_INFO struct
// as soon as numberof preambles
if (NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) {
send_standalone_msg(&UL_INFO, UL_INFO->rach_ind.header.message_id);
send_standalone_msg(UL_INFO, UL_INFO->rach_ind.header.message_id);
} else {
oai_nfapi_rach_ind(&UL_INFO->rach_ind);
}
......@@ -1211,15 +1213,27 @@ void send_standalone_msg(UL_IND_t *UL, nfapi_message_id_e msg_type)
case NFAPI_RX_SR_INDICATION: // is this the right nfapi message_id? Ask Raymond
encoded_size = nfapi_p7_message_pack(&UL->sr_ind, buffer, sizeof(buffer), NULL);
break;
default:
return;
}
if (encoded_size < 0)
{
LOG_E(MAC, "standalone rach pack failed\n");
LOG_E(MAC, "standalone pack failed\n");
return;
}
if (send(ue_sock_descriptor, buffer, encoded_size, 0) < 0)
{
LOG_E(MAC, "Send NFAPI_DL_CONFIG_REQUEST to OAI UE failed\n");
LOG_E(MAC, "Send Proxy UE failed\n");
return;
}
}
void send_standalone_dummy()
{
static const uint16_t dummy[] = {0, 0};
if (send(ue_sock_descriptor, dummy, sizeof(dummy), 0) < 0)
{
LOG_E(MAC, "Send dummy to OAI UE failed\n");
return;
}
}
......
......@@ -137,6 +137,8 @@ void ue_init_standalone_socket(const char *addr, int port);
// read from standalone pnf socket call corresponding memcpy functions
void *ue_standalone_pnf_task(void *context);
void send_standalone_msg(UL_IND_t *UL, nfapi_message_id_e msg_type);
void send_standalone_dummy(void);
extern queue_t dl_config_req_queue;
extern queue_t tx_req_pdu_queue;
......
......@@ -1038,6 +1038,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
int last_sfn_sf = -1;
while (!oai_exit) {
bool sent_any = false;
int sfn_sf = current_sfn_sf;
if (sfn_sf == last_sfn_sf) {
usleep(100);
......@@ -1188,7 +1189,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
#endif
// Prepare the future Tx data
bool sent_any = false;
if ((subframe_select(&UE->frame_parms, proc->subframe_tx) == SF_UL) ||
(UE->frame_parms.frame_type == FDD))
if (UE->mode != loop_through_memory) {
......@@ -1234,12 +1234,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
if (UL_INFO->crc_ind.crc_indication_body.number_of_crcs > 0) {
//LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
//LOG_I(MAC, "ul_config_req_UE_MAC 2.2, SFN/SF of PNF counter:%d.%d, number_of_crcs: %d \n", timer_frame, timer_subframe, UL_INFO->crc_ind.crc_indication_body.number_of_crcs);
if (NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) {
send_standalone_msg(&UL_INFO, UL_INFO->crc_ind.header.message_id);
sent_any = true;
} else {
oai_nfapi_crc_indication(&UL_INFO->crc_ind);
}
send_standalone_msg(UL_INFO, UL_INFO->crc_ind.header.message_id);
sent_any = true;
//LOG_I(MAC, "ul_config_req_UE_MAC 2.21 \n");
UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0;
}
......@@ -1247,12 +1243,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
if (UL_INFO->rx_ind.rx_indication_body.number_of_pdus > 0) {
//LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
//LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus);
if (NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) {
send_standalone_msg(&UL_INFO, UL_INFO->rx_ind.header.message_id);
sent_any = true;
} else {
oai_nfapi_rx_ind(&UL_INFO->rx_ind);
}
send_standalone_msg(UL_INFO, UL_INFO->rx_ind.header.message_id);
sent_any = true;
for (uint8_t num_pdu = 0; num_pdu < UL_INFO->rx_ind.rx_indication_body.number_of_pdus; num_pdu++) {
free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list[num_pdu].data);
......@@ -1263,35 +1255,23 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
}
if (UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis > 0) {
if (NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) {
send_standalone_msg(&UL_INFO, UL_INFO->cqi_ind.header.message_id);
send_standalone_msg(UL_INFO, UL_INFO->cqi_ind.header.message_id);
sent_any = true;
} else {
oai_nfapi_cqi_indication(&UL_INFO->cqi_ind);
}
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
}
if (UL_INFO->harq_ind.harq_indication_body.number_of_harqs > 0) {
//LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs);
if (NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) {
send_standalone_msg(&UL_INFO, UL_INFO->harq_ind.header.message_id);
send_standalone_msg(UL_INFO, UL_INFO->harq_ind.header.message_id);
sent_any = true;
} else {
oai_nfapi_harq_indication(&UL_INFO->harq_ind);
}
//LOG_I(MAC, "ul_config_req_UE_MAC 2.41 \n");
UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0;
}
if (UL_INFO->sr_ind.sr_indication_body.number_of_srs > 0) {
//LOG_I(MAC, "ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs);
if (NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) {
send_standalone_msg(&UL_INFO, UL_INFO->sr_ind.header.message_id);
send_standalone_msg(UL_INFO, UL_INFO->sr_ind.header.message_id);
sent_any = true;
} else {
oai_nfapi_sr_indication(&UL_INFO->sr_ind);
}
//LOG_I(MAC, "ul_config_req_UE_MAC 2.51 \n");
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
}
......@@ -1343,8 +1323,9 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
free(hi_dci0_req);
hi_dci0_req = NULL;
}
if (!sent_any) {
// TODO: send_dummy
if (!sent_any)
{
send_standalone_dummy();
}
}
......
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