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
spbro
OpenXG-RAN
Commits
9ee91703
Commit
9ee91703
authored
Aug 19, 2022
by
laurent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix non reentrant issue in itti
parent
abf68010
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
49 deletions
+35
-49
common/utils/ocp_itti/intertask_interface.cpp
common/utils/ocp_itti/intertask_interface.cpp
+17
-21
common/utils/ocp_itti/intertask_interface.h
common/utils/ocp_itti/intertask_interface.h
+1
-1
openair2/LAYER2/MAC/config.c
openair2/LAYER2/MAC/config.c
+2
-4
openair3/NAS/UE/nas_ue_task.c
openair3/NAS/UE/nas_ue_task.c
+2
-3
openair3/SCTP/sctp_eNB_task.c
openair3/SCTP/sctp_eNB_task.c
+11
-15
openair3/SCTP/sctp_eNB_task.h
openair3/SCTP/sctp_eNB_task.h
+0
-2
openair3/ocp-gtpu/gtp_itf.cpp
openair3/ocp-gtpu/gtp_itf.cpp
+2
-3
No files found.
common/utils/ocp_itti/intertask_interface.cpp
View file @
9ee91703
...
...
@@ -45,9 +45,7 @@ extern "C" {
std
::
vector
<
MessageDef
*>
message_queue
;
std
::
map
<
long
,
timer_elm_t
>
timer_map
;
uint64_t
next_timer
=
UINT64_MAX
;
struct
epoll_event
*
events
=
NULL
;
int
nb_fd_epoll
=
0
;
int
nb_events
=
0
;
int
epoll_fd
=-
1
;
int
sem_fd
=-
1
;
}
task_list_t
;
...
...
@@ -167,8 +165,6 @@ extern "C" {
struct
epoll_event
event
;
task_list_t
*
t
=
tasks
[
task_id
];
t
->
nb_fd_epoll
++
;
t
->
events
=
(
struct
epoll_event
*
)
realloc
((
void
*
)
t
->
events
,
t
->
nb_fd_epoll
*
sizeof
(
struct
epoll_event
));
event
.
events
=
EPOLLIN
|
EPOLLERR
;
event
.
data
.
u64
=
0
;
event
.
data
.
fd
=
fd
;
...
...
@@ -185,7 +181,7 @@ extern "C" {
t
->
nb_fd_epoll
--
;
}
static
inline
int
itti_get_events_locked
(
task_id_t
task_id
,
struct
epoll_event
*
*
events
)
{
static
inline
int
itti_get_events_locked
(
task_id_t
task_id
,
struct
epoll_event
*
events
,
int
nb_
events
)
{
task_list_t
*
t
=
tasks
[
task_id
];
uint64_t
current_time
=
0
;
...
...
@@ -234,40 +230,39 @@ extern "C" {
pthread_mutex_unlock
(
&
t
->
queue_cond_lock
);
LOG_D
(
ITTI
,
"enter blocking wait for %s, timeout: %d ms
\n
"
,
itti_get_task_name
(
task_id
),
epoll_timeout
);
t
->
nb_events
=
epoll_wait
(
t
->
epoll_fd
,
t
->
events
,
t
->
nb_fd_epoll
,
epoll_timeout
);
nb_events
=
epoll_wait
(
t
->
epoll_fd
,
events
,
t
->
nb_fd_epoll
,
epoll_timeout
);
if
(
t
->
nb_events
<
0
&&
(
errno
==
EINTR
||
errno
==
EAGAIN
)
)
if
(
nb_events
<
0
&&
(
errno
==
EINTR
||
errno
==
EAGAIN
)
)
pthread_mutex_lock
(
&
t
->
queue_cond_lock
);
}
while
(
t
->
nb_events
<
0
&&
(
errno
==
EINTR
||
errno
==
EAGAIN
)
);
}
while
(
nb_events
<
0
&&
(
errno
==
EINTR
||
errno
==
EAGAIN
)
);
AssertFatal
(
t
->
nb_events
>=
0
,
AssertFatal
(
nb_events
>=
0
,
"epoll_wait failed for task %s, nb fds %d, timeout %lu: %s!
\n
"
,
itti_get_task_name
(
task_id
),
t
->
nb_fd_epoll
,
t
->
next_timer
!=
UINT64_MAX
?
t
->
next_timer
-
current_time
:
-
1
,
strerror
(
errno
));
LOG_D
(
ITTI
,
"receive on %d descriptors for %s
\n
"
,
t
->
nb_events
,
itti_get_task_name
(
task_id
));
LOG_D
(
ITTI
,
"receive on %d descriptors for %s
\n
"
,
nb_events
,
itti_get_task_name
(
task_id
));
if
(
t
->
nb_events
==
0
)
if
(
nb_events
==
0
)
/* No data to read -> return */
return
0
;
for
(
int
i
=
0
;
i
<
t
->
nb_events
;
i
++
)
{
for
(
int
i
=
0
;
i
<
nb_events
;
i
++
)
{
/* Check if there is an event for ITTI for the event fd */
if
((
t
->
events
[
i
].
events
&
EPOLLIN
)
&&
(
t
->
events
[
i
].
data
.
fd
==
t
->
sem_fd
))
{
if
((
events
[
i
].
events
&
EPOLLIN
)
&&
(
events
[
i
].
data
.
fd
==
t
->
sem_fd
))
{
eventfd_t
sem_counter
;
/* Read will always return 1 */
AssertFatal
(
sizeof
(
sem_counter
)
==
read
(
t
->
sem_fd
,
&
sem_counter
,
sizeof
(
sem_counter
)),
""
);
/* Mark that the event has been processed */
t
->
events
[
i
].
events
&=
~
EPOLLIN
;
events
[
i
].
events
&=
~
EPOLLIN
;
}
}
*
events
=
t
->
events
;
return
t
->
nb_events
;
return
nb_events
;
}
int
itti_get_events
(
task_id_t
task_id
,
struct
epoll_event
*
*
even
ts
)
{
int
itti_get_events
(
task_id_t
task_id
,
struct
epoll_event
*
events
,
int
nb_ev
ts
)
{
pthread_mutex_lock
(
&
tasks
[
task_id
]
->
queue_cond_lock
);
return
itti_get_events_locked
(
task_id
,
events
);
return
itti_get_events_locked
(
task_id
,
events
,
nb_evts
);
}
void
itti_receive_msg
(
task_id_t
task_id
,
MessageDef
**
received_msg
)
{
...
...
@@ -275,15 +270,16 @@ extern "C" {
task_list_t
*
t
=
tasks
[
task_id
];
pthread_mutex_lock
(
&
t
->
queue_cond_lock
);
struct
epoll_event
events
[
t
->
nb_fd_epoll
];
// Weird condition to deal with crap legacy itti interface
if
(
t
->
nb_fd_epoll
==
1
)
{
while
(
t
->
message_queue
.
empty
())
{
itti_get_events_locked
(
task_id
,
&
t
->
events
);
itti_get_events_locked
(
task_id
,
events
,
t
->
nb_fd_epoll
);
pthread_mutex_lock
(
&
t
->
queue_cond_lock
);
}
}
else
{
if
(
t
->
message_queue
.
empty
())
{
itti_get_events_locked
(
task_id
,
&
t
->
events
);
itti_get_events_locked
(
task_id
,
events
,
t
->
nb_fd_epoll
);
pthread_mutex_lock
(
&
t
->
queue_cond_lock
);
}
}
...
...
common/utils/ocp_itti/intertask_interface.h
View file @
9ee91703
...
...
@@ -479,7 +479,7 @@ void itti_unsubscribe_event_fd(task_id_t task_id, int fd);
\param events events list
@returns number of events to handle
**/
int
itti_get_events
(
task_id_t
task_id
,
struct
epoll_event
**
even
ts
);
int
itti_get_events
(
task_id_t
task_id
,
struct
epoll_event
*
events
,
int
nb_max_ev
ts
);
/** \brief Retrieves a message in the queue associated to task_id.
If the queue is empty, the thread is blocked till a new message arrives.
...
...
openair2/LAYER2/MAC/config.c
View file @
9ee91703
...
...
@@ -1009,13 +1009,11 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
LOG_I
(
MAC
,
"[eNB %d][CONFIG] LTE_MBSFNAreaConfiguration_r9_t(%p) commonSF_AllocPeriod_r9(%d)
\n
"
,
Mod_idP
,
mbms_AreaConfig
,
RC
.
mac
[
Mod_idP
]
->
common_channels
[
0
].
commonSF_AllocPeriod_r9
);
for
(
i
=
0
;
i
<
mbms_AreaConfig
->
commonSF_Alloc_r9
.
list
.
count
;
i
++
){
RC
.
mac
[
Mod_idP
]
->
common_channels
[
0
].
commonSF_Alloc_r9_mbsfn_SubframeConfig
[
i
]
=
mbms_AreaConfig
->
commonSF_Alloc_r9
.
list
.
array
[
i
];
LOG_I
(
RRC
,
"[eNB %d][CONFIG] MBSFNArea[%d] commonSF_Alloc_r9: radioframeAllocationPeriod(%ldn),radioframeAllocationOffset(%ld), subframeAllocation(%x
,%x,%x
)
\n
"
LOG_I
(
RRC
,
"[eNB %d][CONFIG] MBSFNArea[%d] commonSF_Alloc_r9: radioframeAllocationPeriod(%ldn),radioframeAllocationOffset(%ld), subframeAllocation(%x)
\n
"
,
Mod_idP
,
i
,
RC
.
mac
[
Mod_idP
]
->
common_channels
[
0
].
commonSF_Alloc_r9_mbsfn_SubframeConfig
[
i
]
->
radioframeAllocationPeriod
,
RC
.
mac
[
Mod_idP
]
->
common_channels
[
0
].
commonSF_Alloc_r9_mbsfn_SubframeConfig
[
i
]
->
radioframeAllocationOffset
,
RC
.
mac
[
Mod_idP
]
->
common_channels
[
0
].
commonSF_Alloc_r9_mbsfn_SubframeConfig
[
i
]
->
subframeAllocation
.
choice
.
oneFrame
.
buf
[
0
]
,
RC
.
mac
[
Mod_idP
]
->
common_channels
[
0
].
commonSF_Alloc_r9_mbsfn_SubframeConfig
[
i
]
->
subframeAllocation
.
choice
.
oneFrame
.
buf
[
1
]
,
RC
.
mac
[
Mod_idP
]
->
common_channels
[
0
].
commonSF_Alloc_r9_mbsfn_SubframeConfig
[
i
]
->
subframeAllocation
.
choice
.
oneFrame
.
buf
[
2
]);
,
RC
.
mac
[
Mod_idP
]
->
common_channels
[
0
].
commonSF_Alloc_r9_mbsfn_SubframeConfig
[
i
]
->
subframeAllocation
.
choice
.
oneFrame
.
buf
[
0
]);
}
}
...
...
openair3/NAS/UE/nas_ue_task.c
View file @
9ee91703
...
...
@@ -86,7 +86,6 @@ void nas_user_api_id_initialize(nas_user_t *user) {
void
*
nas_ue_task
(
void
*
args_p
)
{
int
nb_events
;
struct
epoll_event
*
events
;
MessageDef
*
msg_p
;
instance_t
instance
;
unsigned
int
Mod_id
;
...
...
@@ -306,8 +305,8 @@ void *nas_ue_task(void *args_p)
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
msg_p
=
NULL
;
}
nb_events
=
itti_get_events
(
TASK_NAS_UE
,
&
events
);
struct
epoll_event
events
[
20
];
nb_events
=
itti_get_events
(
TASK_NAS_UE
,
events
,
20
);
if
((
nb_events
>
0
)
&&
(
events
!=
NULL
))
{
if
(
nas_ue_process_events
(
users
,
events
,
nb_events
)
==
true
)
{
...
...
openair3/SCTP/sctp_eNB_task.c
View file @
9ee91703
...
...
@@ -216,7 +216,7 @@ sctp_eNB_accept_associations_multi(
}
//------------------------------------------------------------------------------
void
static
void
sctp_handle_new_association_req_multi
(
const
instance_t
instance
,
const
task_id_t
requestor
,
...
...
@@ -355,7 +355,7 @@ sctp_handle_new_association_req_multi(
}
//------------------------------------------------------------------------------
void
static
void
sctp_handle_new_association_req
(
const
instance_t
instance
,
const
task_id_t
requestor
,
...
...
@@ -617,7 +617,7 @@ sctp_handle_new_association_req(
}
//------------------------------------------------------------------------------
void
sctp_send_data
(
static
void
sctp_send_data
(
instance_t
instance
,
task_id_t
task_id
,
sctp_data_req_t
*
sctp_data_req_p
)
...
...
@@ -1058,16 +1058,13 @@ sctp_eNB_read_from_socket(
//------------------------------------------------------------------------------
void
sctp_eNB_flush_sockets
(
s
tatic
s
ctp_eNB_flush_sockets
(
struct
epoll_event
*
events
,
int
nb_events
)
{
printf
(
"entre sctp_eNB_flush_sockets %p
\n
"
,
events
);
int
i
;
struct
sctp_cnx_list_elm_s
*
sctp_cnx
=
NULL
;
if
(
events
==
NULL
)
{
return
;
}
for
(
i
=
0
;
i
<
nb_events
;
i
++
)
{
sctp_cnx
=
sctp_get_cnx
(
-
1
,
events
[
i
].
data
.
fd
);
...
...
@@ -1090,7 +1087,7 @@ sctp_eNB_flush_sockets(
}
//------------------------------------------------------------------------------
void
sctp_eNB_init
(
void
)
static
void
sctp_eNB_init
(
void
)
{
SCTP_DEBUG
(
"Starting SCTP layer
\n
"
);
...
...
@@ -1100,10 +1097,9 @@ void sctp_eNB_init(void)
}
//------------------------------------------------------------------------------
void
*
sctp_eNB_process_itti_msg
(
void
*
notUsed
)
static
void
sctp_eNB_process_itti_msg
(
)
{
int
nb_events
;
struct
epoll_event
*
events
;
MessageDef
*
received_msg
=
NULL
;
int
result
;
...
...
@@ -1184,12 +1180,12 @@ void *sctp_eNB_process_itti_msg(void *notUsed)
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
received_msg
=
NULL
;
}
nb_events
=
itti_get_events
(
TASK_SCTP
,
&
events
);
struct
epoll_event
events
[
20
];
nb_events
=
itti_get_events
(
TASK_SCTP
,
events
,
20
);
/* Now handle notifications for other sockets */
sctp_eNB_flush_sockets
(
events
,
nb_events
);
return
NULL
;
return
;
}
//------------------------------------------------------------------------------
...
...
@@ -1198,7 +1194,7 @@ void *sctp_eNB_task(void *arg)
sctp_eNB_init
();
while
(
1
)
{
(
void
)
sctp_eNB_process_itti_msg
(
NULL
);
sctp_eNB_process_itti_msg
(
);
}
return
NULL
;
...
...
openair3/SCTP/sctp_eNB_task.h
View file @
9ee91703
...
...
@@ -22,8 +22,6 @@
#ifndef SCTP_ENB_TASK_H_
#define SCTP_ENB_TASK_H_
void
sctp_eNB_init
(
void
);
void
*
sctp_eNB_process_itti_msg
(
void
*
);
void
*
sctp_eNB_task
(
void
*
arg
);
#endif
/* SCTP_ENB_TASK_H_ */
openair3/ocp-gtpu/gtp_itf.cpp
View file @
9ee91703
...
...
@@ -1278,9 +1278,8 @@ void *gtpv1uTask(void *args) {
AssertFatal
(
EXIT_SUCCESS
==
itti_free
(
TASK_GTPV1_U
,
message_p
),
"Failed to free memory!
\n
"
);
}
struct
epoll_event
*
events
;
int
nb_events
=
itti_get_events
(
TASK_GTPV1_U
,
&
events
);
struct
epoll_event
events
[
20
];
int
nb_events
=
itti_get_events
(
TASK_GTPV1_U
,
events
,
20
);
for
(
int
i
=
0
;
i
<
nb_events
;
i
++
)
if
((
events
[
i
].
events
&
EPOLLIN
))
...
...
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