testing ECPRI receive path (with level adjustment for 12-bit OAI RX dynamic range)
This commit is contained in:
@@ -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
|
|||||||
__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
|
|||||||
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);
|
||||||
eth->rx_nsamps=256;
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
|
#ifdef __AVX2__
|
||||||
/* buff[i] points to the position in rx buffer where the payload to be received will be placed
|
int nsamps2 = (payload_size>>5)+1;
|
||||||
buff2 points to the position in rx buffer where the packet header will be placed */
|
__m256i temp_rx[nsamps2];
|
||||||
void *buff2 = (void*)(buff- APP_HEADER_SIZE_BYTES);
|
char *temp_rx0 = ((char *)&temp_rx[1])-APP_HEADER_SIZE_BYTES;
|
||||||
|
#else
|
||||||
/* we don't want to ovewrite with the header info the previous rx buffer data so we store it*/
|
int nsamps2 = (payload_size>>4)+1;
|
||||||
memcpy((void *)temp0,(void *)buff2,APP_HEADER_SIZE_BYTES);
|
__m128i temp_rx[nsamps2];
|
||||||
|
char *temp_rx0 = ((char *)&temp_rx[1])-APP_HEADER_SIZE_BYTES;
|
||||||
bytes_received=0;
|
|
||||||
block_cnt=0;
|
|
||||||
int receive_bytes;
|
|
||||||
if (eth->compression == ALAW_COMPRESS) {
|
|
||||||
receive_bytes = UDP_PACKET_SIZE_BYTES_ALAW(nsamps);
|
|
||||||
} else {
|
|
||||||
receive_bytes = UDP_PACKET_SIZE_BYTES(nsamps);
|
|
||||||
}
|
|
||||||
|
|
||||||
while(bytes_received < receive_bytes) {
|
|
||||||
again:
|
|
||||||
#if DEBUG
|
|
||||||
printf("------- RX------: buff2 current position=%d remaining_bytes=%d bytes_recv=%d \n",
|
|
||||||
(void *)(buff2+bytes_received),
|
|
||||||
receive_bytes - bytes_received,
|
|
||||||
bytes_received);
|
|
||||||
#endif
|
#endif
|
||||||
bytes_received +=recvfrom(eth->sockfdd,
|
#elif defined(__arm__) || defined(__aarch64__)
|
||||||
buff2,
|
int nsamps2 = (payload_size>>4)+1
|
||||||
receive_bytes,
|
int16x8_t temp_rx[nsamps2];
|
||||||
rcvfrom_flag,
|
char *temp_rx0 = ((char *)&temp_rx[1])-APP_HEADER_SIZE_BYTES;
|
||||||
(struct sockaddr *)ð->dest_addrd,
|
#else
|
||||||
(socklen_t *)ð->addr_len);
|
#error Unsupported CPU architecture, USRP device cannot be built
|
||||||
/*
|
#endif
|
||||||
if (packet_cnt%1000000<10) {
|
|
||||||
printf("[AW2S] Received ECPRI packet %d (REV %x, MessType %d, Payload size %d, PC_ID %d, TS %llu\n",
|
eth->rx_nsamps=nsamps;
|
||||||
packet_cnt,*(uint8_t *)buff2,
|
|
||||||
*(uint8_t *)(buff2+1),
|
bytes_received=0;
|
||||||
(*(uint8_t *)(buff2+2)<<8)+*(uint8_t *)(buff2+3),
|
block_cnt=0;
|
||||||
*(uint16_t *)(buff2+4),
|
int receive_bytes;
|
||||||
*(uint64_t *)(buff2+6));
|
AssertFatal(eth->compression == NO_COMPRESS, "IF5 compression not supported for now\n");
|
||||||
}*/
|
|
||||||
packet_cnt++;
|
while(bytes_received < payload_size) {
|
||||||
if (bytes_received ==-1) {
|
again:
|
||||||
eth->num_rx_errors++;
|
bytes_received +=recvfrom(eth->sockfdd,
|
||||||
if (errno == EAGAIN) {
|
temp_rx0,
|
||||||
again_cnt++;
|
payload_size,
|
||||||
usleep(10);
|
rcvfrom_flag,
|
||||||
if (again_cnt == 1000) {
|
(struct sockaddr *)ð->dest_addrd,
|
||||||
|
(socklen_t *)ð->addr_len);
|
||||||
|
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
|
|
||||||
printf("------- RX------: nu=%d an_id=%d ts%d bytes_recv=%d\n",
|
|
||||||
*(int16_t *)buff2,
|
|
||||||
*(int16_t *)(buff2 + sizeof(int16_t)),
|
|
||||||
*(openair0_timestamp *)(buff2 + sizeof(int32_t)),
|
|
||||||
bytes_received);
|
|
||||||
|
|
||||||
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 */
|
|
||||||
*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.
|
|
||||||
*timestamp = *timestamp/3;
|
|
||||||
// handle 1.4,3,5,10,15 MHz cases
|
|
||||||
*cc = *(uint16_t*)(buff2 + ECPRICOMMON_BYTES);
|
|
||||||
}
|
|
||||||
//VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM,eth->pck_seq_num_cur);
|
|
||||||
//VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM_PRV,eth->pck_seq_num_prev);
|
|
||||||
eth->rx_actual_nsamps=bytes_received>>2;
|
|
||||||
eth->rx_count++;
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/* store the timestamp value from packet's header */
|
||||||
|
*timestamp = *(openair0_timestamp *)(temp_rx0 + 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.
|
||||||
|
*timestamp = *timestamp/3;
|
||||||
|
// handle 1.4,3,5,10,15 MHz cases
|
||||||
|
*cc = *(uint16_t*)(temp_rx0 + ECPRICOMMON_BYTES);
|
||||||
|
}
|
||||||
|
eth->rx_actual_nsamps=payload_size>>2;
|
||||||
|
eth->rx_count++;
|
||||||
|
}
|
||||||
|
|
||||||
/* tx buffer values restored */
|
// populate receive buffer in lower 12-bits from 16-bit representation
|
||||||
memcpy((void *)buff2,(void *)temp0,APP_HEADER_SIZE_BYTES);
|
for (int j=1; j<nsamps2; j++) {
|
||||||
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
|
#ifdef __AVX2__
|
||||||
|
// LOG_I(PHY,"((__m256i *)buff)[%d-1] = %p, temp_rx[%d] = %p\n",
|
||||||
|
// j,&((__m256i *)buff)[j-1],j,&temp_rx[j]);
|
||||||
|
((__m256i *)buff)[j-1] = _mm256_srai_epi16(temp_rx[j],4);
|
||||||
|
#else
|
||||||
|
((__m128i *)buff)[j-1] = _mm_srai_epi16(temp_rx[j],4);
|
||||||
|
#endif
|
||||||
|
#elif defined(__arm__)
|
||||||
|
((int16x8_t *)buff)[j] = vshrq_n_s16(temp_rx[i][j],4);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return (bytes_received-APP_HEADER_SIZE_BYTES)>>2;
|
|
||||||
|
return (payload_size>>2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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) {
|
|||||||
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
|
|||||||
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
|
|||||||
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 @@
|
|||||||
#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) {
|
|||||||
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) {
|
|||||||
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) {
|
|||||||
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user