[SMF] Fix Volume/Time Threshold conversion Gy->PFCP

AS shown in 3GPP TS 29.244 C.2.1.1 diagram, the meaning of Threshold
value is different in Diameter Gy and in PFCP interfaces.
In Diameter Gy the value sets the trigger for the "remaining credit",
while in PFCP the value sets the trigger for the "used credit".

ThresholdPFCP = Quota - ThresholdGy
This commit is contained in:
Pau Espin 2024-04-05 14:07:21 +02:00 committed by Sukchan Lee
parent 8484a5af60
commit e078b33f0c
1 changed files with 10 additions and 5 deletions

View File

@ -47,12 +47,14 @@ static void urr_update_volume(smf_sess_t *sess, ogs_pfcp_urr_t *urr, ogs_diam_gy
urr->vol_quota.total_volume = 0;
}
/* Volume Threshold */
if (gy_message->cca.volume_threshold) {
/* Volume Threshold, requires Volume Quota for calculations */
if (gy_message->cca.volume_threshold &&
gy_message->cca.granted.cc_total_octets >= gy_message->cca.volume_threshold) {
ogs_debug("Adding Volume Threshold total_octets=%" PRIu32, gy_message->cca.volume_threshold);
urr->rep_triggers.volume_threshold = 1;
urr->vol_threshold.tovol = 1;
urr->vol_threshold.total_volume = gy_message->cca.volume_threshold;
urr->vol_threshold.total_volume = (gy_message->cca.granted.cc_total_octets -
gy_message->cca.volume_threshold);
} else {
urr->rep_triggers.volume_threshold = 0;
urr->vol_threshold.tovol = 0;
@ -94,6 +96,7 @@ static void urr_update_time(smf_sess_t *sess, ogs_pfcp_urr_t *urr, ogs_diam_gy_m
urr->meas_method &= ~OGS_PFCP_MEASUREMENT_METHOD_DURATION;
}
/* Time Quota */
if (time_quota) {
ogs_debug("Adding Time Quota secs=%" PRIu32, time_quota);
urr->rep_triggers.time_quota = 1;
@ -103,10 +106,12 @@ static void urr_update_time(smf_sess_t *sess, ogs_pfcp_urr_t *urr, ogs_diam_gy_m
urr->time_quota = 0;
}
if (gy_message->cca.time_threshold) {
/* Time Threshold, requires Time Quota for calculations */
if (gy_message->cca.time_threshold &&
time_quota >= gy_message->cca.time_threshold) {
ogs_debug("Adding Time Threshold secs=%" PRIu32, gy_message->cca.time_threshold);
urr->rep_triggers.time_threshold = 1;
urr->time_threshold = gy_message->cca.time_threshold;
urr->time_threshold = (time_quota - gy_message->cca.time_threshold);
} else {
urr->rep_triggers.time_threshold = 0;
urr->time_threshold = 0;