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
+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