Major queue changes note all the log supressions

This commit is contained in:
Andrew Burger
2020-06-04 15:54:38 -07:00
parent 1b4c8d9ebe
commit af92c512cf
8 changed files with 6351 additions and 6287 deletions
+6 -7
View File
@@ -160,7 +160,6 @@ void ue_init_mac(module_id_t module_idP) {
UE_mac_inst[module_idP].SI_Decoded = 0;
next_ra_frame = 0;
next_Mod_id = 0;
tx_request_pdu_list = NULL;
tx_req_num_elems = 0;
}
}
@@ -2469,11 +2468,11 @@ ue_scheduler(const module_id_t module_idP,
if (msg_p != NULL) {
switch (ITTI_MSG_ID(msg_p)) {
case RRC_MAC_CCCH_DATA_REQ:
LOG_I(MAC,
"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),
RRC_MAC_CCCH_DATA_REQ(msg_p).frame,
RRC_MAC_CCCH_DATA_REQ(msg_p).enb_index);
// LOG_I(MAC,
// "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),
// RRC_MAC_CCCH_DATA_REQ(msg_p).frame,
// RRC_MAC_CCCH_DATA_REQ(msg_p).enb_index);
// TODO process CCCH data req.
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
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);
} else
return((SLDCH_t *)NULL);
+99 -47
View File
@@ -40,11 +40,58 @@ void configure_nfapi_pnf(char *vnf_ip_addr,
int vnf_p7_port);
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_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 int timer_subframe;
//extern int timer_frame;
@@ -715,7 +762,8 @@ void dl_config_req_UE_MAC_dci(int sfn,
int sf,
nfapi_dl_config_request_pdu_t *dci,
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(dlsch->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE);
@@ -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;
if (pdu_index < 0 || pdu_index >= tx_req_num_elems) {
LOG_E(MAC,
"%s(): Problem with receiving data: "
"sfn/sf:%d.%d PDU size:%d, TX_PDU index: %d\n",
__func__,
sfn, sf, dci->pdu_size, dlsch->dlsch_pdu.dlsch_pdu_rel8.pdu_index);
// LOG_E(MAC,
// "%s(): Problem with receiving data: "
// "sfn/sf:%d.%d PDU size:%d, TX_PDU index: %d\n",
// __func__,
// sfn, sf, dci->pdu_size, dlsch->dlsch_pdu.dlsch_pdu_rel8.pdu_index);
return;
}
@@ -834,7 +882,8 @@ void dl_config_req_UE_MAC_bch(int sfn,
void dl_config_req_UE_MAC_mch(int sfn,
int sf,
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);
for (int ue_id = 0; ue_id < num_ue; ue_id++) {
@@ -850,11 +899,11 @@ void dl_config_req_UE_MAC_mch(int sfn,
} else {
const int pdu_index = mch->mch_pdu.mch_pdu_rel8.pdu_index;
if (pdu_index < 0 || pdu_index >= tx_req_num_elems) {
LOG_E(MAC,
"%s(): Problem with receiving data: "
"sfn/sf:%d.%d PDU size:%d, TX_PDU index: %d\n",
__func__,
sfn, sf, mch->pdu_size, mch->mch_pdu.mch_pdu_rel8.pdu_index);
// LOG_E(MAC,
// "%s(): Problem with receiving data: "
// "sfn/sf:%d.%d PDU size:%d, TX_PDU index: %d\n",
// __func__,
// sfn, sf, mch->pdu_size, mch->mch_pdu.mch_pdu_rel8.pdu_index);
return;
}
ue_send_mch_sdu(ue_id, 0, sfn,
@@ -911,40 +960,40 @@ int memcpy_dl_config_req(L1_rxtx_proc_t *proc,
p->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;
}
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
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;
ul_config_req->vendor_extension = req->vendor_extension;
p->ul_config_request_body.number_of_pdus = req->ul_config_request_body.number_of_pdus;
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;
p->ul_config_request_body.tl.tag = req->ul_config_request_body.tl.tag;
p->ul_config_request_body.tl.length = req->ul_config_request_body.tl.length;
ul_config_req->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;
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,
sizeof(nfapi_ul_config_request_pdu_t));
for (int i = 0; i < ul_config_req->ul_config_request_body.number_of_pdus; i++) {
ul_config_req->ul_config_request_body.ul_config_pdu_list[i] =
for (int i = 0; i < p->ul_config_request_body.number_of_pdus; i++) {
p->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;
}
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;
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++) {
@@ -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;
}
@@ -971,34 +1020,37 @@ int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc,
nfapi_pnf_p7_config_t* pnf_p7,
nfapi_hi_dci0_request_t* 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){
hi_dci0_req->sfn_sf = req->sfn_sf;
hi_dci0_req->vendor_extension = req->vendor_extension;
p->sfn_sf = req->sfn_sf;
p->vendor_extension = req->vendor_extension;
hi_dci0_req->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;
hi_dci0_req->hi_dci0_request_body.sfnsf = req->hi_dci0_request_body.sfnsf;
p->hi_dci0_request_body.number_of_dci = req->hi_dci0_request_body.number_of_dci;
p->hi_dci0_request_body.number_of_hi = req->hi_dci0_request_body.number_of_hi;
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;
hi_dci0_req->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.tag = req->hi_dci0_request_body.tl.tag;
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
+ hi_dci0_req->hi_dci0_request_body.number_of_hi;
int total_pdus = p->hi_dci0_request_body.number_of_dci
+ 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));
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
// \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;
}
@@ -1101,8 +1153,7 @@ void *ue_standalone_pnf_task(void *context)
}
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");
continue;
}
@@ -1119,7 +1170,7 @@ void *ue_standalone_pnf_task(void *context)
}
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);
}
break;
@@ -1127,6 +1178,7 @@ void *ue_standalone_pnf_task(void *context)
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)
{
@@ -1134,7 +1186,7 @@ void *ue_standalone_pnf_task(void *context)
}
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);
}
break;
+26 -9
View File
@@ -13,6 +13,7 @@
#include "openair2/PHY_INTERFACE/IF_Module.h"
#include "nfapi_interface.h"
#include "nfapi_pnf_interface.h"
#include <pthread.h>
//#include "openair1/PHY/LTE_TRANSPORT/defs.h"
//#include "openair1/PHY/defs.h"
//#include "openair1/PHY/LTE_TRANSPORT/defs.h"
@@ -21,13 +22,9 @@
FILL_UL_INFO_MUTEX_t fill_ul_mutex;
//below 2 difinitions move to phy_stub_UE.c to add initialization when difinition.
extern UL_IND_t *UL_INFO;
extern nfapi_tx_request_pdu_t* tx_request_pdu_list;
// New
/// Pointers to config_request types. Used from nfapi callback functions.
//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;
@@ -36,9 +33,6 @@ int tx_req_num_elems;
//module_id_t next_Mod_id;
eth_params_t stub_eth_params;
// 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.
Sched_Rsp_t get_nfapi_sched_response(uint8_t Mod_id);
@@ -97,7 +91,8 @@ void dl_config_req_UE_MAC_dci(int sfn,
int sf,
nfapi_dl_config_request_pdu_t *dci,
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,
int sf,
nfapi_dl_config_request_pdu_t *bch,
@@ -105,7 +100,8 @@ void dl_config_req_UE_MAC_bch(int sfn,
void dl_config_req_UE_MAC_mch(int sfn,
int sf,
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);
@@ -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
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_ */