node function interfaces via function pointers. Suggestions from L. Thomas, B. Mongazon, C. Roux.

This commit is contained in:
Raymond Knopp
2016-07-31 10:28:56 +02:00
parent f33e9a7027
commit 025f56d28b
18 changed files with 788 additions and 724 deletions
+16 -16
View File
@@ -201,7 +201,7 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
int trx_eth_write_raw_IF4(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
int trx_eth_write_raw_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
int nblocks = nsamps;
int bytes_sent = 0;
@@ -211,14 +211,14 @@ int trx_eth_write_raw_IF4(openair0_device *device, openair0_timestamp timestamp,
ssize_t packet_size;
if (flags == IF4_PDLFFT) {
packet_size = RAW_IF4_PDLFFT_SIZE_BYTES(nblocks);
} else if (flags == IF4_PULFFT) {
packet_size = RAW_IF4_PULFFT_SIZE_BYTES(nblocks);
if (flags == IF4p5_PDLFFT) {
packet_size = RAW_IF4p5_PDLFFT_SIZE_BYTES(nblocks);
} else if (flags == IF4p5_PULFFT) {
packet_size = RAW_IF4p5_PULFFT_SIZE_BYTES(nblocks);
} else if (flags == IF5_MOBIPASS) {
packet_size = RAW_IF5_MOBIPASS_SIZE_BYTES;
} else {
packet_size = RAW_IF4_PRACH_SIZE_BYTES;
packet_size = RAW_IF4p5_PRACH_SIZE_BYTES;
}
eth->tx_nsamps = nblocks;
@@ -304,7 +304,7 @@ int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, voi
int trx_eth_read_raw_IF4(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) {
int trx_eth_read_raw_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) {
// Read nblocks info from packet itself
int nblocks = nsamps;
@@ -312,8 +312,8 @@ int trx_eth_read_raw_IF4(openair0_device *device, openair0_timestamp *timestamp,
eth_state_t *eth = (eth_state_t*)device->priv;
int Mod_id = device->Mod_id;
ssize_t packet_size = MAC_HEADER_SIZE_BYTES + sizeof_IF4_header_t;
IF4_header_t *test_header = (IF4_header_t*)(buff[0] + MAC_HEADER_SIZE_BYTES);
ssize_t packet_size = MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t;
IF4p5_header_t *test_header = (IF4p5_header_t*)(buff[0] + MAC_HEADER_SIZE_BYTES);
bytes_received = recv(eth->sockfd[Mod_id],
buff[0],
@@ -327,12 +327,12 @@ int trx_eth_read_raw_IF4(openair0_device *device, openair0_timestamp *timestamp,
*timestamp = test_header->sub_type;
if (test_header->sub_type == IF4_PDLFFT) {
packet_size = RAW_IF4_PDLFFT_SIZE_BYTES(nblocks);
} else if (test_header->sub_type == IF4_PULFFT) {
packet_size = RAW_IF4_PULFFT_SIZE_BYTES(nblocks);
if (test_header->sub_type == IF4p5_PDLFFT) {
packet_size = RAW_IF4p5_PDLFFT_SIZE_BYTES(nblocks);
} else if (test_header->sub_type == IF4p5_PULFFT) {
packet_size = RAW_IF4p5_PULFFT_SIZE_BYTES(nblocks);
} else {
packet_size = RAW_IF4_PRACH_SIZE_BYTES;
packet_size = RAW_IF4p5_PRACH_SIZE_BYTES;
}
while(bytes_received < packet_size) {
@@ -387,7 +387,7 @@ int eth_set_dev_conf_raw(openair0_device *device) {
int eth_set_dev_conf_raw_IF4(openair0_device *device) {
int eth_set_dev_conf_raw_IF4p5(openair0_device *device) {
// use for cc_id info
int Mod_id = device->Mod_id;
@@ -448,7 +448,7 @@ int eth_get_dev_conf_raw(openair0_device *device) {
}
int eth_get_dev_conf_raw_IF4(openair0_device *device) {
int eth_get_dev_conf_raw_IF4p5(openair0_device *device) {
// use for cc_id info
eth_state_t *eth = (eth_state_t*)device->priv;
@@ -73,27 +73,27 @@ 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) {
} else if (eth->flags == ETH_RAW_IF4p5_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;
if(eth_set_dev_conf_raw_IF4p5(device)!=0) return -1;
} else {
if(eth_get_dev_conf_raw_IF4(device)!=0) return -1;
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_IF4_PRACH_SIZE_BYTES)!=0) return -1;
if(ethernet_tune (device,MTU_SIZE,RAW_IF4p5_PRACH_SIZE_BYTES)!=0) return -1;
} else if (eth->flags == ETH_UDP_IF4_MODE) {
} else if (eth->flags == ETH_UDP_IF4p5_MODE) {
} else if (eth->flags == ETH_RAW_IF5_MOBIPASS) {
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;
//if(eth_set_dev_conf_raw_IF4p5(device)!=0) return -1;
//} else {
//if(eth_get_dev_conf_raw_IF4(device)!=0) return -1;
//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_PACKET_SIZE_BYTES(device->openair0_cfg->samples_per_packet))!=0) return -1;
@@ -339,9 +339,9 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth
} else if (eth_params->transp_preference == 0) {
eth->flags = ETH_UDP_MODE;
} else if (eth_params->transp_preference == 3) {
eth->flags = ETH_RAW_IF4_MODE;
eth->flags = ETH_RAW_IF4p5_MODE;
} else if (eth_params->transp_preference == 2) {
eth->flags = ETH_UDP_IF4_MODE;
eth->flags = ETH_UDP_IF4p5_MODE;
} else if (eth_params->transp_preference == 4) {
eth->flags = ETH_RAW_IF5_MOBIPASS;
} else {
@@ -368,15 +368,15 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth
} else if (eth->flags == ETH_UDP_MODE) {
device->trx_write_func = trx_eth_write_udp;
device->trx_read_func = trx_eth_read_udp;
} else if (eth->flags == ETH_RAW_IF4_MODE) {
device->trx_write_func = trx_eth_write_raw_IF4;
device->trx_read_func = trx_eth_read_raw_IF4;
} else if (eth->flags == ETH_RAW_IF4p5_MODE) {
device->trx_write_func = trx_eth_write_raw_IF4p5;
device->trx_read_func = trx_eth_read_raw_IF4p5;
} else if (eth->flags == ETH_RAW_IF5_MOBIPASS) {
device->trx_write_func = trx_eth_write_raw_IF4;
device->trx_read_func = trx_eth_read_raw_IF4;
device->trx_write_func = trx_eth_write_raw_IF4p5;
device->trx_read_func = trx_eth_read_raw_IF4p5;
} else {
//device->trx_write_func = trx_eth_write_udp_IF4;
//device->trx_read_func = trx_eth_read_udp_IF4;
//device->trx_write_func = trx_eth_write_udp_IF4p5;
//device->trx_read_func = trx_eth_read_udp_IF4p5;
}
eth->if_name[device->Mod_id] = eth_params->local_if_name;
@@ -222,11 +222,11 @@ int eth_set_dev_conf_udp(openair0_device *device);
int eth_socket_init_raw(openair0_device *device);
int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags);
int trx_eth_read_raw(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
int trx_eth_write_raw_IF4(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags);
int trx_eth_read_raw_IF4(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc);
int trx_eth_write_raw_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags);
int trx_eth_read_raw_IF4p5(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);
int eth_get_dev_conf_raw_IF4p5(openair0_device *device);
int eth_set_dev_conf_raw_IF4p5(openair0_device *device);
#endif
@@ -47,8 +47,8 @@
// ETH transport preference modes
#define ETH_UDP_MODE 0
#define ETH_RAW_MODE 1
#define ETH_UDP_IF4_MODE 2
#define ETH_RAW_IF4_MODE 3
#define ETH_UDP_IF4p5_MODE 2
#define ETH_RAW_IF4p5_MODE 3
#define ETH_RAW_IF5_MOBIPASS 4
// Time domain RRH packet sizes
@@ -58,13 +58,13 @@
#define UDP_PACKET_SIZE_BYTES(nsamps) (APP_HEADER_SIZE_BYTES + PAYLOAD_SIZE_BYTES(nsamps))
#define RAW_PACKET_SIZE_BYTES(nsamps) (APP_HEADER_SIZE_BYTES + MAC_HEADER_SIZE_BYTES + PAYLOAD_SIZE_BYTES(nsamps))
// Packet sizes for IF4 interface format
// Packet sizes for IF4p5 interface format
#define DATA_BLOCK_SIZE_BYTES(scaled_nblocks) (sizeof(uint16_t)*scaled_nblocks)
#define PRACH_BLOCK_SIZE_BYTES (sizeof(int16_t)*839*2) // FIX hard coded prach size (uncompressed)
#define RAW_IF4_PDLFFT_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4_header_t + DATA_BLOCK_SIZE_BYTES(nblocks))
#define RAW_IF4_PULFFT_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4_header_t + DATA_BLOCK_SIZE_BYTES(nblocks))
#define RAW_IF4_PRACH_SIZE_BYTES (MAC_HEADER_SIZE_BYTES + sizeof_IF4_header_t + PRACH_BLOCK_SIZE_BYTES)
#define RAW_IF4p5_PDLFFT_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t + DATA_BLOCK_SIZE_BYTES(nblocks))
#define RAW_IF4p5_PULFFT_SIZE_BYTES(nblocks) (MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t + DATA_BLOCK_SIZE_BYTES(nblocks))
#define RAW_IF4p5_PRACH_SIZE_BYTES (MAC_HEADER_SIZE_BYTES + sizeof_IF4p5_header_t + PRACH_BLOCK_SIZE_BYTES)
// Mobipass packet sizes
#define RAW_IF5_MOBIPASS_BLOCK_SIZE_BYTES 1280