Commit c909aec9 authored by Franck Messaoudi's avatar Franck Messaoudi

Fix: fix regression for non-qos enforcement use case

parent 4b30f688
......@@ -556,7 +556,7 @@ void SessionProgramManager::createPipeline(
*/
std::shared_ptr<pfcp::pfcp_qer> qer;
if (!getQer(session, pdr, qer)) {
logger.debug("Missing qer for pdr %d", pdr_id);
logger.debug("Missing vvqer for pdr %d", pdr_id);
}
struct rules_match_pdr rules = {0};
......
......@@ -797,12 +797,14 @@ static __always_inline pfcp_pdr_t_* pfcp_session_s_lookup_precedence_over_n6(
bpf_debug(
"pdi.source_interface.interface_value: %d",
pdi.source_interface.interface_value);
*qfi_out = pdi.qfi.qfi;
// Check if the QoS enforcement is enabled:
u32* enabling_qos = bpf_map_lookup_elem(&m_qos_enabling, &seid);
if (!enabling_qos) {
bpf_debug("Qos enforcement not ebabled for Session %llu", seid);
return pdr_high_prec;
} else {
*qfi_out = pdi.qfi.qfi;
struct session_qfi sdf_key = {0};
sdf_key.seid = seid;
sdf_key.qfi = *qfi_out;
......@@ -938,8 +940,6 @@ int xdp_handle_uplink(struct xdp_md* ctx) {
}
}
/*---------------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------*/
SEC("xdp")
int xdp_handle_shaping(struct xdp_md* ctx) {
......@@ -1086,29 +1086,32 @@ int xdp_handle_downlink(struct xdp_md* ctx) {
pfcp_session_lookup_over_n6(data, data_end, ethh, &ue_ip, &packet_filter);
if (!session) {
bpf_debug("Session lookup failed");
bpf_debug(
"PFCP Session Lookup (Find PFCP session with matching PDRs) failed");
return XDP_PASS;
}
u64 seid = session->seid;
u32 teid_ul = session->teid_ul;
bpf_debug("Session found, SEID = %llu", seid);
bpf_debug("TEID_UL = %x", teid_ul);
bpf_debug("TEID_DL = %x", session->teid_dl);
bpf_debug("UE = %pI4", ue_ip);
u32 teid_ul = bpf_htonl(session->teid_ul);
u32 teid_dl = bpf_htonl(session->teid_dl);
bpf_debug(
"Session found ( seid, teid_ul, teid_dl ) : ( %llu, %u, %u )", seid,
teid_ul, teid_dl);
/*
|-----------------------------------------------------------------------|
|------------------------ PFCP Session's Lookup ------------------------|
|--- (Find matching PDR of the PFCP session with highest precedence) ---|
|-----------------------------------------------------------------------|
*/
|-----------------------------------------------------------------------|
|------------------------ PFCP Session's Lookup ------------------------|
|--- (Find matching PDR of the PFCP session with highest precedence) ---|
|-----------------------------------------------------------------------|
*/
u8 qfi = 0;
pfcp_pdr_t_* pdr_high_precedence = pfcp_session_s_lookup_precedence_over_n6(
seid, ue_ip, &qfi, &packet_filter);
if (!pdr_high_precedence) {
bpf_debug("Session lookup failed");
bpf_debug(
"PFCP Session's Lookup (Find matching PDR of the PFCP session with "
"highest precedence) failed");
return XDP_PASS;
}
......
......@@ -706,7 +706,7 @@ void pfcp_switch::handle_pfcp_session_establishment_request(
std::shared_ptr<itti_n4_session_establishment_request> sreq,
itti_n4_session_establishment_response* resp) {
bool isBpfAccelerationEnabled = upf_cfg.enable_bpf_datapath;
bool isQosEnabled = isBpfAccelerationEnabled && upf_cfg.enable_qos;
// bool isQosEnabled = isBpfAccelerationEnabled && upf_cfg.enable_qos;
itti_n4_session_establishment_request* req = sreq.get();
pfcp::fseid_t fseid = {};
......@@ -759,7 +759,7 @@ void pfcp_switch::handle_pfcp_session_establishment_request(
/*
* Add create_qers
*/
if (isQosEnabled) {
if (isBpfAccelerationEnabled) {
pfcp::qer_id_t qer_id = {};
if (cr_pdr.get(qer_id)) {
pfcp::create_qer cr_qer = {};
......@@ -878,7 +878,7 @@ void pfcp_switch::handle_pfcp_session_modification_request(
std::shared_ptr<itti_n4_session_modification_request> sreq,
itti_n4_session_modification_response* resp) {
bool isBpfAccelerationEnabled = upf_cfg.enable_bpf_datapath;
bool isQosEnabled = isBpfAccelerationEnabled && upf_cfg.enable_qos;
// bool isQosEnabled = isBpfAccelerationEnabled && upf_cfg.enable_qos;
itti_n4_session_modification_request* req = sreq.get();
......@@ -950,7 +950,7 @@ void pfcp_switch::handle_pfcp_session_modification_request(
/*
* Add remove_qers
*/
if (isQosEnabled) {
if (isBpfAccelerationEnabled) {
if (cause.cause_value == CAUSE_VALUE_REQUEST_ACCEPTED) {
for (auto it : req->pfcp_ies.remove_qers) {
Logger::upf_app().info("Modify datapath: remove(qer)");
......@@ -1040,7 +1040,7 @@ void pfcp_switch::handle_pfcp_session_modification_request(
/*
* Add create_qers
*/
if (isQosEnabled) {
if (isBpfAccelerationEnabled) {
if (cause.cause_value == CAUSE_VALUE_REQUEST_ACCEPTED) {
for (auto it : req->pfcp_ies.create_qers) {
create_qer& cr_qer = it;
......@@ -1100,7 +1100,7 @@ void pfcp_switch::handle_pfcp_session_modification_request(
/*
* Add update_qers
*/
if (isQosEnabled) {
if (isBpfAccelerationEnabled) {
for (auto it : req->pfcp_ies.update_qers) {
update_qer& qer = it;
uint8_t cause_value = CAUSE_VALUE_REQUEST_ACCEPTED;
......
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