Commit 01d5f1d5 authored by Franck Messaoudi's avatar Franck Messaoudi

Update: Update the Data-path

parent e24acb72
......@@ -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);
}
}
}
......
......@@ -25,13 +25,13 @@
// u32 ipv4_address;
// };
#define MAX_SDF_FITLER_ENTRIES 15
#define MAX_SDF_FITLER_ENTRIES 1000
/*---------------------------------------------------------------------------------------------------------------*/
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, u32); // seid
__type(value, pfcp_pdr_t_[MAX_PDRS_PER_SESSION]);
__type(key, u64); // 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__
......@@ -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__
......@@ -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;
......
......@@ -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"));
}
/*---------------------------------------------------------------------------------------------------------------*/
......@@ -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;
/*---------------------------------------------------------------------------------------------------------------*/
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment