Commit 7aa9a95e 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 b6b9f250
......@@ -43,8 +43,7 @@ void configure_nfapi_pnf(char *vnf_ip_addr,
UL_IND_t *UL_INFO = NULL;
queue_t dl_config_req_queue;
queue_t tx_req_pdu_queue;
queue_t dl_config_req_tx_req_queue;
queue_t ul_config_req_queue;
queue_t hi_dci0_req_queue;
......@@ -928,194 +927,12 @@ void hi_dci0_req_UE_MAC(int sfn,
}
}
static bool is_my_dl_config_req(const nfapi_dl_config_request_t *req)
{
const rnti_t my_rnti = UE_mac_inst[0].crnti;
int num_pdus = req->dl_config_request_body.number_pdu;
// look through list of pdus for rnti type 1 with my_rnti (normal dlsch case)
for (int i = 0; i < num_pdus; i++)
{
nfapi_dl_config_request_pdu_t *pdu = &req->dl_config_request_body.dl_config_pdu_list[i];
const int pdu_type = pdu->pdu_type;
if (pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
{
const rnti_t dci_rnti = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti;
const int rnti_type = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type;
if (rnti_type == 1 && dci_rnti == my_rnti)
{
return true;
}
}
else if(pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE)
{
return true; // Because these two pdu_types are coupled and we have to accept all other pdu_types
}
}
// Look for broadcasted rnti types
for (int i = 0; i < num_pdus; i++)
{
nfapi_dl_config_request_pdu_t *pdu = &req->dl_config_request_body.dl_config_pdu_list[i];
const int pdu_type = pdu->pdu_type;
if (pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
{
const int rnti_type = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type;
if (rnti_type != 1)
{
return true;
}
}
}
return false;
}
static int get_dlsch_pdu_indicies(const nfapi_dl_config_request_t *req, int *pdu_indicies, size_t max_pdu_indicies)
{
const rnti_t my_rnti = UE_mac_inst[0].crnti; // This is 0 representing the num_ues is 1
int num_pdus = req->dl_config_request_body.number_pdu;
size_t num_pdu_indicies = 0;
for (int i = 0; i < num_pdus; i++)
{
nfapi_dl_config_request_pdu_t *pdu = &req->dl_config_request_body.dl_config_pdu_list[i];
const int pdu_type = pdu->pdu_type;
if (pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
{
const rnti_t dci_rnti = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti;
const int rnti_type = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type;
if (rnti_type == 1 && dci_rnti != my_rnti && i + 1 < num_pdus)
{
if (num_pdu_indicies < max_pdu_indicies)
{
pdu_indicies[num_pdu_indicies++] = i + 1; // This an index of a dlsch pdu which contains a pdu_index field
}
i++;
}
}
}
return num_pdu_indicies;
}
typedef struct dlsch_pdu_indicies_and_request_t
{
size_t num_indicies;
int *indicies;
nfapi_dl_config_request_t *req;
}dlsch_pdu_indicies_and_request_t;
static void print_lists(const dlsch_pdu_indicies_and_request_t *dlsch_list, const nfapi_tx_req_pdu_list_t *tx_pdu_list)
{
const size_t max_result = 1024;
uint16_t num_pdus = tx_pdu_list->num_pdus;
char dlsch_result[max_result];
char tx_pdu_result[max_result];
snprintf(dlsch_result, max_result, "dlsch_list::");
snprintf(tx_pdu_result, max_result, "tx_pdu_list::");
for (size_t i = 0; i < num_pdus; ++i)
{
int dlsch_len = strlen(dlsch_result);
int tx_pdu_len = strlen(tx_pdu_result);
if (tx_pdu_len >= max_result - 1 || dlsch_len >= max_result - 1)
{
break;
}
snprintf(dlsch_result + dlsch_len, max_result - dlsch_len, " %d", dlsch_list->indicies[i]);
snprintf(tx_pdu_result + tx_pdu_len, max_result - tx_pdu_len, " %d", tx_pdu_list->pdus[i].pdu_index);
}
LOG_E(MAC, "%s\n", dlsch_result);
LOG_E(MAC, "%s\n", tx_pdu_result);
}
static bool match_dl_config_req(void *wanted_vp, void *candidate_vp)
{
dlsch_pdu_indicies_and_request_t *wanted = wanted_vp;
const nfapi_tx_req_pdu_list_t *candidate = candidate_vp;
int num_pdus = candidate->num_pdus;
if (wanted->num_indicies != num_pdus)
{
LOG_E(MAC, "tx_req_pdus not equal to dlsch_pdus:: %zu != %d\n", wanted->num_indicies, num_pdus);
return false;
}
for (int i = 0; i < num_pdus; ++i)
{
bool found = false;
const nfapi_tx_request_pdu_t *pdu = &candidate->pdus[i];
for (int j = 0; j < num_pdus; ++j)
{
size_t dlsch_index = wanted->indicies[j];
AssertFatal(dlsch_index < wanted->req->dl_config_request_body.number_pdu, "dlsch_index is out of range of pdu_list\n");
nfapi_dl_config_request_pdu_t *dlsch_pdu = &wanted->req->dl_config_request_body.dl_config_pdu_list[dlsch_index];
// This may be redundant but wont hurt.
AssertFatal(dlsch_pdu->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE,
"dlsch_index: %zu does not map to a DLSCH_PDU in dl_config_req sfn.sf = %d.%d pdu_type = %d\n",
dlsch_index, wanted->req->sfn_sf >> 4, wanted->req->sfn_sf & 15, dlsch_pdu->pdu_type);
if (pdu->pdu_index == dlsch_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index)
{
found = true;
break;
}
}
if (!found)
{
LOG_E(MAC, "Could not find tx_req_pdu index to match dlsch_index for pdu_index: %d\n",
pdu->pdu_index);
print_lists(wanted, candidate);
return false;
}
}
return true;
}
// The following set of memcpy functions should be getting called as callback
// functions from pnf_p7_subframe_ind.
int memcpy_dl_config_req(L1_rxtx_proc_t *proc,
nfapi_pnf_p7_config_t *pnf_p7,
nfapi_dl_config_request_t *req) {
if (!is_my_dl_config_req(req) && req->dl_config_request_body.number_pdu <= 2)
{
const size_t max_dlsch_pdu_indicies = 1024;
int dlsch_pdu_indicies[max_dlsch_pdu_indicies];
// Need to remove corresponding tx_req (comes before dl_config_req always)
int num_dlsch_pdu_indicies = get_dlsch_pdu_indicies(req, dlsch_pdu_indicies, max_dlsch_pdu_indicies);
if (num_dlsch_pdu_indicies == 0)
{
LOG_E(MAC, "COULD NOT FIND DLSCH_PDU_INDICIES for dl_config_req SFN.SF: %d.%d",
req->sfn_sf >> 4, req->sfn_sf & 15);
return 0;
}
dlsch_pdu_indicies_and_request_t wanted =
{
num_dlsch_pdu_indicies,
dlsch_pdu_indicies,
req,
};
nfapi_tx_req_pdu_list_t *matched =
unqueue_matching(&tx_req_pdu_queue, /*max_depth=*/ 2,
match_dl_config_req, &wanted);
if (!matched)
{
LOG_E(MAC, "Could not unqueue_matching\n");
return 0;
}
LOG_I(MAC, "REMOVING.. dl_config_req & tx_req\n");
free(matched);
return 0;
}
nfapi_dl_config_request_t *p = malloc(sizeof(nfapi_dl_config_request_t));
// UE_mac_inst[Mod_id].p->header = req->header;
......@@ -1139,10 +956,6 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc,
req->dl_config_request_body.dl_config_pdu_list[i];
}
if (!put_queue(&dl_config_req_queue, p)) {
free(p);
}
LOG_I(MAC, "DL_CONFIG_REQ QUEUE: %zu", dl_config_req_queue.num_items);
return 0;
}
......@@ -1246,10 +1059,6 @@ int memcpy_tx_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_tx_request_t *req) {
}
}
if (!put_queue(&tx_req_pdu_queue, list)) {
nfapi_free_tx_req_pdu_list(list);
}
return 0;
}
......@@ -1278,10 +1087,16 @@ static bool is_my_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req)
int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc,
nfapi_pnf_p7_config_t* pnf_p7,
nfapi_hi_dci0_request_t* req) {
if (!is_my_hi_dci0_req(req)) return 0;
if (!is_my_hi_dci0_req(req))
{
LOG_W(MAC, "Filtering hi_dci0_req\n");
return 0;
}
nfapi_hi_dci0_request_t *p = (nfapi_hi_dci0_request_t *)malloc(sizeof(nfapi_hi_dci0_request_t));
//if(req!=0){
p->sfn_sf = req->sfn_sf;
p->vendor_extension = req->vendor_extension;
......@@ -1439,6 +1254,9 @@ void *ue_standalone_pnf_task(void *context)
int sd = ue_rx_sock_descriptor;
assert(sd > 0);
nfapi_tx_request_t tx_req;
bool tx_req_valid = false;
while (true)
{
ssize_t len = recvfrom(sd, buffer, sizeof(buffer), 0, (struct sockaddr *)&server_address, &addr_len);
......@@ -1468,7 +1286,6 @@ void *ue_standalone_pnf_task(void *context)
LOG_E(MAC, "Header unpack failed for standalone pnf\n");
continue;
}
switch (header.message_id)
{
case NFAPI_DL_CONFIG_REQUEST:
......@@ -1478,32 +1295,51 @@ void *ue_standalone_pnf_task(void *context)
sizeof(dl_config_req), NULL) < 0)
{
LOG_E(MAC, "Message dl_config_req failed to unpack\n");
break;
}
else
{
// check to see if dl_config_req is null
// In multiUE scenario possible to get a dl_config_req before the tx_req? -Melissa
// How should we handle this? -Melissa
LOG_I(MAC, "dl_config_req Frame: %u Subframe: %u\n", dl_config_req.sfn_sf >> 4,
dl_config_req.sfn_sf & 15);
memcpy_dl_config_req(NULL, NULL, &dl_config_req);
if (!tx_req_valid)
{
LOG_W(MAC, "The tx_req not valid.\n");
break;
}
if (dl_config_req.sfn_sf != tx_req.sfn_sf)
{
LOG_W(MAC, "sfnsf mismatch. dl_config_req Frame: %u Subframe: %u, tx_req Frame: %u Subframe: %u\n",
dl_config_req.sfn_sf >> 4, dl_config_req.sfn_sf & 15,
tx_req.sfn_sf >> 4, tx_req.sfn_sf & 15);
tx_req_valid = false;
break;
}
enqueue_dl_config_req_tx_req(&dl_config_req, &tx_req);
tx_req_valid = false;
break;
}
case NFAPI_TX_REQUEST:
{
nfapi_tx_request_t tx_req;
// lock this tx_req
if (nfapi_p7_message_unpack((void *)buffer, len, &tx_req,
sizeof(tx_req), NULL) < 0)
{
LOG_E(MAC, "Message tx_req failed to unpack\n");
break;
}
else
{
// check to see if tx_req is null
LOG_I(MAC, "tx_req Frame: %u Subframe: %u\n", tx_req.sfn_sf >> 4,
tx_req.sfn_sf & 15);
memcpy_tx_req(NULL, &tx_req);
if (tx_req_valid)
{
LOG_W(MAC, "Received consecutive tx_reqs\n");
}
tx_req_valid = true;
break;
}
case NFAPI_HI_DCI0_REQUEST:
......@@ -1514,12 +1350,12 @@ void *ue_standalone_pnf_task(void *context)
sizeof(hi_dci0_req), NULL) < 0)
{
LOG_E(MAC, "Message hi_dci0_req failed to unpack\n");
break;
}
else
{
// check to see if hi_dci0_req is null
memcpy_hi_dci0_req(NULL, NULL, &hi_dci0_req);
}
break;
}
case NFAPI_UL_CONFIG_REQUEST:
......@@ -1530,12 +1366,12 @@ void *ue_standalone_pnf_task(void *context)
sizeof(ul_config_req), NULL) < 0)
{
LOG_E(MAC, "Message ul_config_req failed to unpack\n");
break;
}
else
{
// check to see if ul_config_req is null
memcpy_ul_config_req(NULL, NULL, &ul_config_req);
}
break;
}
default:
......@@ -1546,6 +1382,132 @@ void *ue_standalone_pnf_task(void *context)
}
}
void *memcpy_dl_config_req_standalone(nfapi_dl_config_request_t *dl_config_req)
{
nfapi_dl_config_request_t *p = malloc(sizeof(nfapi_dl_config_request_t));
p->sfn_sf = dl_config_req->sfn_sf;
p->vendor_extension = dl_config_req->vendor_extension;
p->dl_config_request_body.number_dci = dl_config_req->dl_config_request_body.number_dci;
p->dl_config_request_body.number_pdcch_ofdm_symbols = dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols;
p->dl_config_request_body.number_pdsch_rnti = dl_config_req->dl_config_request_body.number_pdsch_rnti;
p->dl_config_request_body.number_pdu = dl_config_req->dl_config_request_body.number_pdu;
p->dl_config_request_body.tl.tag = dl_config_req->dl_config_request_body.tl.tag;
p->dl_config_request_body.tl.length = dl_config_req->dl_config_request_body.tl.length;
p->dl_config_request_body.dl_config_pdu_list =
calloc(dl_config_req->dl_config_request_body.number_pdu,
sizeof(nfapi_dl_config_request_pdu_t));
for (int i = 0; i < p->dl_config_request_body.number_pdu; i++) {
p->dl_config_request_body.dl_config_pdu_list[i] =
dl_config_req->dl_config_request_body.dl_config_pdu_list[i];
}
return p;
}
void *memcpy_tx_req_standalone(nfapi_tx_request_t *tx_req)
{
int num_pdus = tx_req->tx_request_body.number_of_pdus;
nfapi_tx_req_pdu_list_t *list = calloc(1, sizeof(nfapi_tx_req_pdu_list_t) + num_pdus * sizeof(nfapi_tx_request_pdu_t));
list->num_pdus = num_pdus;
nfapi_tx_request_pdu_t *p = list->pdus;
for (int i = 0; i < num_pdus; i++)
{
p[i].num_segments = tx_req->tx_request_body.tx_pdu_list[i].num_segments;
p[i].pdu_index = tx_req->tx_request_body.tx_pdu_list[i].pdu_index;
p[i].pdu_length = tx_req->tx_request_body.tx_pdu_list[i].pdu_length;
for (int j = 0; j < tx_req->tx_request_body.tx_pdu_list[i].num_segments; j++)
{
p[i].segments[j].segment_length = tx_req->tx_request_body.tx_pdu_list[i].segments[j].segment_length;
if (p[i].segments[j].segment_length > 0)
{
p[i].segments[j].segment_data = calloc(
p[i].segments[j].segment_length, sizeof(uint8_t));
memcpy(p[i].segments[j].segment_data,
tx_req->tx_request_body.tx_pdu_list[i].segments[j].segment_data,
p[i].segments[j].segment_length);
}
}
}
return list;
}
static bool is_my_dl_config_req(const nfapi_dl_config_request_t *req)
{
const rnti_t my_rnti = UE_mac_inst[0].crnti;
int num_pdus = req->dl_config_request_body.number_pdu;
// look through list of pdus for rnti type 1 with my_rnti (normal dlsch case)
for (int i = 0; i < num_pdus; i++)
{
nfapi_dl_config_request_pdu_t *pdu = &req->dl_config_request_body.dl_config_pdu_list[i];
const int pdu_type = pdu->pdu_type;
if (pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
{
const rnti_t dci_rnti = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti;
const int rnti_type = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type;
if (rnti_type == 1 && dci_rnti == my_rnti)
{
return true;
}
}
else if(pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE)
{
return true; // Because these two pdu_types are coupled and we have to accept all other pdu_types
}
}
// Look for broadcasted rnti types
for (int i = 0; i < num_pdus; i++)
{
nfapi_dl_config_request_pdu_t *pdu = &req->dl_config_request_body.dl_config_pdu_list[i];
const int pdu_type = pdu->pdu_type;
if (pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE)
{
const int rnti_type = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type;
if (rnti_type != 1)
{
return true;
}
}
}
return false;
}
void enqueue_dl_config_req_tx_req(nfapi_dl_config_request_t *dl_config_req, nfapi_tx_request_t *tx_req)
{
if (!is_my_dl_config_req(dl_config_req))
{
LOG_I(MAC, "Filtering dl_config_req and tx_req\n");
return;
}
nfapi_dl_config_request_t *dl_config_req_temp = memcpy_dl_config_req_standalone(dl_config_req);
nfapi_tx_req_pdu_list_t *tx_req_temp = memcpy_tx_req_standalone(tx_req);
LOG_E(MAC, "This is the num_pdus for tx_req: %d\n", tx_req_temp->num_pdus);
LOG_E(MAC, "This is the num_pdus for dl_config_req and the sfn_sf: %d, %d:%d\n", dl_config_req_temp->dl_config_request_body.number_pdu,
NFAPI_SFNSF2SFN(dl_config_req_temp->sfn_sf), NFAPI_SFNSF2SF(dl_config_req_temp->sfn_sf));
nfapi_dl_config_req_tx_req_t *req = malloc(sizeof(nfapi_dl_config_req_tx_req_t));
req->dl_config_req = dl_config_req_temp;
req->tx_req_pdu_list = tx_req_temp;
if (!put_queue(&dl_config_req_tx_req_queue, req))
{
free(req->dl_config_req);
nfapi_free_tx_req_pdu_list(req->tx_req_pdu_list);
free(req);
}
}
const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len)
{
char *p = out;
......
......@@ -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