Commit 5bc28899 authored by magounak's avatar magounak

testing ECPRI receive path (with level adjustment for 12-bit OAI RX dynamic range)

parent 2b59cdf5
...@@ -432,7 +432,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16 ...@@ -432,7 +432,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16
} }
*/ */
} else if (eth->compression == NO_COMPRESS) { } else if (eth->compression == NO_COMPRESS) {
int16_t temp_rx[spp_eth*2]; int16_t temp_rx[spp_eth*2] __attribute__((aligned(32)));
for (i=0; i < ru->nb_rx; i++) for (i=0; i < ru->nb_rx; i++)
rxp[i] = &ru->common.rxdata[i][subframe*fp->samples_per_tti]; rxp[i] = &ru->common.rxdata[i][subframe*fp->samples_per_tti];
int aid; int aid;
......
...@@ -289,12 +289,12 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi ...@@ -289,12 +289,12 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi
__m128i buff_tx[nsamps2+2]; __m128i buff_tx[nsamps2+2];
__m128i *buff_tx2=buff_tx+2; __m128i *buff_tx2=buff_tx+2;
#endif #endif
#elif defined(__arm__) #elif defined(__arm__) || defined(__aarch64__)
nsamps2 = (nsamps+3)>>2; nsamps2 = (nsamps+3)>>2;
int16x8_t buff_tx[nsamps2+2]; int16x8_t buff_tx[nsamps2+2];
int16x8_t *buff_tx2=buff_tx+2; int16x8_t *buff_tx2=buff_tx+2;
#else #else
#error Unsupported CPU architecture, USRP device cannot be built #error Unsupported CPU architecture, ethernet device cannot be built
#endif #endif
...@@ -403,102 +403,94 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi ...@@ -403,102 +403,94 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
int rcvfrom_flag =0; int rcvfrom_flag =0;
int block_cnt=0; int block_cnt=0;
int again_cnt=0; int again_cnt=0;
char temp0[APP_HEADER_SIZE_BYTES];
static int packet_cnt=0; static int packet_cnt=0;
int payload_size = UDP_PACKET_SIZE_BYTES(nsamps);
#if defined(__x86_64__) || defined(__i386__)
#ifdef __AVX2__
int nsamps2 = (payload_size>>5)+1;
__m256i temp_rx[nsamps2];
char *temp_rx0 = ((char *)&temp_rx[1])-APP_HEADER_SIZE_BYTES;
#else
int nsamps2 = (payload_size>>4)+1;
__m128i temp_rx[nsamps2];
char *temp_rx0 = ((char *)&temp_rx[1])-APP_HEADER_SIZE_BYTES;
#endif
#elif defined(__arm__) || defined(__aarch64__)
int nsamps2 = (payload_size>>4)+1
int16x8_t temp_rx[nsamps2];
char *temp_rx0 = ((char *)&temp_rx[1])-APP_HEADER_SIZE_BYTES;
#else
#error Unsupported CPU architecture, USRP device cannot be built
#endif
eth->rx_nsamps=256; eth->rx_nsamps=nsamps;
/* buff[i] points to the position in rx buffer where the payload to be received will be placed bytes_received=0;
buff2 points to the position in rx buffer where the packet header will be placed */ block_cnt=0;
void *buff2 = (void*)(buff- APP_HEADER_SIZE_BYTES); int receive_bytes;
AssertFatal(eth->compression == NO_COMPRESS, "IF5 compression not supported for now\n");
/* we don't want to ovewrite with the header info the previous rx buffer data so we store it*/
memcpy((void *)temp0,(void *)buff2,APP_HEADER_SIZE_BYTES); while(bytes_received < payload_size) {
again:
bytes_received=0; bytes_received +=recvfrom(eth->sockfdd,
block_cnt=0; temp_rx0,
int receive_bytes; payload_size,
if (eth->compression == ALAW_COMPRESS) { rcvfrom_flag,
receive_bytes = UDP_PACKET_SIZE_BYTES_ALAW(nsamps); (struct sockaddr *)&eth->dest_addrd,
} else { (socklen_t *)&eth->addr_len);
receive_bytes = UDP_PACKET_SIZE_BYTES(nsamps); packet_cnt++;
} if (bytes_received ==-1) {
eth->num_rx_errors++;
while(bytes_received < receive_bytes) { if (errno == EAGAIN) {
again: again_cnt++;
#if DEBUG usleep(10);
printf("------- RX------: buff2 current position=%d remaining_bytes=%d bytes_recv=%d \n", if (again_cnt == 1000) {
(void *)(buff2+bytes_received),
receive_bytes - bytes_received,
bytes_received);
#endif
bytes_received +=recvfrom(eth->sockfdd,
buff2,
receive_bytes,
rcvfrom_flag,
(struct sockaddr *)&eth->dest_addrd,
(socklen_t *)&eth->addr_len);
/*
if (packet_cnt%1000000<10) {
printf("[AW2S] Received ECPRI packet %d (REV %x, MessType %d, Payload size %d, PC_ID %d, TS %llu\n",
packet_cnt,*(uint8_t *)buff2,
*(uint8_t *)(buff2+1),
(*(uint8_t *)(buff2+2)<<8)+*(uint8_t *)(buff2+3),
*(uint16_t *)(buff2+4),
*(uint64_t *)(buff2+6));
}*/
packet_cnt++;
if (bytes_received ==-1) {
eth->num_rx_errors++;
if (errno == EAGAIN) {
again_cnt++;
usleep(10);
if (again_cnt == 1000) {
perror("ETHERNET READ: "); perror("ETHERNET READ: ");
exit(-1); exit(-1);
} else { } else {
bytes_received=0; bytes_received=0;
goto again; goto again;
} }
} else if (errno == EWOULDBLOCK) { } else if (errno == EWOULDBLOCK) {
block_cnt++; block_cnt++;
usleep(10); usleep(10);
if (block_cnt == 1000) { if (block_cnt == 1000) {
perror("ETHERNET READ: "); perror("ETHERNET READ: ");
exit(-1); exit(-1);
} else { } else {
printf("BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK \n"); printf("BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK \n");
goto again; goto again;
}
} }
} else { }
#if DEBUG } else {
printf("------- RX------: nu=%d an_id=%d ts%d bytes_recv=%d\n", /* store the timestamp value from packet's header */
*(int16_t *)buff2, *timestamp = *(openair0_timestamp *)(temp_rx0 + ECPRICOMMON_BYTES+ECPRIPCID_BYTES);
*(int16_t *)(buff2 + sizeof(int16_t)), // convert TS to samples, /3 for 30.72 Ms/s, /6 for 15.36 Ms/s, /12 for 7.68 Ms/s, etc.
*(openair0_timestamp *)(buff2 + sizeof(int32_t)), *timestamp = *timestamp/3;
bytes_received); // handle 1.4,3,5,10,15 MHz cases
*cc = *(uint16_t*)(temp_rx0 + ECPRICOMMON_BYTES);
dump_packet((device->host_type == RAU_HOST)? "RAU":"RRU", buff2, UDP_PACKET_SIZE_BYTES(nsamps),RX_FLAG); }
#endif eth->rx_actual_nsamps=payload_size>>2;
eth->rx_count++;
/* store the timestamp value from packet's header */ }
*timestamp = *(openair0_timestamp *)(buff2 + ECPRICOMMON_BYTES+ECPRIPCID_BYTES);
// convert TS to samples, /3 for 30.72 Ms/s, /6 for 15.36 Ms/s, /12 for 7.68 Ms/s, etc. // populate receive buffer in lower 12-bits from 16-bit representation
*timestamp = *timestamp/3; for (int j=1; j<nsamps2; j++) {
// handle 1.4,3,5,10,15 MHz cases #if defined(__x86_64__) || defined(__i386__)
*cc = *(uint16_t*)(buff2 + ECPRICOMMON_BYTES); #ifdef __AVX2__
} // LOG_I(PHY,"((__m256i *)buff)[%d-1] = %p, temp_rx[%d] = %p\n",
//VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM,eth->pck_seq_num_cur); // j,&((__m256i *)buff)[j-1],j,&temp_rx[j]);
//VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM_PRV,eth->pck_seq_num_prev); ((__m256i *)buff)[j-1] = _mm256_srai_epi16(temp_rx[j],4);
eth->rx_actual_nsamps=bytes_received>>2; #else
eth->rx_count++; ((__m128i *)buff)[j-1] = _mm_srai_epi16(temp_rx[j],4);
} #endif
#elif defined(__arm__)
/* tx buffer values restored */ ((int16x8_t *)buff)[j] = vshrq_n_s16(temp_rx[i][j],4);
memcpy((void *)buff2,(void *)temp0,APP_HEADER_SIZE_BYTES); #endif
}
return (bytes_received-APP_HEADER_SIZE_BYTES)>>2;
return (payload_size>>2);
} }
......
...@@ -57,7 +57,7 @@ int trx_eth_start(openair0_device *device) { ...@@ -57,7 +57,7 @@ int trx_eth_start(openair0_device *device) {
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
if (eth->flags == ETH_UDP_IF5_ORI_MODE) { if (eth->flags == ETH_UDP_IF5_ECPRI_MODE) {
AssertFatal(device->thirdparty_init != NULL, "device->thirdparty_init is null\n"); AssertFatal(device->thirdparty_init != NULL, "device->thirdparty_init is null\n");
AssertFatal(device->thirdparty_init(device) == 0, "third-party init failed\n"); AssertFatal(device->thirdparty_init(device) == 0, "third-party init failed\n");
device->openair0_cfg->samples_per_packet = 256; device->openair0_cfg->samples_per_packet = 256;
...@@ -168,7 +168,7 @@ void trx_eth_end(openair0_device *device) { ...@@ -168,7 +168,7 @@ void trx_eth_end(openair0_device *device) {
int trx_eth_stop(openair0_device *device) { int trx_eth_stop(openair0_device *device) {
eth_state_t *eth = (eth_state_t*)device->priv; eth_state_t *eth = (eth_state_t*)device->priv;
if (eth->flags == ETH_UDP_IF5_ORI_MODE) { if (eth->flags == ETH_UDP_IF5_ECPRI_MODE) {
AssertFatal(device->thirdparty_cleanup != NULL, "device->thirdparty_cleanup is null\n"); AssertFatal(device->thirdparty_cleanup != NULL, "device->thirdparty_cleanup is null\n");
AssertFatal(device->thirdparty_cleanup(device) == 0, "third-party cleanup failed\n"); AssertFatal(device->thirdparty_cleanup(device) == 0, "third-party cleanup failed\n");
} }
...@@ -377,7 +377,7 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth ...@@ -377,7 +377,7 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth
eth->flags = eth_params->transp_preference; eth->flags = eth_params->transp_preference;
// load third-party driver // load third-party driver
if (eth->flags == ETH_UDP_IF5_ORI_MODE) load_lib(device,openair0_cfg,eth_params,RAU_REMOTE_THIRDPARTY_RADIO_HEAD); if (eth->flags == ETH_UDP_IF5_ECPRI_MODE) load_lib(device,openair0_cfg,eth_params,RAU_REMOTE_THIRDPARTY_RADIO_HEAD);
if (eth_params->if_compress == 0) { if (eth_params->if_compress == 0) {
...@@ -408,7 +408,7 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth ...@@ -408,7 +408,7 @@ int transport_init(openair0_device *device, openair0_config_t *openair0_cfg, eth
if (eth->flags == ETH_RAW_MODE) { if (eth->flags == ETH_RAW_MODE) {
device->trx_write_func = trx_eth_write_raw; device->trx_write_func = trx_eth_write_raw;
device->trx_read_func = trx_eth_read_raw; device->trx_read_func = trx_eth_read_raw;
} else if (eth->flags == ETH_UDP_MODE || eth->flags == ETH_UDP_IF5_ORI_MODE) { } else if (eth->flags == ETH_UDP_MODE || eth->flags == ETH_UDP_IF5_ECPRI_MODE) {
device->trx_write_func2 = trx_eth_write_udp; device->trx_write_func2 = trx_eth_write_udp;
device->trx_read_func2 = trx_eth_read_udp; device->trx_read_func2 = trx_eth_read_udp;
device->trx_ctlsend_func = trx_eth_ctlsend_udp; device->trx_ctlsend_func = trx_eth_ctlsend_udp;
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#define ETH_RAW_MODE 1 #define ETH_RAW_MODE 1
#define ETH_UDP_IF4p5_MODE 2 #define ETH_UDP_IF4p5_MODE 2
#define ETH_RAW_IF4p5_MODE 3 #define ETH_RAW_IF4p5_MODE 3
#define ETH_UDP_IF5_ORI_MODE 4 #define ETH_UDP_IF5_ECPRI_MODE 4
#endif #endif
// COMMOM HEADER LENGTHS // COMMOM HEADER LENGTHS
......
...@@ -2089,10 +2089,6 @@ int stop_rf(RU_t *ru) { ...@@ -2089,10 +2089,6 @@ int stop_rf(RU_t *ru) {
return 0; return 0;
} }
int start_steraming(RU_t *ru) {
return(ru->ifdevice.thirdparty_startstreaming);
}
extern void fep_full(RU_t *ru); extern void fep_full(RU_t *ru);
extern void ru_fep_full_2thread(RU_t *ru); extern void ru_fep_full_2thread(RU_t *ru);
extern void feptx_ofdm(RU_t *ru); extern void feptx_ofdm(RU_t *ru);
...@@ -2556,7 +2552,7 @@ void set_function_spec_param(RU_t *ru) { ...@@ -2556,7 +2552,7 @@ void set_function_spec_param(RU_t *ru) {
ru->fh_south_out = fh_if5_south_out; // synchronous IF5 transmission ru->fh_south_out = fh_if5_south_out; // synchronous IF5 transmission
ru->fh_south_asynch_in = NULL; // no asynchronous UL ru->fh_south_asynch_in = NULL; // no asynchronous UL
} }
ru->start_rf = ru->eth_params.transp_preference == ETH_UDP_IF5_ORI_MODE ? start_streaming : NULL; // no local RF ru->start_rf = ru->eth_params.transp_preference == ETH_UDP_IF5_ECPRI_MODE ? start_streaming : NULL; // no local RF
ru->stop_rf = NULL; ru->stop_rf = NULL;
ru->start_if = start_if; // need to start if interface for IF5 ru->start_if = start_if; // need to start if interface for IF5
ru->ifdevice.host_type = RAU_HOST; ru->ifdevice.host_type = RAU_HOST;
...@@ -2965,10 +2961,10 @@ void RCconfig_RU(void) { ...@@ -2965,10 +2961,10 @@ void RCconfig_RU(void) {
RC.ru[j]->function = NGFI_RAU_IF5; RC.ru[j]->function = NGFI_RAU_IF5;
RC.ru[j]->eth_params.transp_preference = ETH_UDP_MODE; RC.ru[j]->eth_params.transp_preference = ETH_UDP_MODE;
} }
else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_ori_if5") == 0) { else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_ecpri_if5") == 0) {
RC.ru[j]->if_south = REMOTE_IF5; RC.ru[j]->if_south = REMOTE_IF5;
RC.ru[j]->function = NGFI_RAU_IF5; RC.ru[j]->function = NGFI_RAU_IF5;
RC.ru[j]->eth_params.transp_preference = ETH_UDP_IF5_ORI_MODE; RC.ru[j]->eth_params.transp_preference = ETH_UDP_IF5_ECPRI_MODE;
RC.ru[j]->has_ctrl_prt = 0; RC.ru[j]->has_ctrl_prt = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment