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
692d6009
Commit
692d6009
authored
Jan 25, 2019
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make queue_recv() functions return size, not as out-param
parent
623fe85b
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
36 additions
and
33 deletions
+36
-33
openair2/ENB_APP/flexran_agent.c
openair2/ENB_APP/flexran_agent.c
+1
-1
openair2/ENB_APP/flexran_agent_async.c
openair2/ENB_APP/flexran_agent_async.c
+2
-2
openair2/ENB_APP/flexran_agent_async.h
openair2/ENB_APP/flexran_agent_async.h
+1
-1
openair2/ENB_APP/flexran_agent_net_comm.c
openair2/ENB_APP/flexran_agent_net_comm.c
+3
-3
openair2/ENB_APP/flexran_agent_net_comm.h
openair2/ENB_APP/flexran_agent_net_comm.h
+3
-3
openair2/LAYER2/PROTO_AGENT/proto_agent.c
openair2/LAYER2/PROTO_AGENT/proto_agent.c
+1
-1
openair2/LAYER2/PROTO_AGENT/proto_agent_async.c
openair2/LAYER2/PROTO_AGENT/proto_agent_async.c
+2
-2
openair2/LAYER2/PROTO_AGENT/proto_agent_async.h
openair2/LAYER2/PROTO_AGENT/proto_agent_async.h
+1
-1
openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c
openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c
+1
-1
openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h
openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h
+2
-2
openair2/UTIL/ASYNC_IF/link_manager.c
openair2/UTIL/ASYNC_IF/link_manager.c
+3
-3
openair2/UTIL/ASYNC_IF/message_queue.c
openair2/UTIL/ASYNC_IF/message_queue.c
+8
-7
openair2/UTIL/ASYNC_IF/message_queue.h
openair2/UTIL/ASYNC_IF/message_queue.h
+1
-1
openair2/UTIL/ASYNC_IF/ringbuffer_queue.c
openair2/UTIL/ASYNC_IF/ringbuffer_queue.c
+6
-4
openair2/UTIL/ASYNC_IF/ringbuffer_queue.h
openair2/UTIL/ASYNC_IF/ringbuffer_queue.h
+1
-1
No files found.
openair2/ENB_APP/flexran_agent.c
View file @
692d6009
...
...
@@ -115,7 +115,7 @@ void *receive_thread(void *args) {
while
(
1
)
{
while
(
flexran_agent_msg_recv
(
d
->
mod_id
,
FLEXRAN_AGENT_DEFAULT
,
&
data
,
&
size
,
&
priority
)
==
0
)
{
while
(
(
size
=
flexran_agent_msg_recv
(
d
->
mod_id
,
FLEXRAN_AGENT_DEFAULT
,
&
data
,
&
priority
))
>
0
)
{
LOG_D
(
FLEXRAN_AGENT
,
"received message with size %d
\n
"
,
size
);
...
...
openair2/ENB_APP/flexran_agent_async.c
View file @
692d6009
...
...
@@ -94,11 +94,11 @@ int flexran_agent_async_msg_send(void *data, int size, int priority, void *chann
return
message_put
(
channel
->
send_queue
,
data
,
size
,
priority
);
}
int
flexran_agent_async_msg_recv
(
void
**
data
,
int
*
size
,
int
*
priority
,
void
*
channel_info
)
{
int
flexran_agent_async_msg_recv
(
void
**
data
,
int
*
priority
,
void
*
channel_info
)
{
flexran_agent_async_channel_t
*
channel
;
channel
=
(
flexran_agent_async_channel_t
*
)
channel_info
;
return
message_get
(
channel
->
receive_queue
,
data
,
size
,
priority
);
return
message_get
(
channel
->
receive_queue
,
data
,
priority
);
}
void
flexran_agent_async_release
(
flexran_agent_channel_t
*
channel
)
{
...
...
openair2/ENB_APP/flexran_agent_async.h
View file @
692d6009
...
...
@@ -46,7 +46,7 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c
int
flexran_agent_async_msg_send
(
void
*
data
,
int
size
,
int
priority
,
void
*
channel_info
);
/* Receive a message from a given channel */
int
flexran_agent_async_msg_recv
(
void
**
data
,
int
*
size
,
int
*
priority
,
void
*
channel_info
);
int
flexran_agent_async_msg_recv
(
void
**
data
,
int
*
priority
,
void
*
channel_info
);
/* Release a channel */
void
flexran_agent_async_release
(
flexran_agent_channel_t
*
channel
);
...
...
openair2/ENB_APP/flexran_agent_net_comm.c
View file @
692d6009
...
...
@@ -53,7 +53,7 @@ int flexran_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int si
return
-
1
;
}
int
flexran_agent_msg_recv
(
mid_t
mod_id
,
agent_id_t
agent_id
,
void
**
data
,
int
*
size
,
int
*
priority
)
{
int
flexran_agent_msg_recv
(
mid_t
mod_id
,
agent_id_t
agent_id
,
void
**
data
,
int
*
priority
)
{
/*Check if agent id is valid*/
if
(
agent_id
>=
FLEXRAN_AGENT_MAX
||
agent_id
<
0
)
{
goto
error
;
...
...
@@ -66,7 +66,7 @@ int flexran_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *
goto
error
;
}
return
channel
->
msg_recv
(
data
,
size
,
priority
,
channel
->
channel_info
);
return
channel
->
msg_recv
(
data
,
priority
,
channel
->
channel_info
);
error:
LOG_E
(
FLEXRAN_AGENT
,
"No channel registered for agent with id %d
\n
"
,
agent_id
);
...
...
@@ -104,7 +104,7 @@ void flexran_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id) {
int
flexran_agent_create_channel
(
void
*
channel_info
,
int
(
*
msg_send
)(
void
*
data
,
int
size
,
int
priority
,
void
*
channel_info
),
int
(
*
msg_recv
)(
void
**
data
,
int
*
size
,
int
*
priority
,
void
*
channel_info
),
int
(
*
msg_recv
)(
void
**
data
,
int
*
priority
,
void
*
channel_info
),
void
(
*
release
)(
flexran_agent_channel_t
*
channel
))
{
int
channel_id
=
++
flexran_agent_channel_id
;
...
...
openair2/ENB_APP/flexran_agent_net_comm.h
View file @
692d6009
...
...
@@ -39,7 +39,7 @@ int channel_id;
void
*
channel_info
;
/*Callbacks for channel message Tx and Rx*/
int
(
*
msg_send
)(
void
*
data
,
int
size
,
int
priority
,
void
*
channel_info
);
int
(
*
msg_recv
)(
void
**
data
,
int
*
size
,
int
*
priority
,
void
*
channel_info
);
int
(
*
msg_recv
)(
void
**
data
,
int
*
priority
,
void
*
channel_info
);
void
(
*
release
)(
struct
flexran_agent_channel_s
*
channel
);
}
flexran_agent_channel_t
;
...
...
@@ -49,7 +49,7 @@ typedef struct flexran_agent_channel_instance_s{
/*Send and receive messages using the channel registered for a specific agent*/
int
flexran_agent_msg_send
(
mid_t
mod_id
,
agent_id_t
agent_id
,
void
*
data
,
int
size
,
int
priority
);
int
flexran_agent_msg_recv
(
mid_t
mod_id
,
agent_id_t
agent_id
,
void
**
data
,
int
*
size
,
int
*
priority
);
int
flexran_agent_msg_recv
(
mid_t
mod_id
,
agent_id_t
agent_id
,
void
**
data
,
int
*
priority
);
/*Register a channel to an agent. Use FLEXRAN_AGENT_MAX to register the
*same channel to all agents*/
...
...
@@ -61,7 +61,7 @@ void flexran_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id);
/*Create a new channel. Returns the id of the new channel or negative number otherwise*/
int
flexran_agent_create_channel
(
void
*
channel_info
,
int
(
*
msg_send
)(
void
*
data
,
int
size
,
int
priority
,
void
*
channel_info
),
int
(
*
msg_recv
)(
void
**
data
,
int
*
size
,
int
*
priority
,
void
*
channel_info
),
int
(
*
msg_recv
)(
void
**
data
,
int
*
priority
,
void
*
channel_info
),
void
(
*
release
)(
flexran_agent_channel_t
*
channel
));
/*Unregister a channel from all agents and destroy it. Returns 0 in case of success*/
...
...
openair2/LAYER2/PROTO_AGENT/proto_agent.c
View file @
692d6009
...
...
@@ -266,7 +266,7 @@ proto_agent_receive(void *args)
msg
=
NULL
;
ser_msg
=
NULL
;
if
(
proto_agent_async_msg_recv
(
&
data
,
&
size
,
&
priority
,
inst
->
channel
->
channel_info
)
){
if
(
(
size
=
proto_agent_async_msg_recv
(
&
data
,
&
priority
,
inst
->
channel
->
channel_info
))
<=
0
){
err_code
=
PROTOCOL__FLEXSPLIT_ERR__MSG_ENQUEUING
;
goto
error
;
}
...
...
openair2/LAYER2/PROTO_AGENT/proto_agent_async.c
View file @
692d6009
...
...
@@ -78,10 +78,10 @@ int proto_agent_async_msg_send(void *data, int size, int priority, void *channel
return
message_put
(
channel
->
send_queue
,
data
,
size
,
priority
);
}
int
proto_agent_async_msg_recv
(
void
**
data
,
int
*
size
,
int
*
priority
,
void
*
channel_info
)
int
proto_agent_async_msg_recv
(
void
**
data
,
int
*
priority
,
void
*
channel_info
)
{
proto_agent_async_channel_t
*
channel
=
channel_info
;
return
message_get
(
channel
->
receive_queue
,
data
,
size
,
priority
);
return
message_get
(
channel
->
receive_queue
,
data
,
priority
);
}
void
proto_agent_async_release
(
proto_agent_channel_t
*
channel
)
...
...
openair2/LAYER2/PROTO_AGENT/proto_agent_async.h
View file @
692d6009
...
...
@@ -53,7 +53,7 @@ proto_agent_async_channel_info(mod_id_t mod_id, const char *bind_ip, uint16_t bi
int
proto_agent_async_msg_send
(
void
*
data
,
int
size
,
int
priority
,
void
*
channel_info
);
int
proto_agent_async_msg_recv
(
void
**
data
,
int
*
size
,
int
*
priority
,
void
*
channel_info
);
int
proto_agent_async_msg_recv
(
void
**
data
,
int
*
priority
,
void
*
channel_info
);
void
proto_agent_async_release
(
proto_agent_channel_t
*
channel
);
...
...
openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c
View file @
692d6009
...
...
@@ -72,7 +72,7 @@ void proto_agent_unregister_channel(mod_id_t mod_id, proto_agent_id_t agent_id)
int
proto_agent_create_channel
(
void
*
channel_info
,
int
(
*
msg_send
)(
void
*
data
,
int
size
,
int
priority
,
void
*
channel_info
),
int
(
*
msg_recv
)(
void
**
data
,
int
*
size
,
int
*
priority
,
void
*
channel_info
),
int
(
*
msg_recv
)(
void
**
data
,
int
*
priority
,
void
*
channel_info
),
void
(
*
release
)(
proto_agent_channel_t
*
channel
))
{
int
channel_id
=
++
proto_agent_channel_id
;
...
...
openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.h
View file @
692d6009
...
...
@@ -51,7 +51,7 @@ typedef struct proto_agent_channel_s {
struct
proto_agent_async_channel_s
*
channel_info
;
/*Callbacks for channel message Tx and Rx*/
int
(
*
msg_send
)(
void
*
data
,
int
size
,
int
priority
,
void
*
channel_info
);
int
(
*
msg_recv
)(
void
**
data
,
int
*
size
,
int
*
priority
,
void
*
channel_info
);
int
(
*
msg_recv
)(
void
**
data
,
int
*
priority
,
void
*
channel_info
);
void
(
*
release
)(
struct
proto_agent_channel_s
*
channel
);
}
proto_agent_channel_t
;
...
...
@@ -70,7 +70,7 @@ void proto_agent_unregister_channel(mod_id_t mod_id, proto_agent_id_t agent_id);
/*Create a new channel. Returns the id of the new channel or negative number otherwise*/
int
proto_agent_create_channel
(
void
*
channel_info
,
int
(
*
msg_send
)(
void
*
data
,
int
size
,
int
priority
,
void
*
channel_info
),
int
(
*
msg_recv
)(
void
**
data
,
int
*
size
,
int
*
priority
,
void
*
channel_info
),
int
(
*
msg_recv
)(
void
**
data
,
int
*
priority
,
void
*
channel_info
),
void
(
*
release
)(
proto_agent_channel_t
*
channel
));
/*Unregister a channel from all agents and destroy it. Returns 0 in case of success*/
...
...
openair2/UTIL/ASYNC_IF/link_manager.c
View file @
692d6009
...
...
@@ -46,7 +46,7 @@ static void *link_manager_sender_thread(void *_manager)
LOG_D
(
MAC
,
"starting link manager sender thread
\n
"
);
while
(
manager
->
run
)
{
while
(
message_get
(
manager
->
send_queue
,
&
data
,
&
size
,
&
priority
)
==
0
)
{
while
(
(
size
=
message_get
(
manager
->
send_queue
,
&
data
,
&
priority
))
>
0
)
{
link_send_packet
(
manager
->
socket_link
,
data
,
size
,
manager
->
peer_addr
,
manager
->
peer_port
);
free
(
data
);
}
...
...
@@ -184,7 +184,7 @@ int main(void)
data
=
strdup
(
"hello"
);
if
(
data
==
NULL
)
goto
error
;
if
(
message_put
(
send_queue
,
data
,
6
,
100
))
goto
error
;
if
(
message_get
(
receive_queue
,
&
data
,
&
size
,
&
priority
)
)
goto
error
;
if
(
(
size
=
message_get
(
receive_queue
,
&
data
,
&
priority
))
<=
0
)
goto
error
;
printf
(
"received message:
\n
"
);
printf
(
" data: %s
\n
"
,
(
char
*
)
data
);
printf
(
" size: %d
\n
"
,
size
);
...
...
@@ -228,7 +228,7 @@ int main(void)
manager
=
create_link_manager
(
send_queue
,
receive_queue
,
link
);
if
(
manager
==
NULL
)
goto
error
;
if
(
message_get
(
receive_queue
,
&
data
,
&
size
,
&
priority
)
)
goto
error
;
if
(
(
size
=
message_get
(
receive_queue
,
&
data
,
&
priority
))
<=
0
)
goto
error
;
printf
(
"received message:
\n
"
);
printf
(
" data: %s
\n
"
,
(
char
*
)
data
);
printf
(
" size: %d
\n
"
,
size
);
...
...
openair2/UTIL/ASYNC_IF/message_queue.c
View file @
692d6009
...
...
@@ -72,6 +72,8 @@ error:
int
message_put
(
message_queue_t
*
queue
,
void
*
data
,
int
size
,
int
priority
)
{
message_t
*
m
=
NULL
;
if
(
size
<=
0
)
goto
error
;
m
=
calloc
(
1
,
sizeof
(
message_t
));
if
(
m
==
NULL
)
...
...
@@ -106,12 +108,12 @@ int message_put(message_queue_t *queue, void *data, int size, int priority)
return
0
;
error:
free
(
m
);
if
(
m
)
free
(
m
);
LOG_E
(
MAC
,
"%s: an error occured
\n
"
,
__FUNCTION__
);
return
-
1
;
}
int
message_get
(
message_queue_t
*
queue
,
void
**
data
,
int
*
size
,
int
*
priority
)
int
message_get
(
message_queue_t
*
queue
,
void
**
data
,
int
*
priority
)
{
message_t
*
m
;
...
...
@@ -136,12 +138,11 @@ int message_get(message_queue_t *queue, void **data, int *size, int *priority)
goto
error
;
*
data
=
m
->
data
;
*
size
=
m
->
size
;
const
int
size
=
m
->
size
;
*
priority
=
m
->
priority
;
free
(
m
);
return
0
;
return
size
;
error:
LOG_E
(
MAC
,
"%s: an error occured
\n
"
,
__FUNCTION__
);
return
-
1
;
...
...
@@ -181,10 +182,10 @@ int main(void)
if
(
message_put
(
q
,
"hello"
,
6
,
0
))
goto
error
;
if
(
message_put
(
q
,
"world"
,
6
,
1
))
goto
error
;
if
(
message_get
(
q
,
&
data
,
&
size
,
&
priority
)
)
goto
error
;
if
(
(
size
=
message_get
(
q
,
&
data
,
&
priority
))
<=
0
)
goto
error
;
printf
(
"message:
\n
data: '%s'
\n
size: %d
\n
priority: %d
\n
"
,
(
char
*
)
data
,
size
,
priority
);
if
(
message_get
(
q
,
&
data
,
&
size
,
&
priority
)
)
goto
error
;
if
(
(
size
=
message_get
(
q
,
&
data
,
&
priority
))
<=
0
)
goto
error
;
printf
(
"message:
\n
data: '%s'
\n
size: %d
\n
priority: %d
\n
"
,
(
char
*
)
data
,
size
,
priority
);
...
...
openair2/UTIL/ASYNC_IF/message_queue.h
View file @
692d6009
...
...
@@ -55,7 +55,7 @@ typedef struct {
message_queue_t
*
new_message_queue
(
void
);
int
message_put
(
message_queue_t
*
queue
,
void
*
data
,
int
size
,
int
priority
);
int
message_get
(
message_queue_t
*
queue
,
void
**
data
,
int
*
size
,
int
*
priority
);
int
message_get
(
message_queue_t
*
queue
,
void
**
data
,
int
*
priority
);
void
destroy_message_queue
(
message_queue_t
*
queue
);
#ifdef __cplusplus
...
...
openair2/UTIL/ASYNC_IF/ringbuffer_queue.c
View file @
692d6009
...
...
@@ -67,6 +67,9 @@ int message_put(message_queue_t *queue, void *data, int size, int priority) {
message_t
*
overwritten_msg
;
message_t
*
m
=
NULL
;
if
(
size
<=
0
)
goto
error
;
LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE
;
lfds700_misc_prng_init
(
&
ls
);
...
...
@@ -94,12 +97,11 @@ int message_put(message_queue_t *queue, void *data, int size, int priority) {
return
0
;
error:
free
(
m
);
LOG_E
(
MAC
,
"%s: an error occured
\n
"
,
__FUNCTION__
);
return
-
1
;
}
int
message_get
(
message_queue_t
*
queue
,
void
**
data
,
int
*
size
,
int
*
priority
)
{
int
message_get
(
message_queue_t
*
queue
,
void
**
data
,
int
*
priority
)
{
message_t
*
m
;
struct
lfds700_misc_prng_state
ls
;
...
...
@@ -111,10 +113,10 @@ int message_get(message_queue_t *queue, void **data, int *size, int *priority) {
}
*
data
=
m
->
data
;
*
size
=
m
->
size
;
const
int
size
=
m
->
size
;
*
priority
=
m
->
priority
;
free
(
m
);
return
0
;
return
size
;
}
void
destroy_message_queue
(
message_queue_t
*
queue
)
{
...
...
openair2/UTIL/ASYNC_IF/ringbuffer_queue.h
View file @
692d6009
...
...
@@ -47,7 +47,7 @@ typedef struct {
message_queue_t
*
new_message_queue
(
int
size
);
int
message_put
(
message_queue_t
*
queue
,
void
*
data
,
int
size
,
int
priority
);
int
message_get
(
message_queue_t
*
queue
,
void
**
data
,
int
*
size
,
int
*
priority
);
int
message_get
(
message_queue_t
*
queue
,
void
**
data
,
int
*
priority
);
void
destroy_message_queue
(
message_queue_t
*
queue
);
#endif
/* RINGBUFFER_QUEUE_H */
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