initial testing version of L1L-L1H split (RRU-RAU)

This commit is contained in:
Raymond Knopp
2017-04-17 10:40:23 -07:00
parent 71af8ce824
commit b42aed9ed9
134 changed files with 8669 additions and 10672 deletions
+13 -13
View File
@@ -42,25 +42,25 @@ int set_device(openair0_device *device) {
switch (device->type) {
case EXMIMO_DEV:
printf("[%s] has loaded EXPRESS MIMO device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
printf("[%s] has loaded EXPRESS MIMO device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
break;
case USRP_B200_DEV:
printf("[%s] has loaded USRP B200 device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
printf("[%s] has loaded USRP B200 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
break;
case USRP_X300_DEV:
printf("[%s] has loaded USRP X300 device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
printf("[%s] has loaded USRP X300 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
break;
case BLADERF_DEV:
printf("[%s] has loaded BLADERF device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
printf("[%s] has loaded BLADERF device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
break;
case LMSSDR_DEV:
printf("[%s] has loaded LMSSDR device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
printf("[%s] has loaded LMSSDR device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
break;
case NONE_DEV:
printf("[%s] has not loaded a HW device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
printf("[%s] has not loaded a HW device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
break;
default:
printf("[%s] invalid HW device.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
printf("[%s] invalid HW device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
return -1;
}
return 0;
@@ -71,15 +71,15 @@ int set_transport(openair0_device *device) {
switch (device->transp_type) {
case ETHERNET_TP:
printf("[%s] has loaded ETHERNET trasport protocol.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
printf("[%s] has loaded ETHERNET trasport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
return 0;
break;
case NONE_TP:
printf("[%s] has not loaded a transport protocol.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
printf("[%s] has not loaded a transport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
return 0;
break;
default:
printf("[%s] invalid transport protocol.\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"));
printf("[%s] invalid transport protocol.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
return -1;
break;
}
@@ -94,7 +94,7 @@ int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_param
oai_transport_initfunc_t tp ;
int ret=0;
if (flag == BBU_LOCAL_RADIO_HEAD) {
if (flag == RAU_LOCAL_RADIO_HEAD) {
lib_handle = dlopen(OAI_RF_LIBNAME, RTLD_LAZY);
if (!lib_handle) {
fprintf(stderr,"Unable to locate %s: HW device set to NONE_DEV.\n", OAI_RF_LIBNAME);
@@ -144,7 +144,7 @@ int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cf
int device_init(openair0_device *device, openair0_config_t *openair0_cfg);
rc = device_init(device, openair0_cfg);
#else
rc=load_lib(device, openair0_cfg, NULL,BBU_LOCAL_RADIO_HEAD );
rc=load_lib(device, openair0_cfg, NULL,RAU_LOCAL_RADIO_HEAD );
if ( rc >= 0) {
if ( set_device(device) < 0) {
fprintf(stderr, "%s %d:Unsupported radio head\n",__FILE__, __LINE__);
@@ -157,7 +157,7 @@ int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cf
int openair0_transport_load(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params) {
int rc;
rc=load_lib(device, openair0_cfg, eth_params, BBU_REMOTE_RADIO_HEAD);
rc=load_lib(device, openair0_cfg, eth_params, RAU_REMOTE_RADIO_HEAD);
if ( rc >= 0) {
if ( set_transport(device) < 0) {
fprintf(stderr, "%s %d:Unsupported transport protocol\n",__FILE__, __LINE__);
+22 -22
View File
@@ -41,8 +41,8 @@
#define OAI_TP_LIBNAME "liboai_transpro.so"
/* flags for BBU to determine whether the attached radio head is local or remote */
#define BBU_LOCAL_RADIO_HEAD 0
#define BBU_REMOTE_RADIO_HEAD 1
#define RAU_LOCAL_RADIO_HEAD 0
#define RAU_REMOTE_RADIO_HEAD 1
#ifndef MAX_CARDS
#define MAX_CARDS 8
@@ -118,10 +118,10 @@ typedef enum {
/*!\brief openair0 device host type */
typedef enum {
MIN_HOST_TYPE = 0,
/*!\brief device functions within a BBU */
BBU_HOST,
/*!\brief device functions within a RRH */
RRH_HOST,
/*!\brief device functions within a RAU */
RAU_HOST,
/*!\brief device functions within a RRU */
RRU_HOST,
MAX_HOST_TYPE
}host_type_t;
@@ -203,14 +203,6 @@ typedef struct {
//! the two following parameters are used to convert iqs
int iq_txshift;
int iq_rxrescale;
//! remote IP/MAC addr for Ethernet interface
char *remote_addr;
//! remote port number for Ethernet interface
unsigned int remote_port;
//! local IP/MAC addr for Ethernet interface (eNB/BBU, UE)
char *my_addr;
//! local port number for Ethernet interface (eNB/BBU, UE)
unsigned int my_port;
//! Configuration file for LMS7002M
char *configFilename;
} openair0_config_t;
@@ -228,11 +220,11 @@ typedef struct {
char *remote_addr;
//! remote port number for Ethernet interface
uint16_t remote_port;
//! local IP/MAC addr for Ethernet interface (eNB/BBU, UE)
//! local IP/MAC addr for Ethernet interface (eNB/RAU, UE)
char *my_addr;
//! local port number for Ethernet interface (eNB/BBU, UE)
//! local port number for Ethernet interface (eNB/RAU, UE)
uint16_t my_port;
//! local Ethernet interface (eNB/BBU, UE)
//! local Ethernet interface (eNB/RAU, UE)
char *local_if_name;
//! tx_sample_advance for RF + ETH
uint8_t tx_sample_advance;
@@ -271,12 +263,15 @@ struct openair0_device_t {
/*!brief Transport protocol type that the device suppports (in case I/Q samples need to be transported) */
transport_type_t transp_type;
/*!brief Type of the device's host (BBU/RRH) */
/*!brief Type of the device's host (RAU/RRU) */
host_type_t host_type;
/* !brief RF frontend parameters set by application */
openair0_config_t *openair0_cfg;
/* !brief ETH params set by application */
eth_params_t *eth_params;
/*!brief Can be used by driver to hold internal structure*/
void *priv;
@@ -287,16 +282,16 @@ struct openair0_device_t {
*/
int (*trx_start_func)(openair0_device *device);
/*! \brief Called to send a request message between BBU-RRH
/*! \brief Called to send a request message between RAU-RRU
@param device pointer to the device structure specific to the RF hardware target
@param msg pointer to the message structure passed between BBU-RRH
@param msg pointer to the message structure passed between RAU-RRU
@param msg_len length of the message
*/
int (*trx_request_func)(openair0_device *device, void *msg, ssize_t msg_len);
/*! \brief Called to send a reply message between BBU-RRH
/*! \brief Called to send a reply message between RAU-RRU
@param device pointer to the device structure specific to the RF hardware target
@param msg pointer to the message structure passed between BBU-RRH
@param msg pointer to the message structure passed between RAU-RRU
@param msg_len length of the message
*/
int (*trx_reply_func)(openair0_device *device, void *msg, ssize_t msg_len);
@@ -362,6 +357,11 @@ struct openair0_device_t {
*/
int (*trx_set_gains_func)(openair0_device* device, openair0_config_t *openair0_cfg);
/*! \brief RRU Configuration callback
* \param idx RU index
* \param arg pointer to capabilities or configuration
*/
int (*configure_rru)(int idx, void* arg);
};
/* type of device init function, implemented in shared lib */
+20 -20
View File
@@ -60,15 +60,15 @@ int eth_socket_init_raw(openair0_device *device) {
int sock_type=0;
int sock_proto=0;
if (device->host_type == RRH_HOST ) { /* RRH doesn't know remote MAC(will be retrieved from first packet send from BBU) and remote port(don't care) */
local_mac = device->openair0_cfg->my_addr;
if (device->host_type == RRU_HOST ) { /* RRU doesn't know remote MAC(will be retrieved from first packet send from RAU) and remote port(don't care) */
local_mac = device->eth_params->my_addr;
remote_mac = malloc(ETH_ALEN);
memset((void*)remote_mac,0,ETH_ALEN);
printf("[%s] local MAC addr %s remote MAC addr %s\n","RRH", local_mac,remote_mac);
printf("[%s] local MAC addr %s remote MAC addr %s\n","RRU", local_mac,remote_mac);
} else {
local_mac = device->openair0_cfg->my_addr;
remote_mac = device->openair0_cfg->remote_addr;
printf("[%s] local MAC addr %s remote MAC addr %s\n","BBU", local_mac,remote_mac);
local_mac = device->eth_params->my_addr;
remote_mac = device->eth_params->remote_addr;
printf("[%s] local MAC addr %s remote MAC addr %s\n","RAU", local_mac,remote_mac);
}
@@ -96,7 +96,7 @@ int eth_socket_init_raw(openair0_device *device) {
if (eth->flags == ETH_RAW_IF5_MOBIPASS) {
eth->local_addr_ll.sll_protocol = htons(0xbffe);
} else{
eth->local_addr_ll.sll_protocol = htons((short)device->openair0_cfg->my_port);
eth->local_addr_ll.sll_protocol = htons((short)device->eth_params->my_port);
}
eth->local_addr_ll.sll_halen = ETH_ALEN;
eth->local_addr_ll.sll_pkttype = PACKET_OTHERHOST;
@@ -113,9 +113,9 @@ int eth_socket_init_raw(openair0_device *device) {
if (eth->flags == ETH_RAW_IF5_MOBIPASS) {
eth->eh.ether_type = htons(0xbffe);
} else {
eth->eh.ether_type = htons((short)device->openair0_cfg->my_port);
eth->eh.ether_type = htons((short)device->eth_params->my_port);
}
printf("[%s] binding to hardware address %x:%x:%x:%x:%x:%x\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"),eth->eh.ether_shost[0],eth->eh.ether_shost[1],eth->eh.ether_shost[2],eth->eh.ether_shost[3],eth->eh.ether_shost[4],eth->eh.ether_shost[5]);
printf("[%s] binding to hardware address %x:%x:%x:%x:%x:%x\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"),eth->eh.ether_shost[0],eth->eh.ether_shost[1],eth->eh.ether_shost[2],eth->eh.ether_shost[3],eth->eh.ether_shost[4],eth->eh.ether_shost[5]);
return 0;
}
@@ -146,7 +146,7 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
*(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t))=1+(i<<1);
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)) = timestamp;
/*printf("[RRH]write mod_%d %d , len %d, buff %p \n",
/*printf("[RRU]write mod_%d %d , len %d, buff %p \n",
Mod_id,eth->sockfd[Mod_id],RAW_PACKET_SIZE_BYTES(nsamps), buff2);*/
while(bytes_sent < RAW_PACKET_SIZE_BYTES(nsamps)) {
@@ -172,7 +172,7 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
*(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t)),
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)),
bytes_sent);
dump_packet((device->host_type == BBU_HOST)? "BBU":"RRH", buff2, RAW_PACKET_SIZE_BYTES(nsamps), TX_FLAG);
dump_packet((device->host_type == RAU_HOST)? "RAU":"RRU", buff2, RAW_PACKET_SIZE_BYTES(nsamps), TX_FLAG);
#endif
eth->tx_actual_nsamps=bytes_sent>>2;
eth->tx_count++;
@@ -280,7 +280,7 @@ int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, voi
*(int16_t *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int16_t)),
*(openair0_timestamp *)(buff2 + MAC_HEADER_SIZE_BYTES + sizeof(int32_t)),
bytes_received);
dump_packet((device->host_type == BBU_HOST)? "BBU":"RRH", buff2, RAW_PACKET_SIZE_BYTES(nsamps),RX_FLAG);
dump_packet((device->host_type == RAU_HOST)? "RAU":"RRU", buff2, RAW_PACKET_SIZE_BYTES(nsamps),RX_FLAG);
#endif
@@ -433,7 +433,7 @@ int eth_set_dev_conf_raw(openair0_device *device) {
void *msg;
ssize_t msg_len;
/* a BBU client sends to RRH a set of configuration parameters (openair0_config_t)
/* a RAU client sends to RRU a set of configuration parameters (openair0_config_t)
so that RF front end is configured appropriately and
frame/packet size etc. can be set */
@@ -464,7 +464,7 @@ int eth_set_dev_conf_raw_IF4p5(openair0_device *device) {
void *msg;
ssize_t msg_len;
/* a BBU client sends to RRH a set of configuration parameters (openair0_config_t)
/* a RAU client sends to RRU a set of configuration parameters (openair0_config_t)
so that RF front end is configured appropriately and
frame/packet size etc. can be set */
@@ -496,7 +496,7 @@ int eth_get_dev_conf_raw(openair0_device *device) {
msg = malloc(MAC_HEADER_SIZE_BYTES + sizeof(openair0_config_t));
msg_len = MAC_HEADER_SIZE_BYTES + sizeof(openair0_config_t);
/* RRH receives from BBU openair0_config_t */
/* RRU receives from RAU openair0_config_t */
if (recv(eth->sockfd,
msg,
msg_len,
@@ -505,11 +505,11 @@ int eth_get_dev_conf_raw(openair0_device *device) {
exit(0);
}
/* RRH stores the remote MAC address */
/* RRU stores the remote MAC address */
memcpy(eth->eh.ether_dhost,(msg+ETH_ALEN),ETH_ALEN);
//memcpy((void*)&device->openair0_cfg,(msg + MAC_HEADER_SIZE_BYTES), sizeof(openair0_config_t));
device->openair0_cfg=(openair0_config_t *)(msg + MAC_HEADER_SIZE_BYTES);
printf("[%s] binding mod to hardware address %x:%x:%x:%x:%x:%x hardware address %x:%x:%x:%x:%x:%x\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"),eth->eh.ether_shost[0],eth->eh.ether_shost[1],eth->eh.ether_shost[2],eth->eh.ether_shost[3],eth->eh.ether_shost[4],eth->eh.ether_shost[5],eth->eh.ether_dhost[0],eth->eh.ether_dhost[1],eth->eh.ether_dhost[2],eth->eh.ether_dhost[3],eth->eh.ether_dhost[4],eth->eh.ether_dhost[5]);
printf("[%s] binding mod to hardware address %x:%x:%x:%x:%x:%x hardware address %x:%x:%x:%x:%x:%x\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"),eth->eh.ether_shost[0],eth->eh.ether_shost[1],eth->eh.ether_shost[2],eth->eh.ether_shost[3],eth->eh.ether_shost[4],eth->eh.ether_shost[5],eth->eh.ether_dhost[0],eth->eh.ether_dhost[1],eth->eh.ether_dhost[2],eth->eh.ether_dhost[3],eth->eh.ether_dhost[4],eth->eh.ether_dhost[5]);
return 0;
}
@@ -525,7 +525,7 @@ int eth_get_dev_conf_raw_IF4p5(openair0_device *device) {
msg = malloc(MAC_HEADER_SIZE_BYTES + sizeof(openair0_config_t));
msg_len = MAC_HEADER_SIZE_BYTES + sizeof(openair0_config_t);
/* RRH receives from BBU openair0_config_t */
/* RRU receives from RAU openair0_config_t */
if (recv(eth->sockfd,
msg,
msg_len,
@@ -534,11 +534,11 @@ int eth_get_dev_conf_raw_IF4p5(openair0_device *device) {
exit(0);
}
/* RRH stores the remote MAC address */
/* RRU stores the remote MAC address */
memcpy(eth->eh.ether_dhost,(msg+ETH_ALEN),ETH_ALEN);
//memcpy((void*)&device->openair0_cfg,(msg + MAC_HEADER_SIZE_BYTES), sizeof(openair0_config_t));
//device->openair0_cfg=(openair0_config_t *)(msg + MAC_HEADER_SIZE_BYTES);
printf("[%s] binding mod to hardware address %x:%x:%x:%x:%x:%x hardware address %x:%x:%x:%x:%x:%x\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"),eth->eh.ether_shost[0],eth->eh.ether_shost[1],eth->eh.ether_shost[2],eth->eh.ether_shost[3],eth->eh.ether_shost[4],eth->eh.ether_shost[5],eth->eh.ether_dhost[0],eth->eh.ether_dhost[1],eth->eh.ether_dhost[2],eth->eh.ether_dhost[3],eth->eh.ether_dhost[4],eth->eh.ether_dhost[5]);
printf("[%s] binding mod to hardware address %x:%x:%x:%x:%x:%x hardware address %x:%x:%x:%x:%x:%x\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"),eth->eh.ether_shost[0],eth->eh.ether_shost[1],eth->eh.ether_shost[2],eth->eh.ether_shost[3],eth->eh.ether_shost[4],eth->eh.ether_shost[5],eth->eh.ether_dhost[0],eth->eh.ether_dhost[1],eth->eh.ether_dhost[2],eth->eh.ether_dhost[3],eth->eh.ether_dhost[4],eth->eh.ether_dhost[5]);
return 0;
}
+184 -40
View File
@@ -45,6 +45,7 @@
#include "common_lib.h"
#include "ethernet_lib.h"
#include "common/ran_context.h"
#define DEBUG 0
//struct sockaddr_in dest_addr[MAX_INST];
@@ -59,6 +60,8 @@ uint16_t pck_seq_num_prev=0;
int eth_socket_init_udp(openair0_device *device) {
eth_state_t *eth = (eth_state_t*)device->priv;
eth_params_t *eth_params = device->eth_params;
char str_local[INET_ADDRSTRLEN];
char str_remote[INET_ADDRSTRLEN];
const char *local_ip, *remote_ip;
@@ -68,18 +71,18 @@ int eth_socket_init_udp(openair0_device *device) {
int sock_proto=0;
int enable=1;
if (device->host_type == RRH_HOST ) {
local_ip = device->openair0_cfg->my_addr;
local_port = device->openair0_cfg->my_port;
if (device->host_type == RRU_HOST ) {
local_ip = eth_params->my_addr;
local_port = eth_params->my_port;
remote_ip = "0.0.0.0";
remote_port = 0;
printf("[%s] local ip addr %s port %d\n", "RRH", local_ip, local_port);
printf("[%s] local ip addr %s port %d\n", "RRU", local_ip, local_port);
} else {
local_ip = device->openair0_cfg->my_addr;
local_port = device->openair0_cfg->my_port;
remote_ip = device->openair0_cfg->remote_addr;
remote_port = device->openair0_cfg->remote_port;
printf("[%s] local ip addr %s port %d\n","BBU", local_ip, local_port);
local_ip = eth_params->my_addr;
local_port = eth_params->my_port;
remote_ip = eth_params->remote_addr;
remote_port = eth_params->remote_port;
printf("[%s] local ip addr %s port %d\n","RAU", local_ip, local_port);
}
/* Open socket to send on */
@@ -122,7 +125,7 @@ int eth_socket_init_udp(openair0_device *device) {
perror("ETHERNET: Cannot bind to socket");
exit(0);
} else {
printf("[%s] binding to %s:%d\n","RRH",str_local,ntohs(eth->local_addr.sin_port));
printf("[%s] binding to %s:%d\n","RAU",str_local,ntohs(eth->local_addr.sin_port));
}
return 0;
@@ -202,6 +205,10 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam
eth_state_t *eth = (eth_state_t*)device->priv;
ssize_t packet_size;
char str[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &(eth->dest_addr.sin_addr), str, INET_ADDRSTRLEN);
if (flags == IF4p5_PDLFFT) {
packet_size = UDP_IF4p5_PDLFFT_SIZE_BYTES(nblocks);
@@ -217,6 +224,8 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam
}
eth->tx_nsamps = nblocks;
printf("Sending %d bytes to %s\n",packet_size,str);
bytes_sent = sendto(eth->sockfd,
buff[0],
packet_size,
@@ -232,7 +241,6 @@ int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestam
eth->tx_actual_nsamps = bytes_sent>>1;
eth->tx_count++;
}
return (bytes_sent);
}
@@ -294,7 +302,7 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi
*(int16_t *)(buff2 + sizeof(int16_t)),
*(openair0_timestamp *)(buff2 + sizeof(int32_t)),
bytes_sent);
dump_packet((device->host_type == BBU_HOST)? "BBU":"RRH", buff2, UDP_PACKET_SIZE_BYTES(nsamps), TX_FLAG);
dump_packet((device->host_type == RAU_HOST)? "RAU":"RAU", buff2, UDP_PACKET_SIZE_BYTES(nsamps), TX_FLAG);
#endif
eth->tx_actual_nsamps=bytes_sent>>2;
eth->tx_count++;
@@ -382,7 +390,7 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
*(int16_t *)(buff2 + sizeof(int16_t)),
*(openair0_timestamp *)(buff2 + sizeof(int32_t)),
bytes_received);
dump_packet((device->host_type == BBU_HOST)? "BBU":"RRH", buff2, UDP_PACKET_SIZE_BYTES(nsamps),RX_FLAG);
dump_packet((device->host_type == RAU_HOST)? "RAU":"RRU", buff2, UDP_PACKET_SIZE_BYTES(nsamps),RX_FLAG);
#endif
/* store the timestamp value from packet's header */
@@ -420,19 +428,70 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
int eth_set_dev_conf_udp(openair0_device *device) {
eth_state_t *eth = (eth_state_t*)device->priv;
void *msg;
ssize_t msg_len;
ssize_t msg_len,len;
RRU_CONFIG_msg_t rru_config_msg;
int received_capabilities=0;
char str[INET_ADDRSTRLEN];
/* a BBU client sents to RRH a set of configuration parameters (openair0_config_t)
so that RF front end is configured appropriately and
frame/packet size etc. can be set */
inet_ntop(AF_INET, &(eth->dest_addr.sin_addr), str, INET_ADDRSTRLEN);
msg=malloc(sizeof(openair0_config_t));
msg_len=sizeof(openair0_config_t);
memcpy(msg,(void*)device->openair0_cfg,msg_len);
// Wait for capabilities
while (received_capabilities==0) {
rru_config_msg.type = RAU_tick;
rru_config_msg.len = sizeof(RRU_CONFIG_msg_t)-MAX_RRU_CONFIG_SIZE;
printf("Sending RAU tick to RRU on %s\n",str);
if (sendto(eth->sockfd,&rru_config_msg,rru_config_msg.len,0,(struct sockaddr *)&eth->dest_addr,eth->addr_len)==-1) {
perror("ETHERNET: sendto conf_udp");
printf("addr_len : %d, msg_len %d\n",eth->addr_len,msg_len);
exit(0);
}
msg_len = sizeof(RRU_CONFIG_msg_t)-MAX_RRU_CONFIG_SIZE+sizeof(RRU_capabilities_t);
if (sendto(eth->sockfd,msg,msg_len,0,(struct sockaddr *)&eth->dest_addr,eth->addr_len)==-1) {
// wait for answer with timeout
if (len = recvfrom(eth->sockfd,
&rru_config_msg,
msg_len,
0,
(struct sockaddr *)&eth->dest_addr,
(socklen_t *)&eth->addr_len)<0) {
printf("Waiting for RRU on %s\n",str);
}
else if (rru_config_msg.type == RRU_capabilities) {
AssertFatal(rru_config_msg.len==msg_len,"Received capabilities with incorrect length (%d!=%d)\n",rru_config_msg.len,msg_len);
printf("Received capabilities from RRU on %s (len %d/%d, num_bands %d,max_pdschReferenceSignalPower %d, max_rxgain %d, nb_tx %d, nb_rx %d)\n",str,
rru_config_msg.len,msg_len,
((RRU_capabilities_t*)&rru_config_msg.msg[0])->num_bands,
((RRU_capabilities_t*)&rru_config_msg.msg[0])->max_pdschReferenceSignalPower[0],
((RRU_capabilities_t*)&rru_config_msg.msg[0])->max_rxgain[0],
((RRU_capabilities_t*)&rru_config_msg.msg[0])->nb_tx[0],
((RRU_capabilities_t*)&rru_config_msg.msg[0])->nb_rx[0]);
received_capabilities=1;
}
else {
printf("Received incorrect message %d from RRU on %s\n",rru_config_msg.type,str);
}
}
AssertFatal(device->configure_rru!=NULL,"device->configure_rru is null for RRU %d, shouldn't be ...\n",device->Mod_id);
device->configure_rru(device->Mod_id,
(RRU_capabilities_t *)&rru_config_msg.msg[0]);
rru_config_msg.type = RRU_config;
rru_config_msg.len = sizeof(RRU_CONFIG_msg_t)-MAX_RRU_CONFIG_SIZE+sizeof(RRU_config_t);
printf("Sending Configuration to RRU on %s (num_bands %d,band0 %d,txfreq %u,rxfreq %u,att_tx %d,att_rx %d,N_RB_DL %d,N_RB_UL %d,3/4FS %d, prach_FO %d, prach_CI %d)\n",str,
((RRU_config_t *)&rru_config_msg.msg[0])->num_bands,
((RRU_config_t *)&rru_config_msg.msg[0])->band_list[0],
((RRU_config_t *)&rru_config_msg.msg[0])->tx_freq[0],
((RRU_config_t *)&rru_config_msg.msg[0])->rx_freq[0],
((RRU_config_t *)&rru_config_msg.msg[0])->att_tx[0],
((RRU_config_t *)&rru_config_msg.msg[0])->att_rx[0],
((RRU_config_t *)&rru_config_msg.msg[0])->N_RB_DL[0],
((RRU_config_t *)&rru_config_msg.msg[0])->N_RB_UL[0],
((RRU_config_t *)&rru_config_msg.msg[0])->threequarter_fs[0],
((RRU_config_t *)&rru_config_msg.msg[0])->prach_FreqOffset[0],
((RRU_config_t *)&rru_config_msg.msg[0])->prach_ConfigIndex[0]);
if (sendto(eth->sockfd,&rru_config_msg,rru_config_msg.len,0,(struct sockaddr *)&eth->dest_addr,eth->addr_len)==-1) {
perror("ETHERNET: sendto conf_udp");
printf("addr_len : %d, msg_len %d\n",eth->addr_len,msg_len);
exit(0);
@@ -441,30 +500,115 @@ int eth_set_dev_conf_udp(openair0_device *device) {
return 0;
}
extern RAN_CONTEXT_t RC;
int eth_get_dev_conf_udp(openair0_device *device) {
eth_state_t *eth = (eth_state_t*)device->priv;
char str1[INET_ADDRSTRLEN],str[INET_ADDRSTRLEN];
void *msg;
ssize_t msg_len;
msg=malloc(sizeof(openair0_config_t));
msg_len=sizeof(openair0_config_t);
eth_state_t *eth = (eth_state_t*)device->priv;
char str1[INET_ADDRSTRLEN],str[INET_ADDRSTRLEN];
void *msg;
RRU_CONFIG_msg_t rru_config_msg;
ssize_t msg_len;
int tick_received = 0;
int configuration_received = 0;
RRU_capabilities_t *cap;
RU_t *ru = RC.ru[0];
int i;
inet_ntop(AF_INET, &(eth->local_addr.sin_addr), str, INET_ADDRSTRLEN);
inet_ntop(AF_INET, &(eth->dest_addr.sin_addr), str1, INET_ADDRSTRLEN);
/* RRH receives from BBU openair0_config_t */
if (recvfrom(eth->sockfd,
msg,
msg_len,
0,
(struct sockaddr *)&eth->dest_addr,
(socklen_t *)&eth->addr_len)==-1) {
perror("ETHERNET: recv_from conf_udp");
// wait for RAU_tick
while (tick_received == 0) {
msg_len = sizeof(RRU_CONFIG_msg_t)-MAX_RRU_CONFIG_SIZE;
if (recvfrom(eth->sockfd,
&rru_config_msg,
msg_len,
0,
(struct sockaddr *)&eth->dest_addr,
(socklen_t *)&eth->addr_len)<0) {
printf("RRU on %s Waiting for RAU on %s\n",str,str1);
}
else {
if (rru_config_msg.type == RAU_tick) {
printf("Tick received from RAU on %s\n",str1);
tick_received = 1;
}
}
}
// send capabilities
rru_config_msg.type = RRU_capabilities;
rru_config_msg.len = sizeof(RRU_CONFIG_msg_t)-MAX_RRU_CONFIG_SIZE+sizeof(RRU_capabilities_t);
cap = (RRU_capabilities_t*)&rru_config_msg.msg[0];
printf("Sending Capabilities (len %d, num_bands %d,max_pdschReferenceSignalPower %d, max_rxgain %d, nb_tx %d, nb_rx %d)\n",
rru_config_msg.len,ru->num_bands,ru->max_pdschReferenceSignalPower,ru->max_rxgain,ru->nb_tx,ru->nb_rx);
switch (ru->function) {
case NGFI_RRU_IF4p5:
cap->FH_fmt = OAI_IF4p5_only;
break;
case NGFI_RRU_IF5:
cap->FH_fmt = OAI_IF5_only;
break;
case MBP_RRU_IF5:
cap->FH_fmt = MBP_IF5;
break;
default:
AssertFatal(1==0,"RU_function is unknown %d\n",RC.ru[0]->function);
break;
}
cap->num_bands = ru->num_bands;
for (i=0;i<ru->num_bands;i++) {
cap->band_list[i] = ru->band[i];
cap->nb_rx[i] = ru->nb_rx;
cap->nb_tx[i] = ru->nb_tx;
cap->max_pdschReferenceSignalPower[i] = ru->max_pdschReferenceSignalPower;
cap->max_rxgain[i] = ru->max_rxgain;
}
if (sendto(eth->sockfd,&rru_config_msg,rru_config_msg.len,0,(struct sockaddr *)&eth->dest_addr,eth->addr_len)==-1) {
perror("ETHERNET: sendto conf_udp");
printf("addr_len : %d, msg_len %d\n",eth->addr_len,msg_len);
exit(0);
}
device->openair0_cfg=(openair0_config_t *)msg;
// wait for configuration
rru_config_msg.len = sizeof(RRU_CONFIG_msg_t)-MAX_RRU_CONFIG_SIZE+sizeof(RRU_config_t);
while (configuration_received == 0) {
if (recvfrom(eth->sockfd,
&rru_config_msg,
rru_config_msg.len,
0,
(struct sockaddr *)&eth->dest_addr,
(socklen_t *)&eth->addr_len)==-1) {
printf("Waiting for configuration from RAU on %s\n",str1);
}
else {
printf("Configuration received from RAU on %s (num_bands %d,band0 %d,txfreq %u,rxfreq %u,att_tx %d,att_rx %d,N_RB_DL %d,N_RB_UL %d,3/4FS %d, prach_FO %d, prach_CI %d)\n",str,
((RRU_config_t *)&rru_config_msg.msg[0])->num_bands,
((RRU_config_t *)&rru_config_msg.msg[0])->band_list[0],
((RRU_config_t *)&rru_config_msg.msg[0])->tx_freq[0],
((RRU_config_t *)&rru_config_msg.msg[0])->rx_freq[0],
((RRU_config_t *)&rru_config_msg.msg[0])->att_tx[0],
((RRU_config_t *)&rru_config_msg.msg[0])->att_rx[0],
((RRU_config_t *)&rru_config_msg.msg[0])->N_RB_DL[0],
((RRU_config_t *)&rru_config_msg.msg[0])->N_RB_UL[0],
((RRU_config_t *)&rru_config_msg.msg[0])->threequarter_fs[0],
((RRU_config_t *)&rru_config_msg.msg[0])->prach_FreqOffset[0],
((RRU_config_t *)&rru_config_msg.msg[0])->prach_ConfigIndex[0]);
AssertFatal(device->configure_rru!=NULL,"device->configure_rru is null for RRU %d\n",device->Mod_id);
device->configure_rru(device->Mod_id,
(void*)&rru_config_msg.msg[0]);
configuration_received = 1;
}
}
// device->openair0_cfg=(openair0_config_t *)msg;
/* get remote ip address and port */
/* inet_ntop(AF_INET, &(eth->dest_addr.sin_addr), str1, INET_ADDRSTRLEN); */
@@ -476,6 +620,6 @@ int eth_get_dev_conf_udp(openair0_device *device) {
/* device->openair0_cfg->my_port =ntohs(eth->local_addr.sin_port); */
/* device->openair0_cfg->my_addr =str; */
/* printf("[RRH] mod_%d socket %d connected to BBU %s:%d %s:%d\n", Mod_id, eth->sockfd,str1, device->openair0_cfg->remote_port, str, device->openair0_cfg->my_port); */
/* printf("[RRU] mod_%d socket %d connected to BBU %s:%d %s:%d\n", Mod_id, eth->sockfd,str1, device->openair0_cfg->remote_port, str, device->openair0_cfg->my_port); */
return 0;
}
@@ -53,8 +53,12 @@ int trx_eth_start(openair0_device *device) {
if (eth->flags == ETH_RAW_MODE) {
printf("Setting ETHERNET to ETH_RAW_IF5_MODE\n");
if (eth_socket_init_raw(device)!=0) return -1;
/* RRH gets openair0 device configuration - BBU sets openair0 device configuration*/
if (device->host_type == BBU_HOST) {
/* RRU gets device configuration - RAU sets device configuration*/
printf("Setting Timenout to 999999 usecs\n");
if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1;
if (device->host_type == RAU_HOST) {
if(eth_set_dev_conf_raw(device)!=0) return -1;
} else {
if(eth_get_dev_conf_raw(device)!=0) return -1;
@@ -66,20 +70,27 @@ int trx_eth_start(openair0_device *device) {
printf("Setting ETHERNET to ETH_RAW_IF4p5_MODE\n");
if (eth_socket_init_raw(device)!=0) return -1;
/* RRH gets openair0 device configuration - BBU sets openair0 device configuration*/
if (device->host_type == BBU_HOST) {
printf("Setting Timenout to 999999 usecs\n");
if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1;
/* RRU gets openair0 device configuration - RAU sets openair0 device configuration*/
if (device->host_type == RAU_HOST) {
if(eth_set_dev_conf_raw_IF4p5(device)!=0) return -1;
} else {
if(eth_get_dev_conf_raw_IF4p5(device)!=0) return -1;
}
/* adjust MTU wrt number of samples per packet */
if(ethernet_tune (device,MTU_SIZE,RAW_IF4p5_PRACH_SIZE_BYTES)!=0) return -1;
if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1;
} else if (eth->flags == ETH_UDP_IF4p5_MODE) {
printf("Setting ETHERNET to UDP_IF4p5_MODE\n");
if (eth_socket_init_udp(device)!=0) return -1;
if (device->host_type == BBU_HOST) {
printf("Setting Timenout to 999999 usecs\n");
if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1;
if (device->host_type == RAU_HOST) {
if(eth_set_dev_conf_udp(device)!=0) return -1;
} else {
if(eth_get_dev_conf_udp(device)!=0) return -1;
@@ -87,9 +98,10 @@ int trx_eth_start(openair0_device *device) {
/* adjust MTU wrt number of samples per packet */
/*if(ethernet_tune (device,MTU_SIZE,UDP_IF4p5_PRACH_SIZE_BYTES)!=0) return -1;
if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1;*/
*/
} else if (eth->flags == ETH_RAW_IF5_MOBIPASS) {
printf("Setting ETHERNET to RAW_IF5_MODE\n");
if (eth_socket_init_raw(device)!=0) return -1;
@@ -98,8 +110,8 @@ int trx_eth_start(openair0_device *device) {
} else {
printf("Setting ETHERNET to UDP_IF5_MODE\n");
if (eth_socket_init_udp(device)!=0) return -1;
/* RRH gets openair0 device configuration - BBU sets openair0 device configuration*/
if (device->host_type == BBU_HOST) {
/* RRU gets openair0 device configuration - RAU sets openair0 device configuration*/
if (device->host_type == RAU_HOST) {
if(eth_set_dev_conf_udp(device)!=0) return -1;
} else {
if(eth_get_dev_conf_udp(device)!=0) return -1;
@@ -126,7 +138,7 @@ void trx_eth_end(openair0_device *device) {
perror("ETHERNET: Failed to close socket");
exit(0);
} else {
printf("[%s] socket has been successfully closed.\n",(device->host_type == BBU_HOST)? "BBU":"RRH");
printf("[%s] socket has been successfully closed.\n",(device->host_type == RAU_HOST)? "RAU":"RRU");
}
}
@@ -135,7 +147,7 @@ int trx_eth_request(openair0_device *device, void *msg, ssize_t msg_len) {
eth_state_t *eth = (eth_state_t*)device->priv;
/* BBU sends a message to RRH */
/* RAU sends a message to RRU */
if (sendto(eth->sockfd,msg,msg_len,0,(struct sockaddr *)&eth->dest_addr,eth->addr_len)==-1) {
perror("ETHERNET: ");
@@ -149,7 +161,7 @@ int trx_eth_reply(openair0_device *device, void *msg, ssize_t msg_len) {
eth_state_t *eth = (eth_state_t*)device->priv;
/* RRH receives from BBU a message */
/* RRU receives from RAU a message */
if (recvfrom(eth->sockfd,
msg,
@@ -349,7 +361,7 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth
eth->flags = ETH_RAW_MODE;
}
printf("[ETHERNET]: Initializing openair0_device for %s ...\n", ((device->host_type == BBU_HOST) ? "BBU": "RRH"));
printf("[ETHERNET]: Initializing openair0_device for %s ...\n", ((device->host_type == RAU_HOST) ? "RAU": "RRU"));
device->Mod_id = 0;//num_devices_eth++;
device->transp_type = ETHERNET_TP;
device->trx_start_func = trx_eth_start;
@@ -390,9 +402,10 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth
openair0_cfg[0].iq_txshift = eth_params->iq_txshift;// shift
openair0_cfg[0].tx_sample_advance = eth_params->tx_sample_advance;
/* RRH does not have any information to make this configuration atm */
if (device->host_type == BBU_HOST) {
/*Note scheduling advance values valid only for case 7680000 */
/* RRU does not have any information to make this configuration atm */
/*
if (device->host_type == RAU_HOST) {
switch ((int)openair0_cfg[0].sample_rate) {
case 30720000:
openair0_cfg[0].samples_per_packet = 3840;
@@ -414,7 +427,8 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth
exit(-1);
break;
}
}
}*/
device->openair0_cfg=&openair0_cfg[0];
return 0;
}
@@ -455,7 +469,7 @@ void dump_dev(openair0_device *device) {
printf(" Log level is %i :\n" ,device->openair0_cfg->log_level);
printf(" RB number: %i, sample rate: %lf \n" ,
device->openair0_cfg->num_rb_dl, device->openair0_cfg->sample_rate);
printf(" BBU configured for %i tx/%i rx channels)\n",
printf(" RAU configured for %i tx/%i rx channels)\n",
device->openair0_cfg->tx_num_channels,device->openair0_cfg->rx_num_channels);
printf(" Running flags: %s %s (\n",
((eth->flags & ETH_RAW_MODE) ? "RAW socket mode - ":""),
@@ -158,6 +158,80 @@ typedef enum {
MAX_OPT
} eth_opt_t;
#define MAX_RRU_CONFIG_SIZE 1024
typedef enum {
RAU_tick=0,
RRU_capabilities=1,
RRU_config=2,
RRU_MSG_max_num=3
} rru_config_msg_type_t;
typedef struct RRU_CONFIG_msg_s {
rru_config_msg_type_t type;
ssize_t len;
uint8_t msg[MAX_RRU_CONFIG_SIZE];
} RRU_CONFIG_msg_t;
typedef enum {
OAI_IF5_only =0,
OAI_IF4p5_only =1,
OAI_IF5_and_IF4p5 =2,
MBP_IF5 =3,
MAX_FH_FMTs =4
} FH_fmt_options_t;
#define MAX_BANDS_PER_RRU 4
typedef struct RRU_capabilities_s {
/// Fronthaul format
FH_fmt_options_t FH_fmt;
/// number of EUTRA bands (<=4) supported by RRU
uint8_t num_bands;
/// EUTRA band list supported by RRU
uint8_t band_list[MAX_BANDS_PER_RRU];
/// Number of concurrent bands (component carriers)
uint8_t num_concurrent_bands;
/// Maximum TX EPRE of each band
int8_t max_pdschReferenceSignalPower[MAX_BANDS_PER_RRU];
/// Maximum RX gain of each band
uint8_t max_rxgain[MAX_BANDS_PER_RRU];
/// Number of RX ports of each band
uint8_t nb_rx[MAX_BANDS_PER_RRU];
/// Number of TX ports of each band
uint8_t nb_tx[MAX_BANDS_PER_RRU];
/// max DL bandwidth (1,6,15,25,50,75,100)
uint8_t N_RB_DL[MAX_BANDS_PER_RRU];
/// max UL bandwidth (1,6,15,25,50,75,100)
uint8_t N_RB_UL[MAX_BANDS_PER_RRU];
} RRU_capabilities_t;
typedef struct RRU_config_s {
/// Fronthaul format
RU_if_south_t FH_fmt;
/// number of EUTRA bands (<=4) configured in RRU
uint8_t num_bands;
/// EUTRA band list configured in RRU
uint8_t band_list[MAX_BANDS_PER_RRU];
/// TX frequency
uint32_t tx_freq[MAX_BANDS_PER_RRU];
/// RX frequency
uint32_t rx_freq[MAX_BANDS_PER_RRU];
/// TX attenation w.r.t. max
uint8_t att_tx[MAX_BANDS_PER_RRU];
/// RX attenuation w.r.t. max
uint8_t att_rx[MAX_BANDS_PER_RRU];
/// DL bandwidth
uint8_t N_RB_DL[MAX_BANDS_PER_RRU];
/// UL bandwidth
uint8_t N_RB_UL[MAX_BANDS_PER_RRU];
/// 3/4 sampling rate
uint8_t threequarter_fs[MAX_BANDS_PER_RRU];
/// prach_FreqOffset for IF4p5
int prach_FreqOffset[MAX_BANDS_PER_RRU];
/// prach_ConfigIndex for IF4p5
int prach_ConfigIndex[MAX_BANDS_PER_RRU];
} RRU_config_t;
/*
#define SND_BUF_SIZE 1
#define RCV_BUF_SIZE 1<<1
@@ -343,7 +343,7 @@ extern "C" {
int device_init(openair0_device *device, openair0_config_t *openair0_cfg){
device->type=LMSSDR_DEV;
printf("LMSSDR: Initializing openair0_device for %s ...\n", ((device->host_type == BBU_HOST) ? "BBU": "RRH"));
printf("LMSSDR: Initializing openair0_device for %s ...\n", ((device->host_type == RAU_HOST) ? "RAU": "RRU"));
switch ((int)openair0_cfg[0].sample_rate) {
case 30720000:
@@ -154,21 +154,7 @@ eNBs =
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
rrh_gw_config = (
{
local_if_name = "lo";
remote_address = "127.0.0.1";
local_address = "127.0.0.2";
local_port = 50000; #for raw option local port must be the same to remote
remote_port = 50000;
rrh_gw_active = "yes";
tr_preference = "udp_if4p5";
rf_preference = "usrp_b200";
iq_txshift = 4;
tx_sample_advance = 80;
tx_scheduling_advance = 9;
}
);
log_config :
{
@@ -187,5 +173,18 @@ eNBs =
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
}
}
);
RUs = (
ru_config = (
{
local_rf = "no";
local_if_name = "lo";
remote_address = "127.0.0.1";
local_address = "127.0.0.2";
local_port = 50000; #for raw option local port must be the same to remote
remote_port = 50000;
}
);
);
@@ -154,21 +154,7 @@ eNBs =
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
rrh_gw_config = (
{
local_if_name = "lo";
remote_address = "127.0.0.1";
local_address = "127.0.0.2";
local_port = 50000; #for raw option local port must be the same to remote
remote_port = 50000;
rrh_gw_active = "yes";
tr_preference = "udp_if4p5";
rf_preference = "usrp_b200";
iq_txshift = 4;
tx_sample_advance = 80;
tx_scheduling_advance = 9;
}
);
log_config :
{
@@ -189,3 +175,20 @@ eNBs =
};
}
);
RUs = (
{
local_if_name = "lo";
remote_address = "127.0.0.1";
local_address = "127.0.0.2";
local_port = 50000; #for raw option local port must be the same to remote
remote_port = 50001;
local_rf = "no"
tr_preference = "udp_if4p5"
nb_tx = 1
nb_rx = 1
att_tx = 0
att_rx = 0;
eNB_instances = [0];
}
);
@@ -1,193 +1,12 @@
Active_eNBs = ( "eNB_Eurecom_LTEBox");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
eNBs =
(
{
////////// Identification parameters:
eNB_ID = 0xe00;
cell_type = "CELL_MACRO_ENB";
eNB_name = "eNB_Eurecom_LTEBox";
// Tracking area code, 0x0000 and 0xfffe are reserved values
tracking_area_code = "1";
mobile_country_code = "208";
mobile_network_code = "93";
////////// Physical parameters:
component_carriers = (
{
node_function = "NGFI_RRU_IF4p5";
node_timing = "synch_to_ext_device";
node_synch_ref = 0;
frame_type = "FDD";
tdd_config = 3;
tdd_config_s = 0;
prefix_type = "NORMAL";
eutra_band = 7;
downlink_frequency = 2685000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
N_RB_DL = 25;
Nid_cell_mbsfn = 0;
nb_antenna_ports = 1;
nb_antennas_tx = 1;
nb_antennas_rx = 1;
tx_gain = 90;
rx_gain = 120;
prach_root = 0;
prach_config_index = 0;
prach_high_speed = "DISABLE";
prach_zero_correlation = 1;
prach_freq_offset = 2;
pucch_delta_shift = 1;
pucch_nRB_CQI = 1;
pucch_nCS_AN = 0;
pucch_n1_AN = 32;
pdsch_referenceSignalPower = -29;
pdsch_p_b = 0;
pusch_n_SB = 1;
pusch_enable64QAM = "DISABLE";
pusch_hoppingMode = "interSubFrame";
pusch_hoppingOffset = 0;
pusch_groupHoppingEnabled = "ENABLE";
pusch_groupAssignment = 0;
pusch_sequenceHoppingEnabled = "DISABLE";
pusch_nDMRS1 = 1;
phich_duration = "NORMAL";
phich_resource = "ONESIXTH";
srs_enable = "DISABLE";
/* srs_BandwidthConfig =;
srs_SubframeConfig =;
srs_ackNackST =;
srs_MaxUpPts =;*/
pusch_p0_Nominal = -95;
pusch_alpha = "AL1";
pucch_p0_Nominal = -104;
msg3_delta_Preamble = 6;
pucch_deltaF_Format1 = "deltaF2";
pucch_deltaF_Format1b = "deltaF3";
pucch_deltaF_Format2 = "deltaF0";
pucch_deltaF_Format2a = "deltaF0";
pucch_deltaF_Format2b = "deltaF0";
rach_numberOfRA_Preambles = 64;
rach_preamblesGroupAConfig = "DISABLE";
/*
rach_sizeOfRA_PreamblesGroupA = ;
rach_messageSizeGroupA = ;
rach_messagePowerOffsetGroupB = ;
*/
rach_powerRampingStep = 4;
rach_preambleInitialReceivedTargetPower = -104;
rach_preambleTransMax = 10;
rach_raResponseWindowSize = 10;
rach_macContentionResolutionTimer = 48;
rach_maxHARQ_Msg3Tx = 4;
pcch_default_PagingCycle = 128;
pcch_nB = "oneT";
bcch_modificationPeriodCoeff = 2;
ue_TimersAndConstants_t300 = 1000;
ue_TimersAndConstants_t301 = 1000;
ue_TimersAndConstants_t310 = 1000;
ue_TimersAndConstants_t311 = 10000;
ue_TimersAndConstants_n310 = 20;
ue_TimersAndConstants_n311 = 1;
ue_TransmissionMode = 1;
}
);
srb1_parameters :
{
# timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
timer_poll_retransmit = 80;
# timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
timer_reordering = 35;
# timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
timer_status_prohibit = 0;
# poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
poll_pdu = 4;
# poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
poll_byte = 99999;
# max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
max_retx_threshold = 4;
}
# ------- SCTP definitions
SCTP :
{
# Number of streams to use in input/output
SCTP_INSTREAMS = 2;
SCTP_OUTSTREAMS = 2;
};
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.12.11";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth3";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.215/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth3";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.215/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
rrh_gw_config = (
{
RUs = (
{
local_if_name = "lo";
remote_address = "127.0.0.2";
local_address = "127.0.0.1";
local_port = 50000; #for raw option local port must be the same to remote
remote_port = 50000;
rrh_gw_active = "yes";
remote_port = 50000;
local_rf = "yes"
tr_preference = "udp_if4p5";
rf_preference = "usrp_b200";
iq_txshift = 4;
tx_sample_advance = 80;
tx_scheduling_advance = 9;
}
);
);
log_config :
{
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="high";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
}
);
+162 -1844
View File
File diff suppressed because it is too large Load Diff
+877 -454
View File
File diff suppressed because it is too large Load Diff
+146 -305
View File
@@ -56,6 +56,8 @@
#include "PHY/types.h"
#include "PHY/defs.h"
#include "common/ran_context.h"
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
@@ -110,16 +112,18 @@ extern int netlink_init(void);
#include "stats.h"
#endif
// In lte-ru.c
extern void init_RU(const char*);
// In lte-enb.c
extern int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_cfg);
extern void init_eNB(eNB_func_t *, eNB_timing_t *,int,eth_params_t *,int,int);
extern void init_eNB(int,int);
extern void stop_eNB(int);
extern void kill_eNB_proc(void);
// In lte-ue.c
extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
extern void fill_ue_band_info(void);
extern void init_UE(int);
extern void init_UE(int,int,int);
#ifdef XFORMS
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
@@ -223,19 +227,22 @@ int otg_enabled;
#endif
//int number_of_cards = 1;
/*
node_function_t node_function[MAX_NUM_CCs];
node_timing_t node_timing[MAX_NUM_CCs];
int16_t node_synch_ref[MAX_NUM_CCs];
RU_if_in_t ru_if_in[NUMBER_OF_RU_MAX];
*/
static LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
eNB_func_t node_function[MAX_NUM_CCs];
eNB_timing_t node_timing[MAX_NUM_CCs];
int16_t node_synch_ref[MAX_NUM_CCs];
uint32_t target_dl_mcs = 28; //maximum allowed mcs
uint32_t target_ul_mcs = 20;
uint32_t timing_advance = 0;
uint8_t exit_missed_slots=1;
uint64_t num_missed_slots=0; // counter for the number of missed slots
extern void reset_opp_meas(void);
extern void print_opp_meas(void);
int transmission_mode=1;
@@ -270,12 +277,6 @@ int16_t osa_log_verbosity = LOG_MED;
char *rrh_UE_ip = "127.0.0.1";
int rrh_UE_port = 51000;
/* flag set by eNB conf file to specify if the radio head is local or remote (default option is local) */
uint8_t local_remote_radio = BBU_LOCAL_RADIO_HEAD;
/* struct for ethernet specific parameters given in eNB conf file */
eth_params_t *eth_params;
@@ -283,7 +284,8 @@ openair0_config_t openair0_cfg[MAX_CARDS];
double cpuf;
char uecap_xer[1024],uecap_xer_in=0;
extern char uecap_xer[1024];
char uecap_xer_in=0;
int oaisim_flag=0;
@@ -416,19 +418,28 @@ void help (void) {
void exit_fun(const char* s)
{
int CC_id;
int ru_id;
if (s != NULL) {
printf("%s %s() Exiting OAI softmodem: %s\n",__FILE__, __FUNCTION__, s);
}
oai_exit = 1;
if (UE_flag==0) {
for (ru_id=0; ru_id<RC.nb_RU;ru_id++) {
if (RC.ru[ru_id]->rfdevice.trx_end_func)
RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
if (RC.ru[ru_id]->ifdevice.trx_end_func)
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
}
}
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
if (UE_flag == 0) {
if (PHY_vars_eNB_g[0][CC_id]->rfdevice.trx_end_func)
PHY_vars_eNB_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_eNB_g[0][CC_id]->rfdevice);
if (PHY_vars_eNB_g[0][CC_id]->ifdevice.trx_end_func)
PHY_vars_eNB_g[0][CC_id]->ifdevice.trx_end_func(&PHY_vars_eNB_g[0][CC_id]->ifdevice);
/* Note: This is for later, when eNB can be split at IF2
if (RC.eNB[0][CC_id]->ifdevice.trx_end_func)
RC.eNB[0][CC_id]->ifdevice.trx_end_func(&RC.eNB[0][CC_id]->ifdevice); */
}
else {
if (PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func)
@@ -449,7 +460,7 @@ void exit_fun(const char* s)
void reset_stats(FL_OBJECT *button, long arg)
{
int i,j,k;
PHY_VARS_eNB *phy_vars_eNB = PHY_vars_eNB_g[0][0];
PHY_VARS_eNB *phy_vars_eNB = RC.eNB[0][0];
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
for (k=0; k<8; k++) { //harq_processes
@@ -515,16 +526,16 @@ static void *scope_thread(void *arg)
0,7);
} else {
if (PHY_vars_eNB_g[0][0]->mac_enabled==1) {
if (RC.eNB[0][0]->mac_enabled==1) {
len = dump_eNB_l2_stats (stats_buffer, 0);
//fl_set_object_label(form_stats_l2->stats_text, stats_buffer);
fl_clear_browser(form_stats_l2->stats_text);
fl_add_browser_line(form_stats_l2->stats_text, stats_buffer);
}
len = dump_eNB_stats (PHY_vars_eNB_g[0][0], stats_buffer, 0);
len = dump_eNB_stats (RC.eNB[0][0], stats_buffer, 0);
if (MAX_NUM_CCs>1)
len += dump_eNB_stats (PHY_vars_eNB_g[0][1], &stats_buffer[len], 0);
len += dump_eNB_stats (RC.eNB[0][1], &stats_buffer[len], 0);
//fl_set_object_label(form_stats->stats_text, stats_buffer);
fl_clear_browser(form_stats->stats_text);
@@ -533,10 +544,10 @@ static void *scope_thread(void *arg)
ue_cnt=0;
for(UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
// if ((PHY_vars_eNB_g[0][CC_id]->dlsch[UE_id][0]->rnti>0) && (ue_cnt<scope_enb_num_ue)) {
// if ((RC.eNB[0][CC_id]->dlsch[UE_id][0]->rnti>0) && (ue_cnt<scope_enb_num_ue)) {
if ((ue_cnt<scope_enb_num_ue)) {
phy_scope_eNB(form_enb[CC_id][ue_cnt],
PHY_vars_eNB_g[0][CC_id],
RC.eNB[0][CC_id],
UE_id);
ue_cnt++;
}
@@ -671,7 +682,6 @@ static void get_options (int argc, char **argv)
const Enb_properties_array_t *enb_properties;
enum long_option_e {
LONG_OPTION_START = 0x100, /* Start after regular single char options */
@@ -1064,161 +1074,37 @@ static void get_options (int argc, char **argv)
AssertFatal(conf_config_file_name != NULL,"Please provide a configuration file\n");
if ((UE_flag == 0) && (conf_config_file_name != NULL)) {
int i,j;
NB_eNB_INST = 1;
/* Read eNB configuration file */
enb_properties = enb_config_init(conf_config_file_name);
AssertFatal (NB_eNB_INST <= enb_properties->number,
"Number of eNB is greater than eNB defined in configuration file %s (%d/%d)!",
conf_config_file_name, NB_eNB_INST, enb_properties->number);
/* Update some simulation parameters */
for (i=0; i < enb_properties->number; i++) {
AssertFatal (MAX_NUM_CCs == enb_properties->properties[i]->nb_cc,
"lte-softmodem compiled with MAX_NUM_CCs=%d, but only %d CCs configured for eNB %d!",
MAX_NUM_CCs, enb_properties->properties[i]->nb_cc, i);
eth_params = (eth_params_t*)malloc(enb_properties->properties[i]->nb_rrh_gw * sizeof(eth_params_t));
memset(eth_params, 0, enb_properties->properties[i]->nb_rrh_gw * sizeof(eth_params_t));
for (j=0; j<enb_properties->properties[i]->nb_rrh_gw; j++) {
if (enb_properties->properties[i]->rrh_gw_config[j].active == 1 ) {
local_remote_radio = BBU_REMOTE_RADIO_HEAD;
(eth_params+j)->local_if_name = enb_properties->properties[i]->rrh_gw_config[j].rrh_gw_if_name;
(eth_params+j)->my_addr = enb_properties->properties[i]->rrh_gw_config[j].local_address;
(eth_params+j)->my_port = enb_properties->properties[i]->rrh_gw_config[j].local_port;
(eth_params+j)->remote_addr = enb_properties->properties[i]->rrh_gw_config[j].remote_address;
(eth_params+j)->remote_port = enb_properties->properties[i]->rrh_gw_config[j].remote_port;
if (enb_properties->properties[i]->rrh_gw_config[j].raw == 1) {
(eth_params+j)->transp_preference = ETH_RAW_MODE;
} else if (enb_properties->properties[i]->rrh_gw_config[j].rawif4p5 == 1) {
(eth_params+j)->transp_preference = ETH_RAW_IF4p5_MODE;
} else if (enb_properties->properties[i]->rrh_gw_config[j].udpif4p5 == 1) {
(eth_params+j)->transp_preference = ETH_UDP_IF4p5_MODE;
} else if (enb_properties->properties[i]->rrh_gw_config[j].rawif5_mobipass == 1) {
(eth_params+j)->transp_preference = ETH_RAW_IF5_MOBIPASS;
} else {
(eth_params+j)->transp_preference = ETH_UDP_MODE;
}
(eth_params+j)->iq_txshift = enb_properties->properties[i]->rrh_gw_config[j].iq_txshift;
(eth_params+j)->tx_sample_advance = enb_properties->properties[i]->rrh_gw_config[j].tx_sample_advance;
(eth_params+j)->tx_scheduling_advance = enb_properties->properties[i]->rrh_gw_config[j].tx_scheduling_advance;
if (enb_properties->properties[i]->rrh_gw_config[j].exmimo == 1) {
(eth_params+j)->rf_preference = EXMIMO_DEV;
} else if (enb_properties->properties[i]->rrh_gw_config[j].usrp_b200 == 1) {
(eth_params+j)->rf_preference = USRP_B200_DEV;
} else if (enb_properties->properties[i]->rrh_gw_config[j].usrp_x300 == 1) {
(eth_params+j)->rf_preference = USRP_X300_DEV;
} else if (enb_properties->properties[i]->rrh_gw_config[j].bladerf == 1) {
(eth_params+j)->rf_preference = BLADERF_DEV;
} else if (enb_properties->properties[i]->rrh_gw_config[j].lmssdr == 1) {
//(eth_params+j)->rf_preference = LMSSDR_DEV;
} else {
(eth_params+j)->rf_preference = 0;
}
} else {
local_remote_radio = BBU_LOCAL_RADIO_HEAD;
}
}
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
node_function[CC_id] = enb_properties->properties[i]->cc_node_function[CC_id];
node_timing[CC_id] = enb_properties->properties[i]->cc_node_timing[CC_id];
node_synch_ref[CC_id] = enb_properties->properties[i]->cc_node_synch_ref[CC_id];
frame_parms[CC_id]->frame_type = enb_properties->properties[i]->frame_type[CC_id];
frame_parms[CC_id]->tdd_config = enb_properties->properties[i]->tdd_config[CC_id];
frame_parms[CC_id]->tdd_config_S = enb_properties->properties[i]->tdd_config_s[CC_id];
frame_parms[CC_id]->Ncp = enb_properties->properties[i]->prefix_type[CC_id];
//for (j=0; j < enb_properties->properties[i]->nb_cc; j++ ){
frame_parms[CC_id]->Nid_cell = enb_properties->properties[i]->Nid_cell[CC_id];
frame_parms[CC_id]->N_RB_DL = enb_properties->properties[i]->N_RB_DL[CC_id];
frame_parms[CC_id]->N_RB_UL = enb_properties->properties[i]->N_RB_DL[CC_id];
frame_parms[CC_id]->nb_antennas_tx = enb_properties->properties[i]->nb_antennas_tx[CC_id];
frame_parms[CC_id]->nb_antenna_ports_eNB = enb_properties->properties[i]->nb_antenna_ports[CC_id];
frame_parms[CC_id]->nb_antennas_rx = enb_properties->properties[i]->nb_antennas_rx[CC_id];
frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_ConfigIndex = enb_properties->properties[i]->prach_config_index[CC_id];
frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_FreqOffset = enb_properties->properties[i]->prach_freq_offset[CC_id];
frame_parms[CC_id]->mode1_flag = (frame_parms[CC_id]->nb_antenna_ports_eNB == 1) ? 1 : 0;
frame_parms[CC_id]->threequarter_fs = threequarter_fs;
//} // j
}
init_all_otg(0);
g_otg->seed = 0;
init_seeds(g_otg->seed);
for (k=0; k<enb_properties->properties[i]->num_otg_elements; k++) {
j=enb_properties->properties[i]->otg_ue_id[k]; // ue_id
g_otg->application_idx[i][j] = 1;
//g_otg->packet_gen_type=SUBSTRACT_STRING;
g_otg->background[i][j][0] =enb_properties->properties[i]->otg_bg_traffic[k];
g_otg->application_type[i][j][0] =enb_properties->properties[i]->otg_app_type[k];// BCBR; //MCBR, BCBR
/* Read RC configuration file */
RCConfig(conf_config_file_name);
NB_eNB_INST = RC.nb_inst;
NB_RU = RC.nb_RU;
printf("[OTG] configuring traffic type %d for eNB %d UE %d (Background traffic is %s)\n",
g_otg->application_type[i][j][0], i, j,(g_otg->background[i][j][0]==1)?"Enabled":"Disabled");
}
printf("Read in %s : nb_inst %d, nb_ru %d\n",conf_config_file_name,NB_eNB_INST,NB_RU);
init_predef_traffic(enb_properties->properties[i]->num_otg_elements, 1);
glog_level = enb_properties->properties[i]->glog_level;
glog_verbosity = enb_properties->properties[i]->glog_verbosity;
hw_log_level = enb_properties->properties[i]->hw_log_level;
hw_log_verbosity = enb_properties->properties[i]->hw_log_verbosity ;
phy_log_level = enb_properties->properties[i]->phy_log_level;
phy_log_verbosity = enb_properties->properties[i]->phy_log_verbosity;
mac_log_level = enb_properties->properties[i]->mac_log_level;
mac_log_verbosity = enb_properties->properties[i]->mac_log_verbosity;
rlc_log_level = enb_properties->properties[i]->rlc_log_level;
rlc_log_verbosity = enb_properties->properties[i]->rlc_log_verbosity;
pdcp_log_level = enb_properties->properties[i]->pdcp_log_level;
pdcp_log_verbosity = enb_properties->properties[i]->pdcp_log_verbosity;
rrc_log_level = enb_properties->properties[i]->rrc_log_level;
rrc_log_verbosity = enb_properties->properties[i]->rrc_log_verbosity;
# if defined(ENABLE_USE_MME)
gtpu_log_level = enb_properties->properties[i]->gtpu_log_level;
gtpu_log_verbosity = enb_properties->properties[i]->gtpu_log_verbosity;
udp_log_level = enb_properties->properties[i]->udp_log_level;
udp_log_verbosity = enb_properties->properties[i]->udp_log_verbosity;
#endif
#if defined (ENABLE_SECURITY)
osa_log_level = enb_properties->properties[i]->osa_log_level;
osa_log_verbosity = enb_properties->properties[i]->osa_log_verbosity;
#endif
// adjust the log
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
for (k = 0 ; k < 4; k++) {
downlink_frequency[CC_id][k] = enb_properties->properties[i]->downlink_frequency[CC_id];
uplink_frequency_offset[CC_id][k] = enb_properties->properties[i]->uplink_frequency_offset[CC_id];
rx_gain[CC_id][k] = (double)enb_properties->properties[i]->rx_gain[CC_id];
tx_gain[CC_id][k] = (double)enb_properties->properties[i]->tx_gain[CC_id];
}
printf("Downlink frequency/ uplink offset of CC_id %d set to %ju/%d\n", CC_id,
enb_properties->properties[i]->downlink_frequency[CC_id],
enb_properties->properties[i]->uplink_frequency_offset[CC_id]);
} // CC_id
}// i
//this is needed for phy-test option
transmission_mode = enb_properties->properties[0]->ue_TransmissionMode[0]+1;
/*
init_all_otg(0);
g_otg->seed = 0;
init_seeds(g_otg->seed);
for (k=0; k<enb_properties->properties[i]->num_otg_elements; k++) {
j=enb_properties->properties[i]->otg_ue_id[k]; // ue_id
g_otg->application_idx[i][j] = 1;
//g_otg->packet_gen_type=SUBSTRACT_STRING;
g_otg->background[i][j][0] =enb_properties->properties[i]->otg_bg_traffic[k];
g_otg->application_type[i][j][0] =enb_properties->properties[i]->otg_app_type[k];// BCBR; //MCBR, BCBR
printf("[OTG] configuring traffic type %d for eNB %d UE %d (Background traffic is %s)\n",
g_otg->application_type[i][j][0], i, j,(g_otg->background[i][j][0]==1)?"Enabled":"Disabled");
}
init_predef_traffic(enb_properties->properties[i]->num_otg_elements, 1);
*/
} else if (UE_flag == 1) {
if (conf_config_file_name != NULL) {
@@ -1330,31 +1216,17 @@ void init_openair0() {
else //FDD
openair0_cfg[card].duplex_mode = duplex_mode_FDD;
if (local_remote_radio == BBU_REMOTE_RADIO_HEAD) {
openair0_cfg[card].remote_addr = (eth_params+card)->remote_addr;
openair0_cfg[card].remote_port = (eth_params+card)->remote_port;
openair0_cfg[card].my_addr = (eth_params+card)->my_addr;
openair0_cfg[card].my_port = (eth_params+card)->my_port;
}
printf("HW: Configuring card %d, nb_antennas_tx/rx %d/%d\n",card,
((UE_flag==0) ? PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx),
((UE_flag==0) ? PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_rx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx));
((UE_flag==0) ? RC.eNB[0][0]->frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx),
((UE_flag==0) ? RC.eNB[0][0]->frame_parms.nb_antennas_rx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx));
openair0_cfg[card].Mod_id = 0;
if (UE_flag) {
printf("ETHERNET: Configuring UE ETH for %s:%d\n",rrh_UE_ip,rrh_UE_port);
openair0_cfg[card].remote_addr = &rrh_UE_ip[0];
openair0_cfg[card].remote_port = rrh_UE_port;
}
openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
openair0_cfg[card].clock_source = clock_source;
openair0_cfg[card].tx_num_channels=min(2,((UE_flag==0) ? PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx));
openair0_cfg[card].rx_num_channels=min(2,((UE_flag==0) ? PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_rx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx));
openair0_cfg[card].tx_num_channels=min(2,((UE_flag==0) ? RC.eNB[0][0]->frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx));
openair0_cfg[card].rx_num_channels=min(2,((UE_flag==0) ? RC.eNB[0][0]->frame_parms.nb_antennas_rx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx));
for (i=0; i<4; i++) {
@@ -1371,7 +1243,7 @@ void init_openair0() {
openair0_cfg[card].autocal[i] = 1;
openair0_cfg[card].tx_gain[i] = tx_gain[0][i];
if (UE_flag == 0) {
openair0_cfg[card].rx_gain[i] = PHY_vars_eNB_g[0][0]->rx_total_gain_dB;
openair0_cfg[card].rx_gain[i] = RC.eNB[0][0]->rx_total_gain_dB;
}
else {
openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB - rx_gain_off;
@@ -1387,6 +1259,23 @@ void init_openair0() {
}
}
void wait_RUs() {
LOG_I(PHY,"Waiting for RUs to be configured ...\n");
// wait for all RUs to be configured over fronthaul
pthread_mutex_lock(&RC.ru_mutex);
while (RC.ru_mask>0) {
pthread_cond_wait(&RC.ru_cond,&RC.ru_mutex);
}
LOG_I(PHY,"RUs configured\n");
}
int main( int argc, char **argv )
{
int i,j,k,aa,re;
@@ -1395,6 +1284,7 @@ int main( int argc, char **argv )
#endif
int CC_id;
int ru_id;
uint8_t abstraction_flag=0;
uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
@@ -1416,11 +1306,12 @@ int main( int argc, char **argv )
set_latency_target();
// set default parameters
set_default_frame_parms(frame_parms);
if (UE_flag == 1) set_default_frame_parms(frame_parms);
// initialize logging
logInit();
printf("Reading in command-line options\n");
// get options and fill parameters from configuration file
get_options (argc, argv); //Command-line options, enb_properties
@@ -1455,7 +1346,7 @@ int main( int argc, char **argv )
# endif
#endif
} else {
printf("configuring for eNB\n");
printf("configuring for RAU\n");
set_comp_log(HW, hw_log_level, hw_log_verbosity, 1);
set_comp_log(PHY, phy_log_level, phy_log_verbosity, 1);
@@ -1551,12 +1442,13 @@ int main( int argc, char **argv )
frame_parms[CC_id]->nb_antennas_tx = 1;
frame_parms[CC_id]->nb_antennas_rx = 1;
frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later
}
init_ul_hopping(frame_parms[CC_id]);
init_frame_parms(frame_parms[CC_id],1);
// phy_init_top(frame_parms[CC_id]);
phy_init_lte_top(frame_parms[CC_id]);
init_ul_hopping(frame_parms[CC_id]);
init_frame_parms(frame_parms[CC_id],1);
// phy_init_top(frame_parms[CC_id]);
phy_init_lte_top(frame_parms[CC_id]);
}
}
@@ -1630,67 +1522,6 @@ int main( int argc, char **argv )
// printf("tx_max_power = %d -> amp %d\n",tx_max_power,get_tx_amp(tx_max_poHwer,tx_max_power));
} else {
//this is eNB
PHY_vars_eNB_g = malloc(sizeof(PHY_VARS_eNB**));
PHY_vars_eNB_g[0] = malloc(sizeof(PHY_VARS_eNB*));
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,node_function[CC_id],abstraction_flag);
PHY_vars_eNB_g[0][CC_id]->ue_dl_rb_alloc=0x1fff;
PHY_vars_eNB_g[0][CC_id]->target_ue_dl_mcs=target_dl_mcs;
PHY_vars_eNB_g[0][CC_id]->ue_ul_nb_rb=6;
PHY_vars_eNB_g[0][CC_id]->target_ue_ul_mcs=target_ul_mcs;
// initialization for phy-test
for (k=0;k<NUMBER_OF_UE_MAX;k++) {
PHY_vars_eNB_g[0][CC_id]->transmission_mode[k] = transmission_mode;
if (transmission_mode==7)
lte_gold_ue_spec_port5(PHY_vars_eNB_g[0][CC_id]->lte_gold_uespec_port5_table[k],frame_parms[CC_id]->Nid_cell,0x1235+k);
}
if ((transmission_mode==1) || (transmission_mode==7)) {
for (j=0; j<frame_parms[CC_id]->nb_antennas_tx; j++)
for (re=0; re<frame_parms[CC_id]->ofdm_symbol_size; re++)
PHY_vars_eNB_g[0][CC_id]->common_vars.beam_weights[0][0][j][re] = 0x00007fff/frame_parms[CC_id]->nb_antennas_tx;
}
if (phy_test==1) PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0;
else PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1;
if (PHY_vars_eNB_g[0][CC_id]->mac_enabled == 0) { //set default parameters for testing mode
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_ACK_Index = beta_ACK;
PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_RI_Index = beta_RI;
PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_CQI_Index = beta_CQI;
PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].sr_PUCCH_ResourceIndex = i;
PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].sr_ConfigIndex = 7+(i%3);
PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].dsr_TransMax = sr_n4;
}
}
compute_prach_seq(&PHY_vars_eNB_g[0][CC_id]->frame_parms.prach_config_common,
PHY_vars_eNB_g[0][CC_id]->frame_parms.frame_type,
PHY_vars_eNB_g[0][CC_id]->X_u);
PHY_vars_eNB_g[0][CC_id]->rx_total_gain_dB = (int)rx_gain[CC_id][0];
if (frame_parms[CC_id]->frame_type==FDD) {
PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 0;
}
else {
if (frame_parms[CC_id]->N_RB_DL == 100)
PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 624;
else if (frame_parms[CC_id]->N_RB_DL == 50)
PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 624/2;
else if (frame_parms[CC_id]->N_RB_DL == 25)
PHY_vars_eNB_g[0][CC_id]->N_TA_offset = 624/4;
}
}
NB_eNB_INST=1;
NB_INST=1;
}
@@ -1698,9 +1529,9 @@ int main( int argc, char **argv )
cpuf=get_cpu_freq_GHz();
dump_frame_parms(frame_parms[0]);
init_openair0();
// init_openair0();
@@ -1751,32 +1582,24 @@ int main( int argc, char **argv )
int eMBMS_active=0;
if (node_function[0] <= NGFI_RAU_IF4p5) { // don't initialize L2 for RRU
LOG_I(PHY,"Intializing L2\n");
mac_xface = malloc(sizeof(MAC_xface));
l2_init(frame_parms[0],eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL,
0,// cba_group_active
0); // HO flag
mac_xface->macphy_exit = &exit_fun;
}
else if (node_function[0] == NGFI_RRU_IF4p5) { // Initialize PRACH in this case
}
#if defined(ENABLE_ITTI)
if ((UE_flag == 1)||
(node_function[0]<NGFI_RAU_IF4p5))
(RC.nb_inst > 0)) {
// don't create if node doesn't connect to RRC/S1/GTP
if (create_tasks(UE_flag ? 0 : 1, UE_flag ? 1 : 0) < 0) {
printf("cannot create ITTI tasks\n");
exit(-1); // need a softer mode
}
printf("ITTI tasks created\n");
printf("ITTI tasks created\n");
}
else {
printf("No ITTI\n");
}
#endif
if (phy_test==0) {
@@ -1784,8 +1607,7 @@ int main( int argc, char **argv )
printf("Filling UE band info\n");
fill_ue_band_info();
mac_xface->dl_phy_sync_success (0, 0, 0, 1);
} else if (node_function[0]>NGFI_RRU_IF4p5)
mac_xface->mrbch_phy_sync_failure (0, 0, 0);
}
}
@@ -1856,9 +1678,10 @@ int main( int argc, char **argv )
// start the main thread
// start the main threads
if (UE_flag == 1) {
init_UE(1);
int eMBMS_active = 0;
init_UE(1,eMBMS_active,uecap_xer_in);
number_of_cards = 1;
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
@@ -1867,15 +1690,25 @@ int main( int argc, char **argv )
}
}
else {
printf("Initializing eNB threads\n");
init_eNB(node_function,node_timing,1,eth_params,single_thread_flag,wait_for_sync);
number_of_cards = 1;
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_vars_eNB_g[0][CC_id]->rf_map.card=0;
PHY_vars_eNB_g[0][CC_id]->rf_map.chain=CC_id+chain_offset;
number_of_cards = 1;
if (RC.nb_inst > 0) {
printf("Initializing eNB threads\n");
init_eNB(single_thread_flag,wait_for_sync);
}
if (RC.nb_RU >0) {
printf("Initializing RU threads\n");
init_RU(rf_config_file);
for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
RC.ru[ru_id]->rf_map.card=0;
RC.ru[ru_id]->rf_map.chain=CC_id+chain_offset;
}
}
wait_RUs();
// once all RUs are ready intiailize the rest of the eNBs (dependence on final RU parameters after configuration)
init_eNB_afterRU();
}
// connect the TX/RX buffers
@@ -1911,28 +1744,36 @@ int main( int argc, char **argv )
/*
printf("Setting eNB buffer to all-RX\n");
// Set LSBs for antenna switch (ExpressMIMO)
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_vars_eNB_g[0][CC_id]->hw_timing_advance = 0;
for (i=0; i<frame_parms[CC_id]->samples_per_tti*10; i++)
for (aa=0; aa<frame_parms[CC_id]->nb_antennas_tx; aa++)
PHY_vars_eNB_g[0][CC_id]->common_vars.txdata[0][aa][i] = 0x00010001;
RC.eNB[0][CC_id]->hw_timing_advance = 0;
}
for (ru_id=0;ru_id<NB_RU;ru_id++) {
for (i=0; i<RC.ru[ru_id]->frame_parms.samples_per_tti*10; i++)
for (aa=0; aa<RC.ru[ru_id]->nb_tx; aa++)
RC.ru[0]->common.txdata[aa][i] = 0x00010001;
}
*/
}
sleep(3);
printf("Sending sync to all threads\n");
pthread_mutex_lock(&sync_mutex);
sync_var=0;
pthread_cond_broadcast(&sync_cond);
pthread_mutex_unlock(&sync_mutex);
// wait for end of program
// wait for end of program
printf("TYPE <CTRL-C> TO TERMINATE\n");
//getchar();
@@ -1993,11 +1834,11 @@ int main( int argc, char **argv )
PHY_vars_UE_g[0][0]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][0]->rfdevice);
}
else {
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
if (PHY_vars_eNB_g[0][CC_id]->rfdevice.trx_end_func)
PHY_vars_eNB_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_eNB_g[0][CC_id]->rfdevice);
if (PHY_vars_eNB_g[0][CC_id]->ifdevice.trx_end_func)
PHY_vars_eNB_g[0][CC_id]->ifdevice.trx_end_func(&PHY_vars_eNB_g[0][CC_id]->ifdevice);
for(ru_id=0; ru_id<NB_RU; ru_id++) {
if (RC.ru[ru_id]->rfdevice.trx_end_func)
RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
if (RC.ru[ru_id]->ifdevice.trx_end_func)
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
}
}
if (ouput_vcd)
+84 -14
View File
@@ -88,7 +88,7 @@ typedef enum {
void init_UE_threads(int nb_inst);
void *UE_thread(void *arg);
void init_UE(int nb_inst);
void init_UE(int nb_inst,int,int);
extern pthread_cond_t sync_cond;
extern pthread_mutex_t sync_mutex;
@@ -165,18 +165,78 @@ static const eutra_band_t eutra_bands[] = {
{44, 703 * MHz, 803 * MHz, 703 * MHz, 803 * MHz, TDD},
};
pthread_t main_ue_thread;
pthread_attr_t attr_UE_thread;
struct sched_param sched_param_UE_thread;
void init_UE(int nb_inst) {
PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t UE_id,
uint8_t abstraction_flag)
{
int i,j;
PHY_VARS_UE* PHY_vars_UE = malloc(sizeof(PHY_VARS_UE));
memset(PHY_vars_UE,0,sizeof(PHY_VARS_UE));
PHY_vars_UE->Mod_id=UE_id;
memcpy(&(PHY_vars_UE->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS));
phy_init_lte_ue(PHY_vars_UE,1,abstraction_flag);
for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
for (j=0; j<2; j++) {
PHY_vars_UE->dlsch[i][j] = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS,frame_parms->N_RB_DL, abstraction_flag);
if (!PHY_vars_UE->dlsch[i][j]) {
LOG_E(PHY,"Can't get ue dlsch structures\n");
exit(-1);
} else
LOG_D(PHY,"dlsch[%d][%d] => %p\n",UE_id,i,PHY_vars_UE->dlsch[i][j]);
}
PHY_vars_UE->ulsch[i] = new_ue_ulsch(frame_parms->N_RB_UL, abstraction_flag);
if (!PHY_vars_UE->ulsch[i]) {
LOG_E(PHY,"Can't get ue ulsch structures\n");
exit(-1);
}
PHY_vars_UE->dlsch_SI[i] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,frame_parms->N_RB_DL, abstraction_flag);
PHY_vars_UE->dlsch_ra[i] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,frame_parms->N_RB_DL, abstraction_flag);
PHY_vars_UE->transmission_mode[i] = frame_parms->nb_antenna_ports_eNB==1 ? 1 : 2;
}
PHY_vars_UE->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
PHY_vars_UE->dlsch_MCH[0] = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS_MBSFN,frame_parms->N_RB_DL,0);
return (PHY_vars_UE);
}
char uecap_xer[1024];
void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in) {
int error_code;
int inst;
PHY_VARS_UE *UE;
int ret;
LOG_I(PHY,"UE %d: Calling Layer 2 for initialization\n",inst);
if (mac_xface==NULL) mac_xface = malloc(sizeof(MAC_xface));
l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL,
0,// cba_group_active
0); // HO flag
mac_xface->macphy_exit = &exit_fun;
for (inst=0;inst<nb_inst;inst++) {
printf("Intializing UE Threads for instance %d ...\n",inst);
init_UE_threads(inst);
sleep(1);
@@ -188,7 +248,7 @@ void init_UE(int nb_inst) {
exit_fun("Error loading device library");
}
}
UE->rfdevice.host_type = BBU_HOST;
UE->rfdevice.host_type = RAU_HOST;
// UE->rfdevice.type = NONE_DEV;
error_code = pthread_create(&UE->proc.pthread_ue, &UE->proc.attr_ue, UE_thread, NULL);
@@ -235,6 +295,16 @@ static void *UE_thread_synch(void *arg)
printf("UE_thread_sync in with PHY_vars_UE %p\n",arg);
printf("waiting for sync (UE_thread_synch) \n");
printf("waiting for sync (UE_thread)\n");
pthread_mutex_lock(&sync_mutex);
printf("Locked sync_mutex, waiting (UE_thread)\n");
while (sync_var<0)
pthread_cond_wait(&sync_cond, &sync_mutex);
pthread_mutex_unlock(&sync_mutex);
printf("unlocked sync_mutex, waiting (UE_thread)\n");
#ifndef DEADLINE_SCHEDULER
int policy, s, j;
struct sched_param sparam;
@@ -317,7 +387,7 @@ static void *UE_thread_synch(void *arg)
current_band = eutra_bands[ind].band;
printf( "Scanning band %d, dl_min %"PRIu32", ul_min %"PRIu32"\n", current_band, eutra_bands[ind].dl_min,eutra_bands[ind].ul_min);
if ((eutra_bands[ind].dl_min <= downlink_frequency[0][0]) && (eutra_bands[ind].dl_max >= downlink_frequency[0][0])) {
if ((eutra_bands[ind].dl_min <= UE->frame_parms.dl_CarrierFreq) && (eutra_bands[ind].dl_max >= UE->frame_parms.dl_CarrierFreq)) {
for (i=0; i<4; i++)
uplink_frequency_offset[CC_id][i] = eutra_bands[ind].ul_min - eutra_bands[ind].dl_min;
@@ -338,11 +408,11 @@ static void *UE_thread_synch(void *arg)
LOG_I( PHY, "[SCHED][UE] Check absolute frequency DL %"PRIu32", UL %"PRIu32" (oai_exit %d, rx_num_channels %d)\n", downlink_frequency[0][0], downlink_frequency[0][0]+uplink_frequency_offset[0][0],oai_exit, openair0_cfg[0].rx_num_channels);
LOG_I( PHY, "[SCHED][UE] Check absolute frequency DL %"PRIu32", UL %"PRIu32" (oai_exit %d, rx_num_channels %d)\n", UE->frame_parms.dl_CarrierFreq, UE->frame_parms.ul_CarrierFreq,oai_exit, openair0_cfg[0].rx_num_channels);
for (i=0;i<openair0_cfg[UE->rf_map.card].rx_num_channels;i++) {
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] = downlink_frequency[CC_id][i];
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = downlink_frequency[CC_id][i]+uplink_frequency_offset[CC_id][i];
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] = UE->frame_parms.dl_CarrierFreq;
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = UE->frame_parms.ul_CarrierFreq;
openair0_cfg[UE->rf_map.card].autocal[UE->rf_map.chain+i] = 1;
if (uplink_frequency_offset[CC_id][i] != 0) //
openair0_cfg[UE->rf_map.card].duplex_mode = duplex_mode_FDD;
@@ -443,8 +513,8 @@ static void *UE_thread_synch(void *arg)
hw_slot_offset,
freq_offset,
UE->rx_total_gain_dB,
downlink_frequency[0][0]+freq_offset,
downlink_frequency[0][0]+uplink_frequency_offset[0][0]+freq_offset,
UE->frame_parms.dl_CarrierFreq+freq_offset,
UE->frame_parms.ul_CarrierFreq+freq_offset,
UE->UE_scan_carrier );
if (UE->UE_scan_carrier == 1) {
@@ -462,7 +532,7 @@ static void *UE_thread_synch(void *arg)
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] -= UE->common_vars.freq_offset;
}
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i]+uplink_frequency_offset[CC_id][i];
downlink_frequency[CC_id][i] = openair0_cfg[CC_id].rx_freq[i];
UE->frame_parms.dl_CarrierFreq = openair0_cfg[CC_id].rx_freq[i];
freq_offset=0;
}
@@ -562,12 +632,12 @@ static void *UE_thread_synch(void *arg)
LOG_I( PHY, "[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)\n",
freq_offset,
UE->rx_total_gain_dB,
downlink_frequency[0][0]+freq_offset,
downlink_frequency[0][0]+uplink_frequency_offset[0][0]+freq_offset );
UE->frame_parms.dl_CarrierFreq+freq_offset,
UE->frame_parms.ul_CarrierFreq+freq_offset );
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] = downlink_frequency[CC_id][i]+freq_offset;
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = downlink_frequency[CC_id][i]+uplink_frequency_offset[CC_id][i]+freq_offset;
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] = UE->frame_parms.dl_CarrierFreq+freq_offset;
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = UE->frame_parms.ul_CarrierFreq+freq_offset;
openair0_cfg[UE->rf_map.card].rx_gain[UE->rf_map.chain+i] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET;
+108 -2
View File
@@ -29,12 +29,21 @@
* \note
* \warning
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sched.h>
#include <linux/sched.h>
#include <signal.h>
#include <execinfo.h>
#include <getopt.h>
#include <sys/sysinfo.h>
#include "rt_wrapper.h"
static int latency_target_fd = -1;
static int32_t latency_target_value = 0;
/* Latency trick - taken from cyclictest.c
@@ -247,7 +256,104 @@ int sched_getattr(pid_t pid,struct sched_attr *attr,unsigned int size, unsigned
#endif
void thread_top_init(char *thread_name,
int affinity,
uint64_t runtime,
uint64_t deadline,
uint64_t period) {
MSC_START_USE();
#ifdef DEADLINE_SCHEDULER
struct sched_attr attr;
unsigned int flags = 0;
attr.size = sizeof(attr);
attr.sched_flags = 0;
attr.sched_nice = 0;
attr.sched_priority = 0;
attr.sched_policy = SCHED_DEADLINE;
attr.sched_runtime = runtime;
attr.sched_deadline = deadline;
attr.sched_period = period;
if (sched_setattr(0, &attr, flags) < 0 ) {
perror("[SCHED] eNB tx thread: sched_setattr failed\n");
exit(1);
}
#else //LOW_LATENCY
int policy, s, j;
struct sched_param sparam;
char cpu_affinity[1024];
cpu_set_t cpuset;
/* Set affinity mask to include CPUs 1 to MAX_CPUS */
/* CPU 0 is reserved for UHD threads */
/* CPU 1 is reserved for all RX_TX threads */
/* Enable CPU Affinity only if number of CPUs >2 */
CPU_ZERO(&cpuset);
#ifdef CPU_AFFINITY
if (get_nprocs() > 2)
{
if (affinity == 0)
CPU_SET(0,&cpuset);
else
for (j = 1; j < get_nprocs(); j++)
CPU_SET(j, &cpuset);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "pthread_setaffinity_np");
exit_fun("Error setting processor affinity");
}
}
#endif //CPU_AFFINITY
/* Check the actual affinity mask assigned to the thread */
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0) {
perror( "pthread_getaffinity_np");
exit_fun("Error getting processor affinity ");
}
memset(cpu_affinity,0,sizeof(cpu_affinity));
for (j = 0; j < 1024; j++)
if (CPU_ISSET(j, &cpuset)) {
char temp[1024];
sprintf (temp, " CPU_%d", j);
strcat(cpu_affinity, temp);
}
memset(&sparam, 0, sizeof(sparam));
sparam.sched_priority = sched_get_priority_max(SCHED_FIFO);
policy = SCHED_FIFO ;
s = pthread_setschedparam(pthread_self(), policy, &sparam);
if (s != 0) {
perror("pthread_setschedparam : ");
exit_fun("Error setting thread priority");
}
s = pthread_getschedparam(pthread_self(), &policy, &sparam);
if (s != 0) {
perror("pthread_getschedparam : ");
exit_fun("Error getting thread priority");
}
LOG_I(HW, "[SCHED][eNB] %s started on CPU %d, sched_policy = %s , priority = %d, CPU Affinity=%s \n",thread_name,sched_getcpu(),
(policy == SCHED_FIFO) ? "SCHED_FIFO" :
(policy == SCHED_RR) ? "SCHED_RR" :
(policy == SCHED_OTHER) ? "SCHED_OTHER" :
"???",
sparam.sched_priority, cpu_affinity );
#endif //LOW_LATENCY
mlockall(MCL_CURRENT | MCL_FUTURE);
}
+5
View File
@@ -121,3 +121,8 @@ int sched_getattr(pid_t pid,struct sched_attr *attr,unsigned int size, unsigned
#define gettid() syscall(__NR_gettid) // for gettid
void thread_top_init(char *thread_name,
int affinity,
uint64_t runtime,
uint64_t deadline,
uint64_t period);
+137 -128
View File
@@ -72,15 +72,15 @@ double r_re_DL[NUMBER_OF_UE_MAX][2][30720];
double r_im_DL[NUMBER_OF_UE_MAX][2][30720];
double r_re_UL[NUMBER_OF_eNB_MAX][2][30720];
double r_im_UL[NUMBER_OF_eNB_MAX][2][30720];
int eNB_output_mask[NUMBER_OF_UE_MAX];
int UE_output_mask[NUMBER_OF_eNB_MAX];
pthread_mutex_t eNB_output_mutex[NUMBER_OF_UE_MAX];
pthread_mutex_t UE_output_mutex[NUMBER_OF_eNB_MAX];
int RU_output_mask[NUMBER_OF_UE_MAX];
int UE_output_mask[NUMBER_OF_RU_MAX];
pthread_mutex_t RU_output_mutex[NUMBER_OF_UE_MAX];
pthread_mutex_t UE_output_mutex[NUMBER_OF_RU_MAX];
void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],
void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_RU_MAX],
node_desc_t *ue_data[NUMBER_OF_UE_MAX],
uint16_t subframe,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,
uint16_t subframe,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *ue_frame_parms,
uint8_t UE_id,
int CC_id)
{
@@ -88,7 +88,7 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
int32_t att_eNB_id=-1;
int32_t **txdata,**rxdata;
uint8_t eNB_id=0;
uint32_t eNB_id,ru_id=0;
double tx_pwr;
double rx_pwr;
int32_t rx_pwr2;
@@ -97,21 +97,22 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
double min_path_loss=-200;
uint8_t hold_channel=0;
uint8_t nb_antennas_rx = eNB2UE[0][0][CC_id]->nb_rx; // number of rx antennas at UE
uint8_t nb_antennas_tx = eNB2UE[0][0][CC_id]->nb_tx; // number of tx antennas at eNB
uint8_t nb_antennas_rx = RU2UE[0][0][CC_id]->nb_rx; // number of rx antennas at UE
uint8_t nb_antennas_tx = RU2UE[0][0][CC_id]->nb_tx; // number of tx antennas at eNB
double s_re0[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double s_re1[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double s_re0[30720];
double s_re1[30720];
double *s_re[2];
double s_im0[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double s_im1[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double s_im0[30720];
double s_im1[30720];
double *s_im[2];
double r_re00[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double r_re01[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double r_re00[30720];
double r_re01[30720];
double *r_re0[2];
double r_im00[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double r_im01[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double r_im00[30720];
double r_im01[30720];
double *r_im0[2];
LTE_DL_FRAME_PARMS *frame_parms;
s_re[0] = s_re0;
s_im[0] = s_im0;
@@ -132,20 +133,20 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
//for (UE_id=0;UE_id<NB_UE_INST;UE_id++) {
if (!hold_channel) {
// calculate the random channel from each eNB
for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
// calculate the random channel from each RU
for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
random_channel(eNB2UE[eNB_id][UE_id][CC_id],abstraction_flag);
random_channel(RU2UE[ru_id][UE_id][CC_id],abstraction_flag);
/*
for (i=0;i<eNB2UE[eNB_id][UE_id]->nb_taps;i++)
printf("eNB2UE[%d][%d]->a[0][%d] = (%f,%f)\n",eNB_id,UE_id,i,eNB2UE[eNB_id][UE_id]->a[0][i].x,eNB2UE[eNB_id][UE_id]->a[0][i].y);
for (i=0;i<RU2UE[eNB_id][UE_id]->nb_taps;i++)
printf("RU2UE[%d][%d]->a[0][%d] = (%f,%f)\n",eNB_id,UE_id,i,RU2UE[eNB_id][UE_id]->a[0][i].x,RU2UE[eNB_id][UE_id]->a[0][i].y);
*/
freq_channel(eNB2UE[eNB_id][UE_id][CC_id], frame_parms->N_RB_DL,frame_parms->N_RB_DL*12+1);
freq_channel(RU2UE[ru_id][UE_id][CC_id], frame_parms->N_RB_DL,frame_parms->N_RB_DL*12+1);
}
// find out which eNB the UE is attached to
for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
if (find_ue(PHY_vars_UE_g[UE_id][CC_id]->pdcch_vars[0]->crnti,PHY_vars_eNB_g[eNB_id][CC_id])>=0) {
for (eNB_id=0; eNB_id<RC.nb_inst; eNB_id++) {
if (find_ue(PHY_vars_UE_g[UE_id][CC_id]->pdcch_vars[0]->crnti,RC.eNB[eNB_id][CC_id])>=0) {
// UE with UE_id is connected to eNb with eNB_id
att_eNB_id=eNB_id;
LOG_D(OCM,"A: UE attached to eNB (UE%d->eNB%d)\n",UE_id,eNB_id);
@@ -155,11 +156,14 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
// if UE is not attached yet, find assume its the eNB with the smallest pathloss
if (att_eNB_id<0) {
for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
if (min_path_loss<eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB) {
min_path_loss = eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB;
att_eNB_id=eNB_id;
LOG_D(OCM,"B: UE attached to eNB (UE%d->eNB%d)\n",UE_id,eNB_id);
}
for (int ru=0;ru<RC.nb_RU;ru++) {
ru_id = RC.eNB[eNB_id][CC_id]->RU_list[ru]->idx;
if (min_path_loss<RU2UE[ru_id][UE_id][CC_id]->path_loss_dB) {
min_path_loss = RU2UE[ru_id][UE_id][CC_id]->path_loss_dB;
att_eNB_id=eNB_id;
LOG_D(OCM,"B: UE attached to eNB (UE%d->eNB%d)\n",UE_id,eNB_id);
}
}
}
}
@@ -169,20 +173,20 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
}
#ifdef DEBUG_SIM
rx_pwr = signal_energy_fp2(eNB2UE[att_eNB_id][UE_id][CC_id]->ch[0],
eNB2UE[att_eNB_id][UE_id][CC_id]->channel_length)*eNB2UE[att_eNB_id][UE_id][CC_id]->channel_length;
rx_pwr = signal_energy_fp2(RU2UE[att_eNB_id][UE_id][CC_id]->ch[0],
RU2UE[att_eNB_id][UE_id][CC_id]->channel_length)*RU2UE[att_eNB_id][UE_id][CC_id]->channel_length;
LOG_D(OCM,"Channel (CCid %d) eNB %d => UE %d : tx_power %d dBm, path_loss %f dB\n",
CC_id,att_eNB_id,UE_id,
frame_parms->pdsch_config_common.referenceSignalPower,
eNB2UE[att_eNB_id][UE_id][CC_id]->path_loss_dB);
RU2UE[att_eNB_id][UE_id][CC_id]->path_loss_dB);
#endif
//dlsch_abstraction(PHY_vars_UE_g[UE_id]->sinr_dB, rb_alloc, 8);
// fill in perfect channel estimates
channel_desc_t *desc1 = eNB2UE[att_eNB_id][UE_id][CC_id];
channel_desc_t *desc1 = RU2UE[att_eNB_id][UE_id][CC_id];
int32_t **dl_channel_est = PHY_vars_UE_g[UE_id][CC_id]->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[0];
// double scale = pow(10.0,(enb_data[att_eNB_id]->tx_power_dBm + eNB2UE[att_eNB_id][UE_id]->path_loss_dB + (double) PHY_vars_UE_g[UE_id]->rx_total_gain_dB)/20.0);
double scale = pow(10.0,(frame_parms->pdsch_config_common.referenceSignalPower+eNB2UE[att_eNB_id][UE_id][CC_id]->path_loss_dB + (double) PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB)/20.0);
// double scale = pow(10.0,(enb_data[att_eNB_id]->tx_power_dBm + RU2UE[att_eNB_id][UE_id]->path_loss_dB + (double) PHY_vars_UE_g[UE_id]->rx_total_gain_dB)/20.0);
double scale = pow(10.0,(frame_parms->pdsch_config_common.referenceSignalPower+RU2UE[att_eNB_id][UE_id][CC_id]->path_loss_dB + (double) PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB)/20.0);
LOG_D(OCM,"scale =%lf (%d dB)\n",scale,(int) (20*log10(scale)));
// freq_channel(desc1,frame_parms->N_RB_DL,nb_samples);
//write_output("channel.m","ch",desc1->ch[0],desc1->channel_length,1,8);
@@ -202,14 +206,15 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
}
// calculate the SNR for the attached eNB (this assumes eNB always uses PMI stored in eNB_UE_stats; to be improved)
init_snr(eNB2UE[att_eNB_id][UE_id][CC_id], enb_data[att_eNB_id], ue_data[UE_id], PHY_vars_UE_g[UE_id][CC_id]->sinr_dB, &PHY_vars_UE_g[UE_id][CC_id]->N0,
PHY_vars_UE_g[UE_id][CC_id]->transmission_mode[att_eNB_id], PHY_vars_eNB_g[att_eNB_id][CC_id]->UE_stats[UE_id].DL_pmi_single,
PHY_vars_eNB_g[att_eNB_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off,PHY_vars_eNB_g[att_eNB_id][CC_id]->frame_parms.N_RB_DL);
init_snr(RU2UE[att_eNB_id][UE_id][CC_id], enb_data[att_eNB_id], ue_data[UE_id], PHY_vars_UE_g[UE_id][CC_id]->sinr_dB, &PHY_vars_UE_g[UE_id][CC_id]->N0,
PHY_vars_UE_g[UE_id][CC_id]->transmission_mode[att_eNB_id], RC.eNB[att_eNB_id][CC_id]->UE_stats[UE_id].DL_pmi_single,
RC.eNB[att_eNB_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off,RC.eNB[att_eNB_id][CC_id]->frame_parms.N_RB_DL);
// calculate sinr here
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
if (att_eNB_id != eNB_id) {
calculate_sinr(eNB2UE[eNB_id][UE_id][CC_id], enb_data[eNB_id], ue_data[UE_id], PHY_vars_UE_g[UE_id][CC_id]->sinr_dB,PHY_vars_eNB_g[att_eNB_id][CC_id]->frame_parms.N_RB_DL);
calculate_sinr(RU2UE[eNB_id][UE_id][CC_id], enb_data[eNB_id], ue_data[UE_id], PHY_vars_UE_g[UE_id][CC_id]->sinr_dB,
RC.eNB[att_eNB_id][CC_id]->frame_parms.N_RB_DL);
}
}
} // hold channel
@@ -217,19 +222,21 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
else { //abstraction_flag
pthread_mutex_lock(&eNB_output_mutex[UE_id]);
pthread_mutex_lock(&RU_output_mutex[UE_id]);
if (eNB_output_mask[UE_id] == 0) { // This is the first eNodeB for this UE, clear the buffer
if (RU_output_mask[UE_id] == 0) { // This is the first eNodeB for this UE, clear the buffer
for (aa=0; aa<nb_antennas_rx; aa++) {
memset((void*)r_re_DL[UE_id][aa],0,(frame_parms->samples_per_tti)*sizeof(double));
memset((void*)r_im_DL[UE_id][aa],0,(frame_parms->samples_per_tti)*sizeof(double));
memset((void*)r_re_DL[UE_id][aa],0,(RC.ru[0]->frame_parms.samples_per_tti)*sizeof(double));
memset((void*)r_im_DL[UE_id][aa],0,(RC.ru[0]->frame_parms.samples_per_tti)*sizeof(double));
}
}
pthread_mutex_unlock(&eNB_output_mutex[UE_id]);
pthread_mutex_unlock(&RU_output_mutex[UE_id]);
for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
txdata = RC.ru[ru_id]->common.txdata;
frame_parms = &RC.ru[ru_id]->frame_parms;
for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
txdata = PHY_vars_eNB_g[eNB_id][CC_id]->common_vars.txdata[0];
sf_offset = subframe*frame_parms->samples_per_tti;
tx_pwr = dac_fixed_gain(s_re,
s_im,
@@ -244,52 +251,52 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
frame_parms->N_RB_DL*12);
#ifdef DEBUG_SIM
LOG_D(OCM,"[SIM][DL] eNB %d (CCid %d): tx_pwr %.1f dBm/RE (target %d dBm/RE), for subframe %d\n",
eNB_id,CC_id,
LOG_D(OCM,"[SIM][DL] RU %d (CCid %d): tx_pwr %.1f dBm/RE (target %d dBm/RE), for subframe %d\n",
ru_id,CC_id,
10*log10(tx_pwr),
frame_parms->pdsch_config_common.referenceSignalPower,
subframe);
#endif
//eNB2UE[eNB_id][UE_id]->path_loss_dB = 0;
multipath_channel(eNB2UE[eNB_id][UE_id][CC_id],s_re,s_im,r_re0,r_im0,
//RU2UE[eNB_id][UE_id]->path_loss_dB = 0;
multipath_channel(RU2UE[ru_id][UE_id][CC_id],s_re,s_im,r_re0,r_im0,
frame_parms->samples_per_tti,hold_channel);
#ifdef DEBUG_SIM
rx_pwr = signal_energy_fp2(eNB2UE[eNB_id][UE_id][CC_id]->ch[0],
eNB2UE[eNB_id][UE_id][CC_id]->channel_length)*eNB2UE[eNB_id][UE_id][CC_id]->channel_length;
LOG_D(OCM,"[SIM][DL] Channel eNB %d => UE %d (CCid %d): Channel gain %f dB (%f)\n",eNB_id,UE_id,CC_id,10*log10(rx_pwr),rx_pwr);
rx_pwr = signal_energy_fp2(RU2UE[ru_id][UE_id][CC_id]->ch[0],
RU2UE[ru_id][UE_id][CC_id]->channel_length)*RU2UE[ru_id][UE_id][CC_id]->channel_length;
LOG_D(OCM,"[SIM][DL] Channel RU %d => UE %d (CCid %d): Channel gain %f dB (%f)\n",ru_id,UE_id,CC_id,10*log10(rx_pwr),rx_pwr);
#endif
#ifdef DEBUG_SIM
for (i=0; i<eNB2UE[eNB_id][UE_id][CC_id]->channel_length; i++)
LOG_D(OCM,"channel(%d,%d)[%d] : (%f,%f)\n",eNB_id,UE_id,i,eNB2UE[eNB_id][UE_id][CC_id]->ch[0][i].x,eNB2UE[eNB_id][UE_id][CC_id]->ch[0][i].y);
for (i=0; i<RU2UE[ru_id][UE_id][CC_id]->channel_length; i++)
LOG_D(OCM,"channel(%d,%d)[%d] : (%f,%f)\n",ru_id,UE_id,i,RU2UE[ru_id][UE_id][CC_id]->ch[0][i].x,RU2UE[ru_id][UE_id][CC_id]->ch[0][i].y);
#endif
LOG_D(OCM,"[SIM][DL] Channel eNB %d => UE %d (CCid %d): tx_power %.1f dBm/RE, path_loss %1.f dB\n",
eNB_id,UE_id,CC_id,
ru_id,UE_id,CC_id,
(double)frame_parms->pdsch_config_common.referenceSignalPower,
// enb_data[eNB_id]->tx_power_dBm,
eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB);
RU2UE[ru_id][UE_id][CC_id]->path_loss_dB);
#ifdef DEBUG_SIM
rx_pwr = signal_energy_fp(r_re0,r_im0,nb_antennas_rx,
frame_parms->ofdm_symbol_size,
sf_offset)/(12.0*frame_parms->N_RB_DL);
0)/(12.0*frame_parms->N_RB_DL);
LOG_D(OCM,"[SIM][DL] UE %d : rx_pwr %f dBm/RE (%f dBm RSSI)for subframe %d\n",UE_id,
10*log10(rx_pwr),
10*log10(rx_pwr*(double)frame_parms->N_RB_DL*12),subframe);
LOG_D(OCM,"[SIM][DL] UE %d : rx_pwr (noise) -132 dBm/RE (N0fs = %.1f dBm, N0B = %.1f dBm) for slot %d (subframe %d)\n",
LOG_D(OCM,"[SIM][DL] UE %d : rx_pwr (noise) -132 dBm/RE (N0fs = %.1f dBm, N0B = %.1f dBm) for subframe %d\n",
UE_id,
10*log10(eNB2UE[eNB_id][UE_id][CC_id]->sampling_rate*1e6)-174,
10*log10(eNB2UE[eNB_id][UE_id][CC_id]->sampling_rate*1e6*12*frame_parms->N_RB_DL/(double)frame_parms->ofdm_symbol_size)-174,
10*log10(RU2UE[ru_id][UE_id][CC_id]->sampling_rate*1e6)-174,
10*log10(RU2UE[ru_id][UE_id][CC_id]->sampling_rate*1e6*12*frame_parms->N_RB_DL/(double)frame_parms->ofdm_symbol_size)-174,
subframe);
#endif
if (eNB2UE[eNB_id][UE_id][CC_id]->first_run == 1)
eNB2UE[eNB_id][UE_id][CC_id]->first_run = 0;
if (RU2UE[ru_id][UE_id][CC_id]->first_run == 1)
RU2UE[ru_id][UE_id][CC_id]->first_run = 0;
// RF model
@@ -302,36 +309,36 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
r_im0,
nb_antennas_rx,
frame_parms->samples_per_tti,
1e3/eNB2UE[eNB_id][UE_id][CC_id]->sampling_rate, // sampling time (ns)
1e3/RU2UE[ru_id][UE_id][CC_id]->sampling_rate, // sampling time (ns)
(double)PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB - 66.227); // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
#ifdef DEBUG_SIM
rx_pwr = signal_energy_fp(r_re0,r_im0,
nb_antennas_rx,
frame_parms->ofdm_symbol_size,
sf_offset)/(12.0*frame_parms->N_RB_DL);
0)/(12.0*frame_parms->N_RB_DL);
LOG_D(OCM,"[SIM][DL] UE %d : ADC in (eNB %d) %f dBm/RE for subframe %d\n",
UE_id,eNB_id,
UE_id,ru_id,
10*log10(rx_pwr),subframe);
#endif
pthread_mutex_lock(&eNB_output_mutex[UE_id]);
pthread_mutex_lock(&RU_output_mutex[UE_id]);
for (i=0; i<frame_parms->samples_per_tti; i++) {
for (aa=0; aa<nb_antennas_rx; aa++) {
r_re_DL[UE_id][aa][i]+=r_re0[aa][i];
r_im_DL[UE_id][aa][i]+=r_im0[aa][i];
}
}
eNB_output_mask[UE_id] |= (1<<eNB_id);
if (eNB_output_mask[UE_id] == (1<<NB_eNB_INST)-1) {
eNB_output_mask[UE_id]=0;
RU_output_mask[UE_id] |= (1<<ru_id);
if (RU_output_mask[UE_id] == (1<<NB_eNB_INST)-1) {
RU_output_mask[UE_id]=0;
double *r_re_p[2] = {r_re_DL[eNB_id][0],r_re_DL[eNB_id][1]};
double *r_im_p[2] = {r_im_DL[eNB_id][0],r_im_DL[eNB_id][1]};
double *r_re_p[2] = {r_re_DL[ru_id][0],r_re_DL[ru_id][1]};
double *r_im_p[2] = {r_im_DL[ru_id][0],r_im_DL[ru_id][1]};
#ifdef DEBUG_SIM
rx_pwr = signal_energy_fp(r_re_p,r_im_p,nb_antennas_rx,frame_parms->ofdm_symbol_size,sf_offset)/(12.0*frame_parms->N_RB_DL);
rx_pwr = signal_energy_fp(r_re_p,r_im_p,nb_antennas_rx,frame_parms->ofdm_symbol_size,0)/(12.0*frame_parms->N_RB_DL);
LOG_D(OCM,"[SIM][DL] UE %d : ADC in %f dBm for subframe %d\n",UE_id,10*log10(rx_pwr),subframe);
#endif
@@ -357,19 +364,19 @@ void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_N
UNUSED_VARIABLE(rx_pwr);
#endif
} // eNB_output_mask
pthread_mutex_unlock(&eNB_output_mutex[UE_id]);
} // eNB_id
} // RU_output_mask
pthread_mutex_unlock(&RU_output_mutex[UE_id]);
} // ru_id
}
}
void do_UL_sig(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],
void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_RU_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],
uint16_t subframe,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,int eNB_id,uint8_t CC_id)
uint32_t frame,int ru_id,uint8_t CC_id)
{
int32_t **txdata,**rxdata;
@@ -378,8 +385,8 @@ void do_UL_sig(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_N
#endif
uint8_t UE_id=0;
uint8_t nb_antennas_rx = UE2eNB[0][0][CC_id]->nb_rx; // number of rx antennas at eNB
uint8_t nb_antennas_tx = UE2eNB[0][0][CC_id]->nb_tx; // number of tx antennas at UE
uint8_t nb_antennas_rx = UE2RU[0][0][CC_id]->nb_rx; // number of rx antennas at eNB
uint8_t nb_antennas_tx = UE2RU[0][0][CC_id]->nb_tx; // number of tx antennas at UE
double tx_pwr, rx_pwr;
int32_t rx_pwr2;
@@ -396,17 +403,17 @@ void do_UL_sig(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_N
int ulfrrb2 ;
uint8_t harq_pid;
#endif
double s_re0[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double s_re1[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double s_re0[30720];
double s_re1[30720];
double *s_re[2];
double s_im0[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double s_im1[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double s_im0[30720];
double s_im1[30720];
double *s_im[2];
double r_re00[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double r_re01[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double r_re00[30720];
double r_re01[30720];
double *r_re0[2];
double r_im00[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double r_im01[30720];//PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti];
double r_im00[30720];
double r_im01[30720];
double *r_im0[2];
s_re[0] = s_re0;
@@ -418,31 +425,33 @@ void do_UL_sig(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_N
r_im0[0] = r_im00;
r_re0[1] = r_re01;
r_im0[1] = r_im01;
if (abstraction_flag!=0) {
#ifdef PHY_ABSTRACTION_UL
// wire this to 0 until we figure this out
int eNB_id=0;
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
if (!hold_channel) {
random_channel(UE2eNB[UE_id][eNB_id][CC_id],abstraction_flag);
freq_channel(UE2eNB[UE_id][eNB_id][CC_id], frame_parms->N_RB_UL,frame_parms->N_RB_UL*12+1);
random_channel(UE2RU[UE_id][eNB_id][CC_id],abstraction_flag);
freq_channel(UE2RU[UE_id][eNB_id][CC_id], frame_parms->N_RB_UL,frame_parms->N_RB_UL*12+1);
// REceived power at the eNB
rx_pwr = signal_energy_fp2(UE2eNB[UE_id][eNB_id][CC_id]->ch[0],
UE2eNB[UE_id][eNB_id][CC_id]->channel_length)*UE2eNB[UE_id][att_eNB_id][CC_id]->channel_length; // calculate the rx power at the eNB
rx_pwr = signal_energy_fp2(UE2RU[UE_id][eNB_id][CC_id]->ch[0],
UE2RU[UE_id][eNB_id][CC_id]->channel_length)*UE2RU[UE_id][att_eNB_id][CC_id]->channel_length; // calculate the rx power at the eNB
}
// write_output("SINRch.m","SINRch",PHY_vars_eNB_g[att_eNB_id]->sinr_dB_eNB,frame_parms->N_RB_UL*12+1,1,1);
if(subframe>1 && subframe <5) {
harq_pid = subframe2harq_pid(frame_parms,frame,subframe);
ul_nb_rb = PHY_vars_eNB_g[att_eNB_id][CC_id]->ulsch_eNB[(uint8_t)UE_id]->harq_processes[harq_pid]->nb_rb;
ul_fr_rb = PHY_vars_eNB_g[att_eNB_id][CC_id]->ulsch_eNB[(uint8_t)UE_id]->harq_processes[harq_pid]->first_rb;
ul_nb_rb = RC.eNB[att_eNB_id][CC_id].ulsch_eNB[(uint8_t)UE_id]->harq_processes[harq_pid]->nb_rb;
ul_fr_rb = RC.eNB[att_eNB_id][CC_id].ulsch_eNB[(uint8_t)UE_id]->harq_processes[harq_pid]->first_rb;
}
if(ul_nb_rb>1 && (ul_fr_rb < 25 && ul_fr_rb > -1)) {
number_rb_ul = ul_nb_rb;
first_rbUL = ul_fr_rb;
init_snr_up(UE2eNB[UE_id][att_eNB_id][CC_id],enb_data[att_eNB_id], ue_data[UE_id],PHY_vars_eNB_g[att_eNB_id][CC_id]->sinr_dB,&PHY_vars_UE_g[att_eNB_id][CC_id]->N0,ul_nb_rb,ul_fr_rb);
init_snr_up(UE2RU[UE_id][att_eNB_id][CC_id],enb_data[att_eNB_id], ue_data[UE_id],PHY_vars_eNB_g[att_eNB_id][CC_id]->sinr_dB,&PHY_vars_UE_g[att_eNB_id][CC_id]->N0,ul_nb_rb,ul_fr_rb);
}
} //UE_id
@@ -452,24 +461,24 @@ void do_UL_sig(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_N
#endif
} else { //without abstraction
pthread_mutex_lock(&UE_output_mutex[eNB_id]);
pthread_mutex_lock(&UE_output_mutex[ru_id]);
// Clear RX signal for eNB = eNB_id
for (i=0; i<frame_parms->samples_per_tti; i++) {
for (aa=0; aa<nb_antennas_rx; aa++) {
r_re_UL[eNB_id][aa][i]=0.0;
r_im_UL[eNB_id][aa][i]=0.0;
r_re_UL[ru_id][aa][i]=0.0;
r_im_UL[ru_id][aa][i]=0.0;
}
}
pthread_mutex_unlock(&UE_output_mutex[eNB_id]);
pthread_mutex_unlock(&UE_output_mutex[ru_id]);
// Compute RX signal for eNB = eNB_id
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
txdata = PHY_vars_UE_g[UE_id][CC_id]->common_vars.txdata;
txdata = RC.ru[ru_id]->common.txdata;
AssertFatal(txdata != NULL,"txdata is null\n");
sf_offset = subframe*frame_parms->samples_per_tti;
if (((double)PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe] +
UE2eNB[UE_id][eNB_id][CC_id]->path_loss_dB) <= -125.0) {
UE2RU[UE_id][ru_id][CC_id]->path_loss_dB) <= -125.0) {
// don't simulate a UE that is too weak
LOG_D(OCM,"[SIM][UL] UE %d tx_pwr %d dBm (num_RE %d) for subframe %d (sf_offset %d)\n",
UE_id,
@@ -496,53 +505,53 @@ void do_UL_sig(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_N
subframe,sf_offset);
multipath_channel(UE2eNB[UE_id][eNB_id][CC_id],s_re,s_im,r_re0,r_im0,
multipath_channel(UE2RU[UE_id][ru_id][CC_id],s_re,s_im,r_re0,r_im0,
frame_parms->samples_per_tti,hold_channel);
rx_pwr = signal_energy_fp2(UE2eNB[UE_id][eNB_id][CC_id]->ch[0],
UE2eNB[UE_id][eNB_id][CC_id]->channel_length)*UE2eNB[UE_id][eNB_id][CC_id]->channel_length;
rx_pwr = signal_energy_fp2(UE2RU[UE_id][ru_id][CC_id]->ch[0],
UE2RU[UE_id][ru_id][CC_id]->channel_length)*UE2RU[UE_id][ru_id][CC_id]->channel_length;
LOG_D(OCM,"[SIM][UL] subframe %d Channel UE %d => eNB %d : %f dB (hold %d,length %d, PL %f)\n",subframe,UE_id,eNB_id,10*log10(rx_pwr),
hold_channel,UE2eNB[UE_id][eNB_id][CC_id]->channel_length,
UE2eNB[UE_id][eNB_id][CC_id]->path_loss_dB);
LOG_D(OCM,"[SIM][UL] subframe %d Channel UE %d => RU %d : %f dB (hold %d,length %d, PL %f)\n",subframe,UE_id,ru_id,10*log10(rx_pwr),
hold_channel,UE2RU[UE_id][ru_id][CC_id]->channel_length,
UE2RU[UE_id][ru_id][CC_id]->path_loss_dB);
rx_pwr = signal_energy_fp(r_re0,r_im0,nb_antennas_rx,frame_parms->samples_per_tti,0);
LOG_D(OCM,"[SIM][UL] eNB %d : rx_pwr %f dBm (%f) for subframe %d, sptti %d\n",
eNB_id,10*log10(rx_pwr),rx_pwr,subframe,frame_parms->samples_per_tti);
ru_id,10*log10(rx_pwr),rx_pwr,subframe,frame_parms->samples_per_tti);
if (UE2eNB[UE_id][eNB_id][CC_id]->first_run == 1)
UE2eNB[UE_id][eNB_id][CC_id]->first_run = 0;
if (UE2RU[UE_id][ru_id][CC_id]->first_run == 1)
UE2RU[UE_id][ru_id][CC_id]->first_run = 0;
pthread_mutex_lock(&UE_output_mutex[eNB_id]);
pthread_mutex_lock(&UE_output_mutex[ru_id]);
for (aa=0; aa<nb_antennas_rx; aa++) {
for (i=0; i<frame_parms->samples_per_tti; i++) {
r_re_UL[eNB_id][aa][i]+=r_re0[aa][i];
r_im_UL[eNB_id][aa][i]+=r_im0[aa][i];
r_re_UL[ru_id][aa][i]+=r_re0[aa][i];
r_im_UL[ru_id][aa][i]+=r_im0[aa][i];
}
}
pthread_mutex_unlock(&UE_output_mutex[eNB_id]);
pthread_mutex_unlock(&UE_output_mutex[ru_id]);
}
} //UE_id
double *r_re_p[2] = {r_re_UL[eNB_id][0],r_re_UL[eNB_id][1]};
double *r_im_p[2] = {r_im_UL[eNB_id][0],r_im_UL[eNB_id][1]};
double *r_re_p[2] = {r_re_UL[ru_id][0],r_re_UL[ru_id][1]};
double *r_im_p[2] = {r_im_UL[ru_id][0],r_im_UL[ru_id][1]};
rf_rx_simple(r_re_p,
r_im_p,
nb_antennas_rx,
frame_parms->samples_per_tti,
1e3/UE2eNB[0][eNB_id][CC_id]->sampling_rate, // sampling time (ns)
(double)PHY_vars_eNB_g[eNB_id][CC_id]->rx_total_gain_dB - 66.227); // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
1e3/UE2RU[0][ru_id][CC_id]->sampling_rate, // sampling time (ns)
(double)RC.ru[ru_id]->max_rxgain-(double)RC.ru[ru_id]->att_rx - 66.227); // rx_gain (dB) (66.227 = 20*log10(pow2(11)) = gain from the adc that will be applied later)
#ifdef DEBUG_SIM
rx_pwr = signal_energy_fp(r_re_p,r_im_p,nb_antennas_rx,frame_parms->samples_per_tti,0)*(double)frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL);
LOG_D(OCM,"[SIM][UL] rx_pwr (ADC in) %f dB for subframe %d\n",10*log10(rx_pwr),subframe);
#endif
rxdata = PHY_vars_eNB_g[eNB_id][CC_id]->common_vars.rxdata[0];
rxdata = RC.ru[ru_id]->common.rxdata;
sf_offset = subframe*frame_parms->samples_per_tti;
@@ -557,7 +566,7 @@ void do_UL_sig(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_N
#ifdef DEBUG_SIM
rx_pwr2 = signal_energy(rxdata[0]+sf_offset,frame_parms->samples_per_tti)*(double)frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL);
LOG_D(OCM,"[SIM][UL] eNB %d rx_pwr (ADC out) %f dB (%d) for subframe %d (offset %d)\n",eNB_id,10*log10((double)rx_pwr2),rx_pwr2,subframe,sf_offset);
LOG_D(OCM,"[SIM][UL] RU %d rx_pwr (ADC out) %f dB (%d) for subframe %d (offset %d)\n",ru_id,10*log10((double)rx_pwr2),rx_pwr2,subframe,sf_offset);
#else
UNUSED_VARIABLE(tx_pwr);
UNUSED_VARIABLE(rx_pwr);
@@ -574,11 +583,11 @@ void init_channel_vars(LTE_DL_FRAME_PARMS *frame_parms, double ***s_re,double **
int i;
memset(eNB_output_mask,0,sizeof(int)*NUMBER_OF_UE_MAX);
memset(RU_output_mask,0,sizeof(int)*NUMBER_OF_UE_MAX);
for (i=0;i<NB_UE_INST;i++)
pthread_mutex_init(&eNB_output_mutex[i],NULL);
pthread_mutex_init(&RU_output_mutex[i],NULL);
memset(UE_output_mask,0,sizeof(int)*NUMBER_OF_eNB_MAX);
memset(UE_output_mask,0,sizeof(int)*NUMBER_OF_RU_MAX);
for (i=0;i<NB_eNB_INST;i++)
pthread_mutex_init(&UE_output_mutex[i],NULL);
+29 -62
View File
@@ -37,11 +37,11 @@
#include "PHY_INTERFACE/extern.h"
/*
PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id,
uint8_t Nid_cell,
eNB_func_t node_function,
node_function_t node_function,
uint8_t abstraction_flag)
{
@@ -49,7 +49,6 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
PHY_VARS_eNB* PHY_vars_eNB = malloc(sizeof(PHY_VARS_eNB));
memset(PHY_vars_eNB,0,sizeof(PHY_VARS_eNB));
PHY_vars_eNB->Mod_id=eNB_id;
PHY_vars_eNB->cooperation_flag=0;//cooperation_flag;
memcpy(&(PHY_vars_eNB->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_eNB->frame_parms.Nid_cell = ((Nid_cell/3)*3)+((eNB_id+Nid_cell)%3);
PHY_vars_eNB->frame_parms.nushift = PHY_vars_eNB->frame_parms.Nid_cell%6;
@@ -81,7 +80,7 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
}
}
LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n");
LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n",i);
PHY_vars_eNB->ulsch[1+i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,frame_parms->N_RB_UL, abstraction_flag);
if (!PHY_vars_eNB->ulsch[1+i]) {
@@ -147,52 +146,10 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
return (PHY_vars_eNB);
}
PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t UE_id,
uint8_t abstraction_flag)
{
int i,j;
PHY_VARS_UE* PHY_vars_UE = malloc(sizeof(PHY_VARS_UE));
memset(PHY_vars_UE,0,sizeof(PHY_VARS_UE));
PHY_vars_UE->Mod_id=UE_id;
memcpy(&(PHY_vars_UE->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS));
phy_init_lte_ue(PHY_vars_UE,1,abstraction_flag);
for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
for (j=0; j<2; j++) {
PHY_vars_UE->dlsch[i][j] = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS,frame_parms->N_RB_DL, abstraction_flag);
if (!PHY_vars_UE->dlsch[i][j]) {
LOG_E(PHY,"Can't get ue dlsch structures\n");
exit(-1);
} else
LOG_D(PHY,"dlsch[%d][%d] => %p\n",UE_id,i,PHY_vars_UE->dlsch[i][j]);
}
*/
PHY_vars_UE->ulsch[i] = new_ue_ulsch(frame_parms->N_RB_UL, abstraction_flag);
if (!PHY_vars_UE->ulsch[i]) {
LOG_E(PHY,"Can't get ue ulsch structures\n");
exit(-1);
}
PHY_vars_UE->dlsch_SI[i] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,frame_parms->N_RB_DL, abstraction_flag);
PHY_vars_UE->dlsch_ra[i] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,frame_parms->N_RB_DL, abstraction_flag);
PHY_vars_UE->transmission_mode[i] = frame_parms->nb_antenna_ports_eNB==1 ? 1 : 2;
}
PHY_vars_UE->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
PHY_vars_UE->dlsch_MCH[0] = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS_MBSFN,frame_parms->N_RB_DL,0);
return (PHY_vars_UE);
}
/*
PHY_VARS_RN* init_lte_RN(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t RN_id,
uint8_t eMBMS_active_state)
@@ -215,6 +172,7 @@ PHY_VARS_RN* init_lte_RN(LTE_DL_FRAME_PARMS *frame_parms,
return (PHY_vars_RN);
}
void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
uint8_t frame_type,
uint8_t tdd_config,
@@ -231,7 +189,9 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
uint8_t eMBMS_active_state)
{
uint8_t eNB_id,UE_id,RN_id,CC_id;
uint8_t eNB_id,UE_id,CC_id;
int i;
mac_xface = malloc(sizeof(MAC_xface));
@@ -271,15 +231,21 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
phy_init_lte_top(frame_parms[0]);
PHY_vars_eNB_g = (PHY_VARS_eNB***)malloc(NB_eNB_INST*sizeof(PHY_VARS_eNB**));
RC.nb_inst = NB_eNB_INST;
RC.nb_CC = (int *)malloc(MAX_NUM_CCs*sizeof(int));
RC.nb_RU = NB_RU;
for (i=0;i<NB_eNB_INST;i++) RC.nb_CC[i] = MAX_NUM_CCs;
RC.eNB = (PHY_VARS_eNB***)malloc(NB_eNB_INST*sizeof(PHY_VARS_eNB**));
for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
PHY_vars_eNB_g[eNB_id] = (PHY_VARS_eNB**) malloc(MAX_NUM_CCs*sizeof(PHY_VARS_eNB*));
RC.eNB[eNB_id] = (PHY_VARS_eNB**) malloc(MAX_NUM_CCs*sizeof(PHY_VARS_eNB*));
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_vars_eNB_g[eNB_id][CC_id] = init_lte_eNB(frame_parms[CC_id],eNB_id,Nid_cell,eNodeB_3GPP,abstraction_flag);
PHY_vars_eNB_g[eNB_id][CC_id]->Mod_id=eNB_id;
PHY_vars_eNB_g[eNB_id][CC_id]->CC_id=CC_id;
RC.eNB[eNB_id][CC_id] = init_lte_eNB(frame_parms[CC_id],eNB_id,Nid_cell,eNodeB_3GPP,abstraction_flag);
RC.eNB[eNB_id][CC_id]->Mod_id=eNB_id;
RC.eNB[eNB_id][CC_id]->CC_id=CC_id;
}
}
@@ -297,13 +263,14 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
PHY_vars_UE_g[UE_id][CC_id]->CC_id=CC_id;
}
}
// if (NB_RN_INST > 0) {
// PHY_vars_RN_g = malloc(NB_RN_INST*sizeof(PHY_VARS_RN*));
if (NB_RN_INST > 0) {
PHY_vars_RN_g = malloc(NB_RN_INST*sizeof(PHY_VARS_RN*));
for (RN_id=0; RN_id<NB_RN_INST; RN_id++) {
PHY_vars_RN_g[RN_id] = init_lte_RN(*frame_parms,RN_id,eMBMS_active_state);
}
}
// for (RN_id=0; RN_id<NB_RN_INST; RN_id++) {
// PHY_vars_RN_g[RN_id] = init_lte_RN(*frame_parms,RN_id,eMBMS_active_state);
// }
// }
}
*/
+1 -1
View File
@@ -25,7 +25,7 @@
PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t eNB_id,
uint8_t Nid_cell,
eNB_func_t node_function,
node_function_t node_function,
uint8_t abstraction_flag);
PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms,
+189 -158
View File
@@ -131,10 +131,10 @@ uint8_t usim_test = 0;
frame_t frame = 0;
char stats_buffer[16384];
channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs];
channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs];
channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM_CCs];
//Added for PHY abstraction
node_desc_t *enb_data[NUMBER_OF_eNB_MAX];
node_desc_t *enb_data[NUMBER_OF_RU_MAX];
node_desc_t *ue_data[NUMBER_OF_UE_MAX];
pthread_cond_t sync_cond;
@@ -142,7 +142,7 @@ pthread_mutex_t sync_mutex;
int sync_var=-1;
pthread_mutex_t subframe_mutex;
int subframe_eNB_mask=0,subframe_UE_mask=0;
int subframe_ru_mask=0,subframe_UE_mask=0;
openair0_config_t openair0_cfg[MAX_CARDS];
uint32_t downlink_frequency[MAX_NUM_CCs][4];
@@ -179,8 +179,6 @@ extern uint8_t abstraction_flag;
extern uint8_t ethernet_flag;
extern uint16_t Nid_cell;
extern LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
//#ifdef XFORMS
@@ -372,19 +370,19 @@ int omv_write(int pfd, node_list* enb_node_list, node_list* ue_node_list, Data_F
enb_node_list = enb_node_list->next;
omv_data.geo[i].Neighbors = 0;
for (j = NB_eNB_INST; j < NB_UE_INST + NB_eNB_INST; j++) {
if (is_UE_active (i, j - NB_eNB_INST) == 1) {
for (j = NB_RU; j < NB_UE_INST + NB_RU; j++) {
if (is_UE_active (i, j - NB_RU) == 1) {
omv_data.geo[i].Neighbor[omv_data.geo[i].Neighbors] = j;
omv_data.geo[i].Neighbors++;
LOG_D(
OMG,
"[eNB %d][UE %d] is_UE_active(i,j) %d geo (x%d, y%d) num neighbors %d\n", i, j-NB_eNB_INST, is_UE_active(i,j-NB_eNB_INST), omv_data.geo[i].x, omv_data.geo[i].y, omv_data.geo[i].Neighbors);
"[RU %d][UE %d] is_UE_active(i,j) %d geo (x%d, y%d) num neighbors %d\n", i, j-NB_RU, is_UE_active(i,j-NB_RU), omv_data.geo[i].x, omv_data.geo[i].y, omv_data.geo[i].Neighbors);
}
}
}
}
for (i = NB_eNB_INST; i < NB_UE_INST + NB_eNB_INST; i++) {
for (i = NB_RU; i < NB_UE_INST + NB_RU; i++) {
if (ue_node_list != NULL) {
omv_data.geo[i].x = (ue_node_list->node->x_pos < 0.0) ? 0.0 : ue_node_list->node->x_pos;
omv_data.geo[i].y = (ue_node_list->node->y_pos < 0.0) ? 0.0 : ue_node_list->node->y_pos;
@@ -408,13 +406,13 @@ int omv_write(int pfd, node_list* enb_node_list, node_list* ue_node_list, Data_F
ue_node_list = ue_node_list->next;
omv_data.geo[i].Neighbors = 0;
for (j = 0; j < NB_eNB_INST; j++) {
if (is_UE_active (j, i - NB_eNB_INST) == 1) {
for (j = 0; j < NB_RU; j++) {
if (is_UE_active (j, i - NB_RU) == 1) {
omv_data.geo[i].Neighbor[omv_data.geo[i].Neighbors] = j;
omv_data.geo[i].Neighbors++;
LOG_D(
OMG,
"[UE %d][eNB %d] is_UE_active %d geo (x%d, y%d) num neighbors %d\n", i-NB_eNB_INST, j, is_UE_active(j,i-NB_eNB_INST), omv_data.geo[i].x, omv_data.geo[i].y, omv_data.geo[i].Neighbors);
"[UE %d][RU %d] is_UE_active %d geo (x%d, y%d) num neighbors %d\n", i-NB_RU, j, is_UE_active(j,i-NB_RU), omv_data.geo[i].x, omv_data.geo[i].y, omv_data.geo[i].Neighbors);
}
}
}
@@ -446,6 +444,7 @@ static Data_Flow_Unit omv_data;
#endif //ALU
static module_id_t UE_inst = 0;
static module_id_t eNB_inst = 0;
static module_id_t ru_id;
Packet_OTG_List_t *otg_pdcp_buffer;
@@ -455,7 +454,7 @@ typedef enum l2l1_task_state_e {
l2l1_task_state_t l2l1_state = L2L1_WAITTING;
extern openair0_timestamp current_eNB_rx_timestamp[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
extern openair0_timestamp current_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs];
extern openair0_timestamp current_UE_rx_timestamp[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
@@ -617,9 +616,7 @@ l2l1_task (void *args_p)
#endif
module_id_t enb_id;
module_id_t UE_id;
for (enb_id = 0; enb_id < NB_eNB_INST; enb_id++)
mac_xface->mrbch_phy_sync_failure (enb_id, 0, enb_id);
if (abstraction_flag == 1) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++)
mac_xface->dl_phy_sync_success (UE_id, 0, 0,1); //UE_id%NB_eNB_INST);
@@ -692,7 +689,7 @@ l2l1_task (void *args_p)
//oai_emulation.info.time_ms += 1;
oai_emulation.info.time_s += 0.01; // emu time in s, each frame lasts for 10 ms // JNote: TODO check the coherency of the time and frame (I corrected it to 10 (instead of 0.01)
update_omg (frame); // frequency is defined in the omg_global params configurable by the user
update_omg (frame); // frequency is defined in the omg_global params configurable by the user
update_omg_ocm ();
#ifdef OPENAIR2
@@ -704,7 +701,7 @@ l2l1_task (void *args_p)
#endif
update_ocm ();
for (sf = 0; sf < 10; sf++) {
LOG_D(EMU,"************************* Subframe %d\n",sf);
@@ -722,7 +719,7 @@ l2l1_task (void *args_p)
#ifdef PROC
if(Channel_Flag==1)
Channel_Func(s_re2,s_im2,r_re2,r_im2,r_re02,r_im02,r_re0_d,r_im0_d,r_re0_u,r_im0_u,eNB2UE,UE2eNB,enb_data,ue_data,abstraction_flag,frame_parms,sf<<1);
Channel_Func(s_re2,s_im2,r_re2,r_im2,r_re02,r_im02,r_re0_d,r_im0_d,r_re0_u,r_im0_u,RU2UE,UE2RU,enb_data,ue_data,abstraction_flag,frame_parms,sf<<1);
if(Channel_Flag==0)
#endif
@@ -737,11 +734,11 @@ l2l1_task (void *args_p)
int all_done=0;
while (all_done==0) {
pthread_mutex_lock(&subframe_mutex);
int subframe_eNB_mask_local = subframe_eNB_mask;
int subframe_ru_mask_local = subframe_ru_mask;
int subframe_UE_mask_local = subframe_UE_mask;
pthread_mutex_unlock(&subframe_mutex);
LOG_D(EMU,"Frame %d, Subframe %d: Checking masks %x,%x\n",frame,sf,subframe_eNB_mask,subframe_UE_mask);
if ((subframe_eNB_mask_local == ((1<<NB_eNB_INST)-1)) &&
LOG_D(EMU,"Frame %d, Subframe %d: Checking masks %x,%x\n",frame,sf,subframe_ru_mask,subframe_UE_mask);
if ((subframe_ru_mask_local == ((1<<NB_RU)-1)) &&
(subframe_UE_mask_local == ((1<<NB_UE_INST)-1)))
all_done=1;
else
@@ -750,18 +747,20 @@ l2l1_task (void *args_p)
//clear subframe masks for next round
pthread_mutex_lock(&subframe_mutex);
subframe_eNB_mask=0;
subframe_ru_mask=0;
subframe_UE_mask=0;
pthread_mutex_unlock(&subframe_mutex);
// increment timestamps
for (eNB_inst = oai_emulation.info.first_enb_local;
(eNB_inst
/*
for (ru_id = oai_emulation.info.first_enb_local;
(ru_id
< (oai_emulation.info.first_enb_local
+ oai_emulation.info.nb_enb_local));
eNB_inst++) {
current_eNB_rx_timestamp[eNB_inst][CC_id] += PHY_vars_eNB_g[eNB_inst][CC_id]->frame_parms.samples_per_tti;
ru_id++) {
*/
for (ru_id=0;ru_id<NB_RU;ru_id++) {
current_ru_rx_timestamp[ru_id][CC_id] += RC.ru[ru_id]->frame_parms.samples_per_tti;
}
for (UE_inst = 0; UE_inst<NB_UE_INST;UE_inst++) {
current_UE_rx_timestamp[UE_inst][CC_id] += PHY_vars_UE_g[UE_inst][CC_id]->frame_parms.samples_per_tti;
@@ -816,11 +815,11 @@ l2l1_task (void *args_p)
if((sf==9) && frame%10==0)
if(eNB_avg_thr)
fprintf(eNB_avg_thr,"%d %d\n",PHY_vars_eNB_g[eNB_inst][0]->proc.proc_rxtx[sf&1].frame_tx,
(PHY_vars_eNB_g[eNB_inst][0]->total_system_throughput)/((PHY_vars_eNB_g[eNB_inst][0]->proc.proc_rxtx[sf&1].frame_tx+1)*10));
fprintf(eNB_avg_thr,"%d %d\n",RC.eNB[eNB_inst][0]->proc.proc_rxtx[sf&1].frame_tx,
(RC.eNB[eNB_inst][0]->total_system_throughput)/((RC.eNB[eNB_inst][0]->proc.proc_rxtx[sf&1].frame_tx+1)*10));
if (eNB_stats[eNB_inst]) {
len = dump_eNB_stats(PHY_vars_eNB_g[eNB_inst][0], stats_buffer, 0);
len = dump_eNB_stats(RC.eNB[eNB_inst][0], stats_buffer, 0);
rewind (eNB_stats[eNB_inst]);
fwrite (stats_buffer, 1, len, eNB_stats[eNB_inst]);
fflush(eNB_stats[eNB_inst]);
@@ -1069,7 +1068,7 @@ l2l1_task (void *args_p)
6 * 12 * 4, 1, 1);
write_output ("pbch_rxF_llr.m", "pbch_llr",
PHY_vars_UE_g[0][0]->pbch_vars[0]->llr,
(frame_parms[0]->Ncp == 0) ? 1920 : 1728, 1,
(PHY_vars_UE_g[0][0]->frame_parms.Ncp == 0) ? 1920 : 1728, 1,
4);
}
@@ -1078,6 +1077,7 @@ l2l1_task (void *args_p)
}
update_ocm ();
/*
if ((frame >= 10) && (frame <= 11) && (abstraction_flag == 0)
#ifdef PROC
@@ -1139,10 +1139,10 @@ l2l1_task (void *args_p)
UE_inst,
7);
}
phy_scope_eNB(form_enb[UE_inst],
PHY_vars_eNB_g[eNB_inst][0],
UE_inst);
if (RC.eNB && RC.eNB[eNB_inst] && RC.eNB[eNB_inst][0] )
phy_scope_eNB(form_enb[UE_inst],
RC.eNB[eNB_inst][0],
UE_inst);
}
}
@@ -1198,6 +1198,44 @@ int T_port = 2021; /* default port to listen to to wait for the tracer */
int T_dont_fork = 0; /* default is to fork, see 'T_init' to understand */
#endif
void wait_RUs() {
int i;
// wait for all RUs to be configured over fronthaul
pthread_mutex_lock(&RC.ru_mutex);
while (RC.ru_mask>0) {
pthread_cond_wait(&RC.ru_cond,&RC.ru_mutex);
}
// copy frame parameters from RU to UEs
for (i=0;i<NB_UE_INST;i++) {
PHY_vars_UE_g[i][0]->frame_parms.N_RB_DL = RC.ru[0]->frame_parms.N_RB_DL;
PHY_vars_UE_g[i][0]->frame_parms.nb_antennas_tx = 1;
PHY_vars_UE_g[i][0]->frame_parms.nb_antennas_rx = 1;
PHY_vars_UE_g[i][0]->frame_parms.nb_antenna_ports_eNB = RC.ru[0]->frame_parms.nb_antenna_ports_eNB;
PHY_vars_UE_g[i][0]->frame_parms.dl_CarrierFreq = RC.ru[0]->frame_parms.dl_CarrierFreq;
PHY_vars_UE_g[i][0]->frame_parms.ul_CarrierFreq = RC.ru[0]->frame_parms.ul_CarrierFreq;
PHY_vars_UE_g[i][0]->frame_parms.eutra_band = RC.ru[0]->frame_parms.eutra_band;
init_ul_hopping(&PHY_vars_UE_g[i][0]->frame_parms);
init_frame_parms(&PHY_vars_UE_g[i][0]->frame_parms,1);
phy_init_lte_top(&PHY_vars_UE_g[i][0]->frame_parms);
phy_init_lte_ue(PHY_vars_UE_g[i][0],1,0);
current_UE_rx_timestamp[i][0] = PHY_vars_UE_g[i][0]->frame_parms.samples_per_tti;
}
for (ru_id=0;ru_id<RC.nb_RU;ru_id++) current_ru_rx_timestamp[ru_id][0] = RC.ru[ru_id]->frame_parms.samples_per_tti;
printf("RUs are ready, let's go\n");
}
void init_UE(int,int,int);
void init_RU(const char*);
/*------------------------------------------------------------------------------*/
int
main (int argc, char **argv)
@@ -1287,34 +1325,27 @@ main (int argc, char **argv)
init_seed (set_seed);
init_openair1 ();
init_devices ();
init_RU(NULL);
init_UE(NB_UE_INST,0,0);
init_openair2 ();
// init_openair2 ();
init_openair0();
// init_openair0();
if (create_tasks(0,
oai_emulation.info.nb_ue_local) < 0)
exit(-1); // need a softer mode
printf("Waiting for RUs to get set up\n");
wait_RUs();
init_ocm ();
#if defined(ENABLE_ITTI)
// Handle signals until all tasks are terminated
// Note: Cannot handle both RRU/RAU and eNB at the same time, if the first "eNB" is an RRU/RAU, no NAS
if (oai_emulation.info.node_function[0] < NGFI_RAU_IF4p5) {
if (create_tasks(oai_emulation.info.nb_enb_local,
oai_emulation.info.nb_ue_local) < 0)
exit(-1); // need a softer mode
}
else {
if (create_tasks(0,
oai_emulation.info.nb_ue_local) < 0)
exit(-1); // need a softer mode
}
#endif
// wait for all threads to startup
sleep(3);
printf("Sending sync to all threads\n");
pthread_mutex_lock(&sync_mutex);
sync_var=0;
pthread_cond_broadcast(&sync_cond);
@@ -1391,7 +1422,7 @@ reset_opp_meas_oaisim (void)
reset_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc_rx);
reset_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc_tx);
reset_meas (&PHY_vars_UE_g[UE_id][0]->ofdm_demod_stats);
// reset_meas (&PHY_vars_UE_g[UE_id][0]->ofdm_demod_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->rx_dft_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_channel_estimation_stats);
reset_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_freq_offset_estimation_stats);
@@ -1445,64 +1476,64 @@ reset_opp_meas_oaisim (void)
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
reset_meas (&eNB2UE[eNB_id][UE_id][0]->random_channel);
reset_meas (&eNB2UE[eNB_id][UE_id][0]->interp_time);
reset_meas (&eNB2UE[eNB_id][UE_id][0]->interp_freq);
reset_meas (&eNB2UE[eNB_id][UE_id][0]->convolution);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->random_channel);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->interp_time);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->interp_freq);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->convolution);
reset_meas (&RU2UE[eNB_id][UE_id][0]->random_channel);
reset_meas (&RU2UE[eNB_id][UE_id][0]->interp_time);
reset_meas (&RU2UE[eNB_id][UE_id][0]->interp_freq);
reset_meas (&RU2UE[eNB_id][UE_id][0]->convolution);
reset_meas (&UE2RU[UE_id][eNB_id][0]->random_channel);
reset_meas (&UE2RU[UE_id][eNB_id][0]->interp_time);
reset_meas (&UE2RU[UE_id][eNB_id][0]->interp_freq);
reset_meas (&UE2RU[UE_id][eNB_id][0]->convolution);
}
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->phy_proc);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->phy_proc_rx);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->phy_proc_tx);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->rx_prach);
reset_meas (&RC.eNB[eNB_id][0]->phy_proc);
reset_meas (&RC.eNB[eNB_id][0]->phy_proc_rx);
reset_meas (&RC.eNB[eNB_id][0]->phy_proc_tx);
reset_meas (&RC.eNB[eNB_id][0]->rx_prach);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ofdm_mod_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->dlsch_encoding_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->dlsch_modulation_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->dlsch_scrambling_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->dlsch_rate_matching_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->dlsch_turbo_encoding_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->dlsch_interleaving_stats);
reset_meas (&RC.eNB[eNB_id][0]->ofdm_mod_stats);
reset_meas (&RC.eNB[eNB_id][0]->dlsch_encoding_stats);
reset_meas (&RC.eNB[eNB_id][0]->dlsch_modulation_stats);
reset_meas (&RC.eNB[eNB_id][0]->dlsch_scrambling_stats);
reset_meas (&RC.eNB[eNB_id][0]->dlsch_rate_matching_stats);
reset_meas (&RC.eNB[eNB_id][0]->dlsch_turbo_encoding_stats);
reset_meas (&RC.eNB[eNB_id][0]->dlsch_interleaving_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ofdm_demod_stats);
//reset_meas(&PHY_vars_eNB_g[eNB_id]->rx_dft_stats);
//reset_meas(&PHY_vars_eNB_g[eNB_id]->ulsch_channel_estimation_stats);
//reset_meas(&PHY_vars_eNB_g[eNB_id]->ulsch_freq_offset_estimation_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_decoding_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_demodulation_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_rate_unmatching_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_turbo_decoding_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_deinterleaving_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_demultiplexing_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_llr_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_init_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_alpha_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_beta_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_gamma_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_ext_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl1_stats);
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl2_stats);
// reset_meas (&RC.eNB[eNB_id][0]->ofdm_demod_stats);
//reset_meas(&RC.eNB[eNB_id]->rx_dft_stats);
//reset_meas(&RC.eNB[eNB_id]->ulsch_channel_estimation_stats);
//reset_meas(&RC.eNB[eNB_id]->ulsch_freq_offset_estimation_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_decoding_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_demodulation_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_rate_unmatching_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_turbo_decoding_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_deinterleaving_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_demultiplexing_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_llr_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_tc_init_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_tc_alpha_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_tc_beta_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_tc_gamma_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_tc_ext_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_tc_intl1_stats);
reset_meas (&RC.eNB[eNB_id][0]->ulsch_tc_intl2_stats);
#ifdef LOCALIZATION
reset_meas(&PHY_vars_eNB_g[eNB_id][0]->localization_stats);
reset_meas(&RC.eNB[eNB_id][0]->localization_stats);
#endif
/*
* L2 functions
*/
// eNB MAC
reset_meas (&eNB_mac_inst[eNB_id].eNB_scheduler); // total
reset_meas (&eNB_mac_inst[eNB_id].schedule_si); // only schedule + tx
reset_meas (&eNB_mac_inst[eNB_id].schedule_ra); // only ra
reset_meas (&eNB_mac_inst[eNB_id].schedule_ulsch); // onlu ulsch
reset_meas (&eNB_mac_inst[eNB_id].fill_DLSCH_dci); // only dci
reset_meas (&eNB_mac_inst[eNB_id].schedule_dlsch_preprocessor); // include rlc_data_req + MAC header gen
reset_meas (&eNB_mac_inst[eNB_id].schedule_dlsch); // include rlc_data_req + MAC header gen + pre-processor
reset_meas (&eNB_mac_inst[eNB_id].schedule_mch); // only embms
reset_meas (&eNB_mac_inst[eNB_id].rx_ulsch_sdu); // include rlc_data_ind + mac header parser
reset_meas (&RC.mac[eNB_id]->eNB_scheduler); // total
reset_meas (&RC.mac[eNB_id]->schedule_si); // only schedule + tx
reset_meas (&RC.mac[eNB_id]->schedule_ra); // only ra
reset_meas (&RC.mac[eNB_id]->schedule_ulsch); // onlu ulsch
reset_meas (&RC.mac[eNB_id]->fill_DLSCH_dci); // only dci
reset_meas (&RC.mac[eNB_id]->schedule_dlsch_preprocessor); // include rlc_data_req + MAC header gen
reset_meas (&RC.mac[eNB_id]->schedule_dlsch); // include rlc_data_req + MAC header gen + pre-processor
reset_meas (&RC.mac[eNB_id]->schedule_mch); // only embms
reset_meas (&RC.mac[eNB_id]->rx_ulsch_sdu); // include rlc_data_ind + mac header parser
reset_meas (&eNB_pdcp_stats[eNB_id].pdcp_run);
reset_meas (&eNB_pdcp_stats[eNB_id].data_req);
@@ -1532,23 +1563,23 @@ print_opp_meas_oaisim (void)
&oaisim_stats_f);
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
print_meas (&eNB2UE[eNB_id][UE_id][0]->random_channel,
for (ru_id = 0; ru_id < NB_RU; ru_id++) {
print_meas (&RU2UE[ru_id][UE_id][0]->random_channel,
"[DL][random_channel]", &oaisim_stats, &oaisim_stats_f);
print_meas (&eNB2UE[eNB_id][UE_id][0]->interp_time,
print_meas (&RU2UE[ru_id][UE_id][0]->interp_time,
"[DL][interp_time]", &oaisim_stats, &oaisim_stats_f);
print_meas (&eNB2UE[eNB_id][UE_id][0]->interp_freq,
print_meas (&RU2UE[ru_id][UE_id][0]->interp_freq,
"[DL][interp_freq]", &oaisim_stats, &oaisim_stats_f);
print_meas (&eNB2UE[eNB_id][UE_id][0]->convolution,
print_meas (&RU2UE[ru_id][UE_id][0]->convolution,
"[DL][convolution]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->random_channel,
print_meas (&UE2RU[UE_id][ru_id][0]->random_channel,
"[UL][random_channel]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->interp_time,
print_meas (&UE2RU[UE_id][ru_id][0]->interp_time,
"[UL][interp_time]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->interp_freq,
print_meas (&UE2RU[UE_id][ru_id][0]->interp_freq,
"[UL][interp_freq]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->convolution,
print_meas (&UE2RU[UE_id][ru_id][0]->convolution,
"[UL][convolution]", &oaisim_stats, &oaisim_stats_f);
}
}
@@ -1559,8 +1590,8 @@ print_opp_meas_oaisim (void)
print_meas (&PHY_vars_UE_g[UE_id][0]->phy_proc_rx,
"[UE][total_phy_proc_rx]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->ofdm_demod_stats,
"[UE][ofdm_demod]", &oaisim_stats, &oaisim_stats_f);
// print_meas (&PHY_vars_UE_g[UE_id][0]->ofdm_demod_stats,
// "[UE][ofdm_demod]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->rx_dft_stats, "[UE][rx_dft]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_UE_g[UE_id][0]->dlsch_channel_estimation_stats,
@@ -1616,65 +1647,65 @@ print_opp_meas_oaisim (void)
}
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
print_meas (&PHY_vars_eNB_g[eNB_id][0]->phy_proc,
print_meas (&RC.eNB[eNB_id][0]->phy_proc,
"[eNB][total_phy_proc]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->phy_proc_tx,
print_meas (&RC.eNB[eNB_id][0]->phy_proc_tx,
"[eNB][total_phy_proc_tx]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->ofdm_mod_stats,
print_meas (&RC.eNB[eNB_id][0]->ofdm_mod_stats,
"[eNB][ofdm_mod]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->dlsch_modulation_stats,
print_meas (&RC.eNB[eNB_id][0]->dlsch_modulation_stats,
"[eNB][modulation]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->dlsch_scrambling_stats,
print_meas (&RC.eNB[eNB_id][0]->dlsch_scrambling_stats,
"[eNB][scrambling]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->dlsch_encoding_stats,
print_meas (&RC.eNB[eNB_id][0]->dlsch_encoding_stats,
"[eNB][encoding]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->dlsch_interleaving_stats,
print_meas (&RC.eNB[eNB_id][0]->dlsch_interleaving_stats,
"[eNB][|_interleaving]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->dlsch_rate_matching_stats,
print_meas (&RC.eNB[eNB_id][0]->dlsch_rate_matching_stats,
"[eNB][|_rate_matching]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->dlsch_turbo_encoding_stats,
print_meas (&RC.eNB[eNB_id][0]->dlsch_turbo_encoding_stats,
"[eNB][|_turbo_encoding]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->phy_proc_rx,
print_meas (&RC.eNB[eNB_id][0]->phy_proc_rx,
"[eNB][total_phy_proc_rx]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->ofdm_demod_stats,
"[eNB][ofdm_demod]", &oaisim_stats, &oaisim_stats_f);
//print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_channel_estimation_stats,"[eNB][channel_est]");
//print_meas(&PHY_vars_eNB_g[eNB_id][0]->ulsch_freq_offset_estimation_stats,"[eNB][freq_offset]");
//print_meas(&PHY_vars_eNB_g[eNB_id][0]->rx_dft_stats,"[eNB][rx_dft]");
print_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_demodulation_stats,
// print_meas (&RC.eNB[eNB_id][0]->ofdm_demod_stats,
// "[eNB][ofdm_demod]", &oaisim_stats, &oaisim_stats_f);
//print_meas(&RC.eNB[eNB_id][0]->ulsch_channel_estimation_stats,"[eNB][channel_est]");
//print_meas(&RC.eNB[eNB_id][0]->ulsch_freq_offset_estimation_stats,"[eNB][freq_offset]");
//print_meas(&RC.eNB[eNB_id][0]->rx_dft_stats,"[eNB][rx_dft]");
print_meas (&RC.eNB[eNB_id][0]->ulsch_demodulation_stats,
"[eNB][demodulation]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_decoding_stats,
print_meas (&RC.eNB[eNB_id][0]->ulsch_decoding_stats,
"[eNB][decoding]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_deinterleaving_stats,
print_meas (&RC.eNB[eNB_id][0]->ulsch_deinterleaving_stats,
"[eNB][|_deinterleaving]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_demultiplexing_stats,
print_meas (&RC.eNB[eNB_id][0]->ulsch_demultiplexing_stats,
"[eNB][|_demultiplexing]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_rate_unmatching_stats,
print_meas (&RC.eNB[eNB_id][0]->ulsch_rate_unmatching_stats,
"[eNB][|_rate_unmatching]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_turbo_decoding_stats,
print_meas (&RC.eNB[eNB_id][0]->ulsch_turbo_decoding_stats,
"[eNB][|_turbo_decoding]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_init_stats,
print_meas (&RC.eNB[eNB_id][0]->ulsch_tc_init_stats,
"[eNB][ |_tc_init]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_alpha_stats,
print_meas (&RC.eNB[eNB_id][0]->ulsch_tc_alpha_stats,
"[eNB][ |_tc_alpha]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_beta_stats,
print_meas (&RC.eNB[eNB_id][0]->ulsch_tc_beta_stats,
"[eNB][ |_tc_beta]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_gamma_stats,
print_meas (&RC.eNB[eNB_id][0]->ulsch_tc_gamma_stats,
"[eNB][ |_tc_gamma]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_ext_stats,
print_meas (&RC.eNB[eNB_id][0]->ulsch_tc_ext_stats,
"[eNB][ |_tc_ext]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl1_stats,
print_meas (&RC.eNB[eNB_id][0]->ulsch_tc_intl1_stats,
"[eNB][ |_tc_intl1]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->ulsch_tc_intl2_stats,
print_meas (&RC.eNB[eNB_id][0]->ulsch_tc_intl2_stats,
"[eNB][ |_tc_intl2]", &oaisim_stats, &oaisim_stats_f);
print_meas (&PHY_vars_eNB_g[eNB_id][0]->rx_prach, "[eNB][rx_prach]",
print_meas (&RC.eNB[eNB_id][0]->rx_prach, "[eNB][rx_prach]",
&oaisim_stats, &oaisim_stats_f);
#ifdef LOCALIZATION
print_meas(&PHY_vars_eNB_g[eNB_id][0]->localization_stats, "[eNB][LOCALIZATION]",&oaisim_stats,&oaisim_stats_f);
print_meas(&RC.eNB[eNB_id][0]->localization_stats, "[eNB][LOCALIZATION]",&oaisim_stats,&oaisim_stats_f);
#endif
}
@@ -1714,24 +1745,24 @@ print_opp_meas_oaisim (void)
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
print_meas (&eNB_mac_inst[eNB_id].eNB_scheduler, "[eNB][mac_scheduler]",
print_meas (&RC.mac[eNB_id]->eNB_scheduler, "[eNB][mac_scheduler]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&eNB_mac_inst[eNB_id].schedule_si, "[eNB][DL][SI]",
print_meas (&RC.mac[eNB_id]->schedule_si, "[eNB][DL][SI]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&eNB_mac_inst[eNB_id].schedule_ra, "[eNB][DL][RA]",
print_meas (&RC.mac[eNB_id]->schedule_ra, "[eNB][DL][RA]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&eNB_mac_inst[eNB_id].fill_DLSCH_dci,
print_meas (&RC.mac[eNB_id]->fill_DLSCH_dci,
"[eNB][DL/UL][fill_DCI]", &oaisim_stats, &oaisim_stats_f);
print_meas (&eNB_mac_inst[eNB_id].schedule_dlsch_preprocessor,
print_meas (&RC.mac[eNB_id]->schedule_dlsch_preprocessor,
"[eNB][DL][preprocessor]", &oaisim_stats, &oaisim_stats_f);
print_meas (&eNB_mac_inst[eNB_id].schedule_dlsch,
print_meas (&RC.mac[eNB_id]->schedule_dlsch,
"[eNB][DL][schedule_tx_dlsch]", &oaisim_stats,
&oaisim_stats_f);
print_meas (&eNB_mac_inst[eNB_id].schedule_mch, "[eNB][DL][mch]",
print_meas (&RC.mac[eNB_id]->schedule_mch, "[eNB][DL][mch]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&eNB_mac_inst[eNB_id].schedule_ulsch, "[eNB][UL][ULSCH]",
print_meas (&RC.mac[eNB_id]->schedule_ulsch, "[eNB][UL][ULSCH]",
&oaisim_stats, &oaisim_stats_f);
print_meas (&eNB_mac_inst[eNB_id].rx_ulsch_sdu,
print_meas (&RC.mac[eNB_id]->rx_ulsch_sdu,
"[eNB][UL][rx_ulsch_sdu]", &oaisim_stats, &oaisim_stats_f);
print_meas (&eNB_pdcp_stats[eNB_id].pdcp_run, "[eNB][pdcp_run]",
@@ -1922,7 +1953,7 @@ oai_shutdown (void)
eNB_MAC_INST*
get_eNB_mac_inst (module_id_t module_idP)
{
return (&eNB_mac_inst[module_idP]);
return (RC.mac[module_idP]);
}
OAI_Emulation*
+4 -4
View File
@@ -42,13 +42,13 @@ eNB_MAC_INST* get_eNB_mac_inst(module_id_t module_idP);
OAI_Emulation* get_OAI_emulation(void);
void init_channel_vars(LTE_DL_FRAME_PARMS *frame_parms, double ***s_re,double ***s_im,double ***r_re,double ***r_im,double ***r_re0,double ***r_im0);
void do_UL_sig(channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],
void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_RU_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],
uint16_t subframe,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,int eNB_id,uint8_t CC_id);
void do_DL_sig(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_eNB_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],uint16_t subframe,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,uint8_t UE_id,int CC_id);
void do_DL_sig(channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs],
node_desc_t *enb_data[NUMBER_OF_RU_MAX],node_desc_t *ue_data[NUMBER_OF_UE_MAX],uint16_t subframe,uint8_t abstraction_flag,LTE_DL_FRAME_PARMS *frame_parms,uint8_t UE_id,int CC_id);
void init_ue(node_desc_t *ue_data, UE_Antenna ue_ant);//Abstraction changes
void init_enb(node_desc_t *enb_data, eNB_Antenna enb_ant);//Abstraction changes
+2 -1
View File
@@ -247,7 +247,8 @@ void init_oai_emulation(void)
oai_emulation.info.first_rn_local=0;
oai_emulation.info.master_id=0;
oai_emulation.info.nb_ue_local= 1;//default 1 UE
oai_emulation.info.nb_enb_local= 1;//default 1 eNB
oai_emulation.info.nb_enb_local= 0;//default 0 eNB (to be loaded from config)
oai_emulation.info.nb_ru_local= 0;//default 0 ru (to be loaded from config)
oai_emulation.info.nb_rn_local= 0;//default 0 RN : currently only applicable for eMBMS
oai_emulation.info.ethernet_flag=0;
oai_emulation.info.ocm_enabled=1;// flag ?
+208 -366
View File
@@ -91,7 +91,6 @@ extern char smbv_ip[16];
#define K 2 // averaging coefficient
#define TARGET_SF_TIME_NS 1000000 // 1ms = 1000000 ns
#define min(a,b) ((a)<(b)?(a):(b))
int otg_times = 0;
int if_times = 0;
@@ -115,7 +114,7 @@ uint8_t beta_ACK = 0;
uint8_t beta_RI = 0;
uint8_t beta_CQI = 2;
uint8_t target_ul_mcs = 16;
LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
//LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
int map1,map2;
double **ShaF = NULL;
// pointers signal buffers (s = transmit, r,r0 = receive)
@@ -155,10 +154,10 @@ char tdd_config[10];
Packet_OTG_List_t *otg_pdcp_buffer = NULL;
extern node_desc_t *enb_data[NUMBER_OF_eNB_MAX];
extern node_desc_t *enb_data[NUMBER_OF_RU_MAX];
extern node_desc_t *ue_data[NUMBER_OF_UE_MAX];
extern channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs];
extern channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
extern channel_desc_t *RU2UE[NUMBER_OF_RU_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs];
extern channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM_CCs];
extern mapping small_scale_names[];
#if defined(Rel10)
@@ -175,19 +174,12 @@ extern int xforms;
extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
eth_params_t *eth_params;
void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst,eth_params_t *,int,int);
void stop_eNB(int nb_inst);
const Enb_properties_array_t *enb_properties;
int oaisim_flag=1;
void get_simulation_options(int argc, char *argv[])
{
int option;
char *conf_config_file_name = NULL;
enum long_option_e {
LONG_OPTION_START = 0x100, /* Start after regular single char options */
@@ -279,9 +271,9 @@ void get_simulation_options(int argc, char *argv[])
case LONG_OPTION_ENB_CONF:
if (optarg) {
free(conf_config_file_name); // prevent memory leak if option is used multiple times
conf_config_file_name = strdup(optarg);
printf("eNB configuration file is %s\n", conf_config_file_name);
free(RC.config_file_name); // prevent memory leak if option is used multiple times
RC.config_file_name = strdup(optarg);
printf("eNB configuration file is %s\n", RC.config_file_name);
}
break;
@@ -609,8 +601,8 @@ void get_simulation_options(int argc, char *argv[])
case 'O':
if (optarg) {
free(conf_config_file_name); // prevent memory leak if option is used multiple times
conf_config_file_name = strdup(optarg);
free(RC.config_file_name); // prevent memory leak if option is used multiple times
RC.config_file_name = strdup(optarg);
}
break;
@@ -789,55 +781,68 @@ void get_simulation_options(int argc, char *argv[])
}
}
if ((oai_emulation.info.nb_enb_local > 0) && (conf_config_file_name != NULL)) {
if (RC.config_file_name != NULL) {
/* Read eNB configuration file */
enb_properties = enb_config_init(conf_config_file_name);
AssertFatal (oai_emulation.info.nb_enb_local <= enb_properties->number,
"Number of eNB is greater than eNB defined in configuration file %s (%d/%d)!",
conf_config_file_name, oai_emulation.info.nb_enb_local, enb_properties->number);
eth_params = (eth_params_t*)malloc(enb_properties->properties[0]->nb_rrh_gw * sizeof(eth_params_t));
memset(eth_params, 0, enb_properties->properties[0]->nb_rrh_gw * sizeof(eth_params_t));
for (int j=0; j<enb_properties->properties[0]->nb_rrh_gw; j++) {
RCConfig(RC.config_file_name);
printf("returned with %d eNBs, %d rus\n",RC.nb_inst,RC.nb_RU);
oai_emulation.info.nb_enb_local = RC.nb_inst;
oai_emulation.info.nb_ru_local = RC.nb_RU;
/*
for (int j=0; j<enb_properties->nb_ru; j++) {
if (enb_properties->properties[0]->rrh_gw_config[j].active == 1 ) {
// local_remote_radio = BBU_REMOTE_RADIO_HEAD;
(eth_params+j)->local_if_name = enb_properties->properties[0]->rrh_gw_config[j].rrh_gw_if_name;
(eth_params+j)->my_addr = enb_properties->properties[0]->rrh_gw_config[j].local_address;
(eth_params+j)->my_port = enb_properties->properties[0]->rrh_gw_config[j].local_port;
(eth_params+j)->remote_addr = enb_properties->properties[0]->rrh_gw_config[j].remote_address;
(eth_params+j)->remote_port = enb_properties->properties[0]->rrh_gw_config[j].remote_port;
if (enb_properties->properties[0]->rrh_gw_config[j].raw == 1) {
(eth_params+j)->transp_preference = ETH_RAW_MODE;
} else if (enb_properties->properties[0]->rrh_gw_config[j].rawif4p5 == 1) {
(eth_params+j)->transp_preference = ETH_RAW_IF4p5_MODE;
} else if (enb_properties->properties[0]->rrh_gw_config[j].udpif4p5 == 1) {
(eth_params+j)->transp_preference = ETH_UDP_IF4p5_MODE;
} else if (enb_properties->properties[0]->rrh_gw_config[j].rawif5_mobipass == 1) {
(eth_params+j)->transp_preference = ETH_RAW_IF5_MOBIPASS;
} else {
(eth_params+j)->transp_preference = ETH_UDP_MODE;
}
// local_remote_radio = BBU_REMOTE_RADIO_HEAD;
(eth_params+j)->local_if_name = enb_properties->ru_config[j]->ru_if_name;
(eth_params+j)->my_addr = enb_properties->ru_config[j]->local_address;
(eth_params+j)->my_port = enb_properties->ru_config[j]->local_port;
(eth_params+j)->remote_addr = enb_properties->ru_config[j]->remote_address;
(eth_params+j)->remote_port = enb_properties->ru_config[j]->remote_port;
if (enb_properties->ru_config[j]->raw == 1) {
(eth_params+j)->transp_preference = ETH_RAW_MODE;
ru_if_in[j] = REMOTE_IF5;
node_function[j] = NGFI_RRU_IF5;
} else if (enb_properties->ru_config[j]->rawif4p5 == 1) {
(eth_params+j)->transp_preference = ETH_RAW_IF4p5_MODE;
ru_if_in[j] = REMOTE_IF4p5;
node_function[j] = NGFI_RRU_IF4p5;
} else if (enb_properties->ru_config[j]->udpif4p5 == 1) {
(eth_params+j)->transp_preference = ETH_UDP_IF4p5_MODE;
ru_if_in[j] = REMOTE_IF4p5;
node_function[j] = NGFI_RRU_IF4p5;
} else if (enb_properties->ru_config[j]->rawif5_mobipass == 1) {
(eth_params+j)->transp_preference = ETH_RAW_IF5_MOBIPASS;
ru_if_in[j] = REMOTE_IF5;
LOG_E(EMU,"Don't use 8-bit IF5 format with oaisim, please change in configuration file\n");
} else {
(eth_params+j)->transp_preference = ETH_UDP_MODE;
ru_if_in[j] = REMOTE_IF5;
node_function[j] = NGFI_RRU_IF5;
}
}
/* Update some simulation parameters */
oai_emulation.info.frame_type[0] = enb_properties->properties[0]->frame_type[0];
oai_emulation.info.tdd_config[0] = enb_properties->properties[0]->tdd_config[0];
oai_emulation.info.tdd_config_S[0] = enb_properties->properties[0]->tdd_config_s[0];
oai_emulation.info.extended_prefix_flag[0] = enb_properties->properties[0]->prefix_type[0];
node_timing[j] = synch_to_ext_device;
oai_emulation.info.node_function[0] = enb_properties->properties[0]->cc_node_function[0];
oai_emulation.info.node_timing[0] = enb_properties->properties[0]->cc_node_timing[0];
downlink_frequency[0][0] = enb_properties->properties[0]->downlink_frequency[0];
uplink_frequency_offset[0][0] = enb_properties->properties[0]->uplink_frequency_offset[0];
oai_emulation.info.N_RB_DL[0] = enb_properties->properties[0]->N_RB_DL[0];
if (enb_properties->number > 0) {
//Update some simulation parameters
oai_emulation.info.frame_type[0] = enb_properties->properties[0]->frame_type[0];
oai_emulation.info.tdd_config[0] = enb_properties->properties[0]->tdd_config[0];
oai_emulation.info.tdd_config_S[0] = enb_properties->properties[0]->tdd_config_s[0];
oai_emulation.info.extended_prefix_flag[0] = enb_properties->properties[0]->prefix_type[0];
oai_emulation.info.node_function[0] = enb_properties->properties[0]->cc_node_function[0];
oai_emulation.info.node_timing[0] = enb_properties->properties[0]->cc_node_timing[0];
downlink_frequency[0][0] = enb_properties->properties[0]->downlink_frequency[0];
uplink_frequency_offset[0][0] = enb_properties->properties[0]->uplink_frequency_offset[0];
oai_emulation.info.N_RB_DL[0] = enb_properties->properties[0]->N_RB_DL[0];
LOG_E(EMU,"Please use only RRU with oaisim, remove eNB descriptors in configuration file\n");
exit(-1);
}
}*/
}
else {
printf("Please provide a configuration file\n");
exit(-1);
}
free(conf_config_file_name);
conf_config_file_name = 0;
}
void check_and_adjust_params(void)
@@ -910,6 +915,7 @@ void check_and_adjust_params(void)
NB_UE_INST = oai_emulation.info.nb_ue_local + oai_emulation.info.nb_ue_remote;
NB_eNB_INST = oai_emulation.info.nb_enb_local + oai_emulation.info.nb_enb_remote;
NB_RN_INST = oai_emulation.info.nb_rn_local + oai_emulation.info.nb_rn_remote;
NB_RU = oai_emulation.info.nb_ru_local + oai_emulation.info.nb_ru_remote;
#if defined(PDCP_USE_NETLINK_QUEUES) && defined(OPENAIR2)
pdcp_netlink_init();
@@ -994,35 +1000,35 @@ void init_seed(uint8_t set_seed)
}
}
openair0_timestamp current_eNB_rx_timestamp[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
openair0_timestamp current_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs];
openair0_timestamp current_UE_rx_timestamp[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
openair0_timestamp last_eNB_rx_timestamp[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
openair0_timestamp last_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs];
openair0_timestamp last_UE_rx_timestamp[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
int eNB_trx_start(openair0_device *device) {
int ru_trx_start(openair0_device *device) {
return(0);
}
void eNB_trx_end(openair0_device *device) {
void ru_trx_end(openair0_device *device) {
return;
}
int eNB_trx_stop(openair0_device *device) {
int ru_trx_stop(openair0_device *device) {
return(0);
}
int UE_trx_start(openair0_device *device) {
return(0);
}
int UE_trx_end(openair0_device *device) {
return(0);
void UE_trx_end(openair0_device *device) {
return;
}
int UE_trx_stop(openair0_device *device) {
return(0);
}
int eNB_trx_set_freq(openair0_device *device, openair0_config_t *openair0_cfg, int dummy) {
int ru_trx_set_freq(openair0_device *device, openair0_config_t *openair0_cfg, int dummy) {
return(0);
}
int eNB_trx_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) {
int ru_trx_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) {
return(0);
}
int UE_trx_set_freq(openair0_device *device, openair0_config_t *openair0_cfg, int dummy) {
@@ -1033,53 +1039,53 @@ int UE_trx_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) {
}
extern pthread_mutex_t subframe_mutex;
extern int subframe_eNB_mask,subframe_UE_mask;
extern int subframe_ru_mask,subframe_UE_mask;
int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
int ru_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
int eNB_id = device->Mod_id;
int ru_id = device->Mod_id;
int CC_id = device->CC_id;
int subframe;
int sample_count=0;
*ptimestamp = last_eNB_rx_timestamp[eNB_id][CC_id];
*ptimestamp = last_ru_rx_timestamp[ru_id][CC_id];
LOG_D(EMU,"eNB_trx_read nsamps %d TS(%llu,%llu) => subframe %d\n",nsamps,
(unsigned long long)current_eNB_rx_timestamp[eNB_id][CC_id],
(unsigned long long)last_eNB_rx_timestamp[eNB_id][CC_id],
(*ptimestamp/PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti)%10);
// if we're at a subframe boundary generate UL signals for this eNB
LOG_D(EMU,"RU_trx_read nsamps %d TS(%llu,%llu) => subframe %d\n",nsamps,
(unsigned long long)current_ru_rx_timestamp[ru_id][CC_id],
(unsigned long long)last_ru_rx_timestamp[ru_id][CC_id],
(int)((*ptimestamp/RC.ru[ru_id]->frame_parms.samples_per_tti)%10));
// if we're at a subframe boundary generate UL signals for this ru
while (sample_count<nsamps) {
while (current_eNB_rx_timestamp[eNB_id][CC_id]<
(nsamps+last_eNB_rx_timestamp[eNB_id][CC_id])) {
// LOG_D(EMU,"eNB: current TS %llu, last TS %llu, sleeping\n",current_eNB_rx_timestamp[eNB_id][CC_id],last_eNB_rx_timestamp[eNB_id][CC_id]);
while (current_ru_rx_timestamp[ru_id][CC_id]<
(nsamps+last_ru_rx_timestamp[ru_id][CC_id])) {
LOG_D(EMU,"eNB: current TS %llu, last TS %llu, sleeping\n",current_ru_rx_timestamp[ru_id][CC_id],last_ru_rx_timestamp[ru_id][CC_id]);
usleep(500);
}
// tell top-level we are busy
pthread_mutex_lock(&subframe_mutex);
subframe_eNB_mask|=(1<<eNB_id);
subframe_ru_mask|=(1<<ru_id);
pthread_mutex_unlock(&subframe_mutex);
subframe = (last_eNB_rx_timestamp[eNB_id][CC_id]/PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti)%10;
LOG_D(EMU,"eNB_trx_read generating UL subframe %d (Ts %llu, current TS %llu)\n",
subframe = (last_ru_rx_timestamp[ru_id][CC_id]/RC.ru[ru_id]->frame_parms.samples_per_tti)%10;
LOG_D(EMU,"RU_trx_read generating UL subframe %d (Ts %llu, current TS %llu)\n",
subframe,(unsigned long long)*ptimestamp,
(unsigned long long)current_eNB_rx_timestamp[eNB_id][CC_id]);
(unsigned long long)current_ru_rx_timestamp[ru_id][CC_id]);
do_UL_sig(UE2eNB,
do_UL_sig(UE2RU,
enb_data,
ue_data,
subframe,
0, // abstraction_flag
&PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms,
&RC.ru[ru_id]->frame_parms,
0, // frame is only used for abstraction
eNB_id,
ru_id,
CC_id);
last_eNB_rx_timestamp[eNB_id][CC_id] += PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti;
sample_count += PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti;
last_ru_rx_timestamp[ru_id][CC_id] += RC.ru[ru_id]->frame_parms.samples_per_tti;
sample_count += RC.ru[ru_id]->frame_parms.samples_per_tti;
}
@@ -1137,7 +1143,7 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
LOG_D(PHY,"UE_trx_read generating DL subframe %d (Ts %llu, current TS %llu)\n",
subframe,(unsigned long long)*ptimestamp,
(unsigned long long)current_UE_rx_timestamp[UE_id][CC_id]);
do_DL_sig(eNB2UE,
do_DL_sig(RU2UE,
enb_data,
ue_data,
subframe,
@@ -1153,7 +1159,7 @@ int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **
return(nsamps);
}
int eNB_trx_write(openair0_device *device,openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
int ru_trx_write(openair0_device *device,openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
return(nsamps);
}
@@ -1163,10 +1169,11 @@ int UE_trx_write(openair0_device *device,openair0_timestamp timestamp, void **bu
return(nsamps);
}
void init_openair0(void);
//void init_openair0(void);
openair0_config_t openair0_cfg[MAX_CARDS];
//openair0_config_t openair0_cfg[MAX_CARDS];
/*
void init_openair0() {
int card;
@@ -1219,19 +1226,19 @@ void init_openair0() {
printf("HW: Configuring card %d, nb_antennas_tx/rx %d/%d\n",card,
PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_tx,
PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_rx);
RC.ru[0]->nb_tx,
RC.ru[0]->nb_rx);
openair0_cfg[card].Mod_id = 0;
openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
openair0_cfg[card].tx_num_channels=min(2,PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_tx);
openair0_cfg[card].rx_num_channels=min(2,PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_rx);
openair0_cfg[card].tx_num_channels=min(2,RC.ru[0]->nb_tx);
openair0_cfg[card].rx_num_channels=min(2,RC.ru[0]->nb_rx);
for (i=0; i<4; i++) {
openair0_cfg[card].rx_gain[i] = PHY_vars_eNB_g[0][0]->rx_total_gain_dB;
openair0_cfg[card].rx_gain[i] = RC.ru[0]->rx_total_gain_dB;
printf("Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n",
card,i, openair0_cfg[card].tx_gain[i],
@@ -1241,230 +1248,65 @@ void init_openair0() {
}
}
}
*/
void init_devices(void){
module_id_t UE_id, eNB_id;
module_id_t UE_id, ru_id;
uint8_t CC_id;
RU_t *ru;
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
for (eNB_id=0;eNB_id<NB_eNB_INST;eNB_id++) {
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.Mod_id = eNB_id;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.CC_id = CC_id;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.trx_start_func = eNB_trx_start;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.trx_read_func = eNB_trx_read;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.trx_write_func = eNB_trx_write;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.trx_end_func = eNB_trx_end;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.trx_stop_func = eNB_trx_stop;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.trx_set_freq_func = eNB_trx_set_freq;
PHY_vars_eNB_g[eNB_id][CC_id]->rfdevice.trx_set_gains_func = eNB_trx_set_gains;
current_eNB_rx_timestamp[eNB_id][CC_id] = PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.samples_per_tti;
last_eNB_rx_timestamp[eNB_id][CC_id] = 0;
}
// allocate memory for RU if not already done
if (RC.ru==NULL) RC.ru = (RU_t**)malloc(RC.nb_RU*sizeof(RU_t*));
for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
LOG_I(EMU,"Initiaizing rfdevice for RU %d\n",ru_id);
if (RC.ru[ru_id]==NULL) RC.ru[ru_id] = (RU_t*)malloc(sizeof(RU_t));
ru = RC.ru[ru_id];
ru->rfdevice.Mod_id = ru_id;
ru->rfdevice.CC_id = 0;
ru->rfdevice.trx_start_func = ru_trx_start;
ru->rfdevice.trx_read_func = ru_trx_read;
ru->rfdevice.trx_write_func = ru_trx_write;
ru->rfdevice.trx_end_func = ru_trx_end;
ru->rfdevice.trx_stop_func = ru_trx_stop;
ru->rfdevice.trx_set_freq_func = ru_trx_set_freq;
ru->rfdevice.trx_set_gains_func = ru_trx_set_gains;
last_ru_rx_timestamp[ru_id][0] = 0;
}
if (PHY_vars_UE_g==NULL) {
PHY_vars_UE_g = (PHY_VARS_UE ***)malloc((1+NB_UE_INST)*sizeof(PHY_VARS_UE*));
for (UE_id=0;UE_id<NB_UE_INST;UE_id++) {
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.Mod_id = UE_id;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.CC_id = CC_id;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_start_func = UE_trx_start;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_read_func = UE_trx_read;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_write_func = UE_trx_write;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_end_func = UE_trx_end;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_stop_func = UE_trx_stop;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_set_freq_func = UE_trx_set_freq;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_set_gains_func = UE_trx_set_gains;
current_UE_rx_timestamp[UE_id][CC_id] = PHY_vars_UE_g[UE_id][CC_id]->frame_parms.samples_per_tti;
last_UE_rx_timestamp[UE_id][CC_id] = 0;
}
}
}
void init_openair1(void)
{
module_id_t UE_id, eNB_id;
uint8_t CC_id;
#if ENABLE_RAL
int list_index;
#endif
// change the nb_connected_eNB
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
init_lte_vars (&frame_parms[CC_id],
oai_emulation.info.frame_type[CC_id],
oai_emulation.info.tdd_config[CC_id],
oai_emulation.info.tdd_config_S[CC_id],
oai_emulation.info.extended_prefix_flag[CC_id],
oai_emulation.info.N_RB_DL[CC_id],
enb_properties->properties[0]->Nid_cell[CC_id],
cooperation_flag,
enb_properties->properties[0]->nb_antenna_ports[CC_id],
abstraction_flag,
enb_properties->properties[0]->nb_antennas_rx[CC_id],
enb_properties->properties[0]->nb_antennas_tx[CC_id],
nb_antennas_rx_ue,
oai_emulation.info.eMBMS_active_state);
// This is for IF4p5 RRU, gets done by RRC configuration of eNB
PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex = enb_properties->properties[0]->prach_config_index[CC_id];
PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset = enb_properties->properties[0]->prach_freq_offset[CC_id];
}
for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_vars_eNB_g[eNB_id][CC_id]->pusch_config_dedicated[UE_id].betaOffset_ACK_Index = beta_ACK;
PHY_vars_eNB_g[eNB_id][CC_id]->pusch_config_dedicated[UE_id].betaOffset_RI_Index = beta_RI;
PHY_vars_eNB_g[eNB_id][CC_id]->pusch_config_dedicated[UE_id].betaOffset_CQI_Index = beta_CQI;
PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.pdsch_config_common.p_b = (frame_parms[CC_id]->nb_antenna_ports_eNB>1) ? 1 : 0; // rho_A = rho_B
PHY_vars_UE_g[UE_id][CC_id]->pusch_config_dedicated[eNB_id].betaOffset_ACK_Index = beta_ACK;
PHY_vars_UE_g[UE_id][CC_id]->pusch_config_dedicated[eNB_id].betaOffset_RI_Index = beta_RI;
PHY_vars_UE_g[UE_id][CC_id]->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index = beta_CQI;
PHY_vars_UE_g[UE_id][CC_id]->frame_parms.pdsch_config_common.p_b = (frame_parms[CC_id]->nb_antenna_ports_eNB>1) ? 1 : 0; // rho_A = rho_B
PHY_vars_UE_g[UE_id] = (PHY_VARS_UE **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_UE*));
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
PHY_vars_UE_g[UE_id][CC_id] = (PHY_VARS_UE *)malloc(sizeof(PHY_VARS_UE));
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.Mod_id = UE_id;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.CC_id = CC_id;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_start_func = UE_trx_start;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_read_func = UE_trx_read;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_write_func = UE_trx_write;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_end_func = UE_trx_end;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_stop_func = UE_trx_stop;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_set_freq_func = UE_trx_set_freq;
PHY_vars_UE_g[UE_id][CC_id]->rfdevice.trx_set_gains_func = UE_trx_set_gains;
last_UE_rx_timestamp[UE_id][CC_id] = 0;
}
}
}
printf ("AFTER init: MAX_NUM_CCs %d, Nid_cell %d frame_type %d,tdd_config %d\n",
MAX_NUM_CCs,
PHY_vars_eNB_g[0][0]->frame_parms.Nid_cell,
PHY_vars_eNB_g[0][0]->frame_parms.frame_type,
PHY_vars_eNB_g[0][0]->frame_parms.tdd_config);
number_of_cards = 1;
// openair_daq_vars.rx_rf_mode = 1;
// openair_daq_vars.tdd = 1;
// openair_daq_vars.rx_gain_mode = DAQ_AGC_ON;
// openair_daq_vars.dlsch_transmission_mode = oai_emulation.info.transmission_mode[0];
//#warning "NN->FK: OAI EMU channel abstraction does not work for MCS higher than"
// openair_daq_vars.target_ue_dl_mcs = cmin(target_dl_mcs,16);
// openair_daq_vars.target_ue_ul_mcs = target_ul_mcs;
// openair_daq_vars.ue_dl_rb_alloc=0x1fff;
// openair_daq_vars.ue_ul_nb_rb=6;
// openair_daq_vars.dlsch_rate_adaptation = rate_adaptation_flag;
//N_TA_offset
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
PHY_vars_UE_g[UE_id][CC_id]->use_ia_receiver = 0;
PHY_vars_UE_g[UE_id][CC_id]->mode = normal_txrx;
PHY_vars_UE_g[UE_id][CC_id]->mac_enabled = 1;
PHY_vars_UE_g[UE_id][CC_id]->no_timing_correction = 1;
if (PHY_vars_UE_g[UE_id][CC_id]->frame_parms.frame_type == TDD) {
if (PHY_vars_UE_g[UE_id][CC_id]->frame_parms.N_RB_DL == 100)
PHY_vars_UE_g[UE_id][CC_id]->N_TA_offset = 624;
else if (PHY_vars_UE_g[UE_id][CC_id]->frame_parms.N_RB_DL == 50)
PHY_vars_UE_g[UE_id][CC_id]->N_TA_offset = 624/2;
else if (PHY_vars_UE_g[UE_id][CC_id]->frame_parms.N_RB_DL == 25)
PHY_vars_UE_g[UE_id][CC_id]->N_TA_offset = 624/4;
} else {
PHY_vars_UE_g[UE_id][CC_id]->N_TA_offset = 0;
}
}
for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
if (PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.frame_type == TDD) {
if (PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.N_RB_DL == 100)
PHY_vars_eNB_g[eNB_id][CC_id]->N_TA_offset = 624;
else if (PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.N_RB_DL == 50)
PHY_vars_eNB_g[eNB_id][CC_id]->N_TA_offset = 624/2;
else if (PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.N_RB_DL == 25)
PHY_vars_eNB_g[eNB_id][CC_id]->N_TA_offset = 624/4;
} else {
PHY_vars_eNB_g[eNB_id][CC_id]->N_TA_offset = 0;
}
} // eNB_id
} // CC_id
for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
if (phy_test==1)
PHY_vars_eNB_g[eNB_id][CC_id]->mac_enabled=0;
else
PHY_vars_eNB_g[eNB_id][CC_id]->mac_enabled=1;
}
}
init_devices ();
init_eNB(oai_emulation.info.node_function,oai_emulation.info.node_timing,NB_eNB_INST,eth_params,1,0);
// init_ue_status();
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_vars_UE_g[UE_id][CC_id]->tx_power_max_dBm=10;
PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB=100;
// update UE_mode for each eNB_id not just 0
if (abstraction_flag == 0) {
if (phy_test==0) PHY_vars_UE_g[UE_id][CC_id]->UE_mode[0] = NOT_SYNCHED;
else PHY_vars_UE_g[UE_id][CC_id]->UE_mode[0] = PUSCH;
} else {
// 0 is the index of the connected eNB
PHY_vars_UE_g[UE_id][CC_id]->UE_mode[0] = PRACH;
}
if (phy_test==1)
PHY_vars_UE_g[UE_id][CC_id]->mac_enabled=0;
else
PHY_vars_UE_g[UE_id][CC_id]->mac_enabled=1;
PHY_vars_UE_g[UE_id][CC_id]->pdcch_vars[0]->crnti = 0x1235 + UE_id;
PHY_vars_UE_g[UE_id][CC_id]->current_dlsch_cqi[0] = 10;
LOG_I(EMU, "UE %d mode is initialized to %d\n", UE_id, PHY_vars_UE_g[UE_id][CC_id]->UE_mode[0] );
#if ENABLE_RAL
PHY_vars_UE_g[UE_id][CC_id]->ral_thresholds_timed = hashtable_create (64, NULL, NULL);
for (list_index = 0; list_index < RAL_LINK_PARAM_GEN_MAX; list_index++) {
SLIST_INIT(&PHY_vars_UE_g[UE_id][CC_id]->ral_thresholds_gen_polled[list_index]);
}
for (list_index = 0; list_index < RAL_LINK_PARAM_LTE_MAX; list_index++) {
SLIST_INIT(&PHY_vars_UE_g[UE_id][CC_id]->ral_thresholds_lte_polled[list_index]);
}
#endif
} // CC_id
} // UE_id
init_UE(NB_UE_INST);
}
void init_openair2(void)
{
#ifdef OPENAIR2
int CC_id;
//#warning "eNB index is hard coded to zero"
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++)
l2_init (&PHY_vars_eNB_g[0][CC_id]->frame_parms,
oai_emulation.info.eMBMS_active_state,
NULL,
oai_emulation.info.cba_group_active,
oai_emulation.info.handover_active);
mac_xface->macphy_exit = exit_fun;
#endif
}
void init_ocm(void)
{
module_id_t UE_id, eNB_id;
module_id_t UE_id, ru_id;
int CC_id;
/* Added for PHY abstraction */
char* frame_type = "unknown";
LTE_DL_FRAME_PARMS *fp = &RC.ru[0]->frame_parms;
switch (oai_emulation.info.frame_type[0]) {
switch (fp->frame_type) {
case FDD:
frame_type = "FDD";
break;
@@ -1474,10 +1316,6 @@ void init_ocm(void)
break;
}
LOG_I(OCM,"Running with frame_type %d (%s), Nid_cell %d, N_RB_DL %d, EP %d, mode %d, target dl_mcs %d, rate adaptation %d, nframes %d, abstraction %d, channel %s\n",
oai_emulation.info.frame_type[0], frame_type, Nid_cell, oai_emulation.info.N_RB_DL[0], oai_emulation.info.extended_prefix_flag[0], oai_emulation.info.transmission_mode[0],target_dl_mcs,
rate_adaptation_flag,oai_emulation.info.n_frames,abstraction_flag,oai_emulation.environment_system_config.fading.small_scale.selected_option);
if (abstraction_flag) {
get_beta_map();
@@ -1490,9 +1328,9 @@ void init_ocm(void)
}
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
enb_data[eNB_id] = (node_desc_t *)malloc(sizeof(node_desc_t));
init_enb(enb_data[eNB_id],oai_emulation.environment_system_config.antenna.eNB_antenna);
for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) {
enb_data[ru_id] = (node_desc_t *)malloc(sizeof(node_desc_t));
init_enb(enb_data[ru_id],oai_emulation.environment_system_config.antenna.eNB_antenna);
}
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
@@ -1516,43 +1354,43 @@ void init_ocm(void)
}
if (abstraction_flag == 0)
init_channel_vars (frame_parms[0], &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0);
init_channel_vars (fp, &s_re, &s_im, &r_re, &r_im, &r_re0, &r_im0);
// initialize channel descriptors
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
LOG_D(OCM,"Initializing channel (%s, %d) from eNB %d to UE %d\n", oai_emulation.environment_system_config.fading.small_scale.selected_option,
map_str_to_int(small_scale_names,oai_emulation.environment_system_config.fading.small_scale.selected_option), eNB_id, UE_id);
map_str_to_int(small_scale_names,oai_emulation.environment_system_config.fading.small_scale.selected_option), ru_id, UE_id);
eNB2UE[eNB_id][UE_id][CC_id] =
new_channel_desc_scm(PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.nb_antennas_tx,
RU2UE[ru_id][UE_id][CC_id] =
new_channel_desc_scm(RC.ru[ru_id]->nb_tx,
PHY_vars_UE_g[UE_id][CC_id]->frame_parms.nb_antennas_rx,
map_str_to_int(small_scale_names,oai_emulation.environment_system_config.fading.small_scale.selected_option),
N_RB2sampling_rate(PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.N_RB_DL),
N_RB2sampling_rate(RC.ru[ru_id]->frame_parms.N_RB_DL),
N_RB2channel_bandwidth(RC.ru[ru_id]->frame_parms.N_RB_DL),
forgetting_factor,
0,
0);
random_channel(eNB2UE[eNB_id][UE_id][CC_id],abstraction_flag);
LOG_D(OCM,"[SIM] Initializing channel (%s, %d) from UE %d to eNB %d\n", oai_emulation.environment_system_config.fading.small_scale.selected_option,
map_str_to_int(small_scale_names, oai_emulation.environment_system_config.fading.small_scale.selected_option),UE_id, eNB_id);
random_channel(RU2UE[ru_id][UE_id][CC_id],abstraction_flag);
LOG_D(OCM,"[SIM] Initializing channel (%s, %d) from UE %d to ru %d\n", oai_emulation.environment_system_config.fading.small_scale.selected_option,
map_str_to_int(small_scale_names, oai_emulation.environment_system_config.fading.small_scale.selected_option),UE_id, ru_id);
UE2eNB[UE_id][eNB_id][CC_id] =
UE2RU[UE_id][ru_id][CC_id] =
new_channel_desc_scm(PHY_vars_UE_g[UE_id][CC_id]->frame_parms.nb_antennas_tx,
PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.nb_antennas_rx,
RC.ru[ru_id]->nb_rx,
map_str_to_int(small_scale_names, oai_emulation.environment_system_config.fading.small_scale.selected_option),
N_RB2sampling_rate(PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.N_RB_UL),
N_RB2channel_bandwidth(PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.N_RB_UL),
N_RB2sampling_rate(RC.ru[ru_id]->frame_parms.N_RB_UL),
N_RB2channel_bandwidth(RC.ru[ru_id]->frame_parms.N_RB_UL),
forgetting_factor,
0,
0);
random_channel(UE2eNB[UE_id][eNB_id][CC_id],abstraction_flag);
random_channel(UE2RU[UE_id][ru_id][CC_id],abstraction_flag);
// to make channel reciprocal uncomment following line instead of previous. However this only works for SISO at the moment. For MIMO the channel would need to be transposed.
//UE2eNB[UE_id][eNB_id] = eNB2UE[eNB_id][UE_id];
//UE2RU[UE_id][ru_id] = RU2UE[ru_id][UE_id];
}
}
}
@@ -1609,22 +1447,24 @@ void update_omg_ocm()
void update_ocm()
{
module_id_t UE_id, eNB_id;
module_id_t UE_id, ru_id;
int CC_id;
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++)
enb_data[eNB_id]->tx_power_dBm = PHY_vars_eNB_g[eNB_id][0]->frame_parms.pdsch_config_common.referenceSignalPower;
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++)
ue_data[UE_id]->tx_power_dBm = PHY_vars_UE_g[UE_id][0]->tx_power_dBm[0];
/* check if the openair channel model is activated used for PHY abstraction : path loss*/
if ((oai_emulation.info.ocm_enabled == 1)&& (ethernet_flag == 0 )) {
for (ru_id = 0; ru_id < RC.nb_RU; ru_id++)
enb_data[ru_id]->tx_power_dBm = RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++)
ue_data[UE_id]->tx_power_dBm = PHY_vars_UE_g[UE_id][0]->tx_power_dBm[0];
//LOG_D(OMG," extracting position of eNb...\n");
//display_node_list(enb_node_list);
// display_node_list(ue_node_list);
extract_position(enb_node_list, enb_data, NB_eNB_INST);
extract_position(enb_node_list, enb_data, RC.nb_RU);
//extract_position_fixed_enb(enb_data, NB_eNB_INST,frame);
//LOG_D(OMG," extracting position of UE...\n");
// if (oai_emulation.info.omg_model_ue == TRACE)
@@ -1634,21 +1474,21 @@ void update_ocm()
LOG_N(OCM,"Path loss for TTI %d : \n", frame);
*/
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
calc_path_loss (enb_data[eNB_id], ue_data[UE_id], eNB2UE[eNB_id][UE_id][CC_id], oai_emulation.environment_system_config,ShaF);
//calc_path_loss (enb_data[eNB_id], ue_data[UE_id], eNB2UE[eNB_id][UE_id], oai_emulation.environment_system_config,0);
UE2eNB[UE_id][eNB_id][CC_id]->path_loss_dB = eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB;
calc_path_loss (enb_data[ru_id], ue_data[UE_id], RU2UE[ru_id][UE_id][CC_id], oai_emulation.environment_system_config,ShaF);
//calc_path_loss (enb_data[ru_id], ue_data[UE_id], RU2UE[ru_id][UE_id], oai_emulation.environment_system_config,0);
UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = RU2UE[ru_id][UE_id][CC_id]->path_loss_dB;
// if (frame % 50 == 0)
LOG_D(OCM,"Path loss (CCid %d) between eNB %d at (%f,%f) and UE %d at (%f,%f) is %f, angle %f\n",
CC_id,eNB_id,enb_data[eNB_id]->x,enb_data[eNB_id]->y,UE_id,ue_data[UE_id]->x,ue_data[UE_id]->y,
eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB, eNB2UE[eNB_id][UE_id][CC_id]->aoa);
CC_id,ru_id,enb_data[ru_id]->x,enb_data[ru_id]->y,UE_id,ue_data[UE_id]->x,ue_data[UE_id]->y,
RU2UE[ru_id][UE_id][CC_id]->path_loss_dB, RU2UE[ru_id][UE_id][CC_id]->aoa);
//double dx, dy, distance;
//dx = enb_data[eNB_id]->x - ue_data[UE_id]->x;
//dy = enb_data[eNB_id]->y - ue_data[UE_id]->y;
//dx = enb_data[ru_id]->x - ue_data[UE_id]->x;
//dy = enb_data[ru_id]->y - ue_data[UE_id]->y;
//distance = sqrt(dx * dx + dy * dy);
/*LOG_D(LOCALIZE, " OCM distance between eNB %d at (%f,%f) and UE %d at (%f,%f) is %f \n",
eNB_id, enb_data[eNB_id]->x,enb_data[eNB_id]->y,
ru_id, enb_data[ru_id]->x,enb_data[ru_id]->y,
UE_id, ue_data[UE_id]->x,ue_data[UE_id]->y,
distance);*/
}
@@ -1657,26 +1497,28 @@ void update_ocm()
}
else {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
for (eNB_id = 0; eNB_id < NB_eNB_INST; eNB_id++) {
for (ru_id = 0; ru_id < RC.nb_RU; ru_id++) {
for (UE_id = 0; UE_id < NB_UE_INST; UE_id++) {
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
//pathloss: -132.24 dBm/15kHz RE + target SNR - eNB TX power per RE
if (eNB_id == (UE_id % NB_eNB_INST)) {
eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB = -132.24 + snr_dB - PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.pdsch_config_common.referenceSignalPower;
UE2eNB[UE_id][eNB_id][CC_id]->path_loss_dB = -132.24 + snr_dB - PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.pdsch_config_common.referenceSignalPower;
} else {
eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.pdsch_config_common.referenceSignalPower;
UE2eNB[UE_id][eNB_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.pdsch_config_common.referenceSignalPower;
}
LOG_D(OCM,"Path loss from eNB %d to UE %d (CCid %d)=> %f dB (eNB TX %d, SNR %f)\n",eNB_id,UE_id,CC_id,
eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB,
PHY_vars_eNB_g[eNB_id][CC_id]->frame_parms.pdsch_config_common.referenceSignalPower,snr_dB);
}
AssertFatal(RU2UE[ru_id][UE_id][CC_id]!=NULL,"RU2UE[%d][%d][%d] is null\n",ru_id,UE_id,CC_id);
AssertFatal(UE2RU[ru_id][UE_id][CC_id]!=NULL,"RU2UE[%d][%d][%d] is null\n",ru_id,UE_id,CC_id);
//pathloss: -132.24 dBm/15kHz RE + target SNR - eNB TX power per RE
if (ru_id == (UE_id % RC.nb_RU)) {
RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + snr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
} else {
RU2UE[ru_id][UE_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
UE2RU[UE_id][ru_id][CC_id]->path_loss_dB = -132.24 + sinr_dB - RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower;
}
LOG_D(OCM,"Path loss from eNB %d to UE %d (CCid %d)=> %f dB (eNB TX %d, SNR %f)\n",ru_id,UE_id,CC_id,
RU2UE[ru_id][UE_id][CC_id]->path_loss_dB,
RC.ru[ru_id]->frame_parms.pdsch_config_common.referenceSignalPower,snr_dB);
}
}
}
}
}
}
@@ -1715,7 +1557,7 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime)
(otg_pkt->otg_pkt).mode = PDCP_TRANSMISSION_MODE_DATA;
//Adding the packet to the OTG-PDCP buffer
pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[enb_module_idP]));
LOG_I(EMU,"[eNB %d] ADD pkt to OTG buffer with size %d for dst %d on rb_id %d for app id %d \n",
LOG_D(EMU,"[eNB %d] ADD pkt to OTG buffer with size %d for dst %d on rb_id %d for app id %d \n",
(otg_pkt->otg_pkt).module_id, otg_pkt->otg_pkt.sdu_buffer_size, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id, app_id);
} else {
free(otg_pkt);
@@ -1749,7 +1591,7 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime)
//Adding the packet to the OTG-PDCP buffer
(otg_pkt->otg_pkt).mode = PDCP_TRANSMISSION_MODE_TRANSPARENT;
pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[enb_module_idP]));
LOG_I(EMU, "[eNB %d] ADD packet (%p) multicast to OTG buffer for dst %d on rb_id %d\n",
LOG_D(EMU, "[eNB %d] ADD packet (%p) multicast to OTG buffer for dst %d on rb_id %d\n",
(otg_pkt->otg_pkt).module_id, otg_pkt, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id);
} else {
//LOG_I(EMU, "OTG returns null \n");
@@ -1812,7 +1654,7 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime)
(otg_pkt->otg_pkt).mode = PDCP_TRANSMISSION_MODE_DATA;
//Adding the packet to the OTG-PDCP buffer
pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[module_idP]));
LOG_I(EMU, "[eNB %d] ADD pkt to OTG buffer for dst %d on rb_id %d\n", (otg_pkt->otg_pkt).module_id, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id);
LOG_D(EMU, "[eNB %d] ADD pkt to OTG buffer for dst %d on rb_id %d\n", (otg_pkt->otg_pkt).module_id, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id);
} else {
//LOG_I(EMU, "OTG returns null \n");
free(otg_pkt);
@@ -1860,7 +1702,7 @@ void update_otg_UE(module_id_t ue_mod_idP, unsigned int ctime)
//Adding the packet to the OTG-PDCP buffer
(otg_pkt->otg_pkt).mode = PDCP_TRANSMISSION_MODE_DATA;
pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[module_id]));
LOG_I(EMU, "[UE %d] ADD pkt to OTG buffer with size %d for dst %d on rb_id %d \n",
LOG_D(EMU, "[UE %d] ADD pkt to OTG buffer with size %d for dst %d on rb_id %d \n",
(otg_pkt->otg_pkt).module_id, otg_pkt->otg_pkt.sdu_buffer_size, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id);
} else {
free(otg_pkt);
+4 -4
View File
@@ -371,7 +371,7 @@ void init_snr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t *ue_dat
break;
default:
msg("Problem in SINR Calculation for TM5 \n");
LOG_E(EMU,"Problem in SINR Calculation for TM5 \n");
break;
}//switch(q)
@@ -451,7 +451,7 @@ void init_snr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t *ue_dat
break;
default:
msg("Problem in SINR Calculation for TM6 \n");
LOG_E(EMU,"Problem in SINR Calculation for TM6 \n");
break;
}//switch(q)
@@ -470,7 +470,7 @@ void init_snr(channel_desc_t* eNB2UE, node_desc_t *enb_data, node_desc_t *ue_dat
break;
default:
msg("Problem in SINR Initialization in sinr_sim.c\n");
LOG_E(EMU,"Problem in SINR Initialization in sinr_sim.c\n");
break;
}//switch
}//function ends
@@ -726,7 +726,7 @@ void get_MIESM_param()
break;
default:
msg("Error, bad input, quitting\n");
LOG_E(EMU,"Error, bad input, quitting\n");
break;
}