diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 7f8cf95c2bfd3be896823e3e0fa8c8648379c8a0..5bc0088ed527ab7c4577054ffaac7330248cbf1c 100755 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -298,7 +298,7 @@ void enb_config_display(void) printf( "\ttx_scheduling_advance :\t%d:\n",enb_properties.properties[i]->rrh_gw_config[j].tx_scheduling_advance); printf( "\ttx_sample_advance : \t%d:\n",enb_properties.properties[i]->rrh_gw_config[j].tx_sample_advance); printf( "\tiq_txshift : \t%d:\n",enb_properties.properties[i]->rrh_gw_config[j].iq_txshift); - printf( "\ttransport : \t%s Ethernet:\n",(enb_properties.properties[i]->rrh_gw_config[j].raw == 1)? "RAW" : "UDP"); + printf( "\ttransport : \t%s Ethernet:\n",(enb_properties.properties[i]->rrh_gw_config[j].raw == 1)? "RAW" : (enb_properties.properties[i]->rrh_gw_config[j].rawif4 == 1)? "RAW_IF4" : (enb_properties.properties[i]->rrh_gw_config[j].udpif4 == 1)? "UDP_IF4" : "UDP"); if (enb_properties.properties[i]->rrh_gw_config[j].exmimo == 1) { printf( "\tRF target : \tEXMIMO:\n\n"); } else if (enb_properties.properties[i]->rrh_gw_config[j].usrp_b200 == 1) { @@ -2242,9 +2242,9 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udp = 1; } else if (strcmp(tr_preference, "raw") == 0) { enb_properties.properties[enb_properties_index]->rrh_gw_config[j].raw = 1; - } else if (strcmp(tr_preference, "udpif4") == 0) { + } else if (strcmp(tr_preference, "udp_if4") == 0) { enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udpif4 = 1; - } else if (strcmp(tr_preference, "rawif4") == 0) { + } else if (strcmp(tr_preference, "raw_if4") == 0) { enb_properties.properties[enb_properties_index]->rrh_gw_config[j].rawif4 = 1; } else {//if (strcmp(preference, "no") == 0) enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udp = 1; diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c index 780261d12adbf311f0555f4cd60e3f4d336117b2..13dfe574c2ce5e1d1d17bc85c9525028e3d9a022 100644 --- a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c @@ -390,6 +390,37 @@ int eth_set_dev_conf_raw(openair0_device *device) { } + +int eth_set_dev_conf_raw_IF4(openair0_device *device) { + + int Mod_id = device->Mod_id; + eth_state_t *eth = (eth_state_t*)device->priv; + void *msg; + ssize_t msg_len; + + /* a BBU client sends 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 */ + + msg = malloc(MAC_HEADER_SIZE_BYTES + sizeof(openair0_config_t)); + msg_len = MAC_HEADER_SIZE_BYTES + sizeof(openair0_config_t); + + + memcpy(msg,(void*)ð->eh,MAC_HEADER_SIZE_BYTES); + memcpy((msg+MAC_HEADER_SIZE_BYTES),(void*)device->openair0_cfg,sizeof(openair0_config_t)); + + if (send(eth->sockfd[Mod_id], + msg, + msg_len, + 0)==-1) { + perror("ETHERNET: "); + exit(0); + } + + return 0; +} + + int eth_get_dev_conf_raw(openair0_device *device) { eth_state_t *eth = (eth_state_t*)device->priv; @@ -418,3 +449,33 @@ int eth_get_dev_conf_raw(openair0_device *device) { return 0; } + + +int eth_get_dev_conf_raw_IF4(openair0_device *device) { + + eth_state_t *eth = (eth_state_t*)device->priv; + int Mod_id = device->Mod_id; + char str[INET_ADDRSTRLEN]; + void *msg; + ssize_t msg_len; + + 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 */ + if (recv(eth->sockfd[Mod_id], + msg, + msg_len, + 0)==-1) { + perror("ETHERNET: "); + exit(0); + } + + /* RRH 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_%d 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"),Mod_id,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; +} diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c index 6e5aa111406d74bf64e923cff17e5179769ae74f..5802b1569f2f23cf85830d0808cda3a9aed2cd4c 100644 --- a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c @@ -63,7 +63,7 @@ int trx_eth_start(openair0_device *device) { eth_state_t *eth = (eth_state_t*)device->priv; /* initialize socket */ - if ((eth->flags & ETH_RAW_MODE) != 0 ) { + if (eth->flags == ETH_RAW_MODE) { 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) { @@ -73,6 +73,21 @@ int trx_eth_start(openair0_device *device) { } /* adjust MTU wrt number of samples per packet */ if(ethernet_tune (device,MTU_SIZE,RAW_PACKET_SIZE_BYTES(device->openair0_cfg->samples_per_packet))!=0) return -1; + + } else if (eth->flags == ETH_RAW_IF4_MODE) { + 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) { + if(eth_set_dev_conf_raw_IF4(device)!=0) return -1; + } else { + if(eth_get_dev_conf_raw_IF4(device)!=0) return -1; + } + /* adjust MTU wrt number of samples per packet */ + if(ethernet_tune (device,MTU_SIZE,RAW_PACKET_SIZE_BYTES(device->openair0_cfg->samples_per_packet))!=0) return -1; + + } else if (eth->flags == ETH_UDP_IF4_MODE) { + + } else { if (eth_socket_init_udp(device)!=0) return -1; /* RRH gets openair0 device configuration - BBU sets openair0 device configuration*/ diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h index 66cb13ef12e14bb6515af7c539cf2b3ce1aed998..f7753fb51735d885a7f1753637b92ad119993e17 100644 --- a/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h @@ -226,6 +226,7 @@ int trx_eth_write_raw_IF4(openair0_device *device, openair0_timestamp timestamp, int trx_eth_read_raw_IF4(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc); int eth_get_dev_conf_raw(openair0_device *device); int eth_set_dev_conf_raw(openair0_device *device); - +int eth_get_dev_conf_raw_IF4(openair0_device *device); +int eth_set_dev_conf_raw_IF4(openair0_device *device); #endif diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 0cd5d4d0fc84cb8dfc5a58f208504a65fc89be47..c4d37393bdcf3b78d6caa5df014b7ea094977bd1 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1541,13 +1541,6 @@ int main( int argc, char **argv ) openair0_cfg[card].my_port = eth_params->my_port; } - //if (node_function == NGFI_RCC_IF4 || node_function == NGFI_RRU_IF4) { - //openair0_cfg[card].remote_addr = eth_params->remote_addr; - //openair0_cfg[card].remote_port = eth_params->remote_port; - //openair0_cfg[card].my_addr = eth_params->my_addr; - //openair0_cfg[card].my_port = eth_params->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)); @@ -1648,11 +1641,17 @@ int main( int argc, char **argv ) openair0_cfg[0].log_level = glog_level; for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { - PHY_vars_eNB_g[0][CC_id]->rfdevice.host_type = BBU_HOST; + if (node_function == NGFI_RRU_IF4) { + PHY_vars_eNB_g[0][CC_id]->rfdevice.host_type = RRH_HOST; + PHY_vars_eNB_g[0][CC_id]->ifdevice.host_type = RRH_HOST; + } else { + PHY_vars_eNB_g[0][CC_id]->rfdevice.host_type = BBU_HOST; + PHY_vars_eNB_g[0][CC_id]->ifdevice.host_type = BBU_HOST; + } + PHY_vars_eNB_g[0][CC_id]->rfdevice.type = NONE_DEV; PHY_vars_eNB_g[0][CC_id]->rfdevice.transp_type = NONE_TP; - PHY_vars_eNB_g[0][CC_id]->ifdevice.host_type = BBU_HOST; PHY_vars_eNB_g[0][CC_id]->ifdevice.type = NONE_DEV; PHY_vars_eNB_g[0][CC_id]->ifdevice.transp_type = NONE_TP; } @@ -1663,7 +1662,6 @@ int main( int argc, char **argv ) openair0.type = NONE_DEV; /* transport type is initialized NONE_TP (no transport protocol) when the transport protocol will be initiated transport protocol type will be set */ openair0.transp_type = NONE_TP; - //openair0_cfg[0].log_level = glog_level; // Legacy BBU - RRH init //int returns=-1; @@ -1691,9 +1689,7 @@ int main( int argc, char **argv ) //else if (mode==loop_through_memory) { //} //} - - //printf("Done\n"); - + int returns=-1; // Handle spatially distributed MIMO antenna ports