Commit af92c512 authored by Andrew Burger's avatar Andrew Burger

Major queue changes note all the log supressions

parent 1b4c8d9e
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -49,10 +49,10 @@ void generate_sldch(PHY_VARS_UE *ue,SLDCH_t *sldch,int frame_tx,int subframe_tx) ...@@ -49,10 +49,10 @@ void generate_sldch(PHY_VARS_UE *ue,SLDCH_t *sldch,int frame_tx,int subframe_tx)
(void*)sldch, (void*)sldch,
sizeof(SLDCH_t)); sizeof(SLDCH_t));
LOG_I(PHY,"SLDCH configuration %zd bytes, TBS payload %d bytes => %zd bytes\n", // LOG_I(PHY,"SLDCH configuration %zd bytes, TBS payload %d bytes => %zd bytes\n",
sizeof(SLDCH_t)-sizeof(uint8_t*), // sizeof(SLDCH_t)-sizeof(uint8_t*),
sldch->payload_length, // sldch->payload_length,
sldch_header_len+sizeof(SLDCH_t)-sizeof(uint8_t*)+sldch->payload_length); // sldch_header_len+sizeof(SLDCH_t)-sizeof(uint8_t*)+sldch->payload_length);
multicast_link_write_sock(0, multicast_link_write_sock(0,
(char *)&pdu, (char *)&pdu,
......
...@@ -242,9 +242,9 @@ multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP) ...@@ -242,9 +242,9 @@ multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP)
if ((num = sendto (group_list[groupP].socket, dataP, sizeP, 0, if ((num = sendto (group_list[groupP].socket, dataP, sizeP, 0,
(struct sockaddr *) &group_list[groupP].sock_remote_addr, (struct sockaddr *) &group_list[groupP].sock_remote_addr,
sizeof (group_list[groupP].sock_remote_addr))) < 0) { sizeof (group_list[groupP].sock_remote_addr))) < 0) {
LOG_E(PHY, "[MULTICAST] sendto has failed (%d:%s)\n (%s:%d)\n", // LOG_E(PHY, "[MULTICAST] sendto has failed (%d:%s)\n (%s:%d)\n",
errno, strerror(errno), // errno, strerror(errno),
__FILE__, __LINE__); // __FILE__, __LINE__);
} }
return num; return num;
......
...@@ -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_request_pdu_list = NULL;
tx_req_num_elems = 0; tx_req_num_elems = 0;
} }
} }
...@@ -2469,11 +2468,11 @@ ue_scheduler(const module_id_t module_idP, ...@@ -2469,11 +2468,11 @@ ue_scheduler(const module_id_t module_idP,
if (msg_p != NULL) { if (msg_p != NULL) {
switch (ITTI_MSG_ID(msg_p)) { switch (ITTI_MSG_ID(msg_p)) {
case RRC_MAC_CCCH_DATA_REQ: case RRC_MAC_CCCH_DATA_REQ:
LOG_I(MAC, // LOG_I(MAC,
"Received %s from %s: instance %d, frameP %d, eNB_index %d\n", // "Received %s from %s: instance %d, frameP %d, eNB_index %d\n",
ITTI_MSG_NAME(msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), ITTI_MSG_INSTANCE(msg_p), // ITTI_MSG_NAME(msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), ITTI_MSG_INSTANCE(msg_p),
RRC_MAC_CCCH_DATA_REQ(msg_p).frame, // RRC_MAC_CCCH_DATA_REQ(msg_p).frame,
RRC_MAC_CCCH_DATA_REQ(msg_p).enb_index); // RRC_MAC_CCCH_DATA_REQ(msg_p).enb_index);
// TODO process CCCH data req. // TODO process CCCH data req.
break; break;
...@@ -3145,7 +3144,7 @@ SLDCH_t *ue_get_sldch(module_id_t Mod_id,int CC_id,frame_t frame_tx,sub_frame_t ...@@ -3145,7 +3144,7 @@ SLDCH_t *ue_get_sldch(module_id_t Mod_id,int CC_id,frame_t frame_tx,sub_frame_t
0); 0);
if (sldch->payload_length >0 ) { if (sldch->payload_length >0 ) {
LOG_I(MAC,"Got %d bytes from RRC for SLDCH @ %p\n",sldch->payload_length,sldch); // LOG_I(MAC,"Got %d bytes from RRC for SLDCH @ %p\n",sldch->payload_length,sldch);
return (sldch); return (sldch);
} else } else
return((SLDCH_t *)NULL); return((SLDCH_t *)NULL);
......
...@@ -40,11 +40,58 @@ void configure_nfapi_pnf(char *vnf_ip_addr, ...@@ -40,11 +40,58 @@ void configure_nfapi_pnf(char *vnf_ip_addr,
int vnf_p7_port); int vnf_p7_port);
UL_IND_t *UL_INFO = NULL; UL_IND_t *UL_INFO = NULL;
nfapi_tx_request_pdu_t* tx_request_pdu_list = NULL;
nfapi_dl_config_request_t* dl_config_req = NULL;
nfapi_ul_config_request_t* ul_config_req = NULL; nfapi_ul_config_request_t* ul_config_req = NULL;
nfapi_hi_dci0_request_t* hi_dci0_req = NULL; nfapi_hi_dci0_request_t* hi_dci0_req = NULL;
queue_t dl_config_req_queue;
queue_t tx_req_pdu_queue;
queue_t ul_config_req_queue;
queue_t hi_dci0_req_queue;
void init_queue(queue_t *q) {
memset(q, 0, sizeof(*q));
pthread_mutex_init(&q->mutex, NULL);
}
void put_queue(queue_t *q, void *item) {
if (pthread_mutex_lock(&q->mutex) != 0) {
LOG_E(MAC, "put_queue mutex_lock failed\n");
return;
}
if (q->num_items >= MAX_QUEUE_SIZE) {
LOG_E(MAC, "Queue is full in put_queue\n");
} else {
q->items[q->write_index] = item;
q->write_index = (q->write_index + 1) % MAX_QUEUE_SIZE;
q->num_items++;
}
pthread_mutex_unlock(&q->mutex);
}
void *get_queue(queue_t *q) {
void *item = NULL;
if (pthread_mutex_lock(&q->mutex) != 0) {
LOG_E(MAC, "get_queue mutex_lock failed\n");
return NULL;
}
if (q->num_items > 0) {
item = q->items[q->read_index];
q->read_index = (q->read_index + 1) % MAX_QUEUE_SIZE;
q->num_items--;
}
pthread_mutex_unlock(&q->mutex);
return item;
}
extern nfapi_tx_request_pdu_t* tx_request_pdu[1023][10][10]; extern nfapi_tx_request_pdu_t* tx_request_pdu[1023][10][10];
//extern int timer_subframe; //extern int timer_subframe;
//extern int timer_frame; //extern int timer_frame;
...@@ -715,7 +762,8 @@ void dl_config_req_UE_MAC_dci(int sfn, ...@@ -715,7 +762,8 @@ 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) {
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);
...@@ -730,11 +778,11 @@ void dl_config_req_UE_MAC_dci(int sfn, ...@@ -730,11 +778,11 @@ 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_num_elems) {
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",
__func__, // __func__,
sfn, sf, dci->pdu_size, dlsch->dlsch_pdu.dlsch_pdu_rel8.pdu_index); // sfn, sf, dci->pdu_size, dlsch->dlsch_pdu.dlsch_pdu_rel8.pdu_index);
return; return;
} }
...@@ -834,7 +882,8 @@ void dl_config_req_UE_MAC_bch(int sfn, ...@@ -834,7 +882,8 @@ void dl_config_req_UE_MAC_bch(int sfn,
void dl_config_req_UE_MAC_mch(int sfn, 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) {
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++) {
...@@ -850,11 +899,11 @@ void dl_config_req_UE_MAC_mch(int sfn, ...@@ -850,11 +899,11 @@ 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_num_elems) {
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",
__func__, // __func__,
sfn, sf, mch->pdu_size, mch->mch_pdu.mch_pdu_rel8.pdu_index); // sfn, sf, mch->pdu_size, mch->mch_pdu.mch_pdu_rel8.pdu_index);
return; return;
} }
ue_send_mch_sdu(ue_id, 0, sfn, ue_send_mch_sdu(ue_id, 0, sfn,
...@@ -911,40 +960,40 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc, ...@@ -911,40 +960,40 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc,
p->dl_config_request_body.dl_config_pdu_list[i] = p->dl_config_request_body.dl_config_pdu_list[i] =
req->dl_config_request_body.dl_config_pdu_list[i]; req->dl_config_request_body.dl_config_pdu_list[i];
} }
dl_config_req = p;
put_queue(&dl_config_req_queue, p);
return 0; return 0;
} }
int memcpy_ul_config_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req) int memcpy_ul_config_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req)
{ {
// make same changes as in dl_config_req // make same changes as in dl_config_req
ul_config_req = malloc(sizeof(nfapi_ul_config_request_t)); nfapi_ul_config_request_t *p = malloc(sizeof(nfapi_ul_config_request_t));
p->sfn_sf = req->sfn_sf;
p->vendor_extension = req->vendor_extension;
ul_config_req->sfn_sf = req->sfn_sf; p->ul_config_request_body.number_of_pdus = req->ul_config_request_body.number_of_pdus;
ul_config_req->vendor_extension = req->vendor_extension; p->ul_config_request_body.rach_prach_frequency_resources = req->ul_config_request_body.rach_prach_frequency_resources;
p->ul_config_request_body.srs_present = req->ul_config_request_body.srs_present;
ul_config_req->ul_config_request_body.number_of_pdus = req->ul_config_request_body.number_of_pdus;
ul_config_req->ul_config_request_body.rach_prach_frequency_resources = req->ul_config_request_body.rach_prach_frequency_resources;
ul_config_req->ul_config_request_body.srs_present = req->ul_config_request_body.srs_present;
ul_config_req->ul_config_request_body.tl.tag = req->ul_config_request_body.tl.tag; p->ul_config_request_body.tl.tag = req->ul_config_request_body.tl.tag;
ul_config_req->ul_config_request_body.tl.length = req->ul_config_request_body.tl.length; p->ul_config_request_body.tl.length = req->ul_config_request_body.tl.length;
ul_config_req->ul_config_request_body.ul_config_pdu_list = p->ul_config_request_body.ul_config_pdu_list =
calloc(req->ul_config_request_body.number_of_pdus, calloc(req->ul_config_request_body.number_of_pdus,
sizeof(nfapi_ul_config_request_pdu_t)); sizeof(nfapi_ul_config_request_pdu_t));
for (int i = 0; i < ul_config_req->ul_config_request_body.number_of_pdus; i++) { for (int i = 0; i < p->ul_config_request_body.number_of_pdus; i++) {
ul_config_req->ul_config_request_body.ul_config_pdu_list[i] = p->ul_config_request_body.ul_config_pdu_list[i] =
req->ul_config_request_body.ul_config_pdu_list[i]; req->ul_config_request_body.ul_config_pdu_list[i];
} }
// put_queue(&ul_config_req_queue, (void *)p);
ul_config_req = p;
return 0; return 0;
} }
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) {
// make same changes as in dl_config_req
tx_req_num_elems = req->tx_request_body.number_of_pdus; 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)); nfapi_tx_request_pdu_t *p = calloc(tx_req_num_elems, sizeof(nfapi_tx_request_pdu_t));
for (int i = 0; i < tx_req_num_elems; i++) { for (int i = 0; i < tx_req_num_elems; i++) {
...@@ -962,7 +1011,7 @@ int memcpy_tx_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_tx_request_t *req) { ...@@ -962,7 +1011,7 @@ int memcpy_tx_req(nfapi_pnf_p7_config_t *pnf_p7, nfapi_tx_request_t *req) {
} }
} }
} }
tx_request_pdu_list = p; put_queue(&tx_req_pdu_queue, p);
return 0; return 0;
} }
...@@ -971,34 +1020,37 @@ int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc, ...@@ -971,34 +1020,37 @@ 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) {
// make same changes as in dl_config_req // make same changes as in dl_config_req
hi_dci0_req = (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){
hi_dci0_req->sfn_sf = req->sfn_sf; p->sfn_sf = req->sfn_sf;
hi_dci0_req->vendor_extension = req->vendor_extension; p->vendor_extension = req->vendor_extension;
hi_dci0_req->hi_dci0_request_body.number_of_dci = req->hi_dci0_request_body.number_of_dci; p->hi_dci0_request_body.number_of_dci = req->hi_dci0_request_body.number_of_dci;
hi_dci0_req->hi_dci0_request_body.number_of_hi = req->hi_dci0_request_body.number_of_hi; p->hi_dci0_request_body.number_of_hi = req->hi_dci0_request_body.number_of_hi;
hi_dci0_req->hi_dci0_request_body.sfnsf = req->hi_dci0_request_body.sfnsf; p->hi_dci0_request_body.sfnsf = req->hi_dci0_request_body.sfnsf;
// UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.tl = // UE_mac_inst[Mod_id].p->hi_dci0_request_body.tl =
// req->hi_dci0_request_body.tl; // req->hi_dci0_request_body.tl;
hi_dci0_req->hi_dci0_request_body.tl.tag = req->hi_dci0_request_body.tl.tag; p->hi_dci0_request_body.tl.tag = req->hi_dci0_request_body.tl.tag;
hi_dci0_req->hi_dci0_request_body.tl.length = req->hi_dci0_request_body.tl.length; p->hi_dci0_request_body.tl.length = req->hi_dci0_request_body.tl.length;
int total_pdus = hi_dci0_req->hi_dci0_request_body.number_of_dci int total_pdus = p->hi_dci0_request_body.number_of_dci
+ hi_dci0_req->hi_dci0_request_body.number_of_hi; + p->hi_dci0_request_body.number_of_hi;
hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = p->hi_dci0_request_body.hi_dci0_pdu_list =
calloc(total_pdus, sizeof(nfapi_hi_dci0_request_pdu_t)); calloc(total_pdus, sizeof(nfapi_hi_dci0_request_pdu_t));
for (int i = 0; i < total_pdus; i++) { for (int i = 0; i < total_pdus; i++) {
hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list[i] = req->hi_dci0_request_body.hi_dci0_pdu_list[i]; p->hi_dci0_request_body.hi_dci0_pdu_list[i] = req->hi_dci0_request_body.hi_dci0_pdu_list[i];
// LOG_I(MAC, "Original hi_dci0 req. type:%d, Copy type: %d // LOG_I(MAC, "Original hi_dci0 req. type:%d, Copy type: %d
// \n",req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type, // \n",req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type,
// UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type); // UE_mac_inst[Mod_id].p->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type);
} }
// put_queue(&hi_dci0_req_queue, (void *)p);
hi_dci0_req = p;
return 0; return 0;
} }
...@@ -1101,8 +1153,7 @@ void *ue_standalone_pnf_task(void *context) ...@@ -1101,8 +1153,7 @@ void *ue_standalone_pnf_task(void *context)
} }
nfapi_p7_message_header_t header; nfapi_p7_message_header_t header;
if (nfapi_p7_message_header_unpack((void *)buffer, len, &header, sizeof(header), NULL) < 0) if (nfapi_p7_message_header_unpack((void *)buffer, len, &header, sizeof(header), NULL) < 0) {
{
LOG_E(MAC, "Header unpack failed for standalone pnf\n"); LOG_E(MAC, "Header unpack failed for standalone pnf\n");
continue; continue;
} }
...@@ -1119,7 +1170,7 @@ void *ue_standalone_pnf_task(void *context) ...@@ -1119,7 +1170,7 @@ void *ue_standalone_pnf_task(void *context)
} }
else else
{ {
LOG_I(MAC, "Sending dl_config_req to memcpy function\n"); // check to see if dl_config_req is null
memcpy_dl_config_req(NULL, NULL, &dl_config_req); memcpy_dl_config_req(NULL, NULL, &dl_config_req);
} }
break; break;
...@@ -1127,6 +1178,7 @@ void *ue_standalone_pnf_task(void *context) ...@@ -1127,6 +1178,7 @@ void *ue_standalone_pnf_task(void *context)
case NFAPI_TX_REQUEST: case NFAPI_TX_REQUEST:
{ {
nfapi_tx_request_t tx_req; nfapi_tx_request_t tx_req;
// lock this tx_req
if (nfapi_p7_message_unpack((void *)buffer, len, &tx_req, if (nfapi_p7_message_unpack((void *)buffer, len, &tx_req,
sizeof(tx_req), NULL) < 0) sizeof(tx_req), NULL) < 0)
{ {
...@@ -1134,7 +1186,7 @@ void *ue_standalone_pnf_task(void *context) ...@@ -1134,7 +1186,7 @@ void *ue_standalone_pnf_task(void *context)
} }
else else
{ {
LOG_I(MAC, "Sending tx_req to memcpy function\n"); // check to see if tx_req is null
memcpy_tx_req(NULL, &tx_req); memcpy_tx_req(NULL, &tx_req);
} }
break; break;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "openair2/PHY_INTERFACE/IF_Module.h" #include "openair2/PHY_INTERFACE/IF_Module.h"
#include "nfapi_interface.h" #include "nfapi_interface.h"
#include "nfapi_pnf_interface.h" #include "nfapi_pnf_interface.h"
#include <pthread.h>
//#include "openair1/PHY/LTE_TRANSPORT/defs.h" //#include "openair1/PHY/LTE_TRANSPORT/defs.h"
//#include "openair1/PHY/defs.h" //#include "openair1/PHY/defs.h"
//#include "openair1/PHY/LTE_TRANSPORT/defs.h" //#include "openair1/PHY/LTE_TRANSPORT/defs.h"
...@@ -21,13 +22,9 @@ ...@@ -21,13 +22,9 @@
FILL_UL_INFO_MUTEX_t fill_ul_mutex; FILL_UL_INFO_MUTEX_t fill_ul_mutex;
//below 2 difinitions move to phy_stub_UE.c to add initialization when difinition. //below 2 difinitions move to phy_stub_UE.c to add initialization when difinition.
extern UL_IND_t *UL_INFO; extern UL_IND_t *UL_INFO;
extern nfapi_tx_request_pdu_t* tx_request_pdu_list;
// New // New
/// 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.
extern nfapi_dl_config_request_t* dl_config_req;
extern nfapi_ul_config_request_t* ul_config_req;
extern nfapi_hi_dci0_request_t* hi_dci0_req;
int tx_req_num_elems; int tx_req_num_elems;
...@@ -36,9 +33,6 @@ int tx_req_num_elems; ...@@ -36,9 +33,6 @@ int tx_req_num_elems;
//module_id_t next_Mod_id; //module_id_t next_Mod_id;
eth_params_t stub_eth_params; eth_params_t stub_eth_params;
// This function should return all the sched_response config messages which concern a specific UE. Inside this // This function should return all the sched_response config messages which concern a specific UE. Inside this
// function we should somehow make the translation of config message's rnti to Mod_ID. // function we should somehow make the translation of config message's rnti to Mod_ID.
Sched_Rsp_t get_nfapi_sched_response(uint8_t Mod_id); Sched_Rsp_t get_nfapi_sched_response(uint8_t Mod_id);
...@@ -97,7 +91,8 @@ void dl_config_req_UE_MAC_dci(int sfn, ...@@ -97,7 +91,8 @@ 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);
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,
...@@ -105,7 +100,8 @@ void dl_config_req_UE_MAC_bch(int sfn, ...@@ -105,7 +100,8 @@ void dl_config_req_UE_MAC_bch(int sfn,
void dl_config_req_UE_MAC_mch(int sfn, 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);
int tx_req_UE_MAC(nfapi_tx_request_t* req); int tx_req_UE_MAC(nfapi_tx_request_t* req);
...@@ -137,6 +133,27 @@ int ue_init_standalone_socket(const char *addr, int port); ...@@ -137,6 +133,27 @@ int ue_init_standalone_socket(const char *addr, int port);
// This function is used to read from standalone pnf socket call corresponding memcpy functions // This function is used to read from standalone pnf socket call corresponding memcpy functions
void *ue_standalone_pnf_task(void *context); void *ue_standalone_pnf_task(void *context);
#define MAX_QUEUE_SIZE 512
typedef struct queue_t {
void *items[MAX_QUEUE_SIZE];
size_t read_index, write_index;
size_t num_items;
pthread_mutex_t mutex;
} queue_t;
void init_queue(queue_t *q);
void put_queue(queue_t *q, void *item);
void *get_queue(queue_t *q);
extern queue_t dl_config_req_queue;
extern queue_t tx_req_pdu_queue;
extern queue_t ul_config_req_queue;
extern queue_t hi_dci0_req_queue;
extern nfapi_ul_config_request_t* ul_config_req;
extern nfapi_hi_dci0_request_t* hi_dci0_req;
#endif /* PHY_STUB_UE_H_ */ #endif /* PHY_STUB_UE_H_ */
...@@ -1026,10 +1026,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1026,10 +1026,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
} }
proc->subframe_rx=proc->sub_frame_start; proc->subframe_rx=proc->sub_frame_start;
// Initializations for nfapi-L2-emulator mode // Initializations for nfapi-L2-emulator mode
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;
// 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 {
...@@ -1130,6 +1128,12 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1130,6 +1128,12 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
} }
} }
nfapi_dl_config_request_t *dl_config_req = get_queue(&dl_config_req_queue);
nfapi_tx_request_pdu_t *tx_request_pdu_list = get_queue(&tx_req_pdu_queue);
// if ((dl_config_req != NULL) != (tx_request_pdu_list != NULL)) {
// LOG_E(MAC, "In behemoth dl_config_req: %p tx_req_pdu_list: %p\n", dl_config_req, tx_request_pdu_list);
// }
if (dl_config_req && tx_request_pdu_list) { if (dl_config_req && tx_request_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) {
...@@ -1148,7 +1152,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1148,7 +1152,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
NFAPI_SFNSF2SF(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
pdu, pdu,
dlsch, dlsch,
ue_num); ue_num,
tx_request_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),
...@@ -1158,7 +1163,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1158,7 +1163,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
dl_config_req_UE_MAC_mch(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), dl_config_req_UE_MAC_mch(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),
NFAPI_SFNSF2SF(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
pdu, pdu,
ue_num); ue_num,
tx_request_pdu_list);
} }
} }
} }
...@@ -1473,11 +1479,6 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) ...@@ -1473,11 +1479,6 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg)
phy_procedures_UE_SL_RX(UE,proc); phy_procedures_UE_SL_RX(UE,proc);
oai_subframe_ind(timer_frame, timer_subframe); oai_subframe_ind(timer_frame, timer_subframe);
if(dl_config_req!= NULL) {
AssertFatal(0, "dl_config_req_UE_MAC() not handled\n");
//dl_config_req_UE_MAC(dl_config_req, Mod_id);
}
//if(UE_mac_inst[Mod_id].hi_dci0_req!= NULL){ //if(UE_mac_inst[Mod_id].hi_dci0_req!= NULL){
if (hi_dci0_req!=NULL && hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL) { if (hi_dci0_req!=NULL && hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL) {
AssertFatal(0, "hi_dci0_req_UE_MAC() not handled\n"); AssertFatal(0, "hi_dci0_req_UE_MAC() not handled\n");
...@@ -1584,13 +1585,13 @@ void write_dummy(PHY_VARS_UE *UE, openair0_timestamp timestamp) { ...@@ -1584,13 +1585,13 @@ void write_dummy(PHY_VARS_UE *UE, openair0_timestamp timestamp) {
// //
struct complex16 v= {0}; struct complex16 v= {0};
void *samplesVoid[UE->frame_parms.nb_antennas_tx]; void *samplesVoid[UE->frame_parms.nb_antennas_tx];
for ( int i=0; i < UE->frame_parms.nb_antennas_tx; i++) for ( int i=0; i < UE->frame_parms.nb_antennas_tx; i++)
samplesVoid[i]=(void *)&v; samplesVoid[i]=(void *)&v;
AssertFatal( 1 == UE->rfdevice.trx_write_func(&UE->rfdevice, AssertFatal( 1 == UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+2*UE->frame_parms.samples_per_tti, timestamp+2*UE->frame_parms.samples_per_tti,
samplesVoid, samplesVoid,
1, 1,
UE->frame_parms.nb_antennas_tx, UE->frame_parms.nb_antennas_tx,
1),""); 1),"");
...@@ -1644,7 +1645,7 @@ void *UE_thread(void *arg) ...@@ -1644,7 +1645,7 @@ void *UE_thread(void *arg)
int instance_cnt_synch = UE->proc.instance_cnt_synch; int instance_cnt_synch = UE->proc.instance_cnt_synch;
int is_synchronized = UE->is_synchronized; int is_synchronized = UE->is_synchronized;
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), ""); AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
if (is_synchronized == 0) { if (is_synchronized == 0) {
if (instance_cnt_synch < 0) { // we can invoke the synch if (instance_cnt_synch < 0) { // we can invoke the synch
// grab 10 ms of signal and wakeup synch thread // grab 10 ms of signal and wakeup synch thread
...@@ -1654,7 +1655,7 @@ void *UE_thread(void *arg) ...@@ -1654,7 +1655,7 @@ void *UE_thread(void *arg)
for(int sf=0; sf<10; sf++) { for(int sf=0; sf<10; sf++) {
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.samples_per_tti*sf]; rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.samples_per_tti*sf];
AssertFatal(UE->frame_parms.samples_per_tti == UE->rfdevice.trx_read_func(&UE->rfdevice, AssertFatal(UE->frame_parms.samples_per_tti == UE->rfdevice.trx_read_func(&UE->rfdevice,
&timestamp, &timestamp,
rxp, rxp,
...@@ -1665,7 +1666,7 @@ void *UE_thread(void *arg) ...@@ -1665,7 +1666,7 @@ void *UE_thread(void *arg)
} else { } else {
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++) for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
rxp[i] = (void *)&UE->common_vars.rxdata[i][0]; rxp[i] = (void *)&UE->common_vars.rxdata[i][0];
AssertFatal( UE->frame_parms.samples_per_tti*10 == AssertFatal( UE->frame_parms.samples_per_tti*10 ==
UE->rfdevice.trx_read_func(&UE->rfdevice, UE->rfdevice.trx_read_func(&UE->rfdevice,
&timestamp, &timestamp,
...@@ -2267,7 +2268,7 @@ static void *timer_thread( void *param ) ...@@ -2267,7 +2268,7 @@ static void *timer_thread( void *param )
pdu.header.packet_type = TTI_SYNC; pdu.header.packet_type = TTI_SYNC;
pdu.header.absSF = (timer_frame*10)+timer_subframe; pdu.header.absSF = (timer_frame*10)+timer_subframe;
if (NFAPI_MODE != NFAPI_UE_STUB_PNF) { if (NFAPI_MODE != NFAPI_UE_STUB_PNF && NFAPI_MODE != NFAPI_MODE_STANDALONE_PNF) {
multicast_link_write_sock(0, multicast_link_write_sock(0,
(char *)&pdu, (char *)&pdu,
sizeof(UE_tport_header_t)); sizeof(UE_tport_header_t));
......
...@@ -722,7 +722,10 @@ int main( int argc, char **argv ) { ...@@ -722,7 +722,10 @@ int main( int argc, char **argv ) {
//init_UE_stub(1,eMBMS_active,uecap_xer_in,emul_iface); //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); init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface);
} else if (NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) { } else if (NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) {
// init thread and open socket init_queue(&dl_config_req_queue);
init_queue(&tx_req_pdu_queue);
init_queue(&hi_dci0_req_queue);
init_queue(&ul_config_req_queue);
config_sync_var=0; config_sync_var=0;
init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface); init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface);
init_UE_standalone_thread(); init_UE_standalone_thread();
......
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