Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG UE
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Michael Black
OpenXG UE
Commits
4f39c50a
Commit
4f39c50a
authored
Oct 20, 2016
by
luhan wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modifications for if4p5 UDP
parent
a410aad0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
487 additions
and
482 deletions
+487
-482
targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c
targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c
+487
-482
No files found.
targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c
View file @
4f39c50a
...
@@ -142,54 +142,59 @@ int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestam
...
@@ -142,54 +142,59 @@ int trx_eth_read_udp_IF4p5(openair0_device *device, openair0_timestamp *timestam
// Read nblocks info from packet itself
// Read nblocks info from packet itself
int
nblocks
=
nsamps
;
int
nblocks
=
nsamps
;
int
bytes_received
=
0
;
int
bytes_received
=
-
1
;
eth_state_t
*
eth
=
(
eth_state_t
*
)
device
->
priv
;
eth_state_t
*
eth
=
(
eth_state_t
*
)
device
->
priv
;
int
Mod_id
=
device
->
Mod_id
;
int
Mod_id
=
device
->
Mod_id
;
ssize_t
packet_size
=
sizeof_IF4p5_header_t
;
ssize_t
packet_size
=
sizeof_IF4p5_header_t
;
IF4p5_header_t
*
test_header
=
(
IF4p5_header_t
*
)(
buff
[
0
]);
IF4p5_header_t
*
test_header
=
(
IF4p5_header_t
*
)(
buff
[
0
]);
int
block_cnt
=
0
;
int
again_cnt
=
0
;
packet_size
=
max
(
UDP_IF4p5_PRACH_SIZE_BYTES
,
max
(
UDP_IF4p5_PULFFT_SIZE_BYTES
(
nblocks
),
UDP_IF4p5_PDLFFT_SIZE_BYTES
(
nblocks
)));
while
(
bytes_received
==
-
1
)
{
again:
bytes_received
=
recvfrom
(
eth
->
sockfd
[
Mod_id
],
bytes_received
=
recvfrom
(
eth
->
sockfd
[
Mod_id
],
buff
[
0
],
buff
[
0
],
packet_size
,
packet_size
,
0
,
0
,
(
struct
sockaddr
*
)
&
dest_addr
[
Mod_id
],
(
struct
sockaddr
*
)
&
dest_addr
[
Mod_id
],
(
socklen_t
*
)
&
addr_len
[
Mod_id
]);
(
socklen_t
*
)
&
addr_len
[
Mod_id
]);
if
(
bytes_received
==-
1
)
{
if
(
bytes_received
==-
1
)
{
eth
->
num_rx_errors
++
;
eth
->
num_rx_errors
++
;
perror
(
"ETHERNET IF4p5 READ (header): "
);
if
(
errno
==
EAGAIN
)
{
again_cnt
++
;
usleep
(
10
);
if
(
again_cnt
==
1000
)
{
perror
(
"ETHERNET IF4p5 READ (EAGAIN): "
);
exit
(
-
1
);
exit
(
-
1
);
}
else
{
printf
(
"AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN AGAIN
\n
"
);
goto
again
;
}
}
}
else
if
(
errno
==
EWOULDBLOCK
)
{
*
timestamp
=
test_header
->
sub_type
;
block_cnt
++
;
usleep
(
10
);
if
(
test_header
->
sub_type
==
IF4p5_PDLFFT
)
{
if
(
block_cnt
==
1000
)
{
packet_size
=
UDP_IF4p5_PDLFFT_SIZE_BYTES
(
nblocks
);
perror
(
"ETHERNET IF4p5 READ (EWOULDBLOCK): "
);
}
else
if
(
test_header
->
sub_type
==
IF4p5_PULFFT
)
{
exit
(
-
1
);
packet_size
=
UDP_IF4p5_PULFFT_SIZE_BYTES
(
nblocks
);
}
else
{
}
else
{
packet_size
=
UDP_IF4p5_PRACH_SIZE_BYTES
;
printf
(
"BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK
\n
"
);
goto
again
;
}
}
}
else
{
perror
(
"ETHERNET IF4p5 READ"
);
while
(
bytes_received
<
packet_size
)
{
printf
(
"(%s):
\n
"
,
strerror
(
errno
));
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
);
exit
(
-
1
);
}
}
else
{
}
else
{
*
timestamp
=
test_header
->
sub_type
;
eth
->
rx_actual_nsamps
=
bytes_received
>>
1
;
eth
->
rx_actual_nsamps
=
bytes_received
>>
1
;
eth
->
rx_count
++
;
eth
->
rx_count
++
;
}
}
}
}
//printf("size of third %d subtype %d frame %d subframe %d symbol %d \n", bytes_received, test_header->sub_type, ((test_header->frame_status)>>6)&0xffff, ((test_header->frame_status)>>22)&0x000f, ((test_header->frame_status)>>26)&0x000f) ;
eth
->
rx_nsamps
=
nsamps
;
eth
->
rx_nsamps
=
nsamps
;
return
(
bytes_received
);
return
(
bytes_received
);
...
@@ -298,7 +303,7 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi
...
@@ -298,7 +303,7 @@ int trx_eth_write_udp(openair0_device *device, openair0_timestamp timestamp, voi
eth
->
tx_actual_nsamps
=
bytes_sent
>>
2
;
eth
->
tx_actual_nsamps
=
bytes_sent
>>
2
;
eth
->
tx_count
++
;
eth
->
tx_count
++
;
pck_seq_num
++
;
pck_seq_num
++
;
if
(
pck_seq_num
>
MAX_PACKET_SEQ_NUM
(
nsamps
,
76800
)
)
pck_seq_num
=
1
;
if
(
pck_seq_num
>
MAX_PACKET_SEQ_NUM
(
nsamps
,
device
->
openair0_cfg
->
samples_per_frame
)
)
pck_seq_num
=
1
;
}
}
}
}
/* tx buffer values restored */
/* tx buffer values restored */
...
@@ -396,7 +401,7 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
...
@@ -396,7 +401,7 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi
/* get the packet sequence number from packet's header */
/* get the packet sequence number from packet's header */
pck_seq_num_cur
=
*
(
uint16_t
*
)
buff2
;
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));
//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
))){
if
(
(
pck_seq_num_cur
!=
(
pck_seq_num_prev
+
1
)
)
&&
!
((
pck_seq_num_prev
==
MAX_PACKET_SEQ_NUM
(
nsamps
,
device
->
openair0_cfg
->
samples_per_frame
))
&&
(
pck_seq_num_cur
==
1
))
&&
!
((
pck_seq_num_prev
==
1
)
&&
(
pck_seq_num_cur
==
1
)))
{
printf
(
"out of order packet received1! %d|%d|%d
\n
"
,
pck_seq_num_cur
,
pck_seq_num_prev
,(
int
)
*
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
,
pck_seq_num_cur
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment