Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openairinterface5G
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mingxuan Li
openairinterface5G
Commits
fc7bccec
Commit
fc7bccec
authored
2 years ago
by
Cédric Roux
Browse files
Options
Downloads
Patches
Plain Diff
fix a small bug and add a log for when recvfrom() fails
recvfrom() returns ssize_t, not size_t.
parent
08e57ca3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
radio/ETHERNET/USERSPACE/LIB/eth_udp.c
+14
-5
14 additions, 5 deletions
radio/ETHERNET/USERSPACE/LIB/eth_udp.c
with
14 additions
and
5 deletions
radio/ETHERNET/USERSPACE/LIB/eth_udp.c
+
14
−
5
View file @
fc7bccec
...
@@ -447,10 +447,20 @@ void *udp_read_thread(void *arg) {
...
@@ -447,10 +447,20 @@ void *udp_read_thread(void *arg) {
while
(
oai_exit
==
0
)
{
while
(
oai_exit
==
0
)
{
LOG_I
(
PHY
,
"UDP read thread %d, waiting for start sampling_rate_d %d, sampling_rate_n %d
\n
"
,
u
->
thread_id
,
device
->
sampling_rate_ratio_n
,
device
->
sampling_rate_ratio_d
);
LOG_I
(
PHY
,
"UDP read thread %d, waiting for start sampling_rate_d %d, sampling_rate_n %d
\n
"
,
u
->
thread_id
,
device
->
sampling_rate_ratio_n
,
device
->
sampling_rate_ratio_d
);
while
(
fhstate
->
active
>
0
)
{
while
(
fhstate
->
active
>
0
)
{
size_t
count
=
recvfrom
(((
eth_state_t
*
)
device
->
priv
)
->
sockfdd
[
0
],
ssize_t
count
=
recvfrom
(((
eth_state_t
*
)
device
->
priv
)
->
sockfdd
[
0
],
buffer
,
sizeof
(
buffer
),
0
,
buffer
,
sizeof
(
buffer
),
0
,
(
struct
sockaddr
*
)
&
((
eth_state_t
*
)
device
->
priv
)
->
dest_addrd
,
(
struct
sockaddr
*
)
&
((
eth_state_t
*
)
device
->
priv
)
->
dest_addrd
,
(
socklen_t
*
)
&
((
eth_state_t
*
)
device
->
priv
)
->
addr_len
);
(
socklen_t
*
)
&
((
eth_state_t
*
)
device
->
priv
)
->
addr_len
);
/* log and skip processing in case of error from recvfrom */
/* (to be refined if needed) */
if
(
count
==
0
)
{
LOG_E
(
PHY
,
"recvfrom returned 0
\n
"
);
continue
;
}
if
(
count
<
0
)
{
LOG_E
(
PHY
,
"recvfrom failed (%s)
\n
"
,
strerror
(
errno
));
continue
;
}
/* if oai_exit is 1 here, don't access the array rxbase,
/* if oai_exit is 1 here, don't access the array rxbase,
* it may have been freed(), so let's break at this point
* it may have been freed(), so let's break at this point
*/
*/
...
@@ -460,7 +470,6 @@ void *udp_read_thread(void *arg) {
...
@@ -460,7 +470,6 @@ void *udp_read_thread(void *arg) {
TS
=
*
(
openair0_timestamp
*
)(
&
buffer
[
ECPRICOMMON_BYTES
+
ECPRIPCID_BYTES
]);
TS
=
*
(
openair0_timestamp
*
)(
&
buffer
[
ECPRICOMMON_BYTES
+
ECPRIPCID_BYTES
]);
// convert TS to samples, /6 for AW2S @ 30.72 Ms/s, this is converted for other sample rates in OAI application
// convert TS to samples, /6 for AW2S @ 30.72 Ms/s, this is converted for other sample rates in OAI application
TS
=
(
device
->
sampling_rate_ratio_n
*
TS
)
/
(
device
->
sampling_rate_ratio_d
*
6
);
TS
=
(
device
->
sampling_rate_ratio_n
*
TS
)
/
(
device
->
sampling_rate_ratio_d
*
6
);
if
((
int
)
count
<=
0
)
continue
;
AssertFatal
(
aid
<
8
,
"Cannot handle more than 8 antennas, got aid %d
\n
"
,
aid
);
AssertFatal
(
aid
<
8
,
"Cannot handle more than 8 antennas, got aid %d
\n
"
,
aid
);
fhstate
->
r
[
aid
]
=
1
;
fhstate
->
r
[
aid
]
=
1
;
if
(
aid
==
0
&&
first_read
==
0
)
fhstate
->
TS0
=
TS
;
if
(
aid
==
0
&&
first_read
==
0
)
fhstate
->
TS0
=
TS
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment