Commit 21700c42 authored by Melissa's avatar Melissa Committed by Michael Cook

dl_config_Req and tx_reqs are queued together

Additionally, combined many of the individual
dl_config_req and tx_req handle functions.
Also removed some unused functions we added.
Futhermore, removed our additions to the
dl_config_req and tx_req memcpy functions.
parent b18ff74f
This diff is collapsed.
......@@ -103,6 +103,12 @@ typedef struct nfapi_tx_req_pdu_list_t
nfapi_tx_request_pdu_t pdus[]; /* see "struct hack" */
} nfapi_tx_req_pdu_list_t;
typedef struct nfapi_dl_config_req_tx_req_t
{
nfapi_dl_config_request_t *dl_config_req;
nfapi_tx_req_pdu_list_t *tx_req_pdu_list;
} nfapi_dl_config_req_tx_req_t;
void nfapi_free_tx_req_pdu_list(nfapi_tx_req_pdu_list_t *);
void dl_config_req_UE_MAC_dci(int sfn,
......@@ -142,6 +148,10 @@ int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfa
void UE_config_stub_pnf(void);
void *memcpy_tx_req_standalone(nfapi_tx_request_t *tx_req);
void *memcpy_dl_config_req_standalone(nfapi_dl_config_request_t *dl_config_req);
// open an SCTP socket with a standalone PNF module
void ue_init_standalone_socket(const char *addr, int tx_port, int rx_port);
......@@ -149,6 +159,7 @@ void ue_init_standalone_socket(const char *addr, int tx_port, int rx_port);
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);
void enqueue_dl_config_req_tx_req(nfapi_dl_config_request_t *dl_config_req, nfapi_tx_request_t *tx_req);
// Convert downlink nfapi messages to a string.
// Returned memory is malloc'ed, caller is responsible for freeing.
......@@ -160,8 +171,7 @@ char *nfapi_ul_config_req_to_string(nfapi_ul_config_request_t *req);
const char *dl_pdu_type_to_string(uint8_t pdu_type);
const char *ul_pdu_type_to_string(uint8_t pdu_type);
extern queue_t dl_config_req_queue;
extern queue_t tx_req_pdu_queue; /* items in this queue are nfapi_tx_req_pdu_list_t* */
extern queue_t dl_config_req_tx_req_queue;
extern queue_t ul_config_req_queue;
extern queue_t hi_dci0_req_queue;
......
......@@ -1062,14 +1062,11 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
//PANOS: CAREFUL HERE!
wait_sync("UE_phy_stub_standalone_pnf_task");
int num_pairs = 0;
int num_lone = 0;
int last_sfn_sf = -1;
LOG_I(MAC, "Clearing Queues\n");
reset_queue(&dl_config_req_queue);
reset_queue(&dl_config_req_tx_req_queue);
reset_queue(&ul_config_req_queue);
reset_queue(&tx_req_pdu_queue);
reset_queue(&hi_dci0_req_queue);
while (!oai_exit) {
......@@ -1088,51 +1085,13 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
}
last_sfn_sf = sfn_sf;
nfapi_tx_req_pdu_list_t *tx_req_pdu_list = get_queue(&tx_req_pdu_queue);
nfapi_dl_config_request_t *dl_config_req = get_queue(&dl_config_req_queue);
if (tx_req_pdu_list)
{
uint64_t deadline = clock_usec() + 1000;
if (!dl_config_req)
{
for (;;)
{
LOG_E(MAC, "Spinning and waiting for corresponding dl_config_req\n");
dl_config_req = get_queue(&dl_config_req_queue);
if (dl_config_req)
{
break;
}
if (clock_usec() >= deadline)
{
LOG_E(MAC, "Giving up waiting for dl_config_req\n");
break;
}
usleep(1);
}
}
}
nfapi_dl_config_req_tx_req_t *dl_config_req_tx_req = get_queue(&dl_config_req_tx_req_queue);
nfapi_ul_config_request_t *ul_config_req = get_queue(&ul_config_req_queue);
nfapi_hi_dci0_request_t *hi_dci0_req = get_queue(&hi_dci0_req_queue);
LOG_I(MAC, "received from proxy frame %d subframe %d\n",
NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
if (dl_config_req != NULL) {
uint16_t dl_num_pdus = dl_config_req->dl_config_request_body.number_pdu;
LOG_A(MAC, "(OAI UE) Received dl_config_req from proxy at Frame: %d, Subframe: %d,"
" with number of PDUs: %u\n",
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
dl_num_pdus);
if (dl_num_pdus > 0) {
char *dl_str = nfapi_dl_config_req_to_string(dl_config_req);
LOG_I(MAC, "dl_config_req: %s\n", dl_str);
free(dl_str);
}
}
if (tx_req_pdu_list != NULL) {
LOG_D(MAC, "tx_req pdus: %d\n", tx_req_pdu_list->num_pdus);
}
if (ul_config_req != NULL) {
uint8_t ul_num_pdus = ul_config_req->ul_config_request_body.number_of_pdus;
if (ul_num_pdus > 0) {
......@@ -1147,16 +1106,24 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf));
}
if ((dl_config_req != NULL) != (tx_req_pdu_list != NULL)) {
num_lone++;
} else {
num_pairs++;
}
if (dl_config_req_tx_req != NULL) {
if (dl_config_req && tx_req_pdu_list) {
if ((num_pairs % 1000) == 0) {
LOG_I(MAC, "num_pairs:%d, num_lone:%d\n", num_pairs, num_lone);
nfapi_tx_req_pdu_list_t *tx_req_pdu_list = dl_config_req_tx_req->tx_req_pdu_list;
nfapi_dl_config_request_t *dl_config_req = dl_config_req_tx_req->dl_config_req;
uint16_t dl_num_pdus = dl_config_req->dl_config_request_body.number_pdu;
LOG_A(MAC, "(OAI UE) Received dl_config_req from proxy at Frame: %d, Subframe: %d,"
" with number of PDUs: %u\n",
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
dl_num_pdus);
if (dl_num_pdus > 0) {
char *dl_str = nfapi_dl_config_req_to_string(dl_config_req);
LOG_I(MAC, "dl_config_req: %s\n", dl_str);
free(dl_str);
}
LOG_D(MAC, "tx_req pdus: %d\n", tx_req_pdu_list->num_pdus);
// Handling dl_config_req and tx_req:
nfapi_dl_config_request_body_t *dl_config_req_body = &dl_config_req->dl_config_request_body;
for (int i = 0; i < dl_config_req_body->number_pdu; ++i) {
nfapi_dl_config_request_pdu_t *pdu = &dl_config_req_body->dl_config_pdu_list[i];
......@@ -1345,24 +1312,24 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
}
// De-allocate memory of nfapi requests copies before next subframe round
if (dl_config_req != NULL) {
if (dl_config_req->vendor_extension != NULL) {
free(dl_config_req->vendor_extension);
dl_config_req->vendor_extension = NULL;
if (dl_config_req_tx_req != NULL) {
if (dl_config_req_tx_req->dl_config_req->vendor_extension != NULL) {
free(dl_config_req_tx_req->dl_config_req->vendor_extension);
dl_config_req_tx_req->dl_config_req->vendor_extension = NULL;
}
if (dl_config_req->dl_config_request_body.dl_config_pdu_list != NULL) {
free(dl_config_req->dl_config_request_body.dl_config_pdu_list);
dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL;
if (dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list != NULL) {
free(dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list);
dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL;
}
nfapi_free_tx_req_pdu_list(dl_config_req_tx_req->tx_req_pdu_list);
dl_config_req_tx_req->tx_req_pdu_list = NULL;
free(dl_config_req);
dl_config_req = NULL;
}
free(dl_config_req_tx_req->dl_config_req);
dl_config_req_tx_req->dl_config_req = NULL;
if (tx_req_pdu_list != NULL) {
nfapi_free_tx_req_pdu_list(tx_req_pdu_list);
tx_req_pdu_list = NULL;
free(dl_config_req_tx_req);
dl_config_req_tx_req = NULL;
}
if (ul_config_req != NULL) {
......
......@@ -121,7 +121,6 @@ uint64_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
int UE_scan = 1;
int UE_scan_carrier = 0;
......@@ -280,7 +279,7 @@ void exit_function(const char *file, const char *function, const int line, const
}
extern int16_t dlsch_demod_shift;
uint16_t ue_idx_standalone = 0xFFFF;
static void get_options(void) {
int CC_id=0;
int tddflag=0;
......@@ -529,7 +528,7 @@ int restart_L1L2(module_id_t enb_id) {
void init_pdcp(void) {
uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1) ? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT);
// Do we need to include standalone mode here? - Andrew
if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) {
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
}
......@@ -731,8 +730,7 @@ int main( int argc, char **argv ) {
//init_UE_stub(1,eMBMS_active,uecap_xer_in,emul_iface);
init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface);
} else if (NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) {
init_queue(&dl_config_req_queue);
init_queue(&tx_req_pdu_queue);
init_queue(&dl_config_req_tx_req_queue);
init_queue(&hi_dci0_req_queue);
init_queue(&ul_config_req_queue);
......
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