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
01d5f1d5
Commit
01d5f1d5
authored
Apr 08, 2025
by
Franck Messaoudi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update: Update the Data-path
parent
e24acb72
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
129 deletions
+51
-129
src/upf_app/SessionProgramManager.cpp
src/upf_app/SessionProgramManager.cpp
+16
-9
src/upf_app/bpf/rules/include/pfcp_session_lookup_maps.h
src/upf_app/bpf/rules/include/pfcp_session_lookup_maps.h
+14
-14
src/upf_app/bpf/rules/include/rules_matching_pdr.h
src/upf_app/bpf/rules/include/rules_matching_pdr.h
+5
-0
src/upf_app/bpf/rules/include/sdf_filter.h
src/upf_app/bpf/rules/include/sdf_filter.h
+1
-1
src/upf_app/programs/pfcp_session_lookup_xdp_user.cpp
src/upf_app/programs/pfcp_session_lookup_xdp_user.cpp
+6
-0
src/upf_app/programs/pfcp_session_lookup_xdp_user.h
src/upf_app/programs/pfcp_session_lookup_xdp_user.h
+9
-105
No files found.
src/upf_app/SessionProgramManager.cpp
View file @
01d5f1d5
...
...
@@ -529,7 +529,6 @@ void SessionProgramManager::createPipeline(
* TODO: Implement the logic when fteid is not present
*/
}
if
(
!
pdi
.
get
(
ueIpAddress
))
{
ueIpAddress
.
ipv4_address
.
s_addr
=
0
;
logger
.
warn
(
"UE IP Address is missing for PDR %d"
,
pdr_id
);
...
...
@@ -538,7 +537,6 @@ void SessionProgramManager::createPipeline(
* TODO: Implement the logic when ipv4_address.s_addr is not present
*/
}
// sessionIds(pduSession, seid, fteid.teid, 0);
storePduSessionInMap
(
...
...
@@ -582,8 +580,7 @@ void SessionProgramManager::createPipeline(
updateARPTableForN6
(
pPFCP_Session_LookupProgram
,
dnIP
,
upfn6IP
);
});
arpUpdateThread
.
detach
();
saveSeidWithinFARProgram
(
seid
,
pPFCP_Session_LookupProgram
,
key
);
// saveSeidWithinFARProgram(seid, pPFCP_Session_LookupProgram, key);
/*
TO BE CONTINUED
..................
...
...
@@ -594,7 +591,6 @@ void SessionProgramManager::createPipeline(
}
pPFCP_Session_LookupProgram
->
getSessionPdrsMap
()
->
update
(
seid
,
pdrs
,
BPF_ANY
);
/*
TO BE CONTINUED: We Shall treat the case where there are downlink PDRs in
the establishment request. To be done later
...
...
@@ -643,16 +639,19 @@ void SessionProgramManager::modifyPipeline(
bool
enforcing_qos
=
!
session
->
qers_downlink
.
empty
();
const
bool
isBpfAccelerationEnabled
=
upf_cfg
.
enable_bpf_datapath
;
const
bool
isQosEnabled
=
isBpfAccelerationEnabled
&&
upf_cfg
.
enable_qos
;
auto
pPFCP_Session_LookupProgram
=
UserPlaneComponent
::
getInstance
().
getPFCP_Session_LookupProgram
();
if
(
isQosEnabled
&&
enforcing_qos
)
{
uint32_t
key
=
seid
;
pPFCP_Session_LookupProgram
->
getQosEnablingMap
()
->
update
(
key
,
isQosEnabled
,
BPF_ANY
);
logger
.
debug
(
"Instantiate a new QERProgram"
);
std
::
shared_ptr
<
QERProgram
>
pQERProgram
=
std
::
make_shared
<
QERProgram
>
();
pQERProgram
->
setup
(
seid
,
session
->
qers_downlink
,
session
->
pdrs_downlink
);
}
auto
pPFCP_Session_LookupProgram
=
UserPlaneComponent
::
getInstance
().
getPFCP_Session_LookupProgram
();
storePduSessionInMap
(
pPFCP_Session_LookupProgram
,
ueIp
,
teid_ul
,
teid_dl
,
seid
);
...
...
@@ -711,8 +710,16 @@ void SessionProgramManager::modifyPipeline(
sdfFilter
=
*
filterInfo
;
sdfFilter
.
session
.
seid
=
seid
;
sdfFilter
.
session
.
qfi
=
qfi
;
// struct sdfs_per_session sdf_key = {0};
// sdf_key.qer_id = pdr->qer_id.second.qer_id;
// sdf_key.seid = seid;
struct
session_qfi
sdf_key
=
{
0
};
sdf_key
.
qfi
=
qfi
;
sdf_key
.
seid
=
seid
;
pPFCP_Session_LookupProgram
->
getSdfFilterMap
()
->
update
(
pdr
->
qer_id
.
second
.
qer_id
,
sdfFilter
,
BPF_ANY
);
sdf_key
,
sdfFilter
,
BPF_ANY
);
}
}
}
...
...
src/upf_app/bpf/rules/include/pfcp_session_lookup_maps.h
View file @
01d5f1d5
...
...
@@ -25,13 +25,13 @@
// u32 ipv4_address;
// };
#define MAX_SDF_FITLER_ENTRIES 1
5
#define MAX_SDF_FITLER_ENTRIES 1
000
/*---------------------------------------------------------------------------------------------------------------*/
struct
{
__uint
(
type
,
BPF_MAP_TYPE_
ARRAY
);
__uint
(
type
,
BPF_MAP_TYPE_
HASH
);
__uint
(
max_entries
,
MAX_SDF_FITLER_ENTRIES
);
__type
(
key
,
u32
);
__type
(
key
,
struct
session_qfi
);
// <qfi, seid>
__type
(
value
,
struct
sdf_filtr
);
}
m_sdf_filter
SEC
(
".maps"
);
...
...
@@ -59,7 +59,6 @@ struct {
__uint
(
max_entries
,
MAX_UEs
);
//!< TODO: Is it enought?
}
m_ueip_session
SEC
(
".maps"
);
struct
{
__uint
(
type
,
BPF_MAP_TYPE_HASH
);
__uint
(
max_entries
,
MAX_UEs
);
...
...
@@ -67,7 +66,6 @@ struct {
__type
(
value
,
u32
);
//!< PDR
}
m_ue_ip_pdr
SEC
(
".maps"
);
struct
{
__uint
(
type
,
BPF_MAP_TYPE_HASH
);
__uint
(
max_entries
,
MAX_LENGTH
);
// 10,
...
...
@@ -75,7 +73,6 @@ struct {
__type
(
value
,
pfcp_far_t_
);
//
}
m_next_rule_prog_index
SEC
(
".maps"
);
struct
{
__uint
(
type
,
BPF_MAP_TYPE_HASH
);
__uint
(
max_entries
,
INTERFACE_ENTRIES_MAX
);
...
...
@@ -83,7 +80,6 @@ struct {
__type
(
value
,
struct
s_interface
);
}
m_upf_interfaces
SEC
(
".maps"
);
struct
{
__uint
(
type
,
BPF_MAP_TYPE_HASH
);
__uint
(
max_entries
,
MAX_LENGTH
);
...
...
@@ -91,23 +87,27 @@ struct {
__type
(
value
,
struct
session_id
);
// < teid_ul, teid_dl, seid >
}
m_session_mapping
SEC
(
".maps"
);
struct
{
__uint
(
type
,
BPF_MAP_TYPE_HASH
);
__uint
(
max_entries
,
MAX_LENGTH
);
__type
(
key
,
u
32
);
// seid
__type
(
value
,
pfcp_pdr_t_
[
MAX_PDRS_PER_SESSION
]);
__type
(
key
,
u
64
);
// seid
__type
(
value
,
pfcp_pdr_t_
[
MAX_PDRS_PER_SESSION
]);
}
m_session_pdrs
SEC
(
".maps"
);
struct
{
__uint
(
type
,
BPF_MAP_TYPE_HASH
);
__uint
(
max_entries
,
MAX_LENGTH
);
// max_rules = max_pdrs_per_pdu_session * max_pdu_session
__uint
(
max_entries
,
MAX_LENGTH
);
// max_rules = max_pdrs_per_pdu_session * max_pdu_session
__type
(
key
,
struct
pdrs_per_session
);
// < pdr_id, seid >
__type
(
value
,
struct
rules_match_pdr
);
// < FAR, QER, /* MAR, BAR, URR */ >
}
m_rules_match_pdr
SEC
(
".maps"
);
struct
{
__uint
(
type
,
BPF_MAP_TYPE_HASH
);
__uint
(
max_entries
,
MAX_LENGTH
);
// Store only one entry for the QoS flag
__type
(
key
,
u64
);
// seid
__type
(
value
,
u32
);
// Value type (0 for false, 1 for true)
}
m_qos_enabling
SEC
(
".maps"
);
#endif // __PFCP_SESSION_LOOKUP_MAPS_H__
src/upf_app/bpf/rules/include/rules_matching_pdr.h
View file @
01d5f1d5
...
...
@@ -15,4 +15,9 @@ struct pdrs_per_session {
uint64_t
seid
;
};
// struct sdfs_per_session {
// uint16_t qer_id;
// uint64_t seid;
// };
#endif // __RULES_MATCHING_PDR_H__
src/upf_app/bpf/rules/include/sdf_filter.h
View file @
01d5f1d5
...
...
@@ -29,7 +29,7 @@ struct port_range {
__u16
upper_bound
;
// If not specified in SDF: 65535
};
struct
metadata
_filter
{
struct
packet
_filter
{
u32
src_ip
;
u32
dst_ip
;
u8
protocol
;
...
...
src/upf_app/programs/pfcp_session_lookup_xdp_user.cpp
View file @
01d5f1d5
...
...
@@ -229,6 +229,10 @@ std::shared_ptr<BPFMap> PFCP_Session_LookupProgram::getSdfFilterMap() const {
return
mpSdfFilterMap
;
}
std
::
shared_ptr
<
BPFMap
>
PFCP_Session_LookupProgram
::
getQosEnablingMap
()
const
{
return
mpQosEnablingMap
;
}
/*---------------------------------------------------------------------------------------------------------------*/
void
PFCP_Session_LookupProgram
::
initializeMaps
()
{
// Store all maps available in the program.
...
...
@@ -252,6 +256,8 @@ void PFCP_Session_LookupProgram::initializeMaps() {
std
::
make_shared
<
BPFMap
>
(
mpMaps
->
getMap
(
"m_rules_match_pdr"
));
mpSdfFilterMap
=
std
::
make_shared
<
BPFMap
>
(
mpMaps
->
getMap
(
"m_sdf_filter"
));
mpQosEnablingMap
=
std
::
make_shared
<
BPFMap
>
(
mpMaps
->
getMap
(
"m_qos_enabling"
));
}
/*---------------------------------------------------------------------------------------------------------------*/
src/upf_app/programs/pfcp_session_lookup_xdp_user.h
View file @
01d5f1d5
...
...
@@ -24,155 +24,59 @@ using PFCP_Session_LookupProgramLifeCycle =
*/
class
PFCP_Session_LookupProgram
{
public:
/**
* @brief Construct a new PFCP_Session_LookupProgram object.
*
*/
explicit
PFCP_Session_LookupProgram
(
const
std
::
string
&
gtpInterface
,
const
std
::
string
&
udpInterface
);
/*---------------------------------------------------------------------------------------------------------------*/
/**
* @brief Destroy the PFCP_Session_LookupProgram object
*/
virtual
~
PFCP_Session_LookupProgram
();
/*---------------------------------------------------------------------------------------------------------------*/
/**
* @brief Setup the BPF program.
*
*/
void
setup
(
bool
isQosEnabled
);
/*---------------------------------------------------------------------------------------------------------------*/
/**
* @brief Get the BPFMaps object.
*
* @return std::shared_ptr<BPFMaps> The reference of the BPFMaps.
*/
std
::
shared_ptr
<
BPFMaps
>
getMaps
();
/*---------------------------------------------------------------------------------------------------------------*/
/**
* @brief Tear downs the BPF program.
*
*/
void
tearDown
();
/*---------------------------------------------------------------------------------------------------------------*/
/**
* @brief Update program int map.
*
* @param key The key which will be inserted the program file descriptor.
* @param fd The file descriptor.
*/
void
updateProgramMap
(
uint32_t
key
,
uint32_t
fd
);
/*---------------------------------------------------------------------------------------------------------------*/
void
create_upf_interface_map_entry
(
e_reference_point
s
);
void
removeProgramMap
(
uint32_t
key
);
std
::
shared_ptr
<
BPFMap
>
getEgressInterfaceMap
()
const
;
std
::
shared_ptr
<
BPFMap
>
getArpTableMap
()
const
;
std
::
shared_ptr
<
BPFMap
>
getIfaceMap
()
const
;
/*---------------------------------------------------------------------------------------------------------------*/
/**
* @brief Remove program in map.
*
* @param key The key which will be remove in the program map.
*/
void
removeProgramMap
(
uint32_t
key
);
/*---------------------------------------------------------------------------------------------------------------*/
/**
* @brief Get the TEID to session Map object.
*
* @return std::shared_ptr<BPFMap> The TEID to fd map.
*/
std
::
shared_ptr
<
BPFMap
>
getTeidSessionMap
()
const
;
/*---------------------------------------------------------------------------------------------------------------*/
/**
* @brief Get the UE IP to session Map object.
*
* @return std::shared_ptr<BPFMap> The UE IP to fd map.
*/
std
::
shared_ptr
<
BPFMap
>
getUeIpSessionMap
()
const
;
/*---------------------------------------------------------------------------------------------------------------*/
/**
* @brief Get the NextProgRule Map object.
*
* @return std::shared_ptr<BPFMap> The NextProgRule to fd map.
*/
std
::
shared_ptr
<
BPFMap
>
getNextProgRuleMap
()
const
;
/*---------------------------------------------------------------------------------------------------------------*/
/**
* @brief Get the NextProgRuleIndex Map object.
*
* @return std::shared_ptr<BPFMap> The pdi to index map.
*/
std
::
shared_ptr
<
BPFMap
>
getNextProgRuleIndexMap
()
const
;
/*---------------------------------------------------------------------------------------------------------------*/
/**
* @brief Get the Traffic Map object.
*
* @return std::shared_ptr<BPFMap> The TEID.
*/
std
::
shared_ptr
<
BPFMap
>
getTrafficMap
()
const
;
/*---------------------------------------------------------------------------------------------------------------*/
/**
* @brief Get the Session Mapping Map object.
*
* @return std::shared_ptr<BPFMap> mpSessionMappingMap;
*/
std
::
shared_ptr
<
BPFMap
>
getSessionMappingMap
()
const
;
std
::
shared_ptr
<
BPFMap
>
getRulesMatchPdrMap
()
const
;
std
::
shared_ptr
<
BPFMap
>
getSessionPdrsMap
()
const
;
std
::
shared_ptr
<
BPFMap
>
getSdfFilterMap
()
const
;
/*---------------------------------------------------------------------------------------------------------------*/
/**
* @brief Get the UE QFI TEID Map object.
*
* @return std::shared_ptr<BPFMap> mpUeQfiTeidMap;
*/
std
::
shared_ptr
<
BPFMap
>
getQosEnablingMap
()
const
;
std
::
shared_ptr
<
BPFMap
>
getUeQfiTeidMap
()
const
;
/**
* @brief Get theQoS Flow Map object.
*
* @return std::shared_ptr<BPFMap> mpQosFlowMap;
*/
std
::
shared_ptr
<
BPFMap
>
getQosFlowMap
()
const
;
/*---------------------------------------------------------------------------------------------------------------*/
private:
/**
* @brief Initialize BPF wrappers maps.
*
*/
void
initializeMaps
();
std
::
shared_ptr
<
BPFMaps
>
mpMaps
;
pfcp_session_lookup_xdp_kernel_c
*
spSkeleton
;
std
::
shared_ptr
<
PFCP_Session_LookupProgramLifeCycle
>
mpLifeCycle
;
std
::
string
mGTPInterface
;
std
::
string
mUDPInterface
;
std
::
shared_ptr
<
BPFMaps
>
mpMaps
;
std
::
shared_ptr
<
BPFMap
>
mpTeidSessionMap
;
std
::
shared_ptr
<
BPFMap
>
mpUeIpSessionMap
;
std
::
shared_ptr
<
BPFMap
>
mpNextProgRuleIndexMap
;
std
::
shared_ptr
<
BPFMap
>
mpNextProgRuleMap
;
std
::
shared_ptr
<
BPFMap
>
mpSessionMappingMap
;
std
::
shared_ptr
<
PFCP_Session_LookupProgramLifeCycle
>
mpLifeCycle
;
std
::
string
mGTPInterface
;
std
::
string
mUDPInterface
;
std
::
shared_ptr
<
BPFMap
>
mpEgressInterfaceMap
;
std
::
shared_ptr
<
BPFMap
>
mpArpTableMap
;
std
::
shared_ptr
<
BPFMap
>
mpUPFIfaceMap
;
std
::
shared_ptr
<
BPFMap
>
mpRulesMatchPdrMap
;
std
::
shared_ptr
<
BPFMap
>
mpSessionPdrsMap
;
std
::
shared_ptr
<
BPFMap
>
mpSdfFilterMap
;
std
::
shared_ptr
<
BPFMap
>
mpQosEnablingMap
;
/*---------------------------------------------------------------------------------------------------------------*/
};
...
...
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