Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
oai-upf-6g
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
OpenXG
oai-upf-6g
Commits
cfb8d8bc
Commit
cfb8d8bc
authored
Oct 20, 2025
by
Franck Messaoudi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update: clean the constructor
parent
aa0200dd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
129 additions
and
33 deletions
+129
-33
src/upf_app/programs/pfcp_session_lookup_xdp_user.cpp
src/upf_app/programs/pfcp_session_lookup_xdp_user.cpp
+127
-32
src/upf_app/programs/pfcp_session_lookup_xdp_user.h
src/upf_app/programs/pfcp_session_lookup_xdp_user.h
+2
-1
No files found.
src/upf_app/programs/pfcp_session_lookup_xdp_user.cpp
View file @
cfb8d8bc
...
...
@@ -28,26 +28,102 @@ int is_little_endian2() {
}
/*---------------------------------------------------------------------------------------------------------------*/
PFCP_Session_LookupProgram
::
PFCP_Session_LookupProgram
(
const
std
::
string
&
gtpInterface
,
const
std
::
string
&
udpInterface
,
const
upf_config
&
upf_cfg
)
:
mGTPInterface
(
gtpInterface
),
mUDPInterface
(
udpInterface
)
{
struct
pfcp_session_lookup_xdp_kernel_c
*
skel
=
nullptr
;
int
ret
=
-
1
;
// PFCP_Session_LookupProgram::PFCP_Session_LookupProgram(
// const std::string& gtpInterface, const std::string& udpInterface,
// const upf_config& upf_cfg)
// : mGTPInterface(gtpInterface), mUDPInterface(udpInterface) {
// struct pfcp_session_lookup_xdp_kernel_c* skel = nullptr;
// int ret = -1;
// Logger::upf_app().info("Initializing PFCP Session Lookup BPF program...");
// // create the open function (callable)
// auto open_fn = [&upf_cfg, this]() -> pfcp_session_lookup_xdp_kernel_c* {
// struct pfcp_session_lookup_xdp_kernel_c* skel =
// pfcp_session_lookup_xdp_kernel_c__open();
// if (!skel) {
// Logger::upf_app().error("Failed to open BPF skeleton");
// return nullptr;
// }
// // configure maps / rodata here (same pattern as kernel perf)
// uint32_t max_rules_match_pdr =
// upf_cfg.max_pdrs_per_pdu_session * upf_cfg.max_pdu_session;
// bpf_map__set_max_entries(
// skel->maps.m_upf_interfaces, upf_cfg.max_upf_interfaces);
// bpf_map__set_max_entries(
// skel->maps.m_redirect_interfaces,
// upf_cfg.max_upf_redirect_interfaces);
// bpf_map__set_max_entries(
// skel->maps.m_session_mapping, upf_cfg.max_pdu_session);
// bpf_map__set_max_entries(
// skel->maps.m_session_pdrs, upf_cfg.max_pdrs_per_pdu_session);
// bpf_map__set_max_entries(
// skel->maps.m_sdf_filter, upf_cfg.max_sdf_filters_per_pdu_session);
// bpf_map__set_max_entries(skel->maps.m_arp_table,
// upf_cfg.max_arp_entries);
// bpf_map__set_max_entries(skel->maps.m_rules_match_pdr,
// max_rules_match_pdr);
// redirect interfaces and arp tables sould be less or
// equal than max upf interfaces(
// even incuding n4 since URR is also using this interface to
// forward
// traffic to SMF)
// /*---------------------------------------------------------------------------------------------------------------*/
// struct {
// __uint(type, BPF_MAP_TYPE_DEVMAP);
// __uint(max_entries, MAX_INTERFACES);
// __type(key, u32); // id
// __type(value, u32); // tx port
// } m_redirect_interfaces SEC(".maps");
// /*---------------------------------------------------------------------------------------------------------------*/
// struct {
// __uint(type, BPF_MAP_TYPE_HASH);
// __uint(max_entries, ARP_ENTRIES_MAX_SIZE);
// __type(key, u32); // IPv4 address
// __type(value, struct s_arp_mapping); // <IP Address, MAC address>
// } m_arp_table SEC(".maps");
// // optionally set rodata fields:
// if (skel->rodata) {
// skel->rodata->max_upf_interfaces = upf_cfg.max_upf_interfaces;
// skel->rodata->max_upf_redirect_interfaces =
// upf_cfg.max_upf_redirect_interfaces;
// skel->rodata->max_pdu_session = upf_cfg.max_pdu_session;
// skel->rodata->max_pdrs_per_pdu_session =
// upf_cfg.max_pdrs_per_pdu_session;
// skel->rodata->max_sdf_filters_per_pdu_session =
// upf_cfg.max_sdf_filters_per_pdu_session;
// skel->rodata->max_arp_entries = upf_cfg.max_arp_entries;
// }
// return skel;
// };
// // now create the lifecycle object with a callable open_fn (not a raw skel)
// mpLifeCycle = std::make_shared<PFCP_Session_LookupProgramLifeCycle>(
// open_fn,
// /* load */ pfcp_session_lookup_xdp_kernel_c__load,
// /* attach */ pfcp_session_lookup_xdp_kernel_c__attach,
// /* destroy*/ pfcp_session_lookup_xdp_kernel_c__destroy);
// }
Logger
::
upf_app
().
info
(
"Initializing PFCP Session Lookup BPF program..."
);
// create the open function (callable)
auto
open_fn
=
[
&
upf_cfg
,
this
]()
->
pfcp_session_lookup_xdp_kernel_c
*
{
struct
pfcp_session_lookup_xdp_kernel_c
*
skel
=
pfcp_session_lookup_xdp_kernel_c__open
();
/*---------------------------------------------------------------------------------------------------------------*/
void
PFCP_Session_LookupProgram
::
configure_bpf_maps_and_rodata
(
struct
pfcp_session_lookup_xdp_kernel_c
*
skel
,
const
upf_config
&
upf_cfg
)
{
if
(
!
skel
)
{
Logger
::
upf_app
().
error
(
"Failed to open BPF skeleton
"
);
return
nullptr
;
Logger
::
upf_app
().
error
(
"Null skeleton in configure_bpf_maps_and_rodata
"
);
return
;
}
// configure maps / rodata here (same pattern as kernel perf)
// Compute derived limits
uint32_t
max_rules_match_pdr
=
upf_cfg
.
max_pdrs_per_pdu_session
*
upf_cfg
.
max_pdu_session
;
// Configure BPF map sizes
bpf_map__set_max_entries
(
skel
->
maps
.
m_upf_interfaces
,
upf_cfg
.
max_upf_interfaces
);
bpf_map__set_max_entries
(
...
...
@@ -59,11 +135,9 @@ PFCP_Session_LookupProgram::PFCP_Session_LookupProgram(
bpf_map__set_max_entries
(
skel
->
maps
.
m_sdf_filter
,
upf_cfg
.
max_sdf_filters_per_pdu_session
);
bpf_map__set_max_entries
(
skel
->
maps
.
m_arp_table
,
upf_cfg
.
max_arp_entries
);
bpf_map__set_max_entries
(
skel
->
maps
.
m_rules_match_pdr
,
upf_cfg
.
max_pdrs_per_pdu_session
*
upf_cfg
.
max_pdu_session
);
bpf_map__set_max_entries
(
skel
->
maps
.
m_rules_match_pdr
,
max_rules_match_pdr
);
// optionally set rodata fields:
// Configure .rodata constants (if available)
if
(
skel
->
rodata
)
{
skel
->
rodata
->
max_upf_interfaces
=
upf_cfg
.
max_upf_interfaces
;
skel
->
rodata
->
max_upf_redirect_interfaces
=
...
...
@@ -74,11 +148,32 @@ PFCP_Session_LookupProgram::PFCP_Session_LookupProgram(
upf_cfg
.
max_sdf_filters_per_pdu_session
;
skel
->
rodata
->
max_arp_entries
=
upf_cfg
.
max_arp_entries
;
}
}
/*---------------------------------------------------------------------------------------------------------------*/
PFCP_Session_LookupProgram
::
PFCP_Session_LookupProgram
(
const
std
::
string
&
gtpInterface
,
const
std
::
string
&
udpInterface
,
const
upf_config
&
upf_cfg
)
:
mGTPInterface
(
gtpInterface
),
mUDPInterface
(
udpInterface
)
{
struct
pfcp_session_lookup_xdp_kernel_c
*
skel
=
nullptr
;
int
ret
=
-
1
;
Logger
::
upf_app
().
info
(
"Initializing PFCP Session Lookup BPF program..."
);
auto
open_fn
=
[
&
upf_cfg
,
this
]()
->
pfcp_session_lookup_xdp_kernel_c
*
{
struct
pfcp_session_lookup_xdp_kernel_c
*
skel
=
pfcp_session_lookup_xdp_kernel_c__open
();
if
(
!
skel
)
{
Logger
::
upf_app
().
error
(
"Failed to open BPF skeleton"
);
return
nullptr
;
}
// Configure maps and rodata
this
->
configure_bpf_maps_and_rodata
(
skel
,
upf_cfg
);
return
skel
;
};
// now create the lifecycle object with a callable open_fn (not a raw skel)
mpLifeCycle
=
std
::
make_shared
<
PFCP_Session_LookupProgramLifeCycle
>
(
open_fn
,
/* load */
pfcp_session_lookup_xdp_kernel_c__load
,
...
...
src/upf_app/programs/pfcp_session_lookup_xdp_user.h
View file @
cfb8d8bc
...
...
@@ -56,7 +56,8 @@ class PFCP_Session_LookupProgram {
private:
void
initializeMaps
();
void
configure_bpf_maps_and_rodata
(
struct
pfcp_session_lookup_xdp_kernel_c
*
skel
,
const
upf_config
&
upf_cfg
);
pfcp_session_lookup_xdp_kernel_c
*
spSkeleton
;
std
::
shared_ptr
<
PFCP_Session_LookupProgramLifeCycle
>
mpLifeCycle
;
std
::
string
mGTPInterface
;
...
...
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