Commit 0c282ab3 authored by Franck Messaoudi's avatar Franck Messaoudi

Add: adding rules to the maps

parent 24f4c7b8
################################################################################
# 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
################################################################################
# OAI UPF EBPF MAP SIZES Configuration File
###
# This configuration file defines key parameters for optimizing memory allocation and tuning the User Plane Function (UPF). The values set in this file directly impact the size of eBPF maps used for packet processing.
# Configuration Parameters. Each parameter in this file controls a specific aspect of UPF behavior.
# 1. Network Interface Limits
# max_upf_interfaces (Default: 8)
# Specifies the maximum number of network interfaces that UPF can manage.
# Example: Physical/virtual interfaces for GTP-U traffic.
# max_upf_redirect_interfaces (Default: 4)
# Defines the maximum number of interfaces used for traffic redirection.
# Example: Used in PDRs for forwarding packets to specific egress interfaces.
max_upf_interfaces = 8
max_upf_redirect_interfaces = 4
# 2. Session and Rule Limits
# max_pdu_session (Default: 10,000)
# Determines the maximum number of concurrent PDU sessions that UPF can handle.
# Affects the memory allocation for session-related eBPF maps.
# max_pdrs_per_pdu_session (Default: 8)
# Defines the maximum number of Packet Detection Rules (PDRs) that can be applied per PDU session.
# PDRs dictate how packets are processed, forwarded, or dropped.
# max_qos_flows_per_pdu_session (Default: 8)
# Sets the maximum number of QoS flows that a single PDU session can manage.
# Impacts QoS-related eBPF maps (e.g., shaping, policing).
# max_sdf_filters_per_pdu_session (Default: 8)
# Specifies the maximum number of Service Data Flow (SDF) filters per session.
# SDF filters define how traffic is classified within a QoS flow.
max_pdu_session = 10000
max_pdrs_per_pdu_session = 8
max_qos_flows_per_pdu_session = 8
max_sdf_filters_per_pdu_session = 8
# 3. ARP Table Limit
# max_arp_entries (Default: 4)
# Limits the number of ARP table entries stored in eBPF maps.
# Used for resolving MAC addresses in the UPF forwarding path.
max_arp_entries = 1572
# Usage Instructions
# Modify Configuration Values
# Edit the file ebpf_maps.conf to adjust UPF parameters based on deployment needs.
# Example:
# max_pdu_session = 5000
# max_pdrs_per_pdu_session = 16
# Loading the Configuration in Code
# A configuration parser (e.g., ConfigLoader) should read this file and apply the values at runtime.
# Example (C++):
# ConfigLoader config;
# config.loadConfig("upf_config.conf");
# int max_pdu_sessions = config.getValue("max_pdu_session", 10000);
# Memory Optimization
# Ensure the values are optimized to avoid excessive memory usage.
# Example: Reducing max_pdu_session decreases memory footprint.
# Best Practices
# Monitor Resource Usage: Adjust values based on system memory and performance requirements.
# Tune PDU Session Limits: Increase max_pdu_session if handling high session loads.
# Optimize QoS Handling: Set appropriate values for max_qos_flows_per_pdu_session based on traffic characteristics.
#ifndef __GATE_STATUS_H__
#define __GATE_STATUS_H__
#include <types.h>
#include <ie/ie_base.h>
// 8.2.7 Gate Status
enum gate_status_e {
/* Request / Initial message */
OPEN = 0,
CLOSED = 1
};
typedef struct gate_status_s {
u8 ul_gate : 2;
u8 dl_gate : 2;
} gate_status_t;
#endif // __GATE_STATUS_H__
\ No newline at end of file
#if !defined(CREATE_QER_H)
#define CREATE_QER_H
#include <ie/ie_base.h>
#include <ie/qer_id.h>
#include <ie/qer_correlation_id.h>
#include <ie/gate_status.h>
#include <ie/guaranteed_bitrate.h>
#include <ie/maximum_bitrate.h>
#include <ie/qos_flow_identifier.h>
#include <ie/reflective_qos.h>
#include <ie/paging_policy_indicator.h>
//------------------------------------------------------------------------------
// Table 7.5.2.5-1: Create QER IE within PFCP Session Establishment Request
typedef struct create_qer_s {
qer_id_t_ qer_id;
qer_correlation_id_t qer_correlation_id;
gate_status_t gate_status;
mbr_t maximum_bitrate;
gbr_t guaranteed_bitrate;
qfi_t qos_flow_identifier;
rqi_t reflective_qos;
paging_policy_indicator_t paging_policy_indicator;
} create_qer_t;
#endif // CREATE_QER_H
#ifndef __GUARANTEED_BITRATE_H__
#define __GUARANTEED_BITRATE_H__
#include <types.h>
#include <ie/ie_base.h>
// 8.2.9 GBR
typedef struct gbr_s {
u64 ul_gbr;
u64 dl_gbr;
} gbr_t;
#endif // __GUARANTEED_BITRATE_H__
\ No newline at end of file
#ifndef __MAXIMUM_BITRATE_H__
#define __MAXIMUM_BITRATE_H__
#include <types.h>
#include <ie/ie_base.h>
// 8.2.8 MBR
typedef struct mbr_s {
u64 ul_mbr;
u64 dl_mbr;
} mbr_t;
#endif // __MAXIMUM_BITRATE_H__
\ No newline at end of file
#ifndef __PAGING_POLICY_INDICATOR_H__
#define __PAGING_POLICY_INDICATOR_H__
#include <types.h>
#include <ie/ie_base.h>
// 8.2.116 Paging Policy Indicator (PPI)
typedef struct paging_policy_indicator_s {
u8 spare : 4;
u8 ppi_value : 4;
} paging_policy_indicator_t;
#endif // __PAGING_POLICY_INDICATOR_H__
\ No newline at end of file
#ifndef __QER_CORRELATION_ID_H__
#define __QER_CORRELATION_ID_H__
#include <types.h>
#include <ie/ie_base.h>
//-------------------------------------
// 8.2.10 QER Correlation ID
typedef struct qer_correlation_id_s {
u32 qer_correlation_id;
} qer_correlation_id_t;
#endif // __QER_CORRELATION_ID_H__
\ No newline at end of file
#ifndef __QOS_FLOW_IDENTIFIER_H__
#define __QOS_FLOW_IDENTIFIER_H__
#include <types.h>
#include <ie/ie_base.h>
// 8.2.89 QFI
typedef struct qfi_s {
u8 spare : 2;
u8 qfi : 6;
// qfi_s() : qfi(0), spare(0) {}
// qfi_s(const u8& q) : qfi(q), spare(0) {}
// qfi_s(const struct qfi_s& q) : qfi(q.qfi), spare(q.spare) {}
// inline bool operator==(const struct qfi_s& rhs) const {
// return ((qfi == rhs.qfi) && (spare == rhs.spare));
// }
// inline bool operator!=(const struct qfi_s& rhs) const {
// return !((qfi == rhs.qfi) && (spare == rhs.spare));
// }
} qfi_t;
#endif // __QOS_FLOW_IDENTIFIER_H__
\ No newline at end of file
#ifndef __REFLECTIVE_QOS_H__
#define __REFLECTIVE_QOS_H__
#include <types.h>
#include <ie/ie_base.h>
/// 8.2.88 RQI
typedef struct rqi_s {
u8 spare : 7;
u8 rqi : 1;
} rqi_t;
#endif // __REFLECTIVE_QOS_H__
\ No newline at end of file
#ifndef __PFCP_QER_H__
#define __PFCP_QER_H__
#include <types.h>
#include <ie/group_ie/create_qer.h>
#include <ie/qer_id.h>
#include <ie/qer_correlation_id.h>
#include <ie/gate_status.h>
#include <ie/guaranteed_bitrate.h>
#include <ie/maximum_bitrate.h>
#include <ie/qos_flow_identifier.h>
#include <ie/reflective_qos.h>
#include <ie/paging_policy_indicator.h>
typedef struct pfcp_qer_s {
qer_id_t_ qer_id;
qer_correlation_id_t qer_correlation_id;
gate_status_t gate_status;
mbr_t maximum_bitrate;
gbr_t guaranteed_bitrate;
qfi_t qos_flow_identifier;
rqi_t reflective_qos;
paging_policy_indicator_t paging_policy_indicator;
} pfcp_qer_t_;
#endif // __PFCP_QER_H__
#ifndef __RULES_MATCHING_PDR_H__
#define __RULES_MATCHING_PDR_H__
#include <pfcp/pfcp_far.h>
#include <pfcp/pfcp_qer.h>
struct rules_match_pdr {
pfcp_far_t_ far;
pfcp_qer_t_ qer;
// TODO: add other RUles here !
};
struct pdrs_per_session {
uint16_t pdr_id;
uint64_t seid;
};
#endif // __RULES_MATCHING_PDR_H__
#ifndef CONFIG_LOADER_H
#define CONFIG_LOADER_H
#include <unordered_map>
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
class ConfigLoader {
public:
static ConfigLoader& getInstance() {
static ConfigLoader instance; // Singleton instance
return instance;
}
bool loadConfig(const std::string& filename) {
std::ifstream file(filename);
if (!file) {
std::cerr << "Error: Cannot open config file " << filename << std::endl;
return false;
}
std::string line;
while (std::getline(file, line)) {
std::istringstream is_line(line);
std::string key;
if (std::getline(is_line, key, '=')) {
std::string value;
if (std::getline(is_line, value)) {
config[key] = std::stoi(value);
}
}
}
file.close();
return true;
}
int getValue(const std::string& key, int default_value = 0) {
return (config.find(key) != config.end()) ? config[key] : default_value;
}
private:
ConfigLoader() {} // Private constructor
std::unordered_map<std::string, int> config;
};
#endif // CONFIG_LOADER_H
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