some fixes for host type/dev type
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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*/
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user