Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
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
wangjie
OpenXG-RAN
Commits
f1539df7
Commit
f1539df7
authored
May 18, 2019
by
laurent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix UE switch from read only to R+W
parent
290ca22d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
targets/ARCH/rfsimulator/simulator.c
targets/ARCH/rfsimulator/simulator.c
+17
-6
No files found.
targets/ARCH/rfsimulator/simulator.c
View file @
f1539df7
...
@@ -3,6 +3,12 @@
...
@@ -3,6 +3,12 @@
copyleft: OpenAirInterface Software Alliance and it's licence
copyleft: OpenAirInterface Software Alliance and it's licence
*/
*/
/*
* Open issues and limitations
* The read and write should be called in the same thread, that is not new USRP UHD design
* When the opposite side switch from passive reading to active R+Write, the synchro is not fully deterministic
*/
#include <sys/socket.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netinet/tcp.h>
...
@@ -111,7 +117,7 @@ void setblocking(int sock, enum blocking_t active) {
...
@@ -111,7 +117,7 @@ void setblocking(int sock, enum blocking_t active) {
AssertFatal
(
fcntl
(
sock
,
F_SETFL
,
opts
)
>=
0
,
""
);
AssertFatal
(
fcntl
(
sock
,
F_SETFL
,
opts
)
>=
0
,
""
);
}
}
static
bool
flushInput
(
rfsimulator_state_t
*
t
);
static
bool
flushInput
(
rfsimulator_state_t
*
t
,
int
timeout
);
void
fullwrite
(
int
fd
,
void
*
_buf
,
ssize_t
count
,
rfsimulator_state_t
*
t
)
{
void
fullwrite
(
int
fd
,
void
*
_buf
,
ssize_t
count
,
rfsimulator_state_t
*
t
)
{
if
(
t
->
saveIQfile
!=
-
1
)
{
if
(
t
->
saveIQfile
!=
-
1
)
{
...
@@ -134,7 +140,9 @@ void fullwrite(int fd, void *_buf, ssize_t count, rfsimulator_state_t *t) {
...
@@ -134,7 +140,9 @@ void fullwrite(int fd, void *_buf, ssize_t count, rfsimulator_state_t *t) {
continue
;
continue
;
if
(
errno
==
EAGAIN
)
{
if
(
errno
==
EAGAIN
)
{
flushInput
(
t
);
// The opposite side is saturated
// we read incoming sockets meawhile waiting
flushInput
(
t
,
5
);
continue
;
continue
;
}
else
}
else
return
;
return
;
...
@@ -229,14 +237,17 @@ int rfsimulator_write(openair0_device *device, openair0_timestamp timestamp, voi
...
@@ -229,14 +237,17 @@ int rfsimulator_write(openair0_device *device, openair0_timestamp timestamp, voi
lastW
=
timestamp
;
lastW
=
timestamp
;
LOG_D
(
HW
,
"sent %d samples at time: %ld->%ld, energy in first antenna: %d
\n
"
,
LOG_D
(
HW
,
"sent %d samples at time: %ld->%ld, energy in first antenna: %d
\n
"
,
nsamps
,
timestamp
,
timestamp
+
nsamps
,
signal_energy
(
samplesVoid
[
0
],
nsamps
)
);
nsamps
,
timestamp
,
timestamp
+
nsamps
,
signal_energy
(
samplesVoid
[
0
],
nsamps
)
);
// Let's verify we don't have incoming data
// This is mandatory when the opposite side don't transmit
flushInput
(
t
,
0
);
return
nsamps
;
return
nsamps
;
}
}
static
bool
flushInput
(
rfsimulator_state_t
*
t
)
{
static
bool
flushInput
(
rfsimulator_state_t
*
t
,
int
timeout
)
{
// Process all incoming events on sockets
// Process all incoming events on sockets
// store the data in lists
// store the data in lists
struct
epoll_event
events
[
FD_SETSIZE
]
=
{
0
};
struct
epoll_event
events
[
FD_SETSIZE
]
=
{
0
};
int
nfds
=
epoll_wait
(
t
->
epollfd
,
events
,
FD_SETSIZE
,
20
);
int
nfds
=
epoll_wait
(
t
->
epollfd
,
events
,
FD_SETSIZE
,
timeout
);
if
(
nfds
==-
1
)
{
if
(
nfds
==-
1
)
{
if
(
errno
==
EINTR
||
errno
==
EAGAIN
)
if
(
errno
==
EINTR
||
errno
==
EAGAIN
)
...
@@ -356,7 +367,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
...
@@ -356,7 +367,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
if
(
first_sock
==
FD_SETSIZE
)
{
if
(
first_sock
==
FD_SETSIZE
)
{
// no connected device (we are eNB, no UE is connected)
// no connected device (we are eNB, no UE is connected)
if
(
!
flushInput
(
t
))
{
if
(
!
flushInput
(
t
,
10
))
{
for
(
int
x
=
0
;
x
<
nbAnt
;
x
++
)
for
(
int
x
=
0
;
x
<
nbAnt
;
x
++
)
memset
(
samplesVoid
[
x
],
0
,
sampleToByte
(
nsamps
,
1
));
memset
(
samplesVoid
[
x
],
0
,
sampleToByte
(
nsamps
,
1
));
...
@@ -385,7 +396,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
...
@@ -385,7 +396,7 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo
ptr->lastReceivedTS,
ptr->lastReceivedTS,
t->nextTimestamp+nsamps);
t->nextTimestamp+nsamps);
*/
*/
flushInput
(
t
);
flushInput
(
t
,
3
);
}
while
(
have_to_wait
);
}
while
(
have_to_wait
);
}
}
...
...
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