optimizations for IF5 fronthaul with AW2S 4x4 RU
This commit is contained in:
+12
-2
@@ -302,7 +302,11 @@ void fh_if5_south_in(RU_t *ru,
|
||||
int *tti) {
|
||||
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
|
||||
RU_proc_t *proc = &ru->proc;
|
||||
recv_IF5(ru, &proc->timestamp_rx, *tti, IF5_RRH_GW_UL);
|
||||
nfapi_nr_config_request_scf_t *cfg = &ru->config;
|
||||
int is_rx=1;
|
||||
int slot_type = nr_slot_select(cfg,*frame,*tti);
|
||||
if (slot_type == NR_DOWNLINK_SLOT) is_rx=0;
|
||||
recv_IF5(ru, &proc->timestamp_rx, *tti, IF5_RRH_GW_UL,is_rx);
|
||||
if (proc->first_rx == 1) ru->ts_offset = proc->timestamp_rx;
|
||||
proc->frame_rx = ((proc->timestamp_rx-ru->ts_offset) / (fp->samples_per_subframe*10))&1023;
|
||||
proc->tti_rx = fp->get_slot_from_timestamp(proc->timestamp_rx-ru->ts_offset,fp);
|
||||
@@ -475,7 +479,7 @@ void fh_if5_north_asynch_in(RU_t *ru,int *frame,int *slot) {
|
||||
RU_proc_t *proc = &ru->proc;
|
||||
int tti_tx,frame_tx;
|
||||
openair0_timestamp timestamp_tx;
|
||||
recv_IF5(ru, ×tamp_tx, *slot, IF5_RRH_GW_DL);
|
||||
recv_IF5(ru, ×tamp_tx, *slot, IF5_RRH_GW_DL,1);
|
||||
// printf("Received subframe %d (TS %llu) from RCC\n",tti_tx,timestamp_tx);
|
||||
frame_tx = (timestamp_tx / (fp->samples_per_subframe*10))&1023;
|
||||
uint32_t idx_sf = timestamp_tx / fp->samples_per_subframe;
|
||||
@@ -1363,6 +1367,8 @@ void *ru_thread( void *param ) {
|
||||
if (ru->fh_south_in) ru->fh_south_in(ru,&frame,&slot);
|
||||
else AssertFatal(1==0, "No fronthaul interface at south port");
|
||||
|
||||
continue;
|
||||
|
||||
if (initial_wait == 1 && proc->frame_rx < 300 && ru->fh_south_in == rx_rf) {
|
||||
if (proc->frame_rx>0 && ((proc->frame_rx % 100) == 0) && proc->tti_rx==0) {
|
||||
LOG_I(PHY,"delay processing to let RX stream settle, frame %d (trials %d)\n",proc->frame_rx,ru->rx_fhaul.trials);
|
||||
@@ -1413,6 +1419,8 @@ void *ru_thread( void *param ) {
|
||||
int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST);
|
||||
uint8_t prachStartSymbol,N_dur;
|
||||
if (prach_id>=0) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 1 );
|
||||
|
||||
T(T_GNB_PHY_PRACH_INPUT_SIGNAL, T_INT(proc->frame_rx), T_INT(proc->tti_rx), T_INT(0),
|
||||
T_BUFFER(&ru->common.rxdata[0][fp->get_samples_slot_timestamp(proc->tti_rx-1,fp,0)]/*-ru->N_TA_offset*/, fp->get_samples_per_slot(proc->tti_rx,fp)*4*2));
|
||||
N_dur = get_nr_prach_duration(ru->prach_list[prach_id].fmt);
|
||||
@@ -1443,6 +1451,7 @@ void *ru_thread( void *param ) {
|
||||
}
|
||||
|
||||
free_nr_ru_prach_entry(ru,prach_id);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1458,6 +1467,7 @@ void *ru_thread( void *param ) {
|
||||
syncMsg->timestamp_tx = proc->timestamp_tx;
|
||||
res->key = proc->tti_rx;
|
||||
pushTpool(gNB->threadPool, res);
|
||||
|
||||
}
|
||||
|
||||
printf( "Exiting ru_thread \n");
|
||||
|
||||
@@ -1052,7 +1052,7 @@ static inline int64_t clock_difftime_ns(struct timespec start, struct timespec e
|
||||
void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int tti, uint8_t *seqno, uint16_t packet_type) {
|
||||
|
||||
LTE_DL_FRAME_PARMS *fp=ru->frame_parms;
|
||||
int32_t *txp[fp->nb_antennas_tx], *rxp[fp->nb_antennas_rx];
|
||||
int32_t *txp[ru->nb_tx], *rxp[ru->nb_rx];
|
||||
int32_t *tx_buffer=NULL;
|
||||
uint16_t packet_id=0, i=0;
|
||||
|
||||
@@ -1106,7 +1106,7 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int tti, uint8_t *seq
|
||||
|
||||
NR_DL_FRAME_PARMS *nrfp = ru->nr_frame_parms;
|
||||
|
||||
int offset,siglen,factor=1;
|
||||
int offset,siglen,factor_n=1,factor_d=1;
|
||||
if (nrfp) {
|
||||
offset = nrfp->get_samples_slot_timestamp(tti,nrfp,0);
|
||||
siglen = nrfp->get_samples_per_slot(tti,nrfp);
|
||||
@@ -1117,11 +1117,13 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int tti, uint8_t *seq
|
||||
}
|
||||
|
||||
if (ru->openair0_cfg.nr_flag==1) {
|
||||
if (nrfp->N_RB_DL <= 162 && nrfp->N_RB_DL >= 106) factor = 2;
|
||||
else if (nrfp->N_RB_DL < 106) factor=4;
|
||||
if (nrfp->N_RB_DL <= 162 && nrfp->N_RB_DL > 106) {factor_n=1; factor_d=2;} // 61.44 Ms/s
|
||||
else if (nrfp->N_RB_DL <= 106 && nrfp->N_RB_DL > 51 ) {factor_n=3; factor_d=4;} // 46.08 Ms/s
|
||||
else if (nrfp->N_RB_DL == 51 ) {factor_n=1; factor_d=1;} // 30.72 Ms/s
|
||||
else AssertFatal(1==0,"N_RB_DL %d not supported yet\n",nrfp->N_RB_DL);
|
||||
}
|
||||
else {
|
||||
factor = 30720/spsf;
|
||||
factor_n = 30720/spsf;
|
||||
}
|
||||
for (i=0; i < ru->nb_tx; i++)
|
||||
txp[i] = (int32_t*)&ru->common.txdata[i][offset];
|
||||
@@ -1132,7 +1134,7 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int tti, uint8_t *seq
|
||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF0, 1 );
|
||||
clock_gettime( CLOCK_MONOTONIC, &start_comp);
|
||||
ru->ifdevice.trx_write_func2(&ru->ifdevice,
|
||||
(proc_timestamp + packet_id*spp_eth-600)*factor,
|
||||
((proc_timestamp + packet_id*spp_eth-600)*factor_n)/factor_d,
|
||||
(void*)txp[aid],
|
||||
spp_eth,
|
||||
aid,
|
||||
@@ -1181,7 +1183,7 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int tti, uint8_t *seq
|
||||
}
|
||||
*/
|
||||
} else if (eth->compression == NO_COMPRESS) {
|
||||
for (i=0; i < fp->nb_antennas_rx; i++)
|
||||
for (i=0; i < ru->nb_rx; i++)
|
||||
rxp[i] = (void*)&ru->common.rxdata[i][tti*fp->samples_per_tti];
|
||||
|
||||
for (packet_id=0; packet_id < spsf / spp_eth; packet_id++) {
|
||||
@@ -1192,12 +1194,12 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int tti, uint8_t *seq
|
||||
(proc_timestamp + packet_id*spp_eth),
|
||||
(void**)rxp,
|
||||
spp_eth,
|
||||
fp->nb_antennas_rx,
|
||||
ru->nb_rx,
|
||||
0);
|
||||
clock_gettime( CLOCK_MONOTONIC, &end_comp);
|
||||
LOG_D(HW,"[SF %d] IF_Write_Time: %"PRId64"\n",tti,clock_difftime_ns(start_comp, end_comp));
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF0, 0 );
|
||||
for (i=0; i < fp->nb_antennas_rx; i++)
|
||||
for (i=0; i < ru->nb_rx; i++)
|
||||
rxp[i] += spp_eth;
|
||||
|
||||
}
|
||||
@@ -1211,7 +1213,7 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int tti, uint8_t *seq
|
||||
return;
|
||||
}
|
||||
|
||||
void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int tti, uint16_t packet_type) {
|
||||
void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int tti, uint16_t packet_type,int is_rx) {
|
||||
|
||||
LTE_DL_FRAME_PARMS *fp=ru->frame_parms;
|
||||
int32_t *txp[ru->nb_tx], *rxp[ru->nb_rx];
|
||||
@@ -1225,6 +1227,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int tti, uint16_t pa
|
||||
openair0_timestamp timestamp[ru->nb_rx*spsf / spp_eth];
|
||||
long timein[ru->nb_rx*spsf/spp_eth];
|
||||
long timeout[ru->nb_rx*spsf/spp_eth];
|
||||
long aid_list[ru->nb_rx*spsf/spp_eth];
|
||||
struct timespec if_time;
|
||||
|
||||
memset(timestamp, 0, sizeof(timestamp));
|
||||
@@ -1271,7 +1274,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int tti, uint16_t pa
|
||||
*/
|
||||
} else if (eth->compression == NO_COMPRESS) {
|
||||
int subframe = tti;
|
||||
for (i=0; i < fp->nb_antennas_tx; i++)
|
||||
for (i=0; i < ru->nb_tx; i++)
|
||||
txp[i] = (void*)&ru->common.txdata[i][subframe*fp->samples_per_tti];
|
||||
|
||||
for (packet_id=0; packet_id < spsf / spp_eth; packet_id++) {
|
||||
@@ -1282,11 +1285,11 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int tti, uint16_t pa
|
||||
×tamp[packet_id],
|
||||
(void**)txp,
|
||||
spp_eth,
|
||||
fp->nb_antennas_tx);
|
||||
ru->nb_tx);
|
||||
clock_gettime( CLOCK_MONOTONIC, &end_decomp);
|
||||
LOG_D(HW,"[SF %d] IF_Read_Time: %"PRId64"\n",subframe,clock_difftime_ns(start_decomp, end_decomp));
|
||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_IF0, 0 );
|
||||
for (i=0; i < fp->nb_antennas_tx; i++)
|
||||
for (i=0; i < ru->nb_tx; i++)
|
||||
txp[i] += spp_eth;
|
||||
|
||||
}
|
||||
@@ -1329,12 +1332,11 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int tti, uint16_t pa
|
||||
}
|
||||
*/
|
||||
} else if (eth->compression == NO_COMPRESS) {
|
||||
int16_t temp_rx[spp_eth*2] __attribute__((aligned(32)));
|
||||
//int16_t temp_rx[spp_eth*2] __attribute__((aligned(32)));
|
||||
NR_DL_FRAME_PARMS *nrfp = ru->nr_frame_parms;
|
||||
|
||||
int offset,siglen;
|
||||
int factor=1;
|
||||
int ts_offset;
|
||||
int factor_n=1,factor_d=1;
|
||||
if (nrfp) {
|
||||
offset = nrfp->get_samples_slot_timestamp(tti,nrfp,0);
|
||||
siglen = nrfp->get_samples_per_slot(tti,nrfp);
|
||||
@@ -1344,13 +1346,12 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int tti, uint16_t pa
|
||||
siglen = spsf;
|
||||
}
|
||||
if (ru->openair0_cfg.nr_flag==1) { // This check if RRU knows about NR numerologies
|
||||
if (nrfp->N_RB_DL <= 162 && nrfp->N_RB_DL >= 106) factor = 2;
|
||||
else if (nrfp->N_RB_DL < 106) factor=4;
|
||||
ts_offset = 64;
|
||||
if (nrfp->N_RB_DL <= 162 && nrfp->N_RB_DL > 106) factor_n = 2;
|
||||
else if (nrfp->N_RB_DL <= 106 && nrfp->N_RB_DL > 51) {factor_d=3;factor_n=4;}
|
||||
else if (nrfp->N_RB_DL == 51) {factor_n=1;factor_d=1;}
|
||||
}
|
||||
else {
|
||||
factor = 30720/spsf;
|
||||
ts_offset = 256;
|
||||
factor_d = 30720/spsf;
|
||||
}
|
||||
for (i=0; i < ru->nb_rx; i++)
|
||||
rxp[i] = &ru->common.rxdata[i][offset];
|
||||
@@ -1365,19 +1366,21 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int tti, uint16_t pa
|
||||
timein[packet_id] = if_time.tv_nsec;
|
||||
ru->ifdevice.trx_read_func2(&ru->ifdevice,
|
||||
×tamp[packet_id],
|
||||
(void*)temp_rx,
|
||||
(is_rx>0) ? rxp : NULL,
|
||||
spp_eth,
|
||||
packet_id,
|
||||
&aid);
|
||||
clock_gettime( CLOCK_MONOTONIC, &if_time);
|
||||
timeout[packet_id] = if_time.tv_nsec;
|
||||
timestamp[packet_id] /= factor; // for LTE this is the sample rate reduction w.r.t 30.72, for NR 122.88
|
||||
LOG_D(PHY,"TTI %d: factor = %d Received packet %d: aid %d, TS %llu, oldTS %llu, diff %lld, \n",tti,factor,packet_id,aid,(unsigned long long)timestamp[packet_id],(unsigned long long)oldTS,(unsigned long long)(timestamp[packet_id]-timestamp[0]));
|
||||
timestamp[packet_id] = (timestamp[packet_id]*factor_n)/factor_d;
|
||||
aid_list[packet_id] = aid;
|
||||
//LOG_D(PHY,"TTI %d: factor = %d/%d Received packet %d: aid %d, TS %llu, oldTS %llu, diff %lld, \n",tti,factor_n,factor_d,packet_id,aid,(unsigned long long)timestamp[packet_id],(unsigned long long)oldTS,(unsigned long long)(timestamp[packet_id]-timestamp[0]));
|
||||
|
||||
if (aid==0) {
|
||||
if (firstTS==1) firstTS=0;
|
||||
else if (oldTS + ts_offset != timestamp[packet_id]) {
|
||||
LOG_I(PHY,"oldTS %llu, newTS %llu, diff %llu, timein %lu, timeout %lu\n",(long long unsigned int)oldTS,(long long unsigned int)timestamp[packet_id],(long long unsigned int)timestamp[packet_id]-oldTS,timein[packet_id],timeout[packet_id]);
|
||||
for (int i=0;i<=packet_id;i++) LOG_I(PHY,"packet %d TS %llu, timein %lu, timeout %lu\n",i,(long long unsigned int)timestamp[i],timein[i],timeout[i]);
|
||||
else if (oldTS + spp_eth != timestamp[packet_id]) {
|
||||
LOG_I(PHY,"oldTS %llu, newTS %llu, diff %llu, timediff %ld\n",(long long unsigned int)oldTS,(long long unsigned int)timestamp[packet_id],(long long unsigned int)timestamp[packet_id]-oldTS,-timein[packet_id]+timeout[packet_id]);
|
||||
for (int i=0;i<=packet_id;i++) LOG_I(PHY,"packet %d aid %d TS %llu, timediff %ld\n",i,aid_list[i],(long long unsigned int)timestamp[i],-timein[i]+timeout[i]);
|
||||
AssertFatal(1==0,"fronthaul problem\n");
|
||||
}
|
||||
|
||||
@@ -1388,12 +1391,12 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int tti, uint16_t pa
|
||||
// HYPOTHESIS: first packet per subframe has lowest timestamp of subframe
|
||||
// should detect out of order and act accordingly ....
|
||||
AssertFatal(aid==0 || aid==1 || aid==2 || aid==3,"aid %d != 0,1,2 or 3\n",aid);
|
||||
LOG_D(PHY,"rxp[%d] %p, dest %p, offset %d (%llu,%llu)\n",aid,rxp[aid],rxp[aid]+(timestamp[packet_id]-timestamp[0]),(int)(timestamp[packet_id]-timestamp[0]),(long long unsigned int)timestamp[packet_id],(long long unsigned int)timestamp[0]);
|
||||
memcpy((void*)(rxp[aid]+(timestamp[packet_id]-timestamp[0])),
|
||||
(void*)temp_rx,
|
||||
spp_eth<<2);
|
||||
//LOG_D(PHY,"rxp[%d] %p, dest %p, offset %d (%llu,%llu)\n",aid,rxp[aid],rxp[aid]+(timestamp[packet_id]-timestamp[0]),(int)(timestamp[packet_id]-timestamp[0]),(long long unsigned int)timestamp[packet_id],(long long unsigned int)timestamp[0]);
|
||||
//memcpy((void*)(rxp[aid]+(timestamp[packet_id]-timestamp[0])),
|
||||
// (void*)temp_rx,
|
||||
// spp_eth<<2);
|
||||
clock_gettime( CLOCK_MONOTONIC, &end_decomp);
|
||||
LOG_D(HW,"[TTI %d] IF_Read_Time: %"PRId64"\n",tti,clock_difftime_ns(start_decomp, end_decomp));
|
||||
//LOG_D(HW,"[TTI %d] IF_Read_Time: %"PRId64"\n",tti,clock_difftime_ns(start_decomp, end_decomp));
|
||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_IF0, 0 );
|
||||
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ typedef struct IF5_mobipass_header IF5_mobipass_header_t;
|
||||
|
||||
void send_IF5(RU_t *, openair0_timestamp, int, uint8_t*, uint16_t);
|
||||
|
||||
void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16_t packet_type);
|
||||
void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16_t packet_type,int is_rx);
|
||||
|
||||
|
||||
void malloc_IF5_buffer(RU_t *ru);
|
||||
|
||||
@@ -250,7 +250,6 @@ int aw2s_startstreaming(openair0_device *device) {
|
||||
|
||||
}
|
||||
ORI_Object_s *link= ORI_FindObject(ori, ORI_ObjectType_ORILink, 0, NULL);
|
||||
|
||||
if (tx0 == NULL ||
|
||||
(tx1 == NULL && openair0_cfg->tx_num_channels > 1) ||
|
||||
(tx2 == NULL && openair0_cfg->tx_num_channels > 2) ||
|
||||
@@ -335,7 +334,7 @@ int aw2s_startstreaming(openair0_device *device) {
|
||||
printf("\n\n\n========================================================\n");
|
||||
|
||||
/* Put Tx3 into service */
|
||||
result = ORI_ObjectStateModification(ori, tx1, ORI_AST_Unlocked, &RE_result);
|
||||
result = ORI_ObjectStateModification(ori, tx3, ORI_AST_Unlocked, &RE_result);
|
||||
if(result != ORI_Result_SUCCESS)
|
||||
{
|
||||
printf("ORI_ObjectStateModify failed with error: %s\n", ORI_Result_Print(result));
|
||||
@@ -402,7 +401,7 @@ int aw2s_startstreaming(openair0_device *device) {
|
||||
if (rx3) {
|
||||
printf("\n\n\n========================================================\n");
|
||||
|
||||
/* Put Rx1 into service */
|
||||
/* Put Rx3 into service */
|
||||
result = ORI_ObjectStateModification(ori, rx3, ORI_AST_Unlocked, &RE_result);
|
||||
if(result != ORI_Result_SUCCESS)
|
||||
{
|
||||
@@ -412,33 +411,45 @@ int aw2s_startstreaming(openair0_device *device) {
|
||||
}
|
||||
printf("ORI_ObjectStateModify: %s\n", ORI_Result_Print(RE_result));
|
||||
}
|
||||
/*
|
||||
/*
|
||||
while (rx0->fst != ORI_FST_Operational ||
|
||||
(openair0_cfg->rx_num_channels > 1 && rx1->fst != ORI_FST_Operational) ||
|
||||
tx0->fst != ORI_FST_Operational ||
|
||||
(openair0_cfg->tx_num_channels > 1 && tx1->fst != ORI_FST_Operational))
|
||||
{}*/
|
||||
(openair0_cfg->rx_num_channels > 2 && rx2->fst != ORI_FST_Operational) ||
|
||||
(openair0_cfg->rx_num_channels > 3 && rx3->fst != ORI_FST_Operational))
|
||||
{}
|
||||
*/
|
||||
// test RX interface
|
||||
uint64_t TS;
|
||||
char temp_rx[1024] __attribute__((aligned(32)));
|
||||
int64_t deltaTS,olddeltaTS=-1;
|
||||
int aid,r0=0,r1=(openair0_cfg->rx_num_channels > 1) ? 0 : 1;
|
||||
int r2=(openair0_cfg->rx_num_channels > 2) ? 0 : 1;
|
||||
int r3=(openair0_cfg->rx_num_channels > 3) ? 0 : 1;
|
||||
|
||||
int i;
|
||||
int Npackets=1024000;
|
||||
openair0_timestamp oldTS=0;
|
||||
int fhjumps=0;
|
||||
for (i=0;i<Npackets;i++) {
|
||||
device->trx_read_func2(device,
|
||||
(openair0_timestamp*)&TS,
|
||||
(void*)temp_rx,
|
||||
NULL,
|
||||
256,
|
||||
0,
|
||||
&aid);
|
||||
if (aid == 0) r0=1;
|
||||
if (aid == 1) r1=1;
|
||||
if (aid == 2) r2=1;
|
||||
if (aid == 3) r3=1;
|
||||
if (aid==0) {
|
||||
deltaTS = TS-oldTS;
|
||||
oldTS=TS;
|
||||
if (deltaTS != olddeltaTS && olddeltaTS > 0) {
|
||||
fhjumps++;
|
||||
}
|
||||
if (i>0) olddeltaTS = deltaTS;
|
||||
}
|
||||
}
|
||||
if (r0==1 && r1==1 && r2==1 && r3==1) printf("Streaming started, returning to OAI\n");
|
||||
if (r0==1 && r1==1 && r2==1 && r3==1) printf("Streaming started, returning to OAI, fghjumps %d\n",fhjumps);
|
||||
else {
|
||||
printf("Didn't get anything from one antenna port after %d packets %d,%d,%d,%d\n",Npackets,r0,r1,r2,r3);
|
||||
return(-1);
|
||||
|
||||
@@ -411,12 +411,13 @@ struct openair0_device_t {
|
||||
* was received.
|
||||
* \param device the hardware to use
|
||||
* \param[out] ptimestamp the time at which the first sample was received.
|
||||
* \param[out] buff A pointers to a buffer for received samples. The buffer must be large enough to hold the number of samples \ref nsamps.
|
||||
* \param[out] buff A pointer to a buffer[ant_id][] for received samples. The buffer[ant_id] must be large enough to hold the number of samples \ref nsamps * the number of packets.
|
||||
* \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte.
|
||||
* \param packet_idx offset into
|
||||
* \param antenna_id Index of antenna from which samples were received
|
||||
* \returns the number of sample read
|
||||
*/
|
||||
int (*trx_read_func2)(openair0_device *device, openair0_timestamp *ptimestamp, void *buff, int nsamps,int *antenna_id);
|
||||
int (*trx_read_func2)(openair0_device *device, openair0_timestamp *ptimestamp, uint32_t **buff, int nsamps,int packet_idx,int *antenna_id);
|
||||
|
||||
/*! \brief print the device statistics
|
||||
* \param device the hardware to use
|
||||
|
||||
@@ -297,7 +297,7 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi
|
||||
#endif
|
||||
|
||||
|
||||
// bring TX data into 12 LSBs for softmodem RX
|
||||
// bring TX data into 12 MSBs
|
||||
for (int j=0; j<nsamps2; j++) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#ifdef __AVX2__
|
||||
@@ -389,9 +389,7 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi
|
||||
}
|
||||
|
||||
|
||||
#define NOSHIFT 1
|
||||
|
||||
int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, void *buff, int nsamps, int *cc) {
|
||||
int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, uint32_t **buff, int nsamps, int packet_idx,int *cc) {
|
||||
|
||||
int bytes_received=0;
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
@@ -402,41 +400,25 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
|
||||
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 device cannot be built
|
||||
int nsamps2 = (payload_size>>2)+1;
|
||||
int32_t temp_rx[payload_size>>2];
|
||||
char* *temp_rx0 = ((char *)&temp_rx[1]) - APP_HEADER_SIZE_BYTES;
|
||||
#endif
|
||||
int nsamps2 = (payload_size>>2)+(APP_HEADER_SIZE_BYTES>>2);
|
||||
int32_t temp_rx[nsamps2+1];
|
||||
char *temp_rx0 = ((char *)&temp_rx[1+(APP_HEADER_SIZE_BYTES>>2)]) - APP_HEADER_SIZE_BYTES;
|
||||
|
||||
eth->rx_nsamps=nsamps;
|
||||
|
||||
bytes_received=0;
|
||||
block_cnt=0;
|
||||
AssertFatal(eth->compression == NO_COMPRESS, "IF5 compression not supported for now\n");
|
||||
|
||||
|
||||
while(bytes_received < payload_size) {
|
||||
again:
|
||||
// LOG_I(PHY,"temp_rx0 %p, temp_rx[0] %p temp_rx[APP_HEADER_SIZE_BYTES>>2] %p APP_HEADER_SIZE_BYTES %ld\n",temp_rx0,&temp_rx[0],&temp_rx[APP_HEADER_SIZE_BYTES>>2],APP_HEADER_SIZE_BYTES);
|
||||
bytes_received +=recvfrom(eth->sockfdd,
|
||||
temp_rx0,
|
||||
(void*)temp_rx0,
|
||||
payload_size,
|
||||
rcvfrom_flag,
|
||||
(struct sockaddr *)ð->dest_addrd,
|
||||
(socklen_t *)ð->addr_len);
|
||||
(socklen_t *)ð->addr_len);
|
||||
packet_cnt++;
|
||||
if (bytes_received ==-1) {
|
||||
eth->num_rx_errors++;
|
||||
@@ -473,22 +455,9 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
|
||||
eth->rx_count++;
|
||||
}
|
||||
|
||||
#ifdef NOSHIFT
|
||||
memcpy(buff,(void*)(temp_rx+1),payload_size);
|
||||
#else
|
||||
// populate receive buffer in lower 12-bits from 16-bit representation
|
||||
for (int j=1; j<nsamps2; j++) {
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
#ifdef __AVX2__
|
||||
((__m256i *)buff)[j-1] = _mm256_srai_epi16(temp_rx[j],2);
|
||||
#else
|
||||
((__m128i *)buff)[j-1] = _mm_srai_epi16(temp_rx[j],2);
|
||||
#endif
|
||||
#elif defined(__arm__)
|
||||
((int16x8_t *)buff)[j] = vshrq_n_s16(temp_rx[i][j],2);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (buff) memcpy((void*)(buff[*cc]+packet_idx*nsamps),
|
||||
(void*)(temp_rx+1),
|
||||
nsamps<<2);
|
||||
|
||||
return (payload_size>>2);
|
||||
}
|
||||
|
||||
@@ -145,10 +145,10 @@ int trx_eth_start(openair0_device *device)
|
||||
if(ethernet_tune (device,RCV_TIMEOUT,999999)!=0) return -1;
|
||||
}
|
||||
/* apply additional configuration */
|
||||
if(ethernet_tune (device, SND_BUF_SIZE,2000000000)!=0) return -1;
|
||||
if(ethernet_tune (device, RCV_BUF_SIZE,2000000000)!=0) return -1;
|
||||
if(ethernet_tune (device, KERNEL_SND_BUF_MAX_SIZE, 200000000)!=0) return -1;
|
||||
if(ethernet_tune (device, KERNEL_RCV_BUF_MAX_SIZE, 200000000)!=0) return -1;
|
||||
if(ethernet_tune (device, SND_BUF_SIZE,67108864)!=0) return -1;
|
||||
if(ethernet_tune (device, RCV_BUF_SIZE,67108864)!=0) return -1;
|
||||
if(ethernet_tune (device, KERNEL_SND_BUF_MAX_SIZE, 67108864)!=0) return -1;
|
||||
if(ethernet_tune (device, KERNEL_RCV_BUF_MAX_SIZE, 67108864)!=0) return -1;
|
||||
|
||||
|
||||
return 0;
|
||||
@@ -357,7 +357,7 @@ int ethernet_tune(openair0_device *device,
|
||||
}
|
||||
break;
|
||||
case KERNEL_RCV_BUF_MAX_SIZE:
|
||||
ret=snprintf(system_cmd,sizeof(system_cmd),"sysctl -w net.core.rmem_max=%d",value);
|
||||
ret=snprintf(system_cmd,sizeof(system_cmd),"sysctl -w net.core.rmem_max=%d;sysctl -w net.core.rmem_default=%d",value,value);
|
||||
if (ret > 0) {
|
||||
ret=system(system_cmd);
|
||||
if (ret == -1) {
|
||||
@@ -371,7 +371,7 @@ int ethernet_tune(openair0_device *device,
|
||||
}
|
||||
break;
|
||||
case KERNEL_SND_BUF_MAX_SIZE:
|
||||
ret=snprintf(system_cmd,sizeof(system_cmd),"sysctl -w net.core.wmem_max=%d",value);
|
||||
ret=snprintf(system_cmd,sizeof(system_cmd),"sysctl -w net.core.wmem_max=%d;sysctl -w net.core.wmem_default=%d;sysctl -w net.core.netdev_max_backlog=416384;sysctl -w net.core.optmem_max=524288;",value,value);
|
||||
if (ret > 0) {
|
||||
ret=system(system_cmd);
|
||||
if (ret == -1) {
|
||||
|
||||
@@ -238,7 +238,7 @@ int ethernet_tune(openair0_device *device, unsigned int option, int value);
|
||||
*/
|
||||
int eth_socket_init_udp(openair0_device *device);
|
||||
int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, void *buff, int nsamps,int cc, int flags);
|
||||
int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, void *buff, int nsamps, int *cc);
|
||||
int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, uint32_t **buff, int nsamps, int packet_idx,int *cc);
|
||||
|
||||
|
||||
int eth_socket_init_raw(openair0_device *device);
|
||||
|
||||
Reference in New Issue
Block a user