Commit 79df38d5 authored by Andrew Burger's avatar Andrew Burger Committed by Michael Cook

Episys/fixing cqi problem

parent 24f82c5d
...@@ -177,6 +177,10 @@ set(CMAKE_CXX_FLAGS ...@@ -177,6 +177,10 @@ set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic -std=c++11 -D${MKVER}" "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic -std=c++11 -D${MKVER}"
) )
#set(SANITIZER "-fsanitize=address")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER}")
add_definitions("-DASN_DISABLE_OER_SUPPORT") add_definitions("-DASN_DISABLE_OER_SUPPORT")
######################### #########################
......
...@@ -478,49 +478,46 @@ char *log_getthreadname(char *threadname, ...@@ -478,49 +478,46 @@ char *log_getthreadname(char *threadname,
} }
static int log_header(char *log_buffer, static int log_header(char *log_buffer,
int buffsize, int buffsize,
int comp, int comp,
int level, int level,
const char *format) const char *format)
{ {
char threadname[PR_SET_NAME]; char threadname[PR_SET_NAME];
struct timeval tv; struct timespec ts;
gettimeofday(&tv, NULL); if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
struct tm tm; abort();
localtime_r(&tv.tv_sec, &tm); return snprintf(log_buffer, buffsize, "%lu.%06lu %s%s[%s]%c %s %s%s",
return snprintf(log_buffer, buffsize, "%02d:%02d:%02d.%06ld %s%s[%s]%c %s %s%s", ts.tv_sec,
tm.tm_hour, ts.tv_nsec / 1000,
tm.tm_min, log_level_highlight_end[level],
tm.tm_sec, ( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]),
tv.tv_usec, g_log->log_component[comp].name,
log_level_highlight_end[level], ( (g_log->flag & FLAG_LEVEL)?g_log->level2string[level]:' '),
( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]), ( (g_log->flag & FLAG_THREAD)?log_getthreadname(threadname,PR_SET_NAME+1):""),
g_log->log_component[comp].name, format,
( (g_log->flag & FLAG_LEVEL)?g_log->level2string[level]:' '), log_level_highlight_end[level]);
( (g_log->flag & FLAG_THREAD)?log_getthreadname(threadname,PR_SET_NAME+1):""),
format,
log_level_highlight_end[level]);
} }
void logRecord_mt(const char *file, void logRecord_mt(const char *file,
const char *func, const char *func,
int line, int line,
int comp, int comp,
int level, int level,
const char *format, const char *format,
... ) ... )
{ {
char log_buffer[MAX_LOG_TOTAL]= {0}; char log_buffer[MAX_LOG_TOTAL]= {0};
va_list args; va_list args;
va_start(args,format); va_start(args,format);
if (log_mem_flag == 1) { if (log_mem_flag == 1) {
log_output_memory(file,func,line,comp,level,format,args); log_output_memory(file,func,line,comp,level,format,args);
} else { } else {
log_header(log_buffer,MAX_LOG_TOTAL,comp,level,format); log_header(log_buffer,MAX_LOG_TOTAL,comp,level,format);
g_log->log_component[comp].vprint(g_log->log_component[comp].stream,log_buffer,args); g_log->log_component[comp].vprint(g_log->log_component[comp].stream,log_buffer,args);
fflush(g_log->log_component[comp].stream); fflush(g_log->log_component[comp].stream);
} }
va_end(args); va_end(args);
} }
void vlogRecord_mt(const char *file, void vlogRecord_mt(const char *file,
......
...@@ -421,7 +421,8 @@ int phy_subframe_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, ...@@ -421,7 +421,8 @@ int phy_subframe_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id,
} }
int phy_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_rach_indication_t *ind) { int phy_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_rach_indication_t *ind) {
LOG_I(MAC, "%s() NFAPI SFN/SF:%d number_of_preambles:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rach_indication_body.number_of_preambles); LOG_I(MAC, "%s() NFAPI Frame: %d Subframe: %d number_of_preambles:%u\n", __FUNCTION__,
NFAPI_SFNSF2SFN(ind->sfn_sf), NFAPI_SFNSF2SF(ind->sfn_sf), ind->rach_indication_body.number_of_preambles);
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
printf("[VNF] RACH_IND eNB:%p sfn_sf:%d number_of_preambles:%d\n", eNB, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rach_indication_body.number_of_preambles); printf("[VNF] RACH_IND eNB:%p sfn_sf:%d number_of_preambles:%d\n", eNB, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rach_indication_body.number_of_preambles);
pthread_mutex_lock(&eNB->UL_INFO_mutex); pthread_mutex_lock(&eNB->UL_INFO_mutex);
...@@ -478,15 +479,18 @@ int phy_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_rach_indicatio ...@@ -478,15 +479,18 @@ int phy_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_rach_indicatio
int phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indication_t *ind) { int phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indication_t *ind) {
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
LOG_I(MAC, "%s() NFAPI SFN/SF:%d number_of_harqs:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->harq_indication_body.number_of_harqs); LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_harqs:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->harq_indication_body.number_of_harqs);
pthread_mutex_lock(&eNB->UL_INFO_mutex); pthread_mutex_lock(&eNB->UL_INFO_mutex);
if(NFAPI_MODE == NFAPI_MODE_VNF){ if(NFAPI_MODE == NFAPI_MODE_VNF){
int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf); int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf);
UL_RCC_INFO.harq_ind[index] = *ind; UL_RCC_INFO.harq_ind[index] = *ind;
if (ind->harq_indication_body.number_of_harqs > 0) if (ind->harq_indication_body.number_of_harqs > 0) {
UL_RCC_INFO.harq_ind[index].harq_indication_body.harq_pdu_list = malloc(sizeof(nfapi_harq_indication_pdu_t)*ind->harq_indication_body.number_of_harqs ); UL_RCC_INFO.harq_ind[index].harq_indication_body.harq_pdu_list = malloc(sizeof(nfapi_harq_indication_pdu_t)*ind->harq_indication_body.number_of_harqs );
LOG_D(MAC, "%s() NFAPI sfn_sf = %d.%d number_of_harqs: %u\n", __FUNCTION__, NFAPI_SFNSF2SFN(ind->sfn_sf),
NFAPI_SFNSF2SF(ind->sfn_sf), ind->harq_indication_body.number_of_harqs);
}
for (int i=0; i<ind->harq_indication_body.number_of_harqs; i++) { for (int i=0; i<ind->harq_indication_body.number_of_harqs; i++) {
memcpy(&UL_RCC_INFO.harq_ind[index].harq_indication_body.harq_pdu_list[i], &ind->harq_indication_body.harq_pdu_list[i], sizeof(nfapi_harq_indication_pdu_t)); memcpy(&UL_RCC_INFO.harq_ind[index].harq_indication_body.harq_pdu_list[i], &ind->harq_indication_body.harq_pdu_list[i], sizeof(nfapi_harq_indication_pdu_t));
} }
...@@ -506,6 +510,8 @@ int phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indicatio ...@@ -506,6 +510,8 @@ int phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indicatio
int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_t *ind) { int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_t *ind) {
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
LOG_I(MAC, "Got into phy_crc_indication Frame: %d Subframe: %d\n",
NFAPI_SFNSF2SFN(ind->sfn_sf), NFAPI_SFNSF2SF(ind->sfn_sf));
pthread_mutex_lock(&eNB->UL_INFO_mutex); pthread_mutex_lock(&eNB->UL_INFO_mutex);
if(NFAPI_MODE == NFAPI_MODE_VNF){ if(NFAPI_MODE == NFAPI_MODE_VNF){
int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf); int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf);
...@@ -533,8 +539,8 @@ int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_ ...@@ -533,8 +539,8 @@ int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_
dest_ind->crc_indication_body.crc_pdu_list = dest_pdu_list; dest_ind->crc_indication_body.crc_pdu_list = dest_pdu_list;
if (ind->crc_indication_body.number_of_crcs==0) if (ind->crc_indication_body.number_of_crcs==0)
LOG_D(MAC, "%s() NFAPI SFN/SF:%d IND:number_of_crcs:%u UL_INFO:crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->crc_indication_body.number_of_crcs, LOG_D(MAC, "%s() NFAPI sfn_sf = %d.%d number_of_crcs: %u\n", __FUNCTION__, NFAPI_SFNSF2SFN(ind->sfn_sf),
eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs); NFAPI_SFNSF2SF(ind->sfn_sf), ind->crc_indication_body.number_of_crcs);
for (int i=0; i<ind->crc_indication_body.number_of_crcs; i++) { for (int i=0; i<ind->crc_indication_body.number_of_crcs; i++) {
memcpy(&dest_ind->crc_indication_body.crc_pdu_list[i], &ind->crc_indication_body.crc_pdu_list[i], sizeof(ind->crc_indication_body.crc_pdu_list[0])); memcpy(&dest_ind->crc_indication_body.crc_pdu_list[i], &ind->crc_indication_body.crc_pdu_list[i], sizeof(ind->crc_indication_body.crc_pdu_list[0]));
...@@ -580,6 +586,9 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len ...@@ -580,6 +586,9 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len
int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t *ind) { int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t *ind) {
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
LOG_I(MAC, "Got into phy_rx_indication Frame: %d Subframe: %d\n",
NFAPI_SFNSF2SFN(ind->sfn_sf), NFAPI_SFNSF2SF(ind->sfn_sf));
if (ind->rx_indication_body.number_of_pdus==0) { if (ind->rx_indication_body.number_of_pdus==0) {
LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_pdus:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus); LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_pdus:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus);
} }
...@@ -590,8 +599,11 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t ...@@ -590,8 +599,11 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t
UL_RCC_INFO.rx_ind[index] = *ind; UL_RCC_INFO.rx_ind[index] = *ind;
if (ind->rx_indication_body.number_of_pdus > 0) if (ind->rx_indication_body.number_of_pdus > 0) {
UL_RCC_INFO.rx_ind[index].rx_indication_body.rx_pdu_list = malloc(sizeof(nfapi_rx_indication_pdu_t)*ind->rx_indication_body.number_of_pdus ); UL_RCC_INFO.rx_ind[index].rx_indication_body.rx_pdu_list = malloc(sizeof(nfapi_rx_indication_pdu_t)*ind->rx_indication_body.number_of_pdus );
LOG_I(MAC, "%s() NFAPI Frame: %d Subframe: %d number_of_pdus: %u\n", __FUNCTION__, NFAPI_SFNSF2SFN(ind->sfn_sf),
NFAPI_SFNSF2SF(ind->sfn_sf), ind->rx_indication_body.number_of_pdus);
}
for (int i=0; i<ind->rx_indication_body.number_of_pdus; i++) { for (int i=0; i<ind->rx_indication_body.number_of_pdus; i++) {
nfapi_rx_indication_pdu_t *dest_pdu = &UL_RCC_INFO.rx_ind[index].rx_indication_body.rx_pdu_list[i]; nfapi_rx_indication_pdu_t *dest_pdu = &UL_RCC_INFO.rx_ind[index].rx_indication_body.rx_pdu_list[i];
...@@ -664,8 +676,11 @@ int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t ...@@ -664,8 +676,11 @@ int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t
UL_RCC_INFO.sr_ind[index] = *ind; UL_RCC_INFO.sr_ind[index] = *ind;
LOG_D(MAC,"%s() UL_INFO[%d].sr_ind.sr_indication_body.number_of_srs:%d\n", __FUNCTION__, index, eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs); LOG_D(MAC,"%s() UL_INFO[%d].sr_ind.sr_indication_body.number_of_srs:%d\n", __FUNCTION__, index, eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs);
if (ind->sr_indication_body.number_of_srs > 0) if (ind->sr_indication_body.number_of_srs > 0) {
UL_RCC_INFO.sr_ind[index].sr_indication_body.sr_pdu_list = malloc(sizeof(nfapi_sr_indication_pdu_t)*ind->sr_indication_body.number_of_srs ); UL_RCC_INFO.sr_ind[index].sr_indication_body.sr_pdu_list = malloc(sizeof(nfapi_sr_indication_pdu_t)*ind->sr_indication_body.number_of_srs );
LOG_D(MAC, "%s() NFAPI sfn_sf = %d.%d number_of_srs: %u\n", __FUNCTION__, NFAPI_SFNSF2SFN(ind->sfn_sf),
NFAPI_SFNSF2SF(ind->sfn_sf), ind->sr_indication_body.number_of_srs);
}
for (int i=0; i<ind->sr_indication_body.number_of_srs; i++) { for (int i=0; i<ind->sr_indication_body.number_of_srs; i++) {
nfapi_sr_indication_pdu_t *dest_pdu = &UL_RCC_INFO.sr_ind[index].sr_indication_body.sr_pdu_list[i]; nfapi_sr_indication_pdu_t *dest_pdu = &UL_RCC_INFO.sr_ind[index].sr_indication_body.sr_pdu_list[i];
...@@ -695,6 +710,39 @@ int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t ...@@ -695,6 +710,39 @@ int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t
return 1; return 1;
} }
static bool is_ue_same(int ue_id_1, int ue_id_2)
{
if (ue_id_1 == ue_id_2)
{
return true;
}
return false;
}
static void analyze_cqi_pdus_for_duplicates(nfapi_cqi_indication_t *ind)
{
uint16_t num_cqis = ind->cqi_indication_body.number_of_cqis;
for (int i = 0; i < num_cqis; i++)
{
nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i];
LOG_I(MAC, "CQI_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti,
src_pdu->ul_cqi_information.ul_cqi, src_pdu->ul_cqi_information.channel);
for (int j = i + 1; j < num_cqis; j++)
{
int rnti_i = ind->cqi_indication_body.cqi_pdu_list[i].rx_ue_information.rnti;
int rnti_j = ind->cqi_indication_body.cqi_pdu_list[j].rx_ue_information.rnti;
if (is_ue_same(rnti_i, rnti_j))
{
LOG_E(MAC, "Problem, two cqis received from a single UE for rnti %x\n",
rnti_i);
abort();
}
}
}
}
int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_t *ind) { int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_t *ind) {
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data); // vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_cqi_ind(p7_vnf->mac, ind); //mac_cqi_ind(p7_vnf->mac, ind);
...@@ -708,11 +756,15 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_ ...@@ -708,11 +756,15 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_
if (ind->cqi_indication_body.number_of_cqis > 0){ if (ind->cqi_indication_body.number_of_cqis > 0){
UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_pdu_list = malloc(sizeof(nfapi_cqi_indication_pdu_t)*ind->cqi_indication_body.number_of_cqis ); UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_pdu_list = malloc(sizeof(nfapi_cqi_indication_pdu_t)*ind->cqi_indication_body.number_of_cqis );
UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_raw_pdu_list = malloc(sizeof(nfapi_cqi_indication_raw_pdu_t)*ind->cqi_indication_body.number_of_cqis ); UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_raw_pdu_list = malloc(sizeof(nfapi_cqi_indication_raw_pdu_t)*ind->cqi_indication_body.number_of_cqis );
LOG_I(MAC, "%s() NFAPI Frame: %d Subframe: %d, num_cqis: %u\n", __FUNCTION__, NFAPI_SFNSF2SFN(ind->sfn_sf),
NFAPI_SFNSF2SF(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis);
} }
for (int i=0; i<ind->cqi_indication_body.number_of_cqis; i++) {
nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i]; analyze_cqi_pdus_for_duplicates(ind);
LOG_D(MAC, "SR_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti,
src_pdu->ul_cqi_information.ul_cqi, src_pdu->ul_cqi_information.channel); for (int i=0; i < ind->cqi_indication_body.number_of_cqis; i++) {
nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i];
memcpy(&UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_pdu_list[i], memcpy(&UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_pdu_list[i],
src_pdu, sizeof(nfapi_cqi_indication_pdu_t)); src_pdu, sizeof(nfapi_cqi_indication_pdu_t));
...@@ -726,7 +778,7 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_ ...@@ -726,7 +778,7 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_
dest_ind->cqi_indication_body.cqi_raw_pdu_list = ind->cqi_indication_body.cqi_raw_pdu_list; dest_ind->cqi_indication_body.cqi_raw_pdu_list = ind->cqi_indication_body.cqi_raw_pdu_list;
for(int i=0; i<ind->cqi_indication_body.number_of_cqis; i++) { for(int i=0; i<ind->cqi_indication_body.number_of_cqis; i++) {
nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i]; nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i];
LOG_D(MAC, "SR_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti, LOG_D(MAC, "CQI_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti,
src_pdu->ul_cqi_information.ul_cqi, src_pdu->ul_cqi_information.channel); src_pdu->ul_cqi_information.ul_cqi, src_pdu->ul_cqi_information.channel);
memcpy(&dest_ind->cqi_indication_body.cqi_pdu_list[i], memcpy(&dest_ind->cqi_indication_body.cqi_pdu_list[i],
src_pdu, sizeof(nfapi_cqi_indication_pdu_t)); src_pdu, sizeof(nfapi_cqi_indication_pdu_t));
...@@ -1121,6 +1173,21 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { ...@@ -1121,6 +1173,21 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_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;
dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
dl_config_req->header.message_id = NFAPI_DL_CONFIG_REQUEST; dl_config_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
if (dl_config_req->dl_config_request_body.number_pdu > 0)
{
for (int i = 0; i < dl_config_req->dl_config_request_body.number_pdu; i++)
{
uint8_t pdu_type = dl_config_req->dl_config_request_body.dl_config_pdu_list[i].pdu_type;
if(pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE)
{
uint16_t dl_rnti = dl_config_req->dl_config_request_body.dl_config_pdu_list[i].dlsch_pdu.dlsch_pdu_rel8.rnti;
uint16_t numPDUs = dl_config_req->dl_config_request_body.number_pdu;
LOG_I(MAC, "(OAI eNB) Sending dl_config_req at VNF during Frame: %d and Subframe: %d,"
" with a RNTI value of: %x and with number of PDUs: %u\n",
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_rnti, numPDUs);
}
}
}
int retval = nfapi_vnf_p7_dl_config_req(p7_config, dl_config_req); int retval = nfapi_vnf_p7_dl_config_req(p7_config, dl_config_req);
dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols = 1; dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols = 1;
dl_config_req->dl_config_request_body.number_dci = 0; dl_config_req->dl_config_request_body.number_dci = 0;
...@@ -1191,9 +1258,38 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { ...@@ -1191,9 +1258,38 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ul_config_req->header.message_id = NFAPI_UL_CONFIG_REQUEST; ul_config_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
//LOG_D(PHY, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, ul_config_req->header.message_id); //LOG_D(PHY, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, ul_config_req->header.message_id);
//LOG_D(PHY, "[VNF] %s() UL_CONFIG sfn_sf:%d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ul_config_req->sfn_sf), ul_config_req->ul_config_request_body.number_of_pdus, ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present); LOG_D(PHY, "[VNF] %s() UL_CONFIG Frame: %d Subframe: %d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n",
__FUNCTION__, NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf), ul_config_req->ul_config_request_body.number_of_pdus,
ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present);
int retval = nfapi_vnf_p7_ul_config_req(p7_config, ul_config_req); int retval = nfapi_vnf_p7_ul_config_req(p7_config, ul_config_req);
uint8_t num_pdus = ul_config_req->ul_config_request_body.number_of_pdus;
for (int i = 0; i < num_pdus; i++)
{
uint8_t pdu_type = ul_config_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type;
if (pdu_type != 1)
{
continue;
}
LOG_I(MAC, "ul_config_req num_pdus: %u pdu_number: %d pdu_type: %u\n",
num_pdus, i, pdu_type);
for (int j = i + 1; j < num_pdus; j++)
{
uint8_t pdu_type2 = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].pdu_type;
if (pdu_type == pdu_type2)
{
uint16_t rnti_i = ul_config_req->ul_config_request_body.ul_config_pdu_list[i].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti;
uint16_t rnti_j = ul_config_req->ul_config_request_body.ul_config_pdu_list[j].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti;
if (is_ue_same(rnti_i, rnti_j))
{
LOG_E(MAC, "Problem, two cqis being sent to a single UE for rnti %x\n",
rnti_i);
abort();
}
}
}
}
if (retval!=0) { if (retval!=0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval); LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
} else { } else {
......
...@@ -2220,20 +2220,20 @@ typedef struct { ...@@ -2220,20 +2220,20 @@ typedef struct {
nfapi_ul_config_ulsch_cqi_ri_pdu ulsch_cqi_ri_pdu; nfapi_ul_config_ulsch_cqi_ri_pdu ulsch_cqi_ri_pdu;
nfapi_ul_config_ulsch_harq_pdu ulsch_harq_pdu; nfapi_ul_config_ulsch_harq_pdu ulsch_harq_pdu;
nfapi_ul_config_ulsch_cqi_harq_ri_pdu ulsch_cqi_harq_ri_pdu; nfapi_ul_config_ulsch_cqi_harq_ri_pdu ulsch_cqi_harq_ri_pdu;
nfapi_ul_config_uci_cqi_pdu uci_cqi_pdu; nfapi_ul_config_uci_cqi_pdu uci_cqi_pdu; // should never see
nfapi_ul_config_uci_sr_pdu uci_sr_pdu; nfapi_ul_config_uci_sr_pdu uci_sr_pdu;
nfapi_ul_config_uci_harq_pdu uci_harq_pdu; nfapi_ul_config_uci_harq_pdu uci_harq_pdu;
nfapi_ul_config_uci_sr_harq_pdu uci_sr_harq_pdu; nfapi_ul_config_uci_sr_harq_pdu uci_sr_harq_pdu;// should only see once in a while
nfapi_ul_config_uci_cqi_harq_pdu uci_cqi_harq_pdu; nfapi_ul_config_uci_cqi_harq_pdu uci_cqi_harq_pdu;// should never see
nfapi_ul_config_uci_cqi_sr_pdu uci_cqi_sr_pdu; nfapi_ul_config_uci_cqi_sr_pdu uci_cqi_sr_pdu;// should never see
nfapi_ul_config_uci_cqi_sr_harq_pdu uci_cqi_sr_harq_pdu; nfapi_ul_config_uci_cqi_sr_harq_pdu uci_cqi_sr_harq_pdu;// should never see
nfapi_ul_config_srs_pdu srs_pdu; nfapi_ul_config_srs_pdu srs_pdu;// should never see
nfapi_ul_config_harq_buffer_pdu harq_buffer_pdu; nfapi_ul_config_harq_buffer_pdu harq_buffer_pdu;// should never see
nfapi_ul_config_ulsch_uci_csi_pdu ulsch_uci_csi_pdu; nfapi_ul_config_ulsch_uci_csi_pdu ulsch_uci_csi_pdu;// should never see
nfapi_ul_config_ulsch_uci_harq_pdu ulsch_uci_harq_pdu; nfapi_ul_config_ulsch_uci_harq_pdu ulsch_uci_harq_pdu;// should never see
nfapi_ul_config_ulsch_csi_uci_harq_pdu ulsch_csi_uci_harq_pdu; nfapi_ul_config_ulsch_csi_uci_harq_pdu ulsch_csi_uci_harq_pdu;// should never see
nfapi_ul_config_nulsch_pdu nulsch_pdu; nfapi_ul_config_nulsch_pdu nulsch_pdu;// should never see
nfapi_ul_config_nrach_pdu nrach_pdu; nfapi_ul_config_nrach_pdu nrach_pdu;// should never see
}; };
} nfapi_ul_config_request_pdu_t; } nfapi_ul_config_request_pdu_t;
......
...@@ -81,19 +81,19 @@ void* nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t* config) ...@@ -81,19 +81,19 @@ void* nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t* config)
if(size == 0) if(size == 0)
return 0; return 0;
void* buffer_p = NULL; void* buffer_p = NULL;
if(config && config->allocate) if(config && config->allocate)
{ {
buffer_p = (config->allocate)(size); buffer_p = (config->allocate)(size);
if(buffer_p != NULL){ if(buffer_p != NULL){
memset(buffer_p,0,size); memset(buffer_p,0,size);
} }
return buffer_p; return buffer_p;
} }
else else
{ {
buffer_p = calloc(1, size); buffer_p = calloc(1, size);
return buffer_p; return buffer_p;
} }
} }
...@@ -1551,7 +1551,7 @@ static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, ...@@ -1551,7 +1551,7 @@ static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg,
// DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0) // DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end); int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end);
if (pdu->segments[j].segment_length == 3) if (pdu->segments[j].segment_length == 3)
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
pdu->segments[j].segment_data[0], pdu->segments[j].segment_data[0],
...@@ -1583,43 +1583,43 @@ static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e ...@@ -1583,43 +1583,43 @@ static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e
return x && y && z; return x && y && z;
} }
static uint8_t pack_release_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) static uint8_t pack_release_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{ {
nfapi_ue_release_request_body_t* value = (nfapi_ue_release_request_body_t*)tlv; nfapi_ue_release_request_body_t* value = (nfapi_ue_release_request_body_t*)tlv;
if(push16(value->number_of_TLVs, ppWritePackedMsg, end) == 0){ if(push16(value->number_of_TLVs, ppWritePackedMsg, end) == 0){
return 0; return 0;
} }
uint8_t j; uint8_t j;
uint16_t num = value->number_of_TLVs; uint16_t num = value->number_of_TLVs;
for(j = 0; j < num; ++j){ for(j = 0; j < num; ++j){
if(push16(value->ue_release_request_TLVs_list[j].rnti, ppWritePackedMsg, end) == 0){ if(push16(value->ue_release_request_TLVs_list[j].rnti, ppWritePackedMsg, end) == 0){
return 0; return 0;
} }
} }
return 1; return 1;
} }
static uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) static uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{ {
nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg; nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end); int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG, &pNfapiMsg->ue_release_request_body, ppWritePackedMsg, end, &pack_release_request_body_value); int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG, &pNfapiMsg->ue_release_request_body, ppWritePackedMsg, end, &pack_release_request_body_value);
int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
return x && y && z; return x && y && z;
} }
static uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) static uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{ {
nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg; nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
int x = push32(pNfapiMsg->error_code, ppWritePackedMsg, end); int x = push32(pNfapiMsg->error_code, ppWritePackedMsg, end);
int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
return x && z; return x && z;
} }
static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{ {
nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv; nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv;
...@@ -2707,15 +2707,15 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu ...@@ -2707,15 +2707,15 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__); //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__);
result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config); result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config);
break; break;
case NFAPI_UE_RELEASE_REQUEST: case NFAPI_UE_RELEASE_REQUEST:
result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config); result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config);
break; break;
case NFAPI_UE_RELEASE_RESPONSE: case NFAPI_UE_RELEASE_RESPONSE:
result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config); result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
break; break;
case NFAPI_HARQ_INDICATION: case NFAPI_HARQ_INDICATION:
result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
break; break;
...@@ -4479,45 +4479,45 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void * ...@@ -4479,45 +4479,45 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
for(i = 0; i < totalNumPdus; ++i) for(i = 0; i < totalNumPdus; ++i)
{ {
nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]); nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]);
if (pdu) { if (pdu) {
uint16_t length = 0; uint16_t length = 0;
uint16_t index = 0; uint16_t index = 0;
if(!(pull16(ppReadPackedMsg, &length, end) && if(!(pull16(ppReadPackedMsg, &length, end) &&
pull16(ppReadPackedMsg, &index, end))) pull16(ppReadPackedMsg, &index, end)))
return 0; return 0;
pdu->pdu_length = length; pdu->pdu_length = length;
pdu->pdu_index = index; pdu->pdu_index = index;
// TODO : May need to rethink this bit // TODO : May need to rethink this bit
pdu->num_segments = 1; pdu->num_segments = 1;
pdu->segments[0].segment_length = pdu->pdu_length; pdu->segments[0].segment_length = pdu->pdu_length;
pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config); pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config);
if(pdu->segments[0].segment_data) if(pdu->segments[0].segment_data)
{ {
if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end)) if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
return 0; return 0;
#if 0 #if 0
if (pdu->segments[0].segment_length == 3) if (pdu->segments[0].segment_length == 3)
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
pdu->segments[0].segment_data[0], pdu->segments[0].segment_data[0],
pdu->segments[0].segment_data[1], pdu->segments[0].segment_data[1],
pdu->segments[0].segment_data[2] pdu->segments[0].segment_data[2]
); );
} }
#endif #endif
} }
else else
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index); NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index);
} }
} else { } else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n"); NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n");
} }
} }
} }
break; break;
...@@ -4531,55 +4531,55 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void * ...@@ -4531,55 +4531,55 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
return 1; return 1;
} }
static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
{ {
uint8_t proceed = 1; uint8_t proceed = 1;
nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg; nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0) if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
return 0; return 0;
while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed) while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
{ {
nfapi_tl_t generic_tl; nfapi_tl_t generic_tl;
if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
return 0; return 0;
switch(generic_tl.tag) switch(generic_tl.tag)
{ {
case NFAPI_UE_RELEASE_BODY_TAG: case NFAPI_UE_RELEASE_BODY_TAG:
{ {
pNfapiMsg->ue_release_request_body.tl = generic_tl; pNfapiMsg->ue_release_request_body.tl = generic_tl;
if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0) if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0)
return 0; return 0;
if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI) if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI);
return 0; return 0;
} else { } else {
uint8_t j; uint8_t j;
uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs; uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs;
for(j = 0; j < num; ++j){ for(j = 0; j < num; ++j){
if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){ if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){
return 0; return 0;
} }
} }
} }
} }
break; break;
default: default:
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag ); NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag );
} }
break; break;
}; };
} }
return 1; return 1;
} }
static uint8_t unpack_harq_indication_tdd_harq_data_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) static uint8_t unpack_harq_indication_tdd_harq_data_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{ {
nfapi_harq_indication_tdd_harq_data_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_bundling_t*)tlv; nfapi_harq_indication_tdd_harq_data_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_bundling_t*)tlv;
...@@ -5827,18 +5827,18 @@ static uint8_t unpack_nrach_indication_rel13_value(void *tlv, uint8_t **ppReadPa ...@@ -5827,18 +5827,18 @@ static uint8_t unpack_nrach_indication_rel13_value(void *tlv, uint8_t **ppReadPa
pull8(ppReadPackedMsg, &value->nrach_ce_level, end)); pull8(ppReadPackedMsg, &value->nrach_ce_level, end));
} }
static uint8_t unpack_ue_release_resp(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) static uint8_t unpack_ue_release_resp(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
{ {
nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg; nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
if(pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) == 0){ if(pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) == 0){
return 0; return 0;
} }
else{ else{
NFAPI_TRACE(NFAPI_TRACE_INFO, "ue_release_response:error_code = %d\n", pNfapiMsg->error_code); NFAPI_TRACE(NFAPI_TRACE_INFO, "ue_release_response:error_code = %d\n", pNfapiMsg->error_code);
} }
return 1; return 1;
} }
static uint8_t unpack_nrach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) static uint8_t unpack_nrach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{ {
nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv; nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv;
...@@ -6051,17 +6051,17 @@ static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen ...@@ -6051,17 +6051,17 @@ static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen
if (unpackedBufLen >= sizeof(nfapi_timing_info_t)) if (unpackedBufLen >= sizeof(nfapi_timing_info_t))
retLen = sizeof(nfapi_timing_info_t); retLen = sizeof(nfapi_timing_info_t);
break; break;
case NFAPI_UE_RELEASE_REQUEST: case NFAPI_UE_RELEASE_REQUEST:
if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t)) if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t))
retLen = sizeof(nfapi_ue_release_request_t); retLen = sizeof(nfapi_ue_release_request_t);
break; break;
case NFAPI_UE_RELEASE_RESPONSE: case NFAPI_UE_RELEASE_RESPONSE:
if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t)) if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t))
retLen = sizeof(nfapi_ue_release_response_t); retLen = sizeof(nfapi_ue_release_response_t);
break; break;
default: default:
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId); NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId);
break; break;
...@@ -6181,14 +6181,14 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn ...@@ -6181,14 +6181,14 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
else else
return -1; return -1;
break; break;
case NFAPI_UE_RELEASE_REQUEST: case NFAPI_UE_RELEASE_REQUEST:
if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen)) if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config); result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
else else
return -1; return -1;
break; break;
case NFAPI_HARQ_INDICATION: case NFAPI_HARQ_INDICATION:
if (check_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen)) if (check_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen))
result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
...@@ -6206,7 +6206,6 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn ...@@ -6206,7 +6206,6 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
case NFAPI_RX_ULSCH_INDICATION: case NFAPI_RX_ULSCH_INDICATION:
if (check_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen)) if (check_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen))
{ {
nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)pMessageHeader;
result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config); result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config);
} }
else else
...@@ -6289,14 +6288,14 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn ...@@ -6289,14 +6288,14 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
else else
return -1; return -1;
break; break;
case NFAPI_UE_RELEASE_RESPONSE: case NFAPI_UE_RELEASE_RESPONSE:
if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen)) if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config); result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
else else
return -1; return -1;
break; break;
default: default:
if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <time.h> #include <time.h>
#include <stdio.h>
#include <sys/time.h> #include <sys/time.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -505,7 +505,7 @@ int vnf_build_send_dl_node_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t ...@@ -505,7 +505,7 @@ int vnf_build_send_dl_node_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t
dl_node_sync.t1 = calculate_t1(p7_info->sfn_sf, vnf_p7->sf_start_time_hr); dl_node_sync.t1 = calculate_t1(p7_info->sfn_sf, vnf_p7->sf_start_time_hr);
dl_node_sync.delta_sfn_sf = 0; dl_node_sync.delta_sfn_sf = 0;
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &dl_node_sync.header); return vnf_p7_pack_and_send_p7_msg(vnf_p7, &dl_node_sync.header);
} }
int vnf_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info) int vnf_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info)
...@@ -1229,7 +1229,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) ...@@ -1229,7 +1229,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{ {
/*NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n", /*NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n",
ind.header.phy_id, (phy->in_sync ? "via sfn" : "now"), ind.header.phy_id, (phy->in_sync ? "via sfn" : "now"),
NFAPI_SFNSF2DEC(curr_sfn_sf), NFAPI_SFNSF2DEC(new_sfn_sf), phy->adjustment, NFAPI_SFNSF2DEC(curr_sfn_sf), NFAPI_SFNSF2DEC(new_sfn_sf), phy->adjustment,
phy->filtered_adjust ? "FILTERED" : "ABSOLUTE", phy->filtered_adjust ? "FILTERED" : "ABSOLUTE",
phy->zero_count, phy->zero_count,
phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC");*/ phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC");*/
...@@ -1276,7 +1276,8 @@ void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) ...@@ -1276,7 +1276,8 @@ void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
//if (vnf_pnf_sfnsf_delta>1 || vnf_pnf_sfnsf_delta < -1) //if (vnf_pnf_sfnsf_delta>1 || vnf_pnf_sfnsf_delta < -1)
if (vnf_pnf_sfnsf_delta>0 || vnf_pnf_sfnsf_delta < 0) if (vnf_pnf_sfnsf_delta>0 || vnf_pnf_sfnsf_delta < 0)
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() LARGE SFN/SF DELTA between PNF and VNF delta:%d VNF:%d PNF:%d\n\n\n\n\n\n\n\n\n", __FUNCTION__, vnf_pnf_sfnsf_delta, NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), NFAPI_SFNSF2DEC(ind.last_sfn_sf)); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() LARGE SFN/SF DELTA between PNF and VNF delta:%d VNF:%d PNF:%d\n\n\n\n\n\n\n\n\n",
__FUNCTION__, vnf_pnf_sfnsf_delta, NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), NFAPI_SFNSF2DEC(ind.last_sfn_sf));
// Panos: Careful here!!! Modification of the original nfapi-code // Panos: Careful here!!! Modification of the original nfapi-code
vnf_p7->p7_connections[0].sfn_sf = ind.last_sfn_sf; vnf_p7->p7_connections[0].sfn_sf = ind.last_sfn_sf;
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <stdio.h>
#include "vnf_p7.h" #include "vnf_p7.h"
...@@ -180,7 +181,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config) ...@@ -180,7 +181,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
clock_gettime(CLOCK_MONOTONIC, &pselect_start); clock_gettime(CLOCK_MONOTONIC, &pselect_start);
//long millisecond = pselect_start.tv_nsec / 1e6; //long millisecond = pselect_start.tv_nsec / 1e6;
if((last_millisecond == -1) || (millisecond == last_millisecond) || (millisecond == (last_millisecond + 1) % 1000) ) if((last_millisecond == -1) || (millisecond == last_millisecond) || (millisecond == (last_millisecond + 1) % 1000))
{ {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "pselect_start:%d.%d sf_start:%d.%d\n", pselect_start.tv_sec, pselect_start.tv_nsec, sf_start.tv_sec, sf_start.tv_nsec); //NFAPI_TRACE(NFAPI_TRACE_INFO, "pselect_start:%d.%d sf_start:%d.%d\n", pselect_start.tv_sec, pselect_start.tv_nsec, sf_start.tv_sec, sf_start.tv_nsec);
...@@ -255,8 +256,8 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config) ...@@ -255,8 +256,8 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
if (selectRetval==-1 && errno == 22) if (selectRetval==-1 && errno == 22)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n", NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n",
pselect_timeout.tv_sec, pselect_timeout.tv_nsec, pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment, phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
sf_duration.tv_sec, sf_duration.tv_nsec); sf_duration.tv_sec, sf_duration.tv_nsec);
} }
if(selectRetval == 0) if(selectRetval == 0)
...@@ -362,9 +363,7 @@ if (selectRetval==-1 && errno == 22) ...@@ -362,9 +363,7 @@ if (selectRetval==-1 && errno == 22)
while(curr != 0) while(curr != 0)
{ {
curr->sfn_sf = increment_sfn_sf(curr->sfn_sf); curr->sfn_sf = increment_sfn_sf(curr->sfn_sf);
vnf_sync(vnf_p7, curr); vnf_sync(vnf_p7, curr);
curr = curr->next; curr = curr->next;
} }
......
...@@ -49,9 +49,20 @@ void set_taus_seed(unsigned int seed_init) ...@@ -49,9 +49,20 @@ void set_taus_seed(unsigned int seed_init)
unsigned long result = 0; unsigned long result = 0;
if (seed_init == 0) { if (seed_init == 0) {
s0 = (unsigned int)time(NULL); unsigned int data[3];
s1 = (unsigned int)time(NULL); int fd = open("/dev/urandom", O_RDONLY);
s2 = (unsigned int)time(NULL); if (fd == -1)
{
abort();
}
if (read(fd, data, sizeof(data)) != sizeof(data))
{
abort();
}
close(fd);
s0 = data[0];
s1 = data[1];
s2 = data[2];
} else { } else {
/* Use reentrant version of rand48 to ensure that no conflicts with other generators occur */ /* Use reentrant version of rand48 to ensure that no conflicts with other generators occur */
srand48_r((long int)seed_init, &buffer); srand48_r((long int)seed_init, &buffer);
......
...@@ -571,9 +571,16 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -571,9 +571,16 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
UE_sched_ctrl_t *UE_scheduling_control = NULL; UE_sched_ctrl_t *UE_scheduling_control = NULL;
start_meas(&(eNB->eNB_scheduler)); start_meas(&(eNB->eNB_scheduler));
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, VCD_FUNCTION_IN);
if ((frameP == eNB->frame && subframeP <= eNB->subframe) || (frameP == ((eNB->frame + 1023) & 1023)))
{
LOG_E(MAC, "Scheduler being called twice for same subframe SF.SFN: %u.%u\n", frameP, subframeP);
return;
}
eNB->frame = frameP; eNB->frame = frameP;
eNB->subframe = subframeP; eNB->subframe = subframeP;
LOG_I(MAC, "Entering dlsch_ulsch scheduler Frame: %u Subframe: %u\n", frameP, subframeP);
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
mbsfn_status[CC_id] = 0; mbsfn_status[CC_id] = 0;
/* Clear vrb_maps */ /* Clear vrb_maps */
......
...@@ -476,7 +476,7 @@ void generate_Msg2(module_id_t module_idP, ...@@ -476,7 +476,7 @@ void generate_Msg2(module_id_t module_idP,
} }
} else { } else {
if ((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) { if ((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) {
LOG_D(MAC, LOG_I(MAC,
"[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI, state %d\n", "[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI, state %d\n",
module_idP, CC_idP, frameP, subframeP, ra->state); module_idP, CC_idP, frameP, subframeP, ra->state);
// Allocate 4 PRBS starting in RB 0 // Allocate 4 PRBS starting in RB 0
...@@ -1295,7 +1295,7 @@ initiate_ra_proc(module_id_t module_idP, ...@@ -1295,7 +1295,7 @@ initiate_ra_proc(module_id_t module_idP,
prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13; prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
} }
LOG_D(MAC, LOG_I(MAC,
"[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d Initiating RA procedure for preamble index %d\n", "[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d Initiating RA procedure for preamble index %d\n",
module_idP, CC_id, frameP, subframeP, preamble_index); module_idP, CC_id, frameP, subframeP, preamble_index);
LOG_D(MAC, LOG_D(MAC,
...@@ -1305,7 +1305,6 @@ initiate_ra_proc(module_id_t module_idP, ...@@ -1305,7 +1305,6 @@ initiate_ra_proc(module_id_t module_idP,
uint16_t msg2_subframe = subframeP; uint16_t msg2_subframe = subframeP;
int offset; int offset;
static uint8_t failure_cnt = 0 ; static uint8_t failure_cnt = 0 ;
if (prach_ParametersListCE_r13 && if (prach_ParametersListCE_r13 &&
prach_ParametersListCE_r13->list.count < rach_resource_type) { prach_ParametersListCE_r13->list.count < rach_resource_type) {
LOG_E(MAC, LOG_E(MAC,
......
...@@ -4539,6 +4539,7 @@ extract_pucch_csi(module_id_t mod_idP, ...@@ -4539,6 +4539,7 @@ extract_pucch_csi(module_id_t mod_idP,
AssertFatal(cqi_ReportPeriodic->present != LTE_CQI_ReportPeriodic_PR_NOTHING, "cqi_ReportPeriodic->present == LTE_CQI_ReportPeriodic_PR_NOTHING!\n"); AssertFatal(cqi_ReportPeriodic->present != LTE_CQI_ReportPeriodic_PR_NOTHING, "cqi_ReportPeriodic->present == LTE_CQI_ReportPeriodic_PR_NOTHING!\n");
AssertFatal(cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present != LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING, AssertFatal(cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present != LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING,
"cqi_ReportPeriodic->cqi_FormatIndicatorPeriodic.choice.setup.present == LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING!\n"); "cqi_ReportPeriodic->cqi_FormatIndicatorPeriodic.choice.setup.present == LTE_CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_NOTHING!\n");
uint16_t Npd, N_OFFSET_CQI; uint16_t Npd, N_OFFSET_CQI;
int H, K, bandwidth_part, L, Lmask; int H, K, bandwidth_part, L, Lmask;
int ri = sched_ctl->periodic_ri_received[CC_idP]; int ri = sched_ctl->periodic_ri_received[CC_idP];
......
...@@ -1306,7 +1306,6 @@ schedule_ulsch_rnti(module_id_t module_idP, ...@@ -1306,7 +1306,6 @@ schedule_ulsch_rnti(module_id_t module_idP,
* pre_allocated_rb_table_index_ul * pre_allocated_rb_table_index_ul
*/ */
ulsch_scheduler_pre_processor(module_idP, CC_id, frameP, subframeP, sched_frame, sched_subframeP); ulsch_scheduler_pre_processor(module_idP, CC_id, frameP, subframeP, sched_frame, sched_subframeP);
for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) {
if (UE_info->UE_template[CC_id][UE_id].rach_resource_type > 0) if (UE_info->UE_template[CC_id][UE_id].rach_resource_type > 0)
continue; continue;
......
...@@ -282,7 +282,7 @@ Msg3_transmitted(module_id_t module_idP, uint8_t CC_id, ...@@ -282,7 +282,7 @@ Msg3_transmitted(module_id_t module_idP, uint8_t CC_id,
} }
PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id, PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id, // TODO: edit here for sending multiple rachs
frame_t frameP, uint8_t eNB_indexP, frame_t frameP, uint8_t eNB_indexP,
sub_frame_t subframeP) { sub_frame_t subframeP) {
uint8_t Size = 0; uint8_t Size = 0;
......
...@@ -703,15 +703,16 @@ void UL_indication(UL_IND_t *UL_info, L1_rxtx_proc_t *proc) { ...@@ -703,15 +703,16 @@ void UL_indication(UL_IND_t *UL_info, L1_rxtx_proc_t *proc) {
Sched_Rsp_t *sched_info = &Sched_INFO[module_id][CC_id]; Sched_Rsp_t *sched_info = &Sched_INFO[module_id][CC_id];
IF_Module_t *ifi = if_inst[module_id]; IF_Module_t *ifi = if_inst[module_id];
eNB_MAC_INST *mac = RC.mac[module_id]; eNB_MAC_INST *mac = RC.mac[module_id];
if (UL_info->subframe == 3)
{ LOG_D(PHY, "Frame:%d Subframe:%d module_id:%d CC_id:%d UL_info[rx_ind:%d harqs:%d crcs:%d cqis:%d preambles:%d sr_ind:%d]\n",
LOG_D(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rx_ind:%d harqs:%d crcs:%d cqis:%d preambles:%d sr_ind:%d]\n", UL_info->frame, UL_info->subframe,
UL_info->frame,UL_info->subframe, module_id, CC_id,
module_id,CC_id, UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->harq_ind.harq_indication_body.number_of_harqs,
UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->harq_ind.harq_indication_body.number_of_harqs, UL_info->crc_ind.crc_indication_body.number_of_crcs, UL_info->crc_ind.crc_indication_body.number_of_crcs,
UL_info->cqi_ind.cqi_indication_body.number_of_cqis, UL_info->rach_ind.rach_indication_body.number_of_preambles, UL_info->sr_ind.sr_indication_body.number_of_srs); UL_info->cqi_ind.cqi_indication_body.number_of_cqis, UL_info->rach_ind.rach_indication_body.number_of_preambles,
} UL_info->sr_ind.sr_indication_body.number_of_srs);
if(UL_info->frame==1023&&UL_info->subframe==6) { // dl scheduling (0,0)
if (UL_info->frame==1023&&UL_info->subframe==6) { // dl scheduling (0,0)
frame_cnt= (frame_cnt + 1)%7; // to prevent frame_cnt get too big frame_cnt= (frame_cnt + 1)%7; // to prevent frame_cnt get too big
LOG_D(MAC,"current (%d,%d) frame count dl is %d\n",UL_info->frame,UL_info->subframe,frame_cnt); LOG_D(MAC,"current (%d,%d) frame count dl is %d\n",UL_info->frame,UL_info->subframe,frame_cnt);
} }
......
...@@ -164,7 +164,8 @@ void fill_crc_indication_UE_MAC(int Mod_id, ...@@ -164,7 +164,8 @@ void fill_crc_indication_UE_MAC(int Mod_id,
uint16_t rnti, uint16_t rnti,
nfapi_ul_config_request_t *ul_config_req) { nfapi_ul_config_request_t *ul_config_req) {
pthread_mutex_lock(&fill_ul_mutex.crc_mutex); pthread_mutex_lock(&fill_ul_mutex.crc_mutex);
LOG_D(MAC, "fill crc_indication num_crcs: %u\n",
UL_INFO->crc_ind.crc_indication_body.number_of_crcs);
nfapi_crc_indication_pdu_t *pdu = nfapi_crc_indication_pdu_t *pdu =
&UL_INFO->crc_ind.crc_indication_body &UL_INFO->crc_ind.crc_indication_body
.crc_pdu_list[UL_INFO->crc_ind.crc_indication_body.number_of_crcs]; .crc_pdu_list[UL_INFO->crc_ind.crc_indication_body.number_of_crcs];
...@@ -261,6 +262,8 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, ...@@ -261,6 +262,8 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id,
UL_IND_t *UL_INFO, UL_IND_t *UL_INFO,
uint16_t rnti) { uint16_t rnti) {
pthread_mutex_lock(&fill_ul_mutex.cqi_mutex); pthread_mutex_lock(&fill_ul_mutex.cqi_mutex);
LOG_D(MAC, "num_cqis: %u in fill_ulsch_cqi_indication_UE_MAC\n",
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis);
nfapi_cqi_indication_pdu_t *pdu = nfapi_cqi_indication_pdu_t *pdu =
&UL_INFO->cqi_ind.cqi_indication_body &UL_INFO->cqi_ind.cqi_indication_body
.cqi_pdu_list[UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis]; .cqi_pdu_list[UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis];
...@@ -287,13 +290,14 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, ...@@ -287,13 +290,14 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id,
pdu->cqi_indication_rel8.timing_advance = 0; pdu->cqi_indication_rel8.timing_advance = 0;
// pdu->cqi_indication_rel8.number_of_cc_reported = 1; // pdu->cqi_indication_rel8.number_of_cc_reported = 1;
pdu->ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG; pdu->ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;
pdu->ul_cqi_information.channel = 1; // PUSCH pdu->ul_cqi_information.channel = 1;
// eNB_scheduler_primitives.c:4839: the upper four bits seem to be the CQI // eNB_scheduler_primitives.c:4839: the upper four bits seem to be the CQI
const int cqi = 15; const int cqi = 15;
raw_pdu->pdu[0] = cqi << 4; raw_pdu->pdu[0] = cqi << 4;
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis++; UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis++;
pthread_mutex_unlock(&fill_ul_mutex.cqi_mutex); pthread_mutex_unlock(&fill_ul_mutex.cqi_mutex);
} }
...@@ -491,9 +495,7 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id, ...@@ -491,9 +495,7 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
ul_config_req); ul_config_req);
} }
} }
} } else if (ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE) {
else if (ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE) {
// AssertFatal((UE_id = // AssertFatal((UE_id =
// find_ulsch(ul_config_pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE))>=0, // find_ulsch(ul_config_pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE))>=0,
// "No available UE ULSCH for rnti // "No available UE ULSCH for rnti
...@@ -506,7 +508,7 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id, ...@@ -506,7 +508,7 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
uint16_t rnti = ul_config_pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti; uint16_t rnti = ul_config_pdu->ulsch_harq_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti;
uint8_t access_mode = SCHEDULED_ACCESS; uint8_t access_mode = SCHEDULED_ACCESS;
if (buflen > 0) { if (buflen > 0) {
if (UE_mac_inst[Mod_id].first_ULSCH_Tx == 1) { // Msg3 case if (UE_mac_inst[Mod_id].first_ULSCH_Tx == 1) {
fill_crc_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, 0, index, rnti, ul_config_req); fill_crc_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, 0, index, rnti, ul_config_req);
fill_rx_indication_UE_MAC(Mod_id, fill_rx_indication_UE_MAC(Mod_id,
frame, frame,
...@@ -534,7 +536,6 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id, ...@@ -534,7 +536,6 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
rnti, rnti,
index, index,
ul_config_req); ul_config_req);
fill_ulsch_cqi_indication_UE_MAC(Mod_id, frame, subframe, UL_INFO, rnti);
} }
} }
if (ulsch_harq_information != NULL) if (ulsch_harq_information != NULL)
...@@ -678,12 +679,10 @@ int ul_config_req_UE_MAC(nfapi_ul_config_request_t *req, ...@@ -678,12 +679,10 @@ int ul_config_req_UE_MAC(nfapi_ul_config_request_t *req,
req->ul_config_request_body.rach_prach_frequency_resources, req->ul_config_request_body.rach_prach_frequency_resources,
req->ul_config_request_body.srs_present); req->ul_config_request_body.srs_present);
// int sfn = timer_frame; // Needs the ul_config_req sfn_sf
// int sf = timer_subframe;
LOG_D(MAC, "ul_config_req Frame: %d Subframe: %d Proxy Frame: %u Subframe: %u\n", LOG_D(MAC, "ul_config_req Frame: %d Subframe: %d Proxy Frame: %u Subframe: %u\n",
NFAPI_SFNSF2SFN(req->sfn_sf), NFAPI_SFNSF2SF(req->sfn_sf), NFAPI_SFNSF2SFN(req->sfn_sf), NFAPI_SFNSF2SF(req->sfn_sf),
timer_frame, timer_subframe); timer_frame, timer_subframe);
int sfn = NFAPI_SFNSF2SFN(req->sfn_sf); // Needs the ul_config_req sfn_sf int sfn = NFAPI_SFNSF2SFN(req->sfn_sf);
int sf = NFAPI_SFNSF2SF(req->sfn_sf); int sf = NFAPI_SFNSF2SF(req->sfn_sf);
LOG_D(MAC, LOG_D(MAC,
...@@ -714,8 +713,7 @@ int ul_config_req_UE_MAC(nfapi_ul_config_request_t *req, ...@@ -714,8 +713,7 @@ int ul_config_req_UE_MAC(nfapi_ul_config_request_t *req,
handle_nfapi_ul_pdu_UE_MAC( handle_nfapi_ul_pdu_UE_MAC(
Mod_id, pdu, sfn, sf, req->ul_config_request_body.srs_present, i, req); Mod_id, pdu, sfn, sf, req->ul_config_request_body.srs_present, i, req);
} else { } else {
// NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() PDU:%i UNKNOWN type :%d\n", LOG_E(MAC, "UNKNOWN UL_CONFIG_REQ PDU_TYPE or RNTI not matching pdu type: %d\n", pdu_type);
// __FUNCTION__, i, ul_config_pdu_list[i].pdu_type);
} }
} }
...@@ -1129,7 +1127,6 @@ void ue_init_standalone_socket(const char *addr, int tx_port, int rx_port) ...@@ -1129,7 +1127,6 @@ void ue_init_standalone_socket(const char *addr, int tx_port, int rx_port)
close(sd); close(sd);
return; return;
} }
LOG_I(MAC, "Succeeded Now\n");
assert(ue_tx_sock_descriptor == -1); assert(ue_tx_sock_descriptor == -1);
ue_tx_sock_descriptor = sd; ue_tx_sock_descriptor = sd;
} }
...@@ -1161,7 +1158,6 @@ void ue_init_standalone_socket(const char *addr, int tx_port, int rx_port) ...@@ -1161,7 +1158,6 @@ void ue_init_standalone_socket(const char *addr, int tx_port, int rx_port)
close(sd); close(sd);
return; return;
} }
LOG_I(MAC, "Succeeded Now\n");
assert(ue_rx_sock_descriptor == -1); assert(ue_rx_sock_descriptor == -1);
ue_rx_sock_descriptor = sd; ue_rx_sock_descriptor = sd;
} }
...@@ -1311,35 +1307,37 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len ...@@ -1311,35 +1307,37 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len
{ {
case NFAPI_RACH_INDICATION: case NFAPI_RACH_INDICATION:
encoded_size = nfapi_p7_message_pack(&UL->rach_ind, buffer, sizeof(buffer), NULL); encoded_size = nfapi_p7_message_pack(&UL->rach_ind, buffer, sizeof(buffer), NULL);
LOG_E(MAC, "RACH_IND sent to Proxy, Size: %d Frame %d Subframe %d\n", encoded_size, LOG_I(MAC, "RACH_IND sent to Proxy, Size: %d Frame %d Subframe %d\n", encoded_size,
NFAPI_SFNSF2SFN(UL->rach_ind.sfn_sf), NFAPI_SFNSF2SF(UL->rach_ind.sfn_sf)); NFAPI_SFNSF2SFN(UL->rach_ind.sfn_sf), NFAPI_SFNSF2SF(UL->rach_ind.sfn_sf));
break; break;
case NFAPI_CRC_INDICATION: case NFAPI_CRC_INDICATION:
encoded_size = nfapi_p7_message_pack(&UL->crc_ind, buffer, sizeof(buffer), NULL); encoded_size = nfapi_p7_message_pack(&UL->crc_ind, buffer, sizeof(buffer), NULL);
LOG_E(MAC, "CRC_IND sent to Proxy, Size: %d Frame %d Subframe %d\n", encoded_size, LOG_I(MAC, "CRC_IND sent to Proxy, Size: %d Frame %d Subframe %d num_crcs: %u\n", encoded_size,
NFAPI_SFNSF2SFN(UL->crc_ind.sfn_sf), NFAPI_SFNSF2SF(UL->crc_ind.sfn_sf)); NFAPI_SFNSF2SFN(UL->crc_ind.sfn_sf), NFAPI_SFNSF2SF(UL->crc_ind.sfn_sf),
UL->crc_ind.crc_indication_body.number_of_crcs);
break; break;
case NFAPI_RX_ULSCH_INDICATION: // is this the right nfapi message_id? Ask Raymond case NFAPI_RX_ULSCH_INDICATION:
encoded_size = nfapi_p7_message_pack(&UL->rx_ind, buffer, sizeof(buffer), NULL); encoded_size = nfapi_p7_message_pack(&UL->rx_ind, buffer, sizeof(buffer), NULL);
LOG_E(MAC, "RX_IND sent to Proxy, Size: %d Frame %d Subframe %d rx_ind.tl.length: %u vdorext: %p\n", LOG_I(MAC, "RX_IND sent to Proxy, Size: %d Frame %d Subframe %d rx_ind.tl.length: %u num_pdus: %u\n",
encoded_size, NFAPI_SFNSF2SFN(UL->rx_ind.sfn_sf), NFAPI_SFNSF2SF(UL->rx_ind.sfn_sf), encoded_size, NFAPI_SFNSF2SFN(UL->rx_ind.sfn_sf), NFAPI_SFNSF2SF(UL->rx_ind.sfn_sf),
UL->rx_ind.rx_indication_body.tl.length, UL->rx_ind.vendor_extension); UL->rx_ind.rx_indication_body.tl.length, UL->rx_ind.rx_indication_body.number_of_pdus);
break; break;
case NFAPI_RX_CQI_INDICATION: // is this the right nfapi message_id? Ask Raymond case NFAPI_RX_CQI_INDICATION:
encoded_size = nfapi_p7_message_pack(&UL->cqi_ind, buffer, sizeof(buffer), NULL); encoded_size = nfapi_p7_message_pack(&UL->cqi_ind, buffer, sizeof(buffer), NULL); // Check pdu->ul_cqi_information.channel = 1
LOG_E(MAC, "CQI_IND sent to Proxy, Size: %d\n", encoded_size); LOG_I(MAC, "CQI_IND sent to Proxy, Size: %d num_cqis: %u\n", encoded_size,
UL->cqi_ind.cqi_indication_body.number_of_cqis);
break; break;
case NFAPI_HARQ_INDICATION: case NFAPI_HARQ_INDICATION:
encoded_size = nfapi_p7_message_pack(&UL->harq_ind, buffer, sizeof(buffer), NULL); encoded_size = nfapi_p7_message_pack(&UL->harq_ind, buffer, sizeof(buffer), NULL);
LOG_E(MAC, "HARQ_IND sent to Proxy, Size: %d Frame %d Subframe %d\n", encoded_size, LOG_I(MAC, "HARQ_IND sent to Proxy, Size: %d Frame %d Subframe %d\n", encoded_size,
NFAPI_SFNSF2SFN(UL->harq_ind.sfn_sf), NFAPI_SFNSF2SF(UL->harq_ind.sfn_sf)); NFAPI_SFNSF2SFN(UL->harq_ind.sfn_sf), NFAPI_SFNSF2SF(UL->harq_ind.sfn_sf));
break; break;
case NFAPI_RX_SR_INDICATION: // is this the right nfapi message_id? Ask Raymond case NFAPI_RX_SR_INDICATION:
encoded_size = nfapi_p7_message_pack(&UL->sr_ind, buffer, sizeof(buffer), NULL); encoded_size = nfapi_p7_message_pack(&UL->sr_ind, buffer, sizeof(buffer), NULL);
LOG_E(MAC, "SR_IND sent to Proxy, Size: %d\n", encoded_size); LOG_I(MAC, "SR_IND sent to Proxy, Size: %d\n", encoded_size);
break; break;
default: default:
LOG_E(MAC, "%s Unknown Message msg_type :: %u\n", __func__, msg_type); LOG_I(MAC, "%s Unknown Message msg_type :: %u\n", __func__, msg_type);
return; return;
} }
if (encoded_size < 0) if (encoded_size < 0)
...@@ -1357,7 +1355,6 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len ...@@ -1357,7 +1355,6 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len
void send_standalone_dummy() void send_standalone_dummy()
{ {
static const uint16_t dummy[] = {0, 0}; static const uint16_t dummy[] = {0, 0};
// LOG_E(MAC, "Dummy sent to Proxy, Size: %zu\n", sizeof(dummy));
if (send(ue_tx_sock_descriptor, dummy, sizeof(dummy), 0) < 0) if (send(ue_tx_sock_descriptor, dummy, sizeof(dummy), 0) < 0)
{ {
LOG_E(MAC, "send dummy to OAI UE failed: %s\n", strerror(errno)); LOG_E(MAC, "send dummy to OAI UE failed: %s\n", strerror(errno));
...@@ -1365,7 +1362,131 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len ...@@ -1365,7 +1362,131 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len
} }
} }
/* Dummy functions*/ const char *dl_pdu_type_to_string(uint8_t pdu_type)
{
switch (pdu_type)
{
case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE:
return "DCI_DL_PDU_TYPE";
case NFAPI_DL_CONFIG_BCH_PDU_TYPE:
return "BCH_PDU_TYPE";
case NFAPI_DL_CONFIG_MCH_PDU_TYPE:
return "MCH_PDU_TYPE";
case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE:
return "DLSCH_PDU_TYPE";
case NFAPI_DL_CONFIG_PCH_PDU_TYPE:
return "PCH_PDU_TYPE";
case NFAPI_DL_CONFIG_PRS_PDU_TYPE:
return "PRS_PDU_TYPE";
case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE:
return "CSI_RS_PDU_TYPE";
case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE:
return "EPDCCH_DL_PDU_TYPE";
case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE:
return "MPDCCH_PDU_TYPE";
case NFAPI_DL_CONFIG_NBCH_PDU_TYPE:
return "NBCH_PDU_TYPE";
case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE:
return "NPDCCH_PDU_TYPE";
case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE:
return "NDLSCH_PDU_TYPE";
default:
LOG_E(MAC, "%s No corresponding PDU for type: %u\n", __func__, pdu_type);
return "UNKNOWN";
}
}
const char *ul_pdu_type_to_string(uint8_t pdu_type)
{
switch (pdu_type)
{
case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE:
return "UL_CONFIG_ULSCH_PDU_TYPE";
case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE:
return "UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE";
case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE:
return "UL_CONFIG_ULSCH_HARQ_PDU_TYPE";
case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE:
return "UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE";
case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE:
return "UL_CONFIG_UCI_CQI_PDU_TYPE";
case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE:
return "UCI_SR_PDU_TYPE";
case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE:
return "UCI_HARQ_PDU_TYPE";
case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE:
return "UCI_SR_HARQ_PDU_TYPE";
case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE:
return "UCI_CQI_HARQ_PDU_TYPE";
case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE:
return "UCI_CQI_SR_PDU_TYPE";
case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE:
return "UCI_CQI_SR_HARQ_PDU_TYPE";
case NFAPI_UL_CONFIG_SRS_PDU_TYPE:
return "SRS_PDU_TYPE";
case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE:
return "HARQ_BUFFER_PDU_TYPE";
case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE:
return "PDU_TYPE";
case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE:
return "ULSCH_UCI_HARQ_PDU_TYPE";
case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE:
return "ULSCH_CSI_UCI_HARQ_PDU_TYPE";
case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE:
return "NULSCH_PDU_TYPE";
case NFAPI_UL_CONFIG_NRACH_PDU_TYPE:
return "NRACH_PDU_TYPE";
default:
LOG_E(MAC, "%s No corresponding PDU for type: %u\n", __func__, pdu_type);
return "UNKNOWN";
}
}
char *nfapi_dl_config_req_to_string(nfapi_dl_config_request_t *req)
{
const size_t max_result = 1024;
uint16_t num_pdus = req->dl_config_request_body.number_pdu;
int subframe = req->sfn_sf & 15;
int frame = req->sfn_sf >> 4;
char *result = malloc(max_result);
snprintf(result, max_result, "num_pdus=%u Frame=%d Subframe=%d",
num_pdus, frame, subframe);
for (size_t i = 0; i < num_pdus; ++i)
{
int len = strlen(result);
if (len >= max_result - 1)
{
break;
}
snprintf(result + len, max_result - len, " pdu_type=%s",
dl_pdu_type_to_string(req->dl_config_request_body.dl_config_pdu_list[i].pdu_type));
}
return result;
}
char *nfapi_ul_config_req_to_string(nfapi_ul_config_request_t *req)
{
const size_t max_result = 1024;
uint16_t num_pdus = req->ul_config_request_body.number_of_pdus;
int subframe = req->sfn_sf & 15;
int frame = req->sfn_sf >> 4;
char *result = malloc(max_result);
snprintf(result, max_result, "num_pdus=%u Frame=%d Subframe=%d",
num_pdus, frame, subframe);
for (size_t i = 0; i < num_pdus; ++i)
{
int len = strlen(result);
if (len >= max_result - 1)
{
break;
}
snprintf(result + len, max_result - len, " pdu_type=%s",
ul_pdu_type_to_string(req->ul_config_request_body.ul_config_pdu_list[i].pdu_type));
}
return result;
}
/* Dummy functions*/
void handle_nfapi_hi_dci0_dci_pdu( void handle_nfapi_hi_dci0_dci_pdu(
PHY_VARS_eNB * eNB, PHY_VARS_eNB * eNB,
......
...@@ -147,6 +147,17 @@ void *ue_standalone_pnf_task(void *context); ...@@ -147,6 +147,17 @@ void *ue_standalone_pnf_task(void *context);
void send_standalone_msg(UL_IND_t *UL, nfapi_message_id_e msg_type); void send_standalone_msg(UL_IND_t *UL, nfapi_message_id_e msg_type);
void send_standalone_dummy(void); void send_standalone_dummy(void);
// Convert downlink nfapi messages to a string.
// Returned memory is malloc'ed, caller is responsible for freeing.
char *nfapi_dl_config_req_to_string(nfapi_dl_config_request_t *req);
char *nfapi_ul_config_req_to_string(nfapi_ul_config_request_t *req);
// Convert downlink nfapi messages to a string.
// Returned memory is statically allocated.
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 dl_config_req_queue;
extern queue_t tx_req_pdu_queue; extern queue_t tx_req_pdu_queue;
extern queue_t ul_config_req_queue; extern queue_t ul_config_req_queue;
......
...@@ -421,7 +421,7 @@ void rrc_ue_generate_RRCConnectionRequest( const protocol_ctxt_t *const ctxt_pP, ...@@ -421,7 +421,7 @@ void rrc_ue_generate_RRCConnectionRequest( const protocol_ctxt_t *const ctxt_pP,
ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size, eNB_index); ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size, eNB_index);
for (i=0; i<UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size; i++) { for (i=0; i<UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size; i++) {
LOG_T(RRC,"%x.",UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.Payload[i]); LOG_T(RRC,"%x.\n",UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.Payload[i]);
} }
LOG_T(RRC,"\n"); LOG_T(RRC,"\n");
......
...@@ -1047,18 +1047,28 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1047,18 +1047,28 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
LOG_D(MAC, "received from proxy frame %d subframe %d\n", LOG_D(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) {
LOG_D(MAC, "dl_config_req pdus: %u Frame: %d Subframe: %d\n", uint16_t dl_num_pdus = dl_config_req->dl_config_request_body.number_pdu;
dl_config_req->dl_config_request_body.number_pdu, LOG_W(MAC, "(OAI UE) Received dl_config_req from proxy at Frame: %d, Subframe: %d,"
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf)); " 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_D(MAC, "dl_config_req: %s\n", dl_str);
free(dl_str);
}
} }
if (tx_request_pdu_list != NULL) { if (tx_request_pdu_list != NULL) {
LOG_D(MAC, "tx_req segments: %u\n", LOG_D(MAC, "tx_req segments: %u\n",
tx_request_pdu_list->num_segments); tx_request_pdu_list->num_segments);
} }
if (ul_config_req != NULL) { if (ul_config_req != NULL) {
LOG_D(MAC, "ul_config_req pdus: %u Frame: %d Subframe: %d\n", uint8_t ul_num_pdus = ul_config_req->ul_config_request_body.number_of_pdus;
ul_config_req->ul_config_request_body.number_of_pdus, if (ul_num_pdus > 0) {
NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf)); char *ul_str = nfapi_ul_config_req_to_string(ul_config_req);
LOG_D(MAC, "ul_config_req: %s\n", ul_str);
free(ul_str);
}
} }
if (hi_dci0_req != NULL) { if (hi_dci0_req != NULL) {
LOG_D(MAC, "hi_dci0_req pdus: %u Frame: %d Subframe: %d\n", LOG_D(MAC, "hi_dci0_req pdus: %u Frame: %d Subframe: %d\n",
...@@ -1164,7 +1174,6 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1164,7 +1174,6 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
// The one working strangely... // The one working strangely...
//if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) { //if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) {
PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf)); PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf));
LOG_D(MAC, "Celtics prach_resources %p\n", prach_resources);
if (prach_resources != NULL) { if (prach_resources != NULL) {
UE_mac_inst[ue_Mod_id].ra_frame = rx_frame; UE_mac_inst[ue_Mod_id].ra_frame = rx_frame;
LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
...@@ -1185,9 +1194,9 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1185,9 +1194,9 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
// Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
// Generate UL_indications which correspond to UL traffic. // Generate UL_indications which correspond to UL traffic.
if (ul_config_req != NULL) { // check to see if you get every 2 ms //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ if (ul_config_req != NULL) { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id); // Andrew - send over socket to proxy here ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id);
} // Andrew - else send a dummy over the socket }
} }
phy_procedures_UE_SL_RX(UE, proc); phy_procedures_UE_SL_RX(UE, proc);
...@@ -1218,8 +1227,8 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) ...@@ -1218,8 +1227,8 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
} }
if (UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis > 0) { if (UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis > 0) {
send_standalone_msg(UL_INFO, UL_INFO->cqi_ind.header.message_id); send_standalone_msg(UL_INFO, UL_INFO->cqi_ind.header.message_id);
sent_any = true; sent_any = true;
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0; UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
} }
......
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