Commit b41a09dd authored by Melissa Elkadi's avatar Melissa Elkadi

Cleanup before merge

The clean up includes removing white space changes, adding logs,
adding comments to make various changes more obvious, etc.
parent 2cd3af92
......@@ -4,7 +4,6 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
......
# OpenAirInterface License #
# Description #
The purpose of this repository is to provide an updated version of the original OAI code base. The original code base can be found here: https://gitlab.eurecom.fr/oai/openairinterface5g. The updates to the OAI code base removed some latent bugs, added multi-UE scalability, and were tested with a standard bypass proxy between the UE(s) and eNB. The proxy is available at: https://github.com/EpiSci/oai-lte-multi-ue-proxy. With this package, various multi-UE scenarios can be tested without the overhead of PHY-layer features of underlying radios. This proxy was created to allow users to test and utilize EpiSci's updated version of the OAI code.
### Where this all began: ###
OAI code was used to baseline this work. The initial framework for this development was started from the follwoing commit: https://gitlab.eurecom.fr/oai/openairinterface5g/-/commit/362da7c9205691a7314de56bbe8ec369f636da7b.
OpenAirInterface is under OpenAirInterface Software Alliance license.
### Included Fixes: ###
- Ease of use of gprof and address sanitizer for debugging purposes
- Updated json files to allow for GDB, real-time debugging capabilities
- Updated logging features to minimally log only key connection milestones. This imroves scalability of multiple UEs.
- Updated logging to include time stamp for timing analysis
- Updated memory allocation procedures to correct size requirements
- Added debugging features to handle signal terminations
- nfapi.c pullarray8 fix invalid pointer math
- Overlapping destination and source memory in memcpy, so updated to memmove to check for this bug
- Advanced error checking mechanisms in critical pack and unpack functions
- Created option for CPU assignment to UE to improve scalability
- Added EPC integration to allow multiple individual UE entities to each have their USIM information parced by the executables
- Updated random value seeds to minimize probability of error in generation of random values
- Enables capability round robin scheduler if desired
- Enables capability real time scheduler if desired
- Added new standalone functions to the UE phy-layer (phy_stub_ue.c) to incorporate individual UE entities
- Updated sending and packing functions in UE (lte_ue.c) to incorporate new standalone changes
- Incorporated semaphores to control timing of incoming downlink packets
- Implemented new queuing system to handle message exchange from UE to eNB and vice versa
- Updated global value in nFAPI for size of subframe
- Updated global value to increase scalability in system
* [OAI License Model](http://www.openairinterface.org/?page_id=101)
* [OAI License v1.1 on our website](http://www.openairinterface.org/?page_id=698)
It is distributed under **OAI Public License V1.1**.
The license information is distributed under [LICENSE](LICENSE) file in the same directory.
Please see [NOTICE](NOTICE.md) file for third party software that is included in the sources.
# Where to Start #
......
......@@ -13,9 +13,9 @@ eNBs =
eNB_name = "eNB-Eurecom-LTEBox";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = 5;
tracking_area_code = 1;
plmn_list = ( { mcc = 320; mnc = 230; mnc_length = 3; } );
plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } );
tr_s_preference = "local_mac"
......@@ -172,7 +172,7 @@ eNBs =
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.61.3";
mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
......@@ -188,12 +188,12 @@ eNBs =
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "ctrl0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "172.16.0.1";
ENB_INTERFACE_NAME_FOR_S1U = "ctrl0";
ENB_IPV4_ADDRESS_FOR_S1U = "172.16.0.1";
ENB_INTERFACE_NAME_FOR_S1_MME = "ens3";
ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR";
ENB_INTERFACE_NAME_FOR_S1U = "ens3";
ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
ENB_IPV4_ADDRESS_FOR_X2C = "0.0.0.0";
ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR";
ENB_PORT_FOR_X2C = 36422; # Spec 36422
};
......
......@@ -27,7 +27,7 @@ L1s = (
remote_n_portc = 50001;
local_n_portd = 50010;
remote_n_portd = 50011;
}
}
);
RUs = (
......
......@@ -544,8 +544,8 @@ function main() {
#fi
fi
echo_info "installing protobuf/protobuf-c for flexran agent support"
#install_protobuf_from_source
#install_protobuf_c_from_source
install_protobuf_from_source
install_protobuf_c_from_source
fi
if [ "$INSTALL_OPTIONAL" = "1" ] ; then
......
#!/bin/bash
sudo -E ./ran_build/build/lte-softmodem -O ../ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf --noS1
......@@ -523,12 +523,12 @@ void logMinimal(int comp, int level, const char *format, ...)
#endif // LOG_MINIMAL
static int log_header(char *log_buffer,
int buffsize,
int comp,
int level,
const char *format)
int buffsize,
int comp,
int level,
const char *format)
{
char threadname[PR_SET_NAME];
char threadname[PR_SET_NAME];
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
abort();
......@@ -545,24 +545,24 @@ static int log_header(char *log_buffer,
}
void logRecord_mt(const char *file,
const char *func,
int line,
int comp,
int level,
const char *format,
... )
const char *func,
int line,
int comp,
int level,
const char *format,
... )
{
char log_buffer[MAX_LOG_TOTAL]= {0};
va_list args;
va_start(args,format);
if (log_mem_flag == 1) {
log_output_memory(file,func,line,comp,level,format,args);
} else {
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);
fflush(g_log->log_component[comp].stream);
}
va_end(args);
char log_buffer[MAX_LOG_TOTAL]= {0};
va_list args;
va_start(args,format);
if (log_mem_flag == 1) {
log_output_memory(file,func,line,comp,level,format,args);
} else {
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);
fflush(g_log->log_component[comp].stream);
}
va_end(args);
}
void vlogRecord_mt(const char *file,
......
......@@ -425,6 +425,8 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
/* bitmask dependent macros, to generate debug file such as matlab file or message dump */
# define LOG_DUMPFLAG(D) (g_log->dump_mask & D)
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)/* */
/* define variable only used in LOG macro's */
# define LOG_VAR(A,B) A B
# else /* T_TRACER: remove all debugging and tracing messages, except errors */
# define LOG_I(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0)/* */
# define LOG_W(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ; } while(0)/* */
......@@ -438,6 +440,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_DEBUGFLAG(D) ( 0 )
# define LOG_DUMPFLAG(D) ( 0 )
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
# define LOG_VAR(A,B)
# endif /* T_TRACER */
#endif // LOG_MINIMAL
......
......@@ -569,7 +569,6 @@ int signal_handle(int *end);
int signal_mask(void);
void log_scheduler(const char *label);
#ifdef __cplusplus
}
#endif
......
......@@ -421,8 +421,7 @@ 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) {
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);
LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_preambles:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rach_indication_body.number_of_preambles);
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);
pthread_mutex_lock(&eNB->UL_INFO_mutex);
......@@ -486,11 +485,8 @@ int phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indicatio
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 );
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++) {
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));
}
......@@ -510,8 +506,6 @@ 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) {
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);
if(NFAPI_MODE == NFAPI_MODE_VNF){
int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf);
......@@ -539,8 +533,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;
if (ind->crc_indication_body.number_of_crcs==0)
LOG_D(MAC, "%s() NFAPI sfn_sf = %d.%d number_of_crcs: %u\n", __FUNCTION__, NFAPI_SFNSF2SFN(ind->sfn_sf),
NFAPI_SFNSF2SF(ind->sfn_sf), ind->crc_indication_body.number_of_crcs);
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,
eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs);
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]));
......@@ -558,37 +552,9 @@ int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_
return 1;
}
const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len)
{
char *p = out;
char *endp = out + out_len;
const uint8_t *q = data;
snprintf(p, endp - p, "[%zu]", data_len);
p += strlen(p);
for (size_t i = 0; i < data_len; ++i)
{
if (p >= endp)
{
static const char ellipses[] = "...";
char *s = endp - sizeof(ellipses);
if (s >= p)
{
strcpy(s, ellipses);
}
break;
}
snprintf(p, endp - p, " %02X", *q++);
p += strlen(p);
}
return out;
}
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];
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) {
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);
}
......@@ -599,11 +565,8 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t
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 );
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++) {
nfapi_rx_indication_pdu_t *dest_pdu = &UL_RCC_INFO.rx_ind[index].rx_indication_body.rx_pdu_list[i];
......@@ -676,11 +639,8 @@ int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t
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);
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 );
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++) {
nfapi_sr_indication_pdu_t *dest_pdu = &UL_RCC_INFO.sr_ind[index].sr_indication_body.sr_pdu_list[i];
......@@ -752,15 +712,14 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_
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_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);
}
analyze_cqi_pdus_for_duplicates(ind);
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];
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];
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);
memcpy(&UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_pdu_list[i],
src_pdu, sizeof(nfapi_cqi_indication_pdu_t));
......@@ -1173,7 +1132,6 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) {
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_config_req->dl_config_request_body.number_pdu);
if (dl_config_req->dl_config_request_body.number_pdu > 0)
{
// TODO: Decide if we really need these logs in the future:
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;
......@@ -1223,8 +1181,7 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
tx_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
tx_req->header.message_id = NFAPI_TX_REQUEST;
LOG_I(PHY, "[VNF] %s() TX_REQ sfn_sf:%d_%d number_of_pdus:%d\n", __FUNCTION__,
NFAPI_SFNSF2SFN(tx_req->sfn_sf),NFAPI_SFNSF2SF(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
//LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
int retval = nfapi_vnf_p7_tx_req(p7_config, tx_req);
if (retval!=0) {
......@@ -1277,9 +1234,7 @@ 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.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() 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);
//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);
int num_pdus = ul_config_req->ul_config_request_body.number_of_pdus;
nfapi_ul_config_request_pdu_t *pdu_list = ul_config_req->ul_config_request_body.ul_config_pdu_list;
......
......@@ -2220,20 +2220,20 @@ typedef struct {
nfapi_ul_config_ulsch_cqi_ri_pdu ulsch_cqi_ri_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_uci_cqi_pdu uci_cqi_pdu; // should never see
nfapi_ul_config_uci_cqi_pdu uci_cqi_pdu;
nfapi_ul_config_uci_sr_pdu uci_sr_pdu;
nfapi_ul_config_uci_harq_pdu uci_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;// should never see
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;// should never see
nfapi_ul_config_srs_pdu srs_pdu;// should never see
nfapi_ul_config_harq_buffer_pdu harq_buffer_pdu;// should never see
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;// should never see
nfapi_ul_config_ulsch_csi_uci_harq_pdu ulsch_csi_uci_harq_pdu;// should never see
nfapi_ul_config_nulsch_pdu nulsch_pdu;// should never see
nfapi_ul_config_nrach_pdu nrach_pdu;// should never see
nfapi_ul_config_uci_sr_harq_pdu uci_sr_harq_pdu;
nfapi_ul_config_uci_cqi_harq_pdu uci_cqi_harq_pdu;
nfapi_ul_config_uci_cqi_sr_pdu uci_cqi_sr_pdu;
nfapi_ul_config_uci_cqi_sr_harq_pdu uci_cqi_sr_harq_pdu;
nfapi_ul_config_srs_pdu srs_pdu;
nfapi_ul_config_harq_buffer_pdu harq_buffer_pdu;
nfapi_ul_config_ulsch_uci_csi_pdu ulsch_uci_csi_pdu;
nfapi_ul_config_ulsch_uci_harq_pdu ulsch_uci_harq_pdu;
nfapi_ul_config_ulsch_csi_uci_harq_pdu ulsch_csi_uci_harq_pdu;
nfapi_ul_config_nulsch_pdu nulsch_pdu;
nfapi_ul_config_nrach_pdu nrach_pdu;
};
} nfapi_ul_config_request_pdu_t;
......
......@@ -526,7 +526,7 @@ uint32_t pullarray8(uint8_t **in, uint8_t out[], uint32_t max_len, uint32_t len,
return 0;
}
if((end - (*in)) >= sizeof(uint8_t) * len)
if((end - (*in)) >= sizeof(uint8_t) * len)
{
memcpy(out, (*in), len);
(*in)+=len;
......
......@@ -37,31 +37,6 @@
#include <nfapi.h>
#include <debug.h>
__attribute__((unused))
static const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len)
{
char *p = out;
char *endp = out + out_len;
const uint8_t *q = data;
snprintf(p, endp - p, "[%zu]", data_len);
p += strlen(p);
for (size_t i = 0; i < data_len; ++i)
{
if (p >= endp)
{
static const char ellipses[] = "...";
char *s = endp - sizeof(ellipses);
if (s >= p)
{
strcpy(s, ellipses);
}
break;
}
snprintf(p, endp - p, " %02X", *q++);
p += strlen(p);
}
return out;
}
extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, void* user_data);
extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedMsg, void* user_data);
......
......@@ -16,6 +16,7 @@
#include <time.h>
#include <stdio.h>
#include <sys/time.h>
#include <stdlib.h>
......@@ -505,7 +506,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.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)
......@@ -1229,7 +1230,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",
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->zero_count,
phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC");*/
......@@ -1269,7 +1270,6 @@ void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
if (vnf_p7 && vnf_p7->p7_connections)
{
int16_t vnf_pnf_sfnsf_delta = NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf) - NFAPI_SFNSF2DEC(ind.last_sfn_sf);
printf("vnf_pnf_sfnsf_delta = %d adjusting now\n", vnf_pnf_sfnsf_delta); fflush(stdout);
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PNF:SFN/SF:%d VNF:SFN/SF:%d deltaSFNSF:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind.last_sfn_sf), NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), vnf_pnf_sfnsf_delta);
......@@ -1277,8 +1277,7 @@ 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>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
vnf_p7->p7_connections[0].sfn_sf = ind.last_sfn_sf;
}
......
......@@ -23,7 +23,6 @@
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include "vnf_p7.h"
......@@ -181,7 +180,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
clock_gettime(CLOCK_MONOTONIC, &pselect_start);
//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);
......@@ -256,8 +255,8 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
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",
pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
sf_duration.tv_sec, sf_duration.tv_nsec);
}
if(selectRetval == 0)
......
......@@ -84,7 +84,6 @@
#define MAX_eNB 2
#define MAX_gNB 2
#else
// TODO: Change after gaining stability on 20 UES or less
#define MAX_MOBILES_PER_ENB 40
#define MAX_MOBILES_PER_ENB_NB_IoT 40
#define MAX_MOBILES_PER_GNB 2//16
......
......@@ -476,7 +476,7 @@ void generate_Msg2(module_id_t module_idP,
}
} else {
if ((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) {
LOG_I(MAC,
LOG_D(MAC,
"[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI, state %d\n",
module_idP, CC_idP, frameP, subframeP, ra->state);
// Allocate 4 PRBS starting in RB 0
......@@ -1305,6 +1305,7 @@ initiate_ra_proc(module_id_t module_idP,
uint16_t msg2_subframe = subframeP;
int offset;
static uint8_t failure_cnt = 0 ;
if (prach_ParametersListCE_r13 &&
prach_ParametersListCE_r13->list.count < rach_resource_type) {
LOG_E(MAC,
......
......@@ -4539,7 +4539,6 @@ 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->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");
uint16_t Npd, N_OFFSET_CQI;
int H, K, bandwidth_part, L, Lmask;
int ri = sched_ctl->periodic_ri_received[CC_idP];
......
......@@ -1306,6 +1306,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
* pre_allocated_rb_table_index_ul
*/
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]) {
if (UE_info->UE_template[CC_id][UE_id].rach_resource_type > 0)
continue;
......
......@@ -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, // TODO: edit here for sending multiple rachs
PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
frame_t frameP, uint8_t eNB_indexP,
sub_frame_t subframeP) {
uint8_t Size = 0;
......
......@@ -48,9 +48,7 @@ void handle_rach(UL_IND_t *UL_info) {
UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles = 0;
UL_RCC_INFO.rach_ind[j].header.message_id = 0;
}
}
else
{
} else {
if (UL_info->rach_ind.rach_indication_body.number_of_preambles>0) {
AssertFatal(UL_info->rach_ind.rach_indication_body.number_of_preambles==1,"More than 1 preamble not supported\n");
UL_info->rach_ind.rach_indication_body.number_of_preambles=0;
......@@ -703,16 +701,13 @@ void UL_indication(UL_IND_t *UL_info, L1_rxtx_proc_t *proc) {
Sched_Rsp_t *sched_info = &Sched_INFO[module_id][CC_id];
IF_Module_t *ifi = if_inst[module_id];
eNB_MAC_INST *mac = RC.mac[module_id];
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,
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->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);
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",
UL_info->frame, UL_info->subframe,
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->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);
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
LOG_D(MAC,"current (%d,%d) frame count dl is %d\n",UL_info->frame,UL_info->subframe,frame_cnt);
}
......@@ -798,6 +793,7 @@ IF_Module_t *IF_Module_init(int Mod_id) {
AssertFatal(pthread_mutex_init(&if_inst[Mod_id]->if_mutex,NULL)==0,
"allocation of if_inst[%d]->if_mutex fails\n",Mod_id);
}
memset(&UL_RCC_INFO, 0, sizeof(UL_RCC_INFO));
return if_inst[Mod_id];
}
......
......@@ -94,6 +94,7 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,
pdu->rx_indication_rel9.tl.tag = NFAPI_RX_INDICATION_REL9_TAG;
pdu->rx_indication_rel9.timing_advance_r9 = 0;
// ulsch_buffer is necessary to keep its value.
pdu->data = malloc(buflen);
memcpy(pdu->data, ulsch_buffer, buflen);
LOG_I(MAC, "buflen of rx_ind pdu_data = %u SFN.SF: %d.%d\n", buflen,
......@@ -396,12 +397,6 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
pdu->harq_indication_fdd_rel13.harq_tb_n[0] =
1; // Assuming always an ACK (No NACK or DTX)
// TODO: Fix ack/dtx -- needed for 5G
// 1.) if received dl_config_req (with c-rnti) store this info and corresponding subframe.
// 2.) if receiving ul_config_req for uci ack/nack or ulsch ack/nak in subframe n
// go look to see if dl_config_req (with c-rnti) was received in subframe (n - 4)
// 3.) if the answer to #2 is yes then send ACK IF NOT send DTX
} else if ((harq_information->harq_information_rel9_fdd.ack_nack_mode == 0)
&& (harq_information->harq_information_rel9_fdd.harq_size
== 2)) {
......@@ -501,7 +496,9 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
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 =
// 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
......@@ -784,7 +781,7 @@ void dl_config_req_UE_MAC_dci(int sfn,
if (rnti_type == 1) { // C-RNTI (Normal DLSCH case)
for (int ue_id = 0; ue_id < num_ue; ue_id++) {
if (UE_mac_inst[ue_id].crnti == rnti) {
LOG_I(MAC,
LOG_D(MAC,
"%s() Received data: sfn/sf:%d.%d "
"size:%d, TX_PDU index: %d, tx_req_num_elems: %d \n",
__func__,
......@@ -1526,30 +1523,6 @@ void enqueue_dl_config_req_tx_req(nfapi_dl_config_request_t *dl_config_req, nfap
}
}
const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len)
{
char *p = out;
char *endp = out + out_len;
const uint8_t *q = data;
snprintf(p, endp - p, "[%zu]", data_len);
p += strlen(p);
for (size_t i = 0; i < data_len; ++i)
{
if (p >= endp)
{
static const char ellipses[] = "...";
char *s = endp - sizeof(ellipses);
if (s >= p)
{
strcpy(s, ellipses);
}
break;
}
snprintf(p, endp - p, " %02X", *q++);
p += strlen(p);
}
return out;
}
__attribute__((unused))
static void print_rx_ind(nfapi_rx_indication_t *p)
......
......@@ -140,10 +140,13 @@ void hi_dci0_req_UE_MAC(int sfn,
int memcpy_dl_config_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_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);
int memcpy_tx_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req);
int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t* req);
void UE_config_stub_pnf(void);
......
......@@ -2529,7 +2529,7 @@ int decode_BCCH_DLSCH_Message(
memcpy( (void *)sib1,
(void *)&bcch_message->message.choice.c1.choice.systemInformationBlockType1,
sizeof(LTE_SystemInformationBlockType1_t) );
LOG_D( RRC, "[UE %"PRIu8"] Decoding First SIB1\n", ctxt_pP->module_id);
LOG_D( RRC, "[UE %"PRIu8"] Decoding First SIB1\n", ctxt_pP->module_id );
decode_SIB1( ctxt_pP, eNB_index, rsrq, rsrp );
}
}
......
......@@ -262,7 +262,7 @@ void display_usim_data(const char *filename) {
kasme[USIM_K_ASME_SIZE] = '\0';
memcpy(kasme, data.securityctx.Kasme.value, USIM_K_ASME_SIZE);
printf("\tKasme\t: \"%s\"\n", kasme);
#if 0
#if 0 //This doesn't compile anymore due to compiler warnings about pointers
printf("\tulNAScount\t: 0x%.8x\n",
*(uint32_t*) data.securityctx.ulNAScount.value);
printf("\tdlNAScount\t: 0x%.8x\n",
......
......@@ -105,7 +105,7 @@ void *nas_ue_task(void *args_p)
nas_user_t *user = &users->item[i];
user->ueid = i;
/* Get USIM data application filename */ //
/* Get USIM data application filename */
user->usim_data_store = memory_get_path_from_ueid(USIM_API_NVRAM_DIRNAME, USIM_API_NVRAM_FILENAME, user->ueid);
if (user->usim_data_store == NULL)
{
......
......@@ -103,6 +103,7 @@ pthread_cond_t nfapi_sync_cond;
pthread_mutex_t nfapi_sync_mutex;
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
uint16_t sf_ahead=4;
pthread_cond_t sync_cond;
......
......@@ -1388,7 +1388,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
{
#if 0 // TODO: doesn't currently compile
#if 0 // TODO: doesn't currently compile, obviated by multi-ue proxy
thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L);
// for multipule UE's L2-emulator
//module_id_t Mod_id = 0;
......
......@@ -121,6 +121,7 @@ uint64_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
int UE_scan = 1;
int UE_scan_carrier = 0;
......@@ -528,7 +529,7 @@ int restart_L1L2(module_id_t enb_id) {
void init_pdcp(void) {
uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1) ? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT);
// Do we need to include standalone mode here? - Andrew
if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) {
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
}
......
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