Refactor QoS parameter types and consolidate definitions

- Move QoS-related enums and structures from ngap_messages_types.h to 5g_platform_types.h
- Replace ngap_* QoS types with generic qos_* types for better reusability
- Update field names from allocation_retention_priority to arp for consistency
- Update all references across RRC and NGAP modules to use new type names
- Remove duplicate QoS type definitions from NGAP-specific header

This improves code organization by centralizing QoS parameter definitions
in a common platform types header and eliminates NGAP-specific naming
in favor of more generic, reusable type definitions.
This commit is contained in:
Guido Casati
2025-09-24 15:48:40 +02:00
parent 7254e59df9
commit 50923823c0
5 changed files with 62 additions and 59 deletions

View File

@@ -55,4 +55,53 @@ typedef enum {
typedef enum { NON_DYNAMIC, DYNAMIC } fiveQI_t;
/* QoS Priority Level */
typedef enum {
QOS_PRIORITY_SPARE = 0,
QOS_PRIORITY_HIGHEST,
QOS_PRIORITY_2,
QOS_PRIORITY_3,
QOS_PRIORITY_4,
QOS_PRIORITY_5,
QOS_PRIORITY_6,
QOS_PRIORITY_7,
QOS_PRIORITY_8,
QOS_PRIORITY_9,
QOS_PRIORITY_10,
QOS_PRIORITY_11,
QOS_PRIORITY_12,
QOS_PRIORITY_13,
QOS_PRIORITY_LOWEST,
QOS_NO_PRIORITY
} qos_priority_t;
/* Pre-emption Capability */
typedef enum {
PEC_SHALL_NOT_TRIGGER_PREEMPTION = 0,
PEC_MAY_TRIGGER_PREEMPTION,
PEC_MAX,
} qos_pec_t;
/* Pre-emption Vulnerability */
typedef enum {
PEV_NOT_PREEMPTABLE = 0,
PEV_PREEMPTABLE = 1,
PEV_MAX,
} qos_pev_t;
/* Allocation Retention Priority */
typedef struct {
qos_priority_t priority_level;
qos_pec_t pre_emp_capability;
qos_pev_t pre_emp_vulnerability;
} qos_arp_t;
typedef struct pdusession_level_qos_parameter_s {
uint8_t qfi;
uint64_t fiveQI;
uint64_t qos_priority;
fiveQI_t fiveQI_type;
qos_arp_t arp;
} pdusession_level_qos_parameter_t;
#endif

View File

@@ -139,43 +139,6 @@ typedef struct ngap_ambr_s {
bitrate_t br_dl;
} ngap_ambr_t;
typedef enum ngap_priority_level_s {
NGAP_PRIORITY_LEVEL_SPARE = 0,
NGAP_PRIORITY_LEVEL_HIGHEST = 1,
NGAP_PRIORITY_LEVEL_2 = 2,
NGAP_PRIORITY_LEVEL_3 = 3,
NGAP_PRIORITY_LEVEL_4 = 4,
NGAP_PRIORITY_LEVEL_5 = 5,
NGAP_PRIORITY_LEVEL_6 = 6,
NGAP_PRIORITY_LEVEL_7 = 7,
NGAP_PRIORITY_LEVEL_8 = 8,
NGAP_PRIORITY_LEVEL_9 = 9,
NGAP_PRIORITY_LEVEL_10 = 10,
NGAP_PRIORITY_LEVEL_11 = 11,
NGAP_PRIORITY_LEVEL_12 = 12,
NGAP_PRIORITY_LEVEL_13 = 13,
NGAP_PRIORITY_LEVEL_LOWEST = 14,
NGAP_PRIORITY_LEVEL_NO_PRIORITY = 15
} ngap_priority_level_t;
typedef enum ngap_pre_emp_capability_e {
NGAP_PRE_EMPTION_CAPABILITY_SHALL_NOT_TRIGGER_PREEMPTION = 0,
NGAP_PRE_EMPTION_CAPABILITY_MAY_TRIGGER_PREEMPTION = 1,
NGAP_PRE_EMPTION_CAPABILITY_MAX,
} ngap_pre_emp_capability_t;
typedef enum ngap_pre_emp_vulnerability_e {
NGAP_PRE_EMPTION_VULNERABILITY_NOT_PREEMPTABLE = 0,
NGAP_PRE_EMPTION_VULNERABILITY_PREEMPTABLE = 1,
NGAP_PRE_EMPTION_VULNERABILITY_MAX,
} ngap_pre_emp_vulnerability_t;
typedef struct ngap_allocation_retention_priority_s {
ngap_priority_level_t priority_level;
ngap_pre_emp_capability_t pre_emp_capability;
ngap_pre_emp_vulnerability_t pre_emp_vulnerability;
} ngap_allocation_retention_priority_t;
typedef struct ngap_security_capabilities_s {
uint16_t nRencryption_algorithms;
uint16_t nRintegrity_algorithms;
@@ -203,14 +166,6 @@ typedef enum ngap_rrc_establishment_cause_e {
NGAP_RRC_CAUSE_LAST
} ngap_rrc_establishment_cause_t;
typedef struct pdusession_level_qos_parameter_s {
uint8_t qfi;
uint64_t fiveQI;
uint64_t qos_priority;
fiveQI_t fiveQI_type;
ngap_allocation_retention_priority_t allocation_retention_priority;
} pdusession_level_qos_parameter_t;
typedef struct fiveg_s_tmsi_s {
uint16_t amf_set_id;
uint8_t amf_pointer;

View File

@@ -38,6 +38,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "5g_platform_types.h"
#include "openair2/RRC/NR/nr_rrc_proto.h"
#include "openair2/RRC/NR/rrc_gNB_UE_context.h"
#include "openair3/SECU/key_nas_deriver.h"
@@ -2464,13 +2465,11 @@ f1ap_qos_flow_param_t get_qos_char_from_qos_flow_param(const pdusession_level_qo
qos_char.qos_type = NON_DYNAMIC;
qos_char.nondyn.fiveQI = qos_param->fiveQI;
}
const ngap_allocation_retention_priority_t *a = &qos_param->allocation_retention_priority;
const qos_arp_t *a = &qos_param->arp;
qos_char.arp.prio = a->priority_level;
qos_char.arp.preempt_cap = a->pre_emp_capability == NGAP_PRE_EMPTION_CAPABILITY_MAY_TRIGGER_PREEMPTION
? MAY_TRIGGER_PREEMPTION
: SHALL_NOT_TRIGGER_PREEMPTION;
qos_char.arp.preempt_vuln =
a->pre_emp_vulnerability == NGAP_PRE_EMPTION_VULNERABILITY_PREEMPTABLE ? PREEMPTABLE : NOT_PREEMPTABLE;
qos_char.arp.preempt_cap =
a->pre_emp_capability == PEC_MAY_TRIGGER_PREEMPTION ? MAY_TRIGGER_PREEMPTION : SHALL_NOT_TRIGGER_PREEMPTION;
qos_char.arp.preempt_vuln = a->pre_emp_vulnerability == PEV_PREEMPTABLE ? PREEMPTABLE : NOT_PREEMPTABLE;
return qos_char;
}

View File

@@ -368,11 +368,11 @@ bool trigger_bearer_setup(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, int n, pdusession
qos_char->non_dynamic.qos_priority_level = qos_session->qos_priority;
}
ngran_allocation_retention_priority_t *rent_priority = &qos_flow->qos_params.alloc_reten_priority;
ngap_allocation_retention_priority_t *rent_priority_in = &qos_session->allocation_retention_priority;
rent_priority->priority_level = rent_priority_in->priority_level;
rent_priority->preemption_capability = rent_priority_in->pre_emp_capability;
rent_priority->preemption_vulnerability = rent_priority_in->pre_emp_vulnerability;
ngran_allocation_retention_priority_t *arp_out = &qos_flow->qos_params.alloc_reten_priority;
qos_arp_t *arp_in = &qos_session->arp;
arp_out->priority_level = arp_in->priority_level;
arp_out->preemption_capability = arp_in->pre_emp_capability;
arp_out->preemption_vulnerability = arp_in->pre_emp_vulnerability;
}
}
}

View File

@@ -201,9 +201,9 @@ pdusession_level_qos_parameter_t fill_qos(uint8_t qfi, const NGAP_QosFlowLevelQo
}
// Allocation and Retention Priority
const NGAP_AllocationAndRetentionPriority_t *arp = &params->allocationAndRetentionPriority;
out.allocation_retention_priority.priority_level = arp->priorityLevelARP;
out.allocation_retention_priority.pre_emp_capability = arp->pre_emptionCapability;
out.allocation_retention_priority.pre_emp_vulnerability = arp->pre_emptionVulnerability;
out.arp.priority_level = arp->priorityLevelARP;
out.arp.pre_emp_capability = arp->pre_emptionCapability;
out.arp.pre_emp_vulnerability = arp->pre_emptionVulnerability;
return out;
}