Merge remote-tracking branch 'origin/develop' into feature-131-new-license
Conflicts: openair1/PHY/INIT/lte_init.c openair1/PHY/LTE_TRANSPORT/dci_tools.c openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c openair1/SCHED/phy_procedures_lte_eNb.c openair1/SCHED/phy_procedures_lte_ue.c openair1/SIMULATION/LTE_PHY/dlsim.c openair1/SIMULATION/RF/adc.c openair2/LAYER2/MAC/lte_transport_init.c targets/RT/USER/lte-softmodem.c targets/RT/USER/sched_dlsch.c targets/RT/USER/sched_rx_pdsch.c targets/RT/USER/sched_ulsch.c targets/SIMU/USER/oaisim.c
This commit is contained in:
@@ -35,7 +35,7 @@ uint16_t pck_seq_num = 1;
|
||||
uint16_t pck_seq_num_cur=0;
|
||||
uint16_t pck_seq_num_prev=0;
|
||||
|
||||
int eth_socket_init_udp(openair0_device *device) {
|
||||
int eth_socket_init_udp(openair0_device *device) {
|
||||
|
||||
int i = 0;
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
@@ -110,6 +110,105 @@ uint16_t pck_seq_num_prev=0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestamp, void **buff, int nsamps, int cc) {
|
||||
|
||||
// Read nblocks info from packet itself
|
||||
int nblocks = nsamps;
|
||||
int bytes_received=0;
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
int Mod_id = device->Mod_id;
|
||||
|
||||
ssize_t packet_size = sizeof_IF4p5_header_t;
|
||||
IF4p5_header_t *test_header = (IF4p5_header_t*)(buff[0]);
|
||||
|
||||
|
||||
bytes_received = recvfrom(eth->sockfd[Mod_id],
|
||||
buff[0],
|
||||
packet_size,
|
||||
0,
|
||||
(struct sockaddr *)&dest_addr[Mod_id],
|
||||
(socklen_t *)&addr_len[Mod_id]);
|
||||
|
||||
if (bytes_received ==-1) {
|
||||
eth->num_rx_errors++;
|
||||
perror("ETHERNET IF4p5 READ (header): ");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
*timestamp = test_header->sub_type;
|
||||
|
||||
if (test_header->sub_type == IF4p5_PDLFFT) {
|
||||
packet_size = UDP_IF4p5_PDLFFT_SIZE_BYTES(nblocks);
|
||||
} else if (test_header->sub_type == IF4p5_PULFFT) {
|
||||
packet_size = UDP_IF4p5_PULFFT_SIZE_BYTES(nblocks);
|
||||
} else {
|
||||
packet_size = UDP_IF4p5_PRACH_SIZE_BYTES;
|
||||
}
|
||||
|
||||
|
||||
while(bytes_received < packet_size) {
|
||||
bytes_received = recvfrom(eth->sockfd[Mod_id],
|
||||
buff[0],
|
||||
packet_size,
|
||||
0,
|
||||
(struct sockaddr *)&dest_addr[Mod_id],
|
||||
(socklen_t *)&addr_len[Mod_id]);
|
||||
if (bytes_received ==-1) {
|
||||
eth->num_rx_errors++;
|
||||
perror("ETHERNET IF4p5 READ (payload): ");
|
||||
exit(-1);
|
||||
} else {
|
||||
eth->rx_actual_nsamps = bytes_received>>1;
|
||||
eth->rx_count++;
|
||||
}
|
||||
}
|
||||
|
||||
eth->rx_nsamps = nsamps;
|
||||
return(bytes_received);
|
||||
}
|
||||
|
||||
int trx_eth_write_udp_IF4p5(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
|
||||
|
||||
int nblocks = nsamps;
|
||||
int bytes_sent = 0;
|
||||
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
int Mod_id = device->Mod_id;
|
||||
|
||||
ssize_t packet_size;
|
||||
|
||||
if (flags == IF4p5_PDLFFT) {
|
||||
packet_size = UDP_IF4p5_PDLFFT_SIZE_BYTES(nblocks);
|
||||
} else if (flags == IF4p5_PULFFT) {
|
||||
packet_size = UDP_IF4p5_PULFFT_SIZE_BYTES(nblocks);
|
||||
} else if (flags == IF4p5_PRACH) {
|
||||
packet_size = UDP_IF4p5_PRACH_SIZE_BYTES;
|
||||
} else {
|
||||
printf("trx_eth_write_udp_IF4p5: unknown flags %d\n",flags);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
eth->tx_nsamps = nblocks;
|
||||
|
||||
bytes_sent = sendto(eth->sockfd[Mod_id],
|
||||
buff[0],
|
||||
packet_size,
|
||||
0,
|
||||
(struct sockaddr*)&dest_addr[Mod_id],
|
||||
addr_len[Mod_id]);
|
||||
|
||||
if (bytes_sent == -1) {
|
||||
eth->num_tx_errors++;
|
||||
perror("ETHERNET WRITE: ");
|
||||
exit(-1);
|
||||
} else {
|
||||
eth->tx_actual_nsamps = bytes_sent>>1;
|
||||
eth->tx_count++;
|
||||
}
|
||||
|
||||
return (bytes_sent);
|
||||
}
|
||||
|
||||
int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps,int cc, int flags) {
|
||||
|
||||
int bytes_sent=0;
|
||||
@@ -188,7 +287,7 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
|
||||
|
||||
int bytes_received=0;
|
||||
eth_state_t *eth = (eth_state_t*)device->priv;
|
||||
openair0_timestamp prev_timestamp = -1;
|
||||
// openair0_timestamp prev_timestamp = -1;
|
||||
int Mod_id = device->Mod_id;
|
||||
int rcvfrom_flag =0;
|
||||
int block_cnt=0;
|
||||
@@ -270,7 +369,7 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
|
||||
pck_seq_num_cur = *(uint16_t *)buff2;
|
||||
//printf("cur=%d prev=%d buff=%d\n",pck_seq_num_cur,pck_seq_num_prev,*(uint16_t *)(buff2));
|
||||
if ( ( pck_seq_num_cur != (pck_seq_num_prev + 1) ) && !((pck_seq_num_prev==75) && (pck_seq_num_cur==1 ))){
|
||||
printf("out of order packet received1! %d|%d|%d\n",pck_seq_num_cur,pck_seq_num_prev, *timestamp);
|
||||
printf("out of order packet received1! %d|%d|%d\n",pck_seq_num_cur,pck_seq_num_prev,(int)*timestamp);
|
||||
}
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM,pck_seq_num_cur);
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_RX_SEQ_NUM_PRV,pck_seq_num_prev);
|
||||
|
||||
Reference in New Issue
Block a user