Commit 39f07d7a authored by Andrew Burger's avatar Andrew Burger

Set scheduler priorty to 1

To match emane.

Checked with:
```
ps ax -o pid,class,priority,comm |grep RR
```
parent 6dd80ffd
...@@ -1220,7 +1220,7 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) ...@@ -1220,7 +1220,7 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; 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.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
tx_req->header.message_id = NFAPI_TX_REQUEST; 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(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); int retval = nfapi_vnf_p7_tx_req(p7_config, tx_req);
if (retval!=0) { if (retval!=0) {
......
...@@ -160,7 +160,6 @@ void ue_init_mac(module_id_t module_idP) { ...@@ -160,7 +160,6 @@ void ue_init_mac(module_id_t module_idP) {
UE_mac_inst[module_idP].SI_Decoded = 0; UE_mac_inst[module_idP].SI_Decoded = 0;
next_ra_frame = 0; next_ra_frame = 0;
next_Mod_id = 0; next_Mod_id = 0;
tx_req_num_elems = 0;
} }
} }
...@@ -414,7 +413,7 @@ ue_send_sdu(module_id_t module_idP, ...@@ -414,7 +413,7 @@ ue_send_sdu(module_id_t module_idP,
if (payload_ptr != NULL) { if (payload_ptr != NULL) {
for (i = 0; i < num_ce; i++) { for (i = 0; i < num_ce; i++) {
LOG_D(MAC, "ce %d : %d\n",i,rx_ces[i]); LOG_I(MAC, "ce %d : %d\n",i,rx_ces[i]);
switch (rx_ces[i]) { switch (rx_ces[i]) {
case UE_CONT_RES: case UE_CONT_RES:
LOG_I(MAC, LOG_I(MAC,
......
...@@ -757,7 +757,7 @@ void dl_config_req_UE_MAC_dci(int sfn, ...@@ -757,7 +757,7 @@ void dl_config_req_UE_MAC_dci(int sfn,
nfapi_dl_config_request_pdu_t *dci, nfapi_dl_config_request_pdu_t *dci,
nfapi_dl_config_request_pdu_t *dlsch, nfapi_dl_config_request_pdu_t *dlsch,
int num_ue, int num_ue,
nfapi_tx_request_pdu_t *tx_request_pdu_list) { nfapi_tx_req_pdu_list_t *tx_req_pdu_list) {
DevAssert(dci->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE); DevAssert(dci->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE);
DevAssert(dlsch->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE); DevAssert(dlsch->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE);
...@@ -771,7 +771,7 @@ void dl_config_req_UE_MAC_dci(int sfn, ...@@ -771,7 +771,7 @@ void dl_config_req_UE_MAC_dci(int sfn,
} }
const int pdu_index = dlsch->dlsch_pdu.dlsch_pdu_rel8.pdu_index; const int pdu_index = dlsch->dlsch_pdu.dlsch_pdu_rel8.pdu_index;
if (pdu_index < 0 || pdu_index >= tx_req_num_elems) { if (pdu_index < 0 || pdu_index >= tx_req_pdu_list->num_pdus) {
LOG_E(MAC, LOG_E(MAC,
"%s(): Problem with receiving data: " "%s(): Problem with receiving data: "
"sfn/sf:%d.%d PDU size:%d, TX_PDU index: %d\n", "sfn/sf:%d.%d PDU size:%d, TX_PDU index: %d\n",
...@@ -780,21 +780,21 @@ void dl_config_req_UE_MAC_dci(int sfn, ...@@ -780,21 +780,21 @@ void dl_config_req_UE_MAC_dci(int sfn,
return; return;
} }
LOG_D(MAC, "%s() rnti value: 0x%x rnti type: %d\n", __func__, LOG_I(MAC, "%s() rnti value: 0x%x rnti type: %d\n", __func__,
rnti, rnti_type); rnti, rnti_type);
if (rnti_type == 1) { // C-RNTI (Normal DLSCH case) if (rnti_type == 1) { // C-RNTI (Normal DLSCH case)
for (int ue_id = 0; ue_id < num_ue; ue_id++) { for (int ue_id = 0; ue_id < num_ue; ue_id++) {
if (UE_mac_inst[ue_id].crnti == rnti) { if (UE_mac_inst[ue_id].crnti == rnti) {
LOG_D(MAC, LOG_I(MAC,
"%s() Received data: sfn/sf:%d.%d " "%s() Received data: sfn/sf:%d.%d "
"size:%d, TX_PDU index: %d, tx_req_num_elems: %d \n", "size:%d, TX_PDU index: %d, tx_req_num_elems: %d \n",
__func__, __func__,
sfn, sf, dci->pdu_size, sfn, sf, dci->pdu_size,
dlsch->dlsch_pdu.dlsch_pdu_rel8.pdu_index, dlsch->dlsch_pdu.dlsch_pdu_rel8.pdu_index,
tx_req_num_elems); tx_req_pdu_list->num_pdus);
ue_send_sdu(ue_id, 0, sfn, sf, ue_send_sdu(ue_id, 0, sfn, sf,
tx_request_pdu_list[pdu_index].segments[0].segment_data, tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data,
tx_request_pdu_list[pdu_index].segments[0].segment_length, tx_req_pdu_list->pdus[pdu_index].segments[0].segment_length,
0); 0);
return; return;
} }
...@@ -806,16 +806,16 @@ void dl_config_req_UE_MAC_dci(int sfn, ...@@ -806,16 +806,16 @@ void dl_config_req_UE_MAC_dci(int sfn,
continue; continue;
ue_decode_si(ue_id, 0, sfn, 0, ue_decode_si(ue_id, 0, sfn, 0,
tx_request_pdu_list[pdu_index].segments[0].segment_data, tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data,
tx_request_pdu_list[pdu_index].segments[0].segment_length); tx_req_pdu_list->pdus[pdu_index].segments[0].segment_length);
} }
} else if (rnti == 0xFFFE) { /* PI-RNTI */ } else if (rnti == 0xFFFE) { /* PI-RNTI */
for (int ue_id = 0; ue_id < num_ue; ue_id++) { for (int ue_id = 0; ue_id < num_ue; ue_id++) {
LOG_I(MAC, "%s() Received paging message: sfn/sf:%d.%d\n", LOG_I(MAC, "%s() Received paging message: sfn/sf:%d.%d\n",
__func__, sfn, sf); __func__, sfn, sf);
ue_decode_p(ue_id, 0, sfn, 0, ue_decode_p(ue_id, 0, sfn, 0,
tx_request_pdu_list[pdu_index].segments[0].segment_data, tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data,
tx_request_pdu_list[pdu_index].segments[0].segment_length); tx_req_pdu_list->pdus[pdu_index].segments[0].segment_length);
} }
} else if (rnti == 0x0002) { /* RA-RNTI */ } else if (rnti == 0x0002) { /* RA-RNTI */
for (int ue_id = 0; ue_id < num_ue; ue_id++) { for (int ue_id = 0; ue_id < num_ue; ue_id++) {
...@@ -837,10 +837,10 @@ void dl_config_req_UE_MAC_dci(int sfn, ...@@ -837,10 +837,10 @@ void dl_config_req_UE_MAC_dci(int sfn,
__func__, UE_mac_inst[ue_id].RA_prach_resources.ra_PreambleIndex); __func__, UE_mac_inst[ue_id].RA_prach_resources.ra_PreambleIndex);
ue_process_rar(ue_id, 0, sfn, ue_process_rar(ue_id, 0, sfn,
ra_rnti, //RA-RNTI ra_rnti, //RA-RNTI
tx_request_pdu_list[pdu_index].segments[0].segment_data, tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data,
&UE_mac_inst[ue_id].crnti, //t-crnti &UE_mac_inst[ue_id].crnti, //t-crnti
UE_mac_inst[ue_id].RA_prach_resources.ra_PreambleIndex, UE_mac_inst[ue_id].RA_prach_resources.ra_PreambleIndex,
tx_request_pdu_list[pdu_index].segments[0].segment_data); tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data);
// UE_mac_inst[ue_id].UE_mode[0] = RA_RESPONSE; // UE_mac_inst[ue_id].UE_mode[0] = RA_RESPONSE;
LOG_I(MAC, "setting UE_MODE now: %d\n", UE_mac_inst[ue_id].UE_mode[0]); LOG_I(MAC, "setting UE_MODE now: %d\n", UE_mac_inst[ue_id].UE_mode[0]);
// Expecting an UL_CONFIG_ULSCH_PDU to enable Msg3 Txon (first // Expecting an UL_CONFIG_ULSCH_PDU to enable Msg3 Txon (first
...@@ -880,7 +880,7 @@ void dl_config_req_UE_MAC_mch(int sfn, ...@@ -880,7 +880,7 @@ void dl_config_req_UE_MAC_mch(int sfn,
int sf, int sf,
nfapi_dl_config_request_pdu_t *mch, nfapi_dl_config_request_pdu_t *mch,
int num_ue, int num_ue,
nfapi_tx_request_pdu_t *tx_request_pdu_list) { nfapi_tx_req_pdu_list_t *tx_req_pdu_list) {
DevAssert(mch->pdu_type == NFAPI_DL_CONFIG_MCH_PDU_TYPE); DevAssert(mch->pdu_type == NFAPI_DL_CONFIG_MCH_PDU_TYPE);
for (int ue_id = 0; ue_id < num_ue; ue_id++) { for (int ue_id = 0; ue_id < num_ue; ue_id++) {
...@@ -895,7 +895,7 @@ void dl_config_req_UE_MAC_mch(int sfn, ...@@ -895,7 +895,7 @@ void dl_config_req_UE_MAC_mch(int sfn,
} else { } else {
const int pdu_index = mch->mch_pdu.mch_pdu_rel8.pdu_index; const int pdu_index = mch->mch_pdu.mch_pdu_rel8.pdu_index;
if (pdu_index < 0 || pdu_index >= tx_req_num_elems) { if (pdu_index < 0 || pdu_index >= tx_req_pdu_list->num_pdus) {
LOG_E(MAC, LOG_E(MAC,
"%s(): Problem with receiving data: " "%s(): Problem with receiving data: "
"sfn/sf:%d.%d PDU size:%d, TX_PDU index: %d\n", "sfn/sf:%d.%d PDU size:%d, TX_PDU index: %d\n",
...@@ -904,8 +904,8 @@ void dl_config_req_UE_MAC_mch(int sfn, ...@@ -904,8 +904,8 @@ void dl_config_req_UE_MAC_mch(int sfn,
return; return;
} }
ue_send_mch_sdu(ue_id, 0, sfn, ue_send_mch_sdu(ue_id, 0, sfn,
tx_request_pdu_list[pdu_index].segments[0].segment_data, tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data,
tx_request_pdu_list[pdu_index].segments[0].segment_length, tx_req_pdu_list->pdus[pdu_index].segments[0].segment_length,
0,0); 0,0);
} }
} }
...@@ -928,17 +928,13 @@ void hi_dci0_req_UE_MAC(int sfn, ...@@ -928,17 +928,13 @@ void hi_dci0_req_UE_MAC(int sfn,
} }
} }
// TODO: Find a way to drop more un-wanted dl_config_reqs & tx_reqs static bool is_my_dl_config_req(const nfapi_dl_config_request_t *req)
// In the current state we let alot of unecessary packets through
// during the ra-rnti/pi-rnti/si-rnti in the startup state before a c-rnti is assigned
// Right now we are just accepting all dl_config_req and tx_reqs
// when the c-rnti is 0 - Andrew
static bool is_my_dl_config_req(nfapi_dl_config_request_t *req)
{ {
bool is_my_rnti = true;
const rnti_t my_rnti = UE_mac_inst[0].crnti; // 0 for standalone pnf mode. TODO: Make this more clear - Andrew
for (int i = 0; i < req->dl_config_request_body.number_pdu; i++) 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]; nfapi_dl_config_request_pdu_t *pdu = &req->dl_config_request_body.dl_config_pdu_list[i];
const int pdu_type = pdu->pdu_type; const int pdu_type = pdu->pdu_type;
...@@ -946,21 +942,128 @@ static bool is_my_dl_config_req(nfapi_dl_config_request_t *req) ...@@ -946,21 +942,128 @@ static bool is_my_dl_config_req(nfapi_dl_config_request_t *req)
{ {
const rnti_t dci_rnti = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti; 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; const int rnti_type = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type;
if (rnti_type == 1 && dci_rnti != my_rnti) if (rnti_type == 1 && dci_rnti == my_rnti)
{ {
is_my_rnti = false; return true;
LOG_I(MAC, "RNTI is not mine for pdu_type: %d my_rnti: 0x%x dci_rnti: 0x%x\n",
pdu_type, my_rnti, dci_rnti);
} }
else }
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)
{ {
is_my_rnti = true; return true;
break;
} }
} }
} }
return is_my_rnti;
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;
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_t
{
size_t num_indicies;
int *indicies;
}dlsch_pdu_indicies_t;
static void print_lists(const dlsch_pdu_indicies_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_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)
{
if (pdu->pdu_index == wanted->indicies[i])
{
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 // The following set of memcpy functions should be getting called as callback
...@@ -969,15 +1072,29 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc, ...@@ -969,15 +1072,29 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc,
nfapi_pnf_p7_config_t *pnf_p7, nfapi_pnf_p7_config_t *pnf_p7,
nfapi_dl_config_request_t *req) { nfapi_dl_config_request_t *req) {
if (!is_my_dl_config_req(req)) if (!is_my_dl_config_req(req) && req->dl_config_request_body.number_pdu <= 2)
{ {
// TODO: Add in some kind of log or check to identify that what is being removed from the queue is correct. - Andrew 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) // Need to remove corresponding tx_req (comes before dl_config_req always)
void *p = unqueue(&tx_req_pdu_queue); int num_dlsch_pdu_indicies = get_dlsch_pdu_indicies(req, dlsch_pdu_indicies, max_dlsch_pdu_indicies);
if (p) if (num_dlsch_pdu_indicies == 0)
{ {
free(p); 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_t wanted = {num_dlsch_pdu_indicies, dlsch_pdu_indicies};
nfapi_tx_req_pdu_list_t *matched = unqueue_matching(&tx_req_pdu_queue, match_dl_config_req, &wanted);
if (!matched)
{
LOG_W(MAC, "Could not unqueue_matching\n");
return 0;
}
LOG_E(MAC, "REMOVING.. dl_config_req & tx_req\n");
free(matched);
return 0; return 0;
} }
...@@ -1007,6 +1124,7 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc, ...@@ -1007,6 +1124,7 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc,
if (!put_queue(&dl_config_req_queue, p)) { if (!put_queue(&dl_config_req_queue, p)) {
free(p); free(p);
} }
LOG_I(MAC, "DL_CONFIG_REQ QUEUE: %zu", dl_config_req_queue.num_items);
return 0; return 0;
} }
...@@ -1071,10 +1189,30 @@ int memcpy_ul_config_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, nf ...@@ -1071,10 +1189,30 @@ int memcpy_ul_config_req(L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, nf
return 0; return 0;
} }
void nfapi_free_tx_req_pdu_list(nfapi_tx_req_pdu_list_t *list)
{
// free all the p[i].segments[j].segment_data memory
int num_pdus = list->num_pdus;
nfapi_tx_request_pdu_t *pdus = list->pdus;
for (int i = 0; i < num_pdus; i++) {
int num_segments = pdus[i].num_segments;
for (int j = 0; j < num_segments; j++) {
free(pdus[i].segments[j].segment_data);
pdus[i].segments[j].segment_data = NULL;
}
}
free(list);
}
int memcpy_tx_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_tx_request_t *req) { int memcpy_tx_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_tx_request_t *req) {
tx_req_num_elems = req->tx_request_body.number_of_pdus;
nfapi_tx_request_pdu_t *p = calloc(tx_req_num_elems, sizeof(nfapi_tx_request_pdu_t)); int num_pdus = req->tx_request_body.number_of_pdus;
for (int i = 0; i < tx_req_num_elems; i++) {
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 = req->tx_request_body.tx_pdu_list[i].num_segments; p[i].num_segments = req->tx_request_body.tx_pdu_list[i].num_segments;
p[i].pdu_index = req->tx_request_body.tx_pdu_list[i].pdu_index; p[i].pdu_index = req->tx_request_body.tx_pdu_list[i].pdu_index;
p[i].pdu_length = req->tx_request_body.tx_pdu_list[i].pdu_length; p[i].pdu_length = req->tx_request_body.tx_pdu_list[i].pdu_length;
...@@ -1090,15 +1228,15 @@ int memcpy_tx_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_tx_request_t *req) { ...@@ -1090,15 +1228,15 @@ int memcpy_tx_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_tx_request_t *req) {
} }
} }
if (!put_queue(&tx_req_pdu_queue, p)) { if (!put_queue(&tx_req_pdu_queue, list)) {
free(p); nfapi_free_tx_req_pdu_list(list);
} }
return 0; return 0;
} }
int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc, int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc,
nfapi_pnf_p7_config_t* pnf_p7, nfapi_pnf_p7_config_t* pnf_p7,
nfapi_hi_dci0_request_t* req) { nfapi_hi_dci0_request_t* req) {
nfapi_hi_dci0_request_t *p = (nfapi_hi_dci0_request_t *)malloc(sizeof(nfapi_hi_dci0_request_t)); nfapi_hi_dci0_request_t *p = (nfapi_hi_dci0_request_t *)malloc(sizeof(nfapi_hi_dci0_request_t));
//if(req!=0){ //if(req!=0){
...@@ -1132,7 +1270,7 @@ int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc, ...@@ -1132,7 +1270,7 @@ int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc,
if (!put_queue(&hi_dci0_req_queue, p)) { if (!put_queue(&hi_dci0_req_queue, p)) {
free(p); free(p);
} }
LOG_I(MAC, "DCI0 QUEUE: %zu\n", hi_dci0_req_queue.num_items);
return 0; return 0;
} }
...@@ -1304,7 +1442,7 @@ void *ue_standalone_pnf_task(void *context) ...@@ -1304,7 +1442,7 @@ void *ue_standalone_pnf_task(void *context)
else else
{ {
// check to see if dl_config_req is null // check to see if dl_config_req is null
LOG_D(MAC, "dl_config_req Frame: %u Subframe: %u\n", dl_config_req.sfn_sf >> 4, LOG_I(MAC, "dl_config_req Frame: %u Subframe: %u\n", dl_config_req.sfn_sf >> 4,
dl_config_req.sfn_sf & 15); dl_config_req.sfn_sf & 15);
memcpy_dl_config_req(NULL, NULL, &dl_config_req); memcpy_dl_config_req(NULL, NULL, &dl_config_req);
} }
...@@ -1322,7 +1460,7 @@ void *ue_standalone_pnf_task(void *context) ...@@ -1322,7 +1460,7 @@ void *ue_standalone_pnf_task(void *context)
else else
{ {
// check to see if tx_req is null // check to see if tx_req is null
LOG_D(MAC, "tx_req Frame: %u Subframe: %u\n", tx_req.sfn_sf >> 4, LOG_I(MAC, "tx_req Frame: %u Subframe: %u\n", tx_req.sfn_sf >> 4,
tx_req.sfn_sf & 15); tx_req.sfn_sf & 15);
memcpy_tx_req(NULL, &tx_req); memcpy_tx_req(NULL, &tx_req);
} }
......
...@@ -29,8 +29,6 @@ extern UL_IND_t *UL_INFO; ...@@ -29,8 +29,6 @@ extern UL_IND_t *UL_INFO;
/// Pointers to config_request types. Used from nfapi callback functions. /// Pointers to config_request types. Used from nfapi callback functions.
//below 3 difinitions move to phy_stub_UE.c to add initialization when difinition. //below 3 difinitions move to phy_stub_UE.c to add initialization when difinition.
int tx_req_num_elems;
//below 2 difinitions move to lte-ue.c to add initialization when difinition. //below 2 difinitions move to lte-ue.c to add initialization when difinition.
//int next_ra_frame; //int next_ra_frame;
//module_id_t next_Mod_id; //module_id_t next_Mod_id;
...@@ -99,12 +97,20 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id, ...@@ -99,12 +97,20 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
uint16_t frame,uint8_t subframe,uint8_t srs_present, int index, uint16_t frame,uint8_t subframe,uint8_t srs_present, int index,
nfapi_ul_config_request_t *ul_config_req); nfapi_ul_config_request_t *ul_config_req);
typedef struct nfapi_tx_req_pdu_list_t
{
int num_pdus; /* number .pdus[] objects */
nfapi_tx_request_pdu_t pdus[]; /* see "struct hack" */
} nfapi_tx_req_pdu_list_t;
void nfapi_free_tx_req_pdu_list(nfapi_tx_req_pdu_list_t *);
void dl_config_req_UE_MAC_dci(int sfn, void dl_config_req_UE_MAC_dci(int sfn,
int sf, int sf,
nfapi_dl_config_request_pdu_t *dci, nfapi_dl_config_request_pdu_t *dci,
nfapi_dl_config_request_pdu_t *dlsch, nfapi_dl_config_request_pdu_t *dlsch,
int num_ue, int num_ue,
nfapi_tx_request_pdu_t *tx_request_pdu_list); nfapi_tx_req_pdu_list_t *);
void dl_config_req_UE_MAC_bch(int sfn, void dl_config_req_UE_MAC_bch(int sfn,
int sf, int sf,
nfapi_dl_config_request_pdu_t *bch, nfapi_dl_config_request_pdu_t *bch,
...@@ -113,7 +119,7 @@ void dl_config_req_UE_MAC_mch(int sfn, ...@@ -113,7 +119,7 @@ void dl_config_req_UE_MAC_mch(int sfn,
int sf, int sf,
nfapi_dl_config_request_pdu_t *bch, nfapi_dl_config_request_pdu_t *bch,
int num_ue, int num_ue,
nfapi_tx_request_pdu_t *tx_request_pdu_list); nfapi_tx_req_pdu_list_t *);
int tx_req_UE_MAC(nfapi_tx_request_t* req); int tx_req_UE_MAC(nfapi_tx_request_t* req);
...@@ -154,9 +160,8 @@ char *nfapi_ul_config_req_to_string(nfapi_ul_config_request_t *req); ...@@ -154,9 +160,8 @@ 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 *dl_pdu_type_to_string(uint8_t pdu_type);
const char *ul_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 dl_config_req_queue;
extern queue_t tx_req_pdu_queue; extern queue_t tx_req_pdu_queue; /* items in this queue are nfapi_tx_req_pdu_list_t* */
extern queue_t ul_config_req_queue; extern queue_t ul_config_req_queue;
extern queue_t hi_dci0_req_queue; extern queue_t hi_dci0_req_queue;
......
...@@ -150,4 +150,4 @@ void *unqueue_matching(queue_t *q, queue_matcher_t *matcher, void *wanted) ...@@ -150,4 +150,4 @@ void *unqueue_matching(queue_t *q, queue_matcher_t *matcher, void *wanted)
pthread_mutex_unlock(&q->mutex); pthread_mutex_unlock(&q->mutex);
return item; return item;
} }
\ No newline at end of file
...@@ -1088,9 +1088,9 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1088,9 +1088,9 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
} }
last_sfn_sf = sfn_sf; last_sfn_sf = sfn_sf;
nfapi_tx_request_pdu_t *tx_request_pdu_list = get_queue(&tx_req_pdu_queue); 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); nfapi_dl_config_request_t *dl_config_req = get_queue(&dl_config_req_queue);
if (tx_request_pdu_list) if (tx_req_pdu_list)
{ {
uint64_t deadline = clock_usec() + 1000; uint64_t deadline = clock_usec() + 1000;
if (!dl_config_req) if (!dl_config_req)
...@@ -1116,7 +1116,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1116,7 +1116,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
nfapi_ul_config_request_t *ul_config_req = get_queue(&ul_config_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); nfapi_hi_dci0_request_t *hi_dci0_req = get_queue(&hi_dci0_req_queue);
LOG_D(MAC, "received from proxy frame %d subframe %d\n", LOG_I(MAC, "received from proxy frame %d subframe %d\n",
NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
if (dl_config_req != NULL) { if (dl_config_req != NULL) {
uint16_t dl_num_pdus = dl_config_req->dl_config_request_body.number_pdu; uint16_t dl_num_pdus = dl_config_req->dl_config_request_body.number_pdu;
...@@ -1126,19 +1126,18 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1126,19 +1126,18 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
dl_num_pdus); dl_num_pdus);
if (dl_num_pdus > 0) { if (dl_num_pdus > 0) {
char *dl_str = nfapi_dl_config_req_to_string(dl_config_req); char *dl_str = nfapi_dl_config_req_to_string(dl_config_req);
LOG_D(MAC, "dl_config_req: %s\n", dl_str); LOG_I(MAC, "dl_config_req: %s\n", dl_str);
free(dl_str); free(dl_str);
} }
} }
if (tx_request_pdu_list != NULL) { if (tx_req_pdu_list != NULL) {
LOG_D(MAC, "tx_req segments: %u\n", LOG_D(MAC, "tx_req pdus: %d\n", tx_req_pdu_list->num_pdus);
tx_request_pdu_list->num_segments);
} }
if (ul_config_req != NULL) { if (ul_config_req != NULL) {
uint8_t ul_num_pdus = ul_config_req->ul_config_request_body.number_of_pdus; uint8_t ul_num_pdus = ul_config_req->ul_config_request_body.number_of_pdus;
if (ul_num_pdus > 0) { if (ul_num_pdus > 0) {
char *ul_str = nfapi_ul_config_req_to_string(ul_config_req); char *ul_str = nfapi_ul_config_req_to_string(ul_config_req);
LOG_D(MAC, "ul_config_req: %s\n", ul_str); LOG_I(MAC, "ul_config_req: %s\n", ul_str);
free(ul_str); free(ul_str);
} }
} }
...@@ -1148,13 +1147,13 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1148,13 +1147,13 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf)); NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf));
} }
if ((dl_config_req != NULL) != (tx_request_pdu_list != NULL)) { if ((dl_config_req != NULL) != (tx_req_pdu_list != NULL)) {
num_lone++; num_lone++;
} else { } else {
num_pairs++; num_pairs++;
} }
if (dl_config_req && tx_request_pdu_list) { if (dl_config_req && tx_req_pdu_list) {
if ((num_pairs % 1000) == 0) { if ((num_pairs % 1000) == 0) {
LOG_I(MAC, "num_pairs:%d, num_lone:%d\n", num_pairs, num_lone); LOG_I(MAC, "num_pairs:%d, num_lone:%d\n", num_pairs, num_lone);
} }
...@@ -1176,7 +1175,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1176,7 +1175,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
pdu, pdu,
dlsch, dlsch,
ue_num, ue_num,
tx_request_pdu_list); tx_req_pdu_list);
} else if (pdu->pdu_type == NFAPI_DL_CONFIG_BCH_PDU_TYPE) { } else if (pdu->pdu_type == NFAPI_DL_CONFIG_BCH_PDU_TYPE) {
dl_config_req_UE_MAC_bch(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), dl_config_req_UE_MAC_bch(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),
NFAPI_SFNSF2SF(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
...@@ -1187,7 +1186,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1187,7 +1186,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
NFAPI_SFNSF2SF(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
pdu, pdu,
ue_num, ue_num,
tx_request_pdu_list); tx_req_pdu_list);
} }
} }
} }
...@@ -1361,16 +1360,9 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1361,16 +1360,9 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
dl_config_req = NULL; dl_config_req = NULL;
} }
if (tx_request_pdu_list != NULL) { if (tx_req_pdu_list != NULL) {
for (int i = 0; i < tx_req_num_elems; i++) { nfapi_free_tx_req_pdu_list(tx_req_pdu_list);
for (int j = 0; j < tx_request_pdu_list[i].num_segments; j++) { tx_req_pdu_list = NULL;
free(tx_request_pdu_list[i].segments[j].segment_data);
tx_request_pdu_list[i].segments[j].segment_data = NULL;
}
}
tx_req_num_elems = 0;
free(tx_request_pdu_list);
tx_request_pdu_list = NULL;
} }
if (ul_config_req != NULL) { if (ul_config_req != NULL) {
...@@ -1475,7 +1467,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1475,7 +1467,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
dl_config_req = NULL; dl_config_req = NULL;
ul_config_req = NULL; ul_config_req = NULL;
hi_dci0_req = NULL; hi_dci0_req = NULL;
tx_request_pdu_list = NULL; tx_req_pdu_list = NULL;
// waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1. // waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1.
do { do {
...@@ -1571,7 +1563,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1571,7 +1563,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
} }
} }
if (dl_config_req && tx_request_pdu_list) { if (dl_config_req && tx_req_pdu_list) {
nfapi_dl_config_request_body_t* dl_config_req_body = &dl_config_req->dl_config_request_body; 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) { 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]; nfapi_dl_config_request_pdu_t* pdu = &dl_config_req_body->dl_config_pdu_list[i];
...@@ -1785,16 +1777,16 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1785,16 +1777,16 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
dl_config_req = NULL; dl_config_req = NULL;
} }
if(tx_request_pdu_list!=NULL) { if(tx_req_pdu_list!=NULL) {
for (int i = 0; i < tx_req_num_elems; i++) { for (int i = 0; i < tx_req_num_elems; i++) {
for (int j = 0; j < tx_request_pdu_list[i].num_segments; j++) { for (int j = 0; j < tx_req_pdu_list[i].num_segments; j++) {
free(tx_request_pdu_list[i].segments[j].segment_data); free(tx_req_pdu_list[i].segments[j].segment_data);
tx_request_pdu_list[i].segments[j].segment_data = NULL; tx_req_pdu_list[i].segments[j].segment_data = NULL;
} }
} }
tx_req_num_elems = 0; tx_req_num_elems = 0;
free(tx_request_pdu_list); free(tx_req_pdu_list);
tx_request_pdu_list = NULL; tx_req_pdu_list = NULL;
} }
if(ul_config_req!=NULL) { if(ul_config_req!=NULL) {
......
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