Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF-Simple
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
Operations
Operations
Metrics
Environments
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
CommunityXG
OpenXG-SMF-Simple
Commits
ccd880dc
Commit
ccd880dc
authored
Mar 28, 2019
by
gauthier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPGWU thread scheduler and priority in config file (still boost asio to be removed)
parent
fd99e0f5
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
186 additions
and
98 deletions
+186
-98
etc/spgw_u.conf
etc/spgw_u.conf
+8
-2
src/common/utils/CMakeLists.txt
src/common/utils/CMakeLists.txt
+1
-0
src/common/utils/async_shell_cmd.cpp
src/common/utils/async_shell_cmd.cpp
+7
-3
src/common/utils/async_shell_cmd.hpp
src/common/utils/async_shell_cmd.hpp
+2
-1
src/common/utils/thread_sched.cpp
src/common/utils/thread_sched.cpp
+48
-0
src/common/utils/thread_sched.hpp
src/common/utils/thread_sched.hpp
+13
-6
src/gtpv1u/gtpv1u.cpp
src/gtpv1u/gtpv1u.cpp
+10
-20
src/gtpv1u/gtpv1u.hpp
src/gtpv1u/gtpv1u.hpp
+6
-6
src/itti/itti.cpp
src/itti/itti.cpp
+4
-3
src/itti/itti.hpp
src/itti/itti.hpp
+3
-2
src/oai_spgwu/main.cpp
src/oai_spgwu/main.cpp
+4
-2
src/spgwu/simpleswitch/pfcp_switch.cpp
src/spgwu/simpleswitch/pfcp_switch.cpp
+2
-15
src/spgwu/simpleswitch/pfcp_switch.hpp
src/spgwu/simpleswitch/pfcp_switch.hpp
+2
-2
src/spgwu/simpleswitch/spgwu_s1u.cpp
src/spgwu/simpleswitch/spgwu_s1u.cpp
+2
-15
src/spgwu/spgwu_app.cpp
src/spgwu/spgwu_app.cpp
+6
-3
src/spgwu/spgwu_config.cpp
src/spgwu/spgwu_config.cpp
+45
-5
src/spgwu/spgwu_config.hpp
src/spgwu/spgwu_config.hpp
+18
-12
src/spgwu/spgwu_sx.cpp
src/spgwu/spgwu_sx.cpp
+5
-1
No files found.
etc/spgw_u.conf
View file @
ccd880dc
...
@@ -23,9 +23,9 @@ SPGW-U =
...
@@ -23,9 +23,9 @@ SPGW-U =
INSTANCE
= @
INSTANCE
@;
# 0 is the default
INSTANCE
= @
INSTANCE
@;
# 0 is the default
PID_DIRECTORY
=
"@PID_DIRECTORY@"
;
# /var/run is the default
PID_DIRECTORY
=
"@PID_DIRECTORY@"
;
# /var/run is the default
ITTI
:
ITTI
_TASKS
:
{
{
SCHED_PARAMS
:
ITTI_TIMER_
SCHED_PARAMS
:
{
{
CPU_ID
=
1
;
CPU_ID
=
1
;
SCHED_POLICY
=
"SCHED_FIFO"
;
# Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
SCHED_POLICY
=
"SCHED_FIFO"
;
# Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
...
@@ -43,6 +43,12 @@ SPGW-U =
...
@@ -43,6 +43,12 @@ SPGW-U =
SCHED_POLICY
=
"SCHED_FIFO"
;
# Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
SCHED_POLICY
=
"SCHED_FIFO"
;
# Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
SCHED_PRIORITY
=
84
;
SCHED_PRIORITY
=
84
;
};
};
ASYNC_CMD_SCHED_PARAMS
:
{
CPU_ID
=
1
;
SCHED_POLICY
=
"SCHED_FIFO"
;
# Values in { SCHED_OTHER, SCHED_IDLE, SCHED_BATCH, SCHED_FIFO, SCHED_RR }
SCHED_PRIORITY
=
84
;
};
};
};
INTERFACES
:
INTERFACES
:
...
...
src/common/utils/CMakeLists.txt
View file @
ccd880dc
...
@@ -34,6 +34,7 @@ set(CN_UTILS_SRC STATIC
...
@@ -34,6 +34,7 @@ set(CN_UTILS_SRC STATIC
#${CMAKE_CURRENT_SOURCE_DIR}/mcc_mnc_itu.c
#${CMAKE_CURRENT_SOURCE_DIR}/mcc_mnc_itu.c
${
CMAKE_CURRENT_SOURCE_DIR
}
/pid_file.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/pid_file.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/string.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/string.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/thread_sched.cpp
)
)
...
...
src/common/utils/async_shell_cmd.cpp
View file @
ccd880dc
...
@@ -53,9 +53,13 @@ extern itti_mw *itti_inst;
...
@@ -53,9 +53,13 @@ extern itti_mw *itti_inst;
void
async_cmd_task
(
void
*
);
void
async_cmd_task
(
void
*
);
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
async_cmd_task
(
void
*
)
void
async_cmd_task
(
void
*
args_p
)
{
{
const
task_id_t
task_id
=
TASK_ASYNC_SHELL_CMD
;
const
task_id_t
task_id
=
TASK_ASYNC_SHELL_CMD
;
const
thread_sched_params
*
const
sched_params
=
(
const
oai
::
cn
::
util
::
thread_sched_params
*
const
)
args_p
;
sched_params
->
apply
(
task_id
,
Logger
::
async_cmd
());
itti_inst
->
notify_task_ready
(
task_id
);
itti_inst
->
notify_task_ready
(
task_id
);
do
{
do
{
...
@@ -95,11 +99,11 @@ void async_cmd_task (void*)
...
@@ -95,11 +99,11 @@ void async_cmd_task (void*)
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
async_shell_cmd
::
async_shell_cmd
(
void
)
async_shell_cmd
::
async_shell_cmd
(
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
{
{
Logger
::
async_cmd
().
startup
(
"Starting..."
);
Logger
::
async_cmd
().
startup
(
"Starting..."
);
if
(
itti_inst
->
create_task
(
TASK_ASYNC_SHELL_CMD
,
async_cmd_task
,
nullptr
)
)
{
if
(
itti_inst
->
create_task
(
TASK_ASYNC_SHELL_CMD
,
async_cmd_task
,
&
sched_params
)
)
{
Logger
::
async_cmd
().
error
(
"Cannot create task TASK_ASYNC_SHELL_CMD"
);
Logger
::
async_cmd
().
error
(
"Cannot create task TASK_ASYNC_SHELL_CMD"
);
throw
std
::
runtime_error
(
"Cannot create task TASK_ASYNC_SHELL_CMD"
);
throw
std
::
runtime_error
(
"Cannot create task TASK_ASYNC_SHELL_CMD"
);
}
}
...
...
src/common/utils/async_shell_cmd.hpp
View file @
ccd880dc
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#define FILE_ASYNC_SHELL_CMD_HPP_SEEN
#define FILE_ASYNC_SHELL_CMD_HPP_SEEN
#include "itti_msg.hpp"
#include "itti_msg.hpp"
#include "thread_sched.hpp"
#include <string>
#include <string>
#include <thread>
#include <thread>
...
@@ -43,7 +44,7 @@ private:
...
@@ -43,7 +44,7 @@ private:
std
::
thread
thread
;
std
::
thread
thread
;
public:
public:
async_shell_cmd
(
);
explicit
async_shell_cmd
(
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
~
async_shell_cmd
()
{}
~
async_shell_cmd
()
{}
async_shell_cmd
(
async_shell_cmd
const
&
)
=
delete
;
async_shell_cmd
(
async_shell_cmd
const
&
)
=
delete
;
void
operator
=
(
async_shell_cmd
const
&
)
=
delete
;
void
operator
=
(
async_shell_cmd
const
&
)
=
delete
;
...
...
src/common/utils/thread_sched.cpp
0 → 100644
View file @
ccd880dc
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file thread_sched.c
\brief
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#include "thread_sched.hpp"
//------------------------------------------------------------------------------
void
oai
::
cn
::
util
::
thread_sched_params
::
apply
(
const
int
task_id
,
_Logger
&
logger
)
const
{
if
(
cpu_id
>=
0
)
{
cpu_set_t
cpuset
;
CPU_SET
(
cpu_id
,
&
cpuset
);
if
(
int
rc
=
pthread_setaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
))
{
logger
.
warn
(
"Could not set affinity to ITTI task %d, err=%d"
,
task_id
,
rc
);
}
}
struct
sched_param
sparam
;
memset
(
&
sparam
,
0
,
sizeof
(
sparam
));
sparam
.
sched_priority
=
sched_priority
;
if
(
int
rc
=
pthread_setschedparam
(
pthread_self
(),
sched_policy
,
&
sparam
))
{
logger
.
warn
(
"Could not set schedparam to ITTI task %d, err=%d"
,
task_id
,
rc
);
}
}
src/common/
thread_sched.h
→
src/common/
utils/thread_sched.hpp
View file @
ccd880dc
...
@@ -19,20 +19,27 @@
...
@@ -19,20 +19,27 @@
* contact@openairinterface.org
* contact@openairinterface.org
*/
*/
/*! \file thread_sched.h
/*! \file thread_sched.h
pp
\brief
\brief
\company Eurecom
\company Eurecom
\email: lionel.gauthier@eurecom.fr
\email: lionel.gauthier@eurecom.fr
*/
*/
#ifndef FILE_THREAD_SCHED_SEEN
#ifndef FILE_THREAD_SCHED_
HPP_
SEEN
#define FILE_THREAD_SCHED_SEEN
#define FILE_THREAD_SCHED_
HPP_
SEEN
#include <sched.h>
#include <sched.h>
#include "logger.hpp"
typedef
struct
thread_sched_params_s
{
namespace
oai
::
cn
::
util
{
class
thread_sched_params
{
public:
int
cpu_id
;
int
cpu_id
;
int
sched_policy
;
int
sched_policy
;
int
sched_priority
;
int
sched_priority
;
}
thread_sched_params_t
;
void
apply
(
const
int
task_id
,
_Logger
&
logger
)
const
;
#endif
/* FILE_COMMON_ROOT_TYPES_SEEN */
};
}
#endif
/* FILE_THREAD_SCHED_HPP_SEEN */
src/gtpv1u/gtpv1u.cpp
View file @
ccd880dc
...
@@ -55,23 +55,13 @@ static std::string string_to_hex(const std::string& input)
...
@@ -55,23 +55,13 @@ static std::string string_to_hex(const std::string& input)
return
output
;
return
output
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
udp_server
::
udp_read_loop
(
const
thread_sched_params_t
&
thread_
sched_params
)
void
udp_server
::
udp_read_loop
(
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
{
{
socklen_t
r_endpoint_addr_len
=
0
;
socklen_t
r_endpoint_addr_len
=
0
;
struct
sockaddr_storage
r_endpoint
=
{};
struct
sockaddr_storage
r_endpoint
=
{};
size_t
bytes_received
=
0
;
size_t
bytes_received
=
0
;
if
(
thread_sched_params
.
cpu_id
>=
0
)
{
sched_params
.
apply
(
TASK_NONE
,
Logger
::
udp
());
cpu_set_t
cpuset
;
CPU_SET
(
thread_sched_params
.
cpu_id
,
&
cpuset
);
pthread_setaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
);
}
struct
sched_param
sparam
;
memset
(
&
sparam
,
0
,
sizeof
(
sparam
));
sparam
.
sched_priority
=
thread_sched_params
.
sched_priority
;
pthread_setschedparam
(
pthread_self
(),
thread_sched_params
.
sched_policy
,
&
sparam
);
while
(
1
)
{
while
(
1
)
{
r_endpoint_addr_len
=
sizeof
(
struct
sockaddr_storage
);
r_endpoint_addr_len
=
sizeof
(
struct
sockaddr_storage
);
...
@@ -169,11 +159,11 @@ int udp_server::create_socket (char * address, const uint16_t port_num)
...
@@ -169,11 +159,11 @@ int udp_server::create_socket (char * address, const uint16_t port_num)
}
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
udp_server
::
start_receive
(
gtpu_l4_stack
*
gtp_stack
,
const
thread_sched_params_t
&
thread_
sched_params
)
void
udp_server
::
start_receive
(
gtpu_l4_stack
*
gtp_stack
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
{
{
app_
=
gtp_stack
;
app_
=
gtp_stack
;
Logger
::
udp
().
trace
(
"udp_server::start_receive"
);
Logger
::
udp
().
trace
(
"udp_server::start_receive"
);
thread_
=
thread
(
&
udp_server
::
udp_read_loop
,
this
,
thread_
sched_params
);
thread_
=
thread
(
&
udp_server
::
udp_read_loop
,
this
,
sched_params
);
thread_
.
detach
();
thread_
.
detach
();
}
}
...
@@ -196,7 +186,7 @@ void udp_server::start_receive(gtpu_l4_stack * gtp_stack, const thread_sched_par
...
@@ -196,7 +186,7 @@ void udp_server::start_receive(gtpu_l4_stack * gtp_stack, const thread_sched_par
//}
//}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
gtpu_l4_stack
::
gtpu_l4_stack
(
const
struct
in_addr
&
address
,
const
uint16_t
port_num
,
const
thread_sched_params_t
&
thread_
sched_params
)
:
gtpu_l4_stack
::
gtpu_l4_stack
(
const
struct
in_addr
&
address
,
const
uint16_t
port_num
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
:
udp_s
(
udp_server
(
address
,
port_num
))
udp_s
(
udp_server
(
address
,
port_num
))
{
{
Logger
::
gtpv1_u
().
info
(
"gtpu_l4_stack created listening to %s:%d"
,
oai
::
cn
::
core
::
toString
(
address
).
c_str
(),
port_num
);
Logger
::
gtpv1_u
().
info
(
"gtpu_l4_stack created listening to %s:%d"
,
oai
::
cn
::
core
::
toString
(
address
).
c_str
(),
port_num
);
...
@@ -205,10 +195,10 @@ gtpu_l4_stack::gtpu_l4_stack(const struct in_addr& address, const uint16_t port_
...
@@ -205,10 +195,10 @@ gtpu_l4_stack::gtpu_l4_stack(const struct in_addr& address, const uint16_t port_
srand
(
time
(
NULL
));
srand
(
time
(
NULL
));
seq_num
=
rand
()
&
0x7FFFFFFF
;
seq_num
=
rand
()
&
0x7FFFFFFF
;
restart_counter
=
0
;
restart_counter
=
0
;
udp_s
.
start_receive
(
this
,
thread_
sched_params
);
udp_s
.
start_receive
(
this
,
sched_params
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
gtpu_l4_stack
::
gtpu_l4_stack
(
const
struct
in6_addr
&
address
,
const
uint16_t
port_num
,
const
thread_sched_params_t
&
thread_
sched_params
)
:
gtpu_l4_stack
::
gtpu_l4_stack
(
const
struct
in6_addr
&
address
,
const
uint16_t
port_num
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
:
udp_s
(
udp_server
(
address
,
port_num
))
udp_s
(
udp_server
(
address
,
port_num
))
{
{
Logger
::
gtpv1_u
().
info
(
"gtpu_l4_stack created listening to %s:%d"
,
oai
::
cn
::
core
::
toString
(
address
).
c_str
(),
port_num
);
Logger
::
gtpv1_u
().
info
(
"gtpu_l4_stack created listening to %s:%d"
,
oai
::
cn
::
core
::
toString
(
address
).
c_str
(),
port_num
);
...
@@ -217,10 +207,10 @@ gtpu_l4_stack::gtpu_l4_stack(const struct in6_addr& address, const uint16_t port
...
@@ -217,10 +207,10 @@ gtpu_l4_stack::gtpu_l4_stack(const struct in6_addr& address, const uint16_t port
srand
(
time
(
NULL
));
srand
(
time
(
NULL
));
seq_num
=
rand
()
&
0x7FFFFFFF
;
seq_num
=
rand
()
&
0x7FFFFFFF
;
restart_counter
=
0
;
restart_counter
=
0
;
udp_s
.
start_receive
(
this
,
thread_
sched_params
);
udp_s
.
start_receive
(
this
,
sched_params
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
gtpu_l4_stack
::
gtpu_l4_stack
(
char
*
address
,
const
uint16_t
port_num
,
const
thread_sched_params_t
&
thread_
sched_params
)
:
gtpu_l4_stack
::
gtpu_l4_stack
(
char
*
address
,
const
uint16_t
port_num
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
:
udp_s
(
udp_server
(
address
,
port_num
))
udp_s
(
udp_server
(
address
,
port_num
))
{
{
Logger
::
gtpv1_u
().
info
(
"gtpu_l4_stack created listening to %s:%d"
,
address
,
port_num
);
Logger
::
gtpv1_u
().
info
(
"gtpu_l4_stack created listening to %s:%d"
,
address
,
port_num
);
...
@@ -229,7 +219,7 @@ gtpu_l4_stack::gtpu_l4_stack(char * address, const uint16_t port_num, const thre
...
@@ -229,7 +219,7 @@ gtpu_l4_stack::gtpu_l4_stack(char * address, const uint16_t port_num, const thre
srand
(
time
(
NULL
));
srand
(
time
(
NULL
));
seq_num
=
rand
()
&
0x7FFFFFFF
;
seq_num
=
rand
()
&
0x7FFFFFFF
;
restart_counter
=
0
;
restart_counter
=
0
;
udp_s
.
start_receive
(
this
,
thread_
sched_params
);
udp_s
.
start_receive
(
this
,
sched_params
);
}
}
...
...
src/gtpv1u/gtpv1u.hpp
View file @
ccd880dc
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#include "3gpp_29.281.hpp"
#include "3gpp_29.281.hpp"
#include "itti.hpp"
#include "itti.hpp"
#include "msg_gtpv1u.hpp"
#include "msg_gtpv1u.hpp"
#include "thread_sched.h"
#include "thread_sched.h
pp
"
#include <iostream>
#include <iostream>
#include <map>
#include <map>
...
@@ -94,7 +94,7 @@ public:
...
@@ -94,7 +94,7 @@ public:
close
(
socket_
);
close
(
socket_
);
}
}
void
udp_read_loop
(
const
thread_sched_params_t
&
thread_sched_params
);
void
udp_read_loop
(
const
oai
::
cn
::
util
::
thread_sched_params
&
thread_sched_params
);
void
async_send_to
(
const
char
*
send_buffer
,
const
ssize_t
num_bytes
,
const
struct
sockaddr_in
&
peer_addr
)
void
async_send_to
(
const
char
*
send_buffer
,
const
ssize_t
num_bytes
,
const
struct
sockaddr_in
&
peer_addr
)
{
{
...
@@ -114,7 +114,7 @@ public:
...
@@ -114,7 +114,7 @@ public:
}
}
void
start_receive
(
gtpu_l4_stack
*
gtp_stack
,
const
thread_sched_params_t
&
thread_
sched_params
);
void
start_receive
(
gtpu_l4_stack
*
gtp_stack
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
protected:
protected:
int
create_socket
(
const
struct
in_addr
&
address
,
const
uint16_t
port
);
int
create_socket
(
const
struct
in_addr
&
address
,
const
uint16_t
port
);
...
@@ -162,9 +162,9 @@ protected:
...
@@ -162,9 +162,9 @@ protected:
public:
public:
static
const
uint8_t
version
=
1
;
static
const
uint8_t
version
=
1
;
gtpu_l4_stack
(
const
struct
in_addr
&
address
,
const
uint16_t
port_num
,
const
thread_sched_params_t
&
thread_
sched_params
);
gtpu_l4_stack
(
const
struct
in_addr
&
address
,
const
uint16_t
port_num
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
gtpu_l4_stack
(
const
struct
in6_addr
&
address
,
const
uint16_t
port_num
,
const
thread_sched_params_t
&
thread_
sched_params
);
gtpu_l4_stack
(
const
struct
in6_addr
&
address
,
const
uint16_t
port_num
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
gtpu_l4_stack
(
char
*
ip_address
,
const
uint16_t
port_num
,
const
thread_sched_params_t
&
thread_
sched_params
);
gtpu_l4_stack
(
char
*
ip_address
,
const
uint16_t
port_num
,
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
virtual
void
handle_receive
(
char
*
recv_buffer
,
const
std
::
size_t
bytes_transferred
,
const
struct
sockaddr_storage
&
r_endpoint
,
const
socklen_t
&
r_endpoint_addr_len
);
virtual
void
handle_receive
(
char
*
recv_buffer
,
const
std
::
size_t
bytes_transferred
,
const
struct
sockaddr_storage
&
r_endpoint
,
const
socklen_t
&
r_endpoint_addr_len
);
void
handle_receive_message_cb
(
const
gtpv1u_msg
&
msg
,
const
struct
sockaddr_storage
&
r_endpoint
,
const
socklen_t
&
r_endpoint_addr_len
,
const
core
::
itti
::
task_id_t
&
task_id
,
bool
&
error
,
uint64_t
&
gtpc_tx_id
);
void
handle_receive_message_cb
(
const
gtpv1u_msg
&
msg
,
const
struct
sockaddr_storage
&
r_endpoint
,
const
socklen_t
&
r_endpoint_addr_len
,
const
core
::
itti
::
task_id_t
&
task_id
,
bool
&
error
,
uint64_t
&
gtpc_tx_id
);
...
...
src/itti/itti.cpp
View file @
ccd880dc
...
@@ -42,9 +42,10 @@ extern itti_mw *itti_inst;
...
@@ -42,9 +42,10 @@ extern itti_mw *itti_inst;
static
itti_timer
null_timer
(
ITTI_INVALID_TIMER_ID
,
TASK_NONE
,
0xFFFFFFFF
,
0xFFFFFFFF
,
0
,
0
);
static
itti_timer
null_timer
(
ITTI_INVALID_TIMER_ID
,
TASK_NONE
,
0xFFFFFFFF
,
0xFFFFFFFF
,
0
,
0
);
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
itti_mw
::
timer_manager_task
(
void
)
void
itti_mw
::
timer_manager_task
(
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
{
{
Logger
::
itti
().
info
(
"Starting timer_manager_task"
);
Logger
::
itti
().
info
(
"Starting timer_manager_task"
);
sched_params
.
apply
(
TASK_ITTI_TIMER
,
Logger
::
itti
());
while
(
true
)
{
while
(
true
)
{
if
(
itti_inst
->
terminate
)
return
;
if
(
itti_inst
->
terminate
)
return
;
{
{
...
@@ -109,9 +110,9 @@ itti_mw::~itti_mw() {
...
@@ -109,9 +110,9 @@ itti_mw::~itti_mw() {
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
itti_mw
::
start
(
void
)
{
void
itti_mw
::
start
(
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
{
Logger
::
itti
().
startup
(
"Starting..."
);
Logger
::
itti
().
startup
(
"Starting..."
);
timer_thread
=
thread
(
timer_manager_task
);
timer_thread
=
thread
(
timer_manager_task
,
sched_params
);
Logger
::
itti
().
startup
(
"Started"
);
Logger
::
itti
().
startup
(
"Started"
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
...
src/itti/itti.hpp
View file @
ccd880dc
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
#include <chrono>
#include <chrono>
#include <iomanip>
#include <iomanip>
#include "itti_msg.hpp"
#include "itti_msg.hpp"
#include "thread_sched.hpp"
namespace
oai
::
cn
::
core
::
itti
{
namespace
oai
::
cn
::
core
::
itti
{
...
@@ -131,7 +132,7 @@ private:
...
@@ -131,7 +132,7 @@ private:
bool
terminate
;
bool
terminate
;
static
void
timer_manager_task
(
void
);
static
void
timer_manager_task
(
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
public:
public:
itti_mw
();
itti_mw
();
...
@@ -139,7 +140,7 @@ public:
...
@@ -139,7 +140,7 @@ public:
void
operator
=
(
itti_mw
const
&
)
=
delete
;
void
operator
=
(
itti_mw
const
&
)
=
delete
;
~
itti_mw
();
~
itti_mw
();
void
start
(
void
);
void
start
(
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
timer_id_t
increment_timer_id
();
timer_id_t
increment_timer_id
();
unsigned
int
increment_message_number
();
unsigned
int
increment_message_number
();
...
...
src/oai_spgwu/main.cpp
View file @
ccd880dc
...
@@ -82,13 +82,15 @@ int main(int argc, char **argv)
...
@@ -82,13 +82,15 @@ int main(int argc, char **argv)
sigaction
(
SIGINT
,
&
sigIntHandler
,
NULL
);
sigaction
(
SIGINT
,
&
sigIntHandler
,
NULL
);
// Config
// Config
spgwu_cfg
.
load
(
Options
::
getlibconfigConfig
());
spgwu_cfg
.
display
();
// Inter task Interface
// Inter task Interface
itti_inst
=
new
itti_mw
();
itti_inst
=
new
itti_mw
();
itti_inst
->
start
();
itti_inst
->
start
(
spgwu_cfg
.
itti
.
itti_timer_sched_params
);
// system command
// system command
async_shell_cmd_inst
=
new
async_shell_cmd
();
async_shell_cmd_inst
=
new
async_shell_cmd
(
spgwu_cfg
.
itti
.
async_cmd_sched_params
);
// PGW application layer
// PGW application layer
spgwu_app_inst
=
new
spgwu_app
(
Options
::
getlibconfigConfig
());
spgwu_app_inst
=
new
spgwu_app
(
Options
::
getlibconfigConfig
());
...
...
src/spgwu/simpleswitch/pfcp_switch.cpp
View file @
ccd880dc
...
@@ -124,24 +124,11 @@ void pfcp_switch::commit_changes()
...
@@ -124,24 +124,11 @@ void pfcp_switch::commit_changes()
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
pfcp_switch
::
pdn_read_loop
(
const
thread_sched_params_t
&
thread_
sched_params
)
void
pfcp_switch
::
pdn_read_loop
(
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
)
{
{
int
bytes_received
=
0
;
int
bytes_received
=
0
;
if
(
thread_sched_params
.
cpu_id
>=
0
)
{
sched_params
.
apply
(
TASK_NONE
,
Logger
::
pfcp_switch
());
cpu_set_t
cpuset
;
CPU_SET
(
thread_sched_params
.
cpu_id
,
&
cpuset
);
if
(
int
rc
=
pthread_setaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
))
{
Logger
::
pfcp_switch
().
warn
(
"Could not set affinity to thread polling SGi interface, err=%d"
,
rc
);
}
}
struct
sched_param
sparam
;
memset
(
&
sparam
,
0
,
sizeof
(
sparam
));
sparam
.
sched_priority
=
thread_sched_params
.
sched_priority
;
if
(
int
rc
=
pthread_setschedparam
(
pthread_self
(),
thread_sched_params
.
sched_policy
,
&
sparam
))
{
Logger
::
pfcp_switch
().
warn
(
"Could not set schedparam to thread polling SGi interface, err=%d"
,
rc
);
}
struct
msghdr
msg
=
{};
struct
msghdr
msg
=
{};
msg
.
msg_iov
=
&
msg_iov_
;
msg
.
msg_iov
=
&
msg_iov_
;
...
...
src/spgwu/simpleswitch/pfcp_switch.hpp
View file @
ccd880dc
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#include "msg_pfcp.hpp"
#include "msg_pfcp.hpp"
#include "pfcp_session.hpp"
#include "pfcp_session.hpp"
#include "uint_generator.hpp"
#include "uint_generator.hpp"
#include "thread_sched.h"
#include "thread_sched.h
pp
"
#include <folly/AtomicHashMap.h>
#include <folly/AtomicHashMap.h>
#include <linux/ip.h>
#include <linux/ip.h>
...
@@ -109,7 +109,7 @@ private:
...
@@ -109,7 +109,7 @@ private:
//moodycamel::ConcurrentQueue<core::pfcp::pfcp_session*> create_session_q;
//moodycamel::ConcurrentQueue<core::pfcp::pfcp_session*> create_session_q;
void
pdn_read_loop
(
const
thread_sched_params_t
&
thread_
sched_params
);
void
pdn_read_loop
(
const
oai
::
cn
::
util
::
thread_sched_params
&
sched_params
);
int
create_pdn_socket
(
const
char
*
const
ifname
,
const
bool
promisc
,
int
&
if_index
);
int
create_pdn_socket
(
const
char
*
const
ifname
,
const
bool
promisc
,
int
&
if_index
);
int
create_pdn_socket
(
const
char
*
const
ifname
);
int
create_pdn_socket
(
const
char
*
const
ifname
);
void
setup_pdn_interfaces
();
void
setup_pdn_interfaces
();
...
...
src/spgwu/simpleswitch/spgwu_s1u.cpp
View file @
ccd880dc
...
@@ -55,22 +55,9 @@ void spgwu_s1u_task (void*);
...
@@ -55,22 +55,9 @@ void spgwu_s1u_task (void*);
void
spgwu_s1u_task
(
void
*
args_p
)
void
spgwu_s1u_task
(
void
*
args_p
)
{
{
const
task_id_t
task_id
=
TASK_SPGWU_S1U
;
const
task_id_t
task_id
=
TASK_SPGWU_S1U
;
const
thread_sched_params_t
*
const
thread_sched_params
=
(
const
thread_sched_params_t
*
const
)
args_p
;
if
(
thread_sched_params
->
cpu_id
>=
0
)
{
const
oai
::
cn
::
util
::
thread_sched_params
*
const
sched_params
=
(
const
oai
::
cn
::
util
::
thread_sched_params
*
const
)
args_p
;
cpu_set_t
cpuset
;
sched_params
->
apply
(
task_id
,
Logger
::
spgwu_s1u
());
CPU_SET
(
thread_sched_params
->
cpu_id
,
&
cpuset
);
if
(
int
rc
=
pthread_setaffinity_np
(
pthread_self
(),
sizeof
(
cpu_set_t
),
&
cpuset
))
{
Logger
::
spgwu_s1u
().
warn
(
"Could not set affinity to ITTI task TASK_SPGWU_S1U, err=%d"
,
rc
);
}
}
struct
sched_param
sparam
;
memset
(
&
sparam
,
0
,
sizeof
(
sparam
));
sparam
.
sched_priority
=
thread_sched_params
->
sched_priority
;
if
(
int
rc
=
pthread_setschedparam
(
pthread_self
(),
thread_sched_params
->
sched_policy
,
&
sparam
))
{
Logger
::
spgwu_s1u
().
warn
(
"Could not set schedparam to ITTI task TASK_SPGWU_S1U, err=%d"
,
rc
);
}
itti_inst
->
notify_task_ready
(
task_id
);
itti_inst
->
notify_task_ready
(
task_id
);
...
...
src/spgwu/spgwu_app.cpp
View file @
ccd880dc
...
@@ -58,6 +58,11 @@ void spgwu_app_task (void*);
...
@@ -58,6 +58,11 @@ void spgwu_app_task (void*);
void
spgwu_app_task
(
void
*
args_p
)
void
spgwu_app_task
(
void
*
args_p
)
{
{
const
task_id_t
task_id
=
TASK_SPGWU_APP
;
const
task_id_t
task_id
=
TASK_SPGWU_APP
;
const
oai
::
cn
::
util
::
thread_sched_params
*
const
sched_params
=
(
const
oai
::
cn
::
util
::
thread_sched_params
*
const
)
args_p
;
sched_params
->
apply
(
task_id
,
Logger
::
spgwu_app
());
itti_inst
->
notify_task_ready
(
task_id
);
itti_inst
->
notify_task_ready
(
task_id
);
do
{
do
{
...
@@ -111,11 +116,9 @@ void spgwu_app_task (void *args_p)
...
@@ -111,11 +116,9 @@ void spgwu_app_task (void *args_p)
spgwu_app
::
spgwu_app
(
const
std
::
string
&
config_file
)
spgwu_app
::
spgwu_app
(
const
std
::
string
&
config_file
)
{
{
Logger
::
spgwu_app
().
startup
(
"Starting..."
);
Logger
::
spgwu_app
().
startup
(
"Starting..."
);
spgwu_cfg
.
load
(
config_file
);
spgwu_cfg
.
execute
();
spgwu_cfg
.
execute
();
spgwu_cfg
.
display
();
if
(
itti_inst
->
create_task
(
TASK_SPGWU_APP
,
spgwu_app_task
,
nullptr
)
)
{
if
(
itti_inst
->
create_task
(
TASK_SPGWU_APP
,
spgwu_app_task
,
&
spgwu_cfg
.
itti
.
spgwu_app_sched_params
)
)
{
Logger
::
spgwu_app
().
error
(
"Cannot create task TASK_SPGWU_APP"
);
Logger
::
spgwu_app
().
error
(
"Cannot create task TASK_SPGWU_APP"
);
throw
std
::
runtime_error
(
"Cannot create task TASK_SPGWU_APP"
);
throw
std
::
runtime_error
(
"Cannot create task TASK_SPGWU_APP"
);
}
}
...
...
src/spgwu/spgwu_config.cpp
View file @
ccd880dc
...
@@ -96,7 +96,7 @@ int spgwu_config::get_pfcp_fseid(oai::cn::core::pfcp::fseid_t& fseid)
...
@@ -96,7 +96,7 @@ int spgwu_config::get_pfcp_fseid(oai::cn::core::pfcp::fseid_t& fseid)
return
rc
;
return
rc
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int
spgwu_config
::
load_thread_sched_params
(
const
Setting
&
thread_sched_params_cfg
,
thread_sched_params_t
&
cfg
)
int
spgwu_config
::
load_thread_sched_params
(
const
Setting
&
thread_sched_params_cfg
,
oai
::
cn
::
util
::
thread_sched_params
&
cfg
)
{
{
thread_sched_params_cfg
.
lookupValue
(
SPGWU_CONFIG_STRING_THREAD_RD_CPU_ID
,
cfg
.
cpu_id
);
thread_sched_params_cfg
.
lookupValue
(
SPGWU_CONFIG_STRING_THREAD_RD_CPU_ID
,
cfg
.
cpu_id
);
...
@@ -127,14 +127,21 @@ int spgwu_config::load_thread_sched_params(const Setting& thread_sched_params_cf
...
@@ -127,14 +127,21 @@ int spgwu_config::load_thread_sched_params(const Setting& thread_sched_params_cf
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int
spgwu_config
::
load_itti
(
const
Setting
&
itti_cfg
,
itti_cfg_t
&
cfg
)
int
spgwu_config
::
load_itti
(
const
Setting
&
itti_cfg
,
itti_cfg_t
&
cfg
)
{
{
const
Setting
&
sched_params_cfg
=
itti_cfg
[
SPGWU_CONFIG_STRING_SCHED_PARAMS
];
const
Setting
&
sched_params_cfg
=
itti_cfg
[
SPGWU_CONFIG_STRING_
ITTI_TIMER_
SCHED_PARAMS
];
load_thread_sched_params
(
sched_params_cfg
,
cfg
.
core
_sched_params
);
load_thread_sched_params
(
sched_params_cfg
,
cfg
.
itti_timer
_sched_params
);
const
Setting
&
s1u_sched_params_cfg
=
itti_cfg
[
SPGWU_CONFIG_STRING_S1U_SCHED_PARAMS
];
const
Setting
&
s1u_sched_params_cfg
=
itti_cfg
[
SPGWU_CONFIG_STRING_S1U_SCHED_PARAMS
];
load_thread_sched_params
(
s1u_sched_params_cfg
,
cfg
.
s1u_sched_params
);
load_thread_sched_params
(
s1u_sched_params_cfg
,
cfg
.
s1u_sched_params
);
const
Setting
&
sx_sched_params_cfg
=
itti_cfg
[
SPGWU_CONFIG_STRING_SX_SCHED_PARAMS
];
const
Setting
&
sx_sched_params_cfg
=
itti_cfg
[
SPGWU_CONFIG_STRING_SX_SCHED_PARAMS
];
load_thread_sched_params
(
sx_sched_params_cfg
,
cfg
.
sx_sched_params
);
load_thread_sched_params
(
sx_sched_params_cfg
,
cfg
.
sx_sched_params
);
const
Setting
&
spgwu_app_sched_params_cfg
=
itti_cfg
[
SPGWU_CONFIG_STRING_SX_SCHED_PARAMS
];
load_thread_sched_params
(
spgwu_app_sched_params_cfg
,
cfg
.
spgwu_app_sched_params
);
const
Setting
&
async_cmd_sched_params_cfg
=
itti_cfg
[
SPGWU_CONFIG_STRING_ASYNC_CMD_SCHED_PARAMS
];
load_thread_sched_params
(
async_cmd_sched_params_cfg
,
cfg
.
async_cmd_sched_params
);
return
RETURNok
;
return
RETURNok
;
}
}
...
@@ -208,7 +215,7 @@ int spgwu_config::load(const string& config_file)
...
@@ -208,7 +215,7 @@ int spgwu_config::load(const string& config_file)
spgwu_cfg
.
lookupValue
(
SPGWU_CONFIG_STRING_PID_DIRECTORY
,
pid_dir
);
spgwu_cfg
.
lookupValue
(
SPGWU_CONFIG_STRING_PID_DIRECTORY
,
pid_dir
);
util
::
trim
(
pid_dir
);
util
::
trim
(
pid_dir
);
const
Setting
&
itti_cfg
=
spgwu_cfg
[
SPGWU_CONFIG_STRING_ITTI
];
const
Setting
&
itti_cfg
=
spgwu_cfg
[
SPGWU_CONFIG_STRING_ITTI
_TASKS
];
load_itti
(
itti_cfg
,
itti
);
load_itti
(
itti_cfg
,
itti
);
const
Setting
&
nw_if_cfg
=
spgwu_cfg
[
SPGWU_CONFIG_STRING_INTERFACES
];
const
Setting
&
nw_if_cfg
=
spgwu_cfg
[
SPGWU_CONFIG_STRING_INTERFACES
];
...
@@ -325,24 +332,57 @@ void spgwu_config::display ()
...
@@ -325,24 +332,57 @@ void spgwu_config::display ()
Logger
::
spgwu_app
().
info
(
"Configuration:"
);
Logger
::
spgwu_app
().
info
(
"Configuration:"
);
Logger
::
spgwu_app
().
info
(
"- Instance ..............: %d"
,
instance
);
Logger
::
spgwu_app
().
info
(
"- Instance ..............: %d"
,
instance
);
Logger
::
spgwu_app
().
info
(
"- PID dir ...............: %s"
,
pid_dir
.
c_str
());
Logger
::
spgwu_app
().
info
(
"- PID dir ...............: %s"
,
pid_dir
.
c_str
());
Logger
::
spgwu_app
().
info
(
"-S1u_S12_S4:"
);
Logger
::
spgwu_app
().
info
(
"- ITTI tasks:"
);
Logger
::
spgwu_app
().
info
(
" ITTI Timer task:"
);
Logger
::
spgwu_app
().
info
(
" CPU ID .........: %d"
,
itti
.
itti_timer_sched_params
.
cpu_id
);
Logger
::
spgwu_app
().
info
(
" sched policy....: %d"
,
itti
.
itti_timer_sched_params
.
sched_policy
);
Logger
::
spgwu_app
().
info
(
" sched priority..: %d"
,
itti
.
itti_timer_sched_params
.
sched_priority
);
Logger
::
spgwu_app
().
info
(
" SPGWU-S1U task:"
);
Logger
::
spgwu_app
().
info
(
" CPU ID .........: %d"
,
itti
.
s1u_sched_params
.
cpu_id
);
Logger
::
spgwu_app
().
info
(
" sched policy....: %d"
,
itti
.
s1u_sched_params
.
sched_policy
);
Logger
::
spgwu_app
().
info
(
" sched priority..: %d"
,
itti
.
s1u_sched_params
.
sched_priority
);
Logger
::
spgwu_app
().
info
(
" SPGWU-SX task:"
);
Logger
::
spgwu_app
().
info
(
" CPU ID .........: %d"
,
itti
.
sx_sched_params
.
cpu_id
);
Logger
::
spgwu_app
().
info
(
" sched policy....: %d"
,
itti
.
sx_sched_params
.
sched_policy
);
Logger
::
spgwu_app
().
info
(
" sched priority..: %d"
,
itti
.
sx_sched_params
.
sched_priority
);
Logger
::
spgwu_app
().
info
(
" SPGWU_APP task:"
);
Logger
::
spgwu_app
().
info
(
" CPU ID .........: %d"
,
itti
.
spgwu_app_sched_params
.
cpu_id
);
Logger
::
spgwu_app
().
info
(
" sched policy....: %d"
,
itti
.
spgwu_app_sched_params
.
sched_policy
);
Logger
::
spgwu_app
().
info
(
" sched priority..: %d"
,
itti
.
spgwu_app_sched_params
.
sched_priority
);
Logger
::
spgwu_app
().
info
(
" ASYNC_SHELL_CMD task:"
);
Logger
::
spgwu_app
().
info
(
" CPU ID .........: %d"
,
itti
.
async_cmd_sched_params
.
cpu_id
);
Logger
::
spgwu_app
().
info
(
" sched policy....: %d"
,
itti
.
async_cmd_sched_params
.
sched_policy
);
Logger
::
spgwu_app
().
info
(
" sched priority..: %d"
,
itti
.
async_cmd_sched_params
.
sched_priority
);
Logger
::
spgwu_app
().
info
(
"- S1u_S12_S4:"
);
Logger
::
spgwu_app
().
info
(
" iface ............: %s"
,
s1_up
.
if_name
.
c_str
());
Logger
::
spgwu_app
().
info
(
" iface ............: %s"
,
s1_up
.
if_name
.
c_str
());
Logger
::
spgwu_app
().
info
(
" ipv4.addr ........: %s"
,
inet_ntoa
(
s1_up
.
addr4
));
Logger
::
spgwu_app
().
info
(
" ipv4.addr ........: %s"
,
inet_ntoa
(
s1_up
.
addr4
));
Logger
::
spgwu_app
().
info
(
" ipv4.mask ........: %s"
,
inet_ntoa
(
s1_up
.
network4
));
Logger
::
spgwu_app
().
info
(
" ipv4.mask ........: %s"
,
inet_ntoa
(
s1_up
.
network4
));
Logger
::
spgwu_app
().
info
(
" mtu ..............: %d"
,
s1_up
.
mtu
);
Logger
::
spgwu_app
().
info
(
" mtu ..............: %d"
,
s1_up
.
mtu
);
Logger
::
spgwu_app
().
info
(
" port .............: %d"
,
s1_up
.
port
);
Logger
::
spgwu_app
().
info
(
" port .............: %d"
,
s1_up
.
port
);
Logger
::
spgwu_app
().
info
(
" Reader thread:"
);
Logger
::
spgwu_app
().
info
(
" CPU ID .........: %d"
,
s1_up
.
thread_rd_sched_params
.
cpu_id
);
Logger
::
spgwu_app
().
info
(
" sched policy....: %d"
,
s1_up
.
thread_rd_sched_params
.
sched_policy
);
Logger
::
spgwu_app
().
info
(
" sched priority..: %d"
,
s1_up
.
thread_rd_sched_params
.
sched_priority
);
Logger
::
spgwu_app
().
info
(
"- SXA-SXB:"
);
Logger
::
spgwu_app
().
info
(
"- SXA-SXB:"
);
Logger
::
spgwu_app
().
info
(
" iface ............: %s"
,
sx
.
if_name
.
c_str
());
Logger
::
spgwu_app
().
info
(
" iface ............: %s"
,
sx
.
if_name
.
c_str
());
Logger
::
spgwu_app
().
info
(
" ipv4.addr ........: %s"
,
inet_ntoa
(
sx
.
addr4
));
Logger
::
spgwu_app
().
info
(
" ipv4.addr ........: %s"
,
inet_ntoa
(
sx
.
addr4
));
Logger
::
spgwu_app
().
info
(
" ipv4.mask ........: %s"
,
inet_ntoa
(
sx
.
network4
));
Logger
::
spgwu_app
().
info
(
" ipv4.mask ........: %s"
,
inet_ntoa
(
sx
.
network4
));
Logger
::
spgwu_app
().
info
(
" mtu ..............: %d"
,
sx
.
mtu
);
Logger
::
spgwu_app
().
info
(
" mtu ..............: %d"
,
sx
.
mtu
);
Logger
::
spgwu_app
().
info
(
" port .............: %u"
,
sx
.
port
);
Logger
::
spgwu_app
().
info
(
" port .............: %u"
,
sx
.
port
);
Logger
::
spgwu_app
().
info
(
" Reader thread:"
);
Logger
::
spgwu_app
().
info
(
" CPU ID .........: %d (TODO)"
,
sx
.
thread_rd_sched_params
.
cpu_id
);
Logger
::
spgwu_app
().
info
(
" sched policy....: %d (TODO)"
,
sx
.
thread_rd_sched_params
.
sched_policy
);
Logger
::
spgwu_app
().
info
(
" sched priority..: %d (TODO)"
,
sx
.
thread_rd_sched_params
.
sched_priority
);
Logger
::
spgwu_app
().
info
(
"- SGi:"
);
Logger
::
spgwu_app
().
info
(
"- SGi:"
);
Logger
::
spgwu_app
().
info
(
" iface ............: %s"
,
sgi
.
if_name
.
c_str
());
Logger
::
spgwu_app
().
info
(
" iface ............: %s"
,
sgi
.
if_name
.
c_str
());
Logger
::
spgwu_app
().
info
(
" ipv4.addr ........: %s"
,
inet_ntoa
(
sgi
.
addr4
));
Logger
::
spgwu_app
().
info
(
" ipv4.addr ........: %s"
,
inet_ntoa
(
sgi
.
addr4
));
Logger
::
spgwu_app
().
info
(
" ipv4.mask ........: %s"
,
inet_ntoa
(
sgi
.
network4
));
Logger
::
spgwu_app
().
info
(
" ipv4.mask ........: %s"
,
inet_ntoa
(
sgi
.
network4
));
Logger
::
spgwu_app
().
info
(
" mtu ..............: %d"
,
sgi
.
mtu
);
Logger
::
spgwu_app
().
info
(
" mtu ..............: %d"
,
sgi
.
mtu
);
Logger
::
spgwu_app
().
info
(
" gateway ..........: %s"
,
gateway
.
c_str
());
Logger
::
spgwu_app
().
info
(
" gateway ..........: %s"
,
gateway
.
c_str
());
Logger
::
spgwu_app
().
info
(
" Reader thread:"
);
Logger
::
spgwu_app
().
info
(
" CPU ID .........: %d"
,
sgi
.
thread_rd_sched_params
.
cpu_id
);
Logger
::
spgwu_app
().
info
(
" sched policy....: %d"
,
sgi
.
thread_rd_sched_params
.
sched_policy
);
Logger
::
spgwu_app
().
info
(
" sched priority..: %d"
,
sgi
.
thread_rd_sched_params
.
sched_priority
);
Logger
::
spgwu_app
().
info
(
"- PDN networks:"
);
Logger
::
spgwu_app
().
info
(
"- PDN networks:"
);
int
i
=
1
;
int
i
=
1
;
for
(
auto
it
:
pdns
)
{
for
(
auto
it
:
pdns
)
{
...
...
src/spgwu/spgwu_config.hpp
View file @
ccd880dc
...
@@ -29,8 +29,9 @@
...
@@ -29,8 +29,9 @@
#ifndef FILE_SPGWU_CONFIG_HPP_SEEN
#ifndef FILE_SPGWU_CONFIG_HPP_SEEN
#define FILE_SPGWU_CONFIG_HPP_SEEN
#define FILE_SPGWU_CONFIG_HPP_SEEN
#include "3gpp_29.244.h"
#include "3gpp_29.244.h"
#include "thread_sched.h"
#include "thread_sched.h
pp
"
#include <libconfig.h++>
#include <libconfig.h++>
#include <mutex>
#include <mutex>
#include <netinet/in.h>
#include <netinet/in.h>
...
@@ -49,11 +50,9 @@ namespace oai::cn::nf::spgwu {
...
@@ -49,11 +50,9 @@ namespace oai::cn::nf::spgwu {
#define SPGWU_CONFIG_STRING_IPV4_ADDRESS "IPV4_ADDRESS"
#define SPGWU_CONFIG_STRING_IPV4_ADDRESS "IPV4_ADDRESS"
#define SPGWU_CONFIG_STRING_PORT "PORT"
#define SPGWU_CONFIG_STRING_PORT "PORT"
#define SPGWU_CONFIG_STRING_SCHED_PARAMS "SCHED_PARAMS"
#define SPGWU_CONFIG_STRING_SCHED_PARAMS "SCHED_PARAMS"
#define SPGWU_CONFIG_STRING_S1U_SCHED_PARAMS "S1U_SCHED_PARAMS"
#define SPGWU_CONFIG_STRING_THREAD_RD_CPU_ID "CPU_ID"
#define SPGWU_CONFIG_STRING_SX_SCHED_PARAMS "SX_SCHED_PARAMS"
#define SPGWU_CONFIG_STRING_THREAD_RD_SCHED_POLICY "SCHED_POLICY"
#define SPGWU_CONFIG_STRING_THREAD_RD_CPU_ID "THREAD_RD_CPU_ID"
#define SPGWU_CONFIG_STRING_THREAD_RD_SCHED_PRIORITY "SCHED_PRIORITY"
#define SPGWU_CONFIG_STRING_THREAD_RD_SCHED_POLICY "THREAD_RD_SCHED_POLICY"
#define SPGWU_CONFIG_STRING_THREAD_RD_SCHED_PRIORITY "THREAD_RD_SCHED_PRIORITY"
#define SPGWU_CONFIG_STRING_INTERFACE_SGI "SGI"
#define SPGWU_CONFIG_STRING_INTERFACE_SGI "SGI"
#define SPGWU_CONFIG_STRING_INTERFACE_SX "SX"
#define SPGWU_CONFIG_STRING_INTERFACE_SX "SX"
#define SPGWU_CONFIG_STRING_INTERFACE_S1U_S12_S4_UP "S1U_S12_S4_UP"
#define SPGWU_CONFIG_STRING_INTERFACE_S1U_S12_S4_UP "S1U_S12_S4_UP"
...
@@ -64,7 +63,12 @@ namespace oai::cn::nf::spgwu {
...
@@ -64,7 +63,12 @@ namespace oai::cn::nf::spgwu {
#define SPGWU_CONFIG_STRING_SNAT "SNAT"
#define SPGWU_CONFIG_STRING_SNAT "SNAT"
#define SPGWU_CONFIG_STRING_MAX_PFCP_SESSIONS "MAX_PFCP_SESSIONS"
#define SPGWU_CONFIG_STRING_MAX_PFCP_SESSIONS "MAX_PFCP_SESSIONS"
#define SPGWU_CONFIG_STRING_SPGWC_LIST "SPGW-C_LIST"
#define SPGWU_CONFIG_STRING_SPGWC_LIST "SPGW-C_LIST"
#define SPGWU_CONFIG_STRING_ITTI "ITTI"
#define SPGWU_CONFIG_STRING_ITTI_TASKS "ITTI_TASKS"
#define SPGWU_CONFIG_STRING_ITTI_TIMER_SCHED_PARAMS "ITTI_TIMER_SCHED_PARAMS"
#define SPGWU_CONFIG_STRING_S1U_SCHED_PARAMS "S1U_SCHED_PARAMS"
#define SPGWU_CONFIG_STRING_SX_SCHED_PARAMS "SX_SCHED_PARAMS"
#define SPGWU_CONFIG_STRING_SPGWU_APP_SCHED_PARAMS "SPGWU_APP_SCHED_PARAMS"
#define SPGWU_CONFIG_STRING_ASYNC_CMD_SCHED_PARAMS "ASYNC_CMD_SCHED_PARAMS"
#define SPGW_ABORT_ON_ERROR true
#define SPGW_ABORT_ON_ERROR true
#define SPGW_WARN_ON_ERROR false
#define SPGW_WARN_ON_ERROR false
...
@@ -76,7 +80,7 @@ typedef struct interface_cfg_s {
...
@@ -76,7 +80,7 @@ typedef struct interface_cfg_s {
struct
in6_addr
addr6
;
struct
in6_addr
addr6
;
unsigned
int
mtu
;
unsigned
int
mtu
;
unsigned
int
port
;
unsigned
int
port
;
thread_sched_params_t
thread_rd_sched_params
;
oai
::
cn
::
util
::
thread_sched_params
thread_rd_sched_params
;
}
interface_cfg_t
;
}
interface_cfg_t
;
typedef
struct
pdn_cfg_s
{
typedef
struct
pdn_cfg_s
{
...
@@ -88,9 +92,11 @@ typedef struct pdn_cfg_s {
...
@@ -88,9 +92,11 @@ typedef struct pdn_cfg_s {
}
pdn_cfg_t
;
}
pdn_cfg_t
;
typedef
struct
itti_cfg_s
{
typedef
struct
itti_cfg_s
{
thread_sched_params_t
core_sched_params
;
oai
::
cn
::
util
::
thread_sched_params
itti_timer_sched_params
;
thread_sched_params_t
s1u_sched_params
;
oai
::
cn
::
util
::
thread_sched_params
s1u_sched_params
;
thread_sched_params_t
sx_sched_params
;
oai
::
cn
::
util
::
thread_sched_params
sx_sched_params
;
oai
::
cn
::
util
::
thread_sched_params
spgwu_app_sched_params
;
oai
::
cn
::
util
::
thread_sched_params
async_cmd_sched_params
;
}
itti_cfg_t
;
}
itti_cfg_t
;
class
spgwu_config
{
class
spgwu_config
{
...
@@ -99,7 +105,7 @@ private:
...
@@ -99,7 +105,7 @@ private:
int
load_itti
(
const
libconfig
::
Setting
&
itti_cfg
,
itti_cfg_t
&
cfg
);
int
load_itti
(
const
libconfig
::
Setting
&
itti_cfg
,
itti_cfg_t
&
cfg
);
int
load_interface
(
const
libconfig
::
Setting
&
if_cfg
,
interface_cfg_t
&
cfg
);
int
load_interface
(
const
libconfig
::
Setting
&
if_cfg
,
interface_cfg_t
&
cfg
);
int
load_thread_sched_params
(
const
libconfig
::
Setting
&
thread_sched_params_cfg
,
thread_sched_params_t
&
cfg
);
int
load_thread_sched_params
(
const
libconfig
::
Setting
&
thread_sched_params_cfg
,
oai
::
cn
::
util
::
thread_sched_params
&
cfg
);
public:
public:
...
...
src/spgwu/spgwu_sx.cpp
View file @
ccd880dc
...
@@ -56,6 +56,10 @@ void spgwu_sx_task (void*);
...
@@ -56,6 +56,10 @@ void spgwu_sx_task (void*);
void
spgwu_sx_task
(
void
*
args_p
)
void
spgwu_sx_task
(
void
*
args_p
)
{
{
const
task_id_t
task_id
=
TASK_SPGWU_SX
;
const
task_id_t
task_id
=
TASK_SPGWU_SX
;
const
oai
::
cn
::
util
::
thread_sched_params
*
const
sched_params
=
(
const
oai
::
cn
::
util
::
thread_sched_params
*
const
)
args_p
;
sched_params
->
apply
(
task_id
,
Logger
::
spgwu_sx
());
itti_inst
->
notify_task_ready
(
task_id
);
itti_inst
->
notify_task_ready
(
task_id
);
do
{
do
{
...
@@ -216,7 +220,7 @@ spgwu_sx::spgwu_sx () : pfcp_l4_stack(std::string(inet_ntoa(spgwu_cfg.sx.addr4))
...
@@ -216,7 +220,7 @@ spgwu_sx::spgwu_sx () : pfcp_l4_stack(std::string(inet_ntoa(spgwu_cfg.sx.addr4))
up_function_features
.
trace
=
0
;
up_function_features
.
trace
=
0
;
up_function_features
.
frrt
=
0
;
up_function_features
.
frrt
=
0
;
if
(
itti_inst
->
create_task
(
TASK_SPGWU_SX
,
spgwu_sx_task
,
nullptr
)
)
{
if
(
itti_inst
->
create_task
(
TASK_SPGWU_SX
,
spgwu_sx_task
,
&
spgwu_cfg
.
itti
.
sx_sched_params
)
)
{
Logger
::
spgwu_sx
().
error
(
"Cannot create task TASK_SPGWU_SX"
);
Logger
::
spgwu_sx
().
error
(
"Cannot create task TASK_SPGWU_SX"
);
throw
std
::
runtime_error
(
"Cannot create task TASK_SPGWU_SX"
);
throw
std
::
runtime_error
(
"Cannot create task TASK_SPGWU_SX"
);
}
}
...
...
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