forked from acouzens/open5gs
[PFCP] Fix calculation of AMBR
When converting bitrates from bits per second to kilobits per second, if the conversion results in fractions, the resulting value should be rounded upwards
This commit is contained in:
parent
22cca3eb48
commit
9e20617a8f
|
@ -349,7 +349,7 @@ int16_t ogs_pfcp_parse_sdf_filter(
|
||||||
int16_t ogs_pfcp_build_bitrate(ogs_tlv_octet_t *octet,
|
int16_t ogs_pfcp_build_bitrate(ogs_tlv_octet_t *octet,
|
||||||
ogs_pfcp_bitrate_t *bitrate, void *data, int data_len)
|
ogs_pfcp_bitrate_t *bitrate, void *data, int data_len)
|
||||||
{
|
{
|
||||||
ogs_pfcp_bitrate_t target;
|
uint64_t target;
|
||||||
int16_t size = 0;
|
int16_t size = 0;
|
||||||
|
|
||||||
ogs_assert(bitrate);
|
ogs_assert(bitrate);
|
||||||
|
@ -358,18 +358,25 @@ int16_t ogs_pfcp_build_bitrate(ogs_tlv_octet_t *octet,
|
||||||
ogs_assert(data_len >= OGS_PFCP_BITRATE_LEN);
|
ogs_assert(data_len >= OGS_PFCP_BITRATE_LEN);
|
||||||
|
|
||||||
octet->data = data;
|
octet->data = data;
|
||||||
memcpy(&target, bitrate, sizeof(ogs_pfcp_bitrate_t));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ch 8.15 Bearer QoS in TS 29.274 v15.9.0
|
* Ch 8.15 Bearer QoS in TS 29.274 v15.9.0
|
||||||
*
|
*
|
||||||
* The UL/DL MBR and GBR fields are encoded as kilobits
|
* The UL/DL MBR and GBR fields are encoded as kilobits
|
||||||
* per second (1 kbps = 1000 bps) in binary value.
|
* per second (1 kbps = 1000 bps) in binary value.
|
||||||
|
* The UL/DL MBR and GBR fields may require converting values
|
||||||
|
* in bits per second to kilobits per second when the UL/DL MBR
|
||||||
|
* and GBR values are received from an interface other than GTPv2
|
||||||
|
* interface. If such conversions result in fractions, then
|
||||||
|
* the value of UL/DL MBR and GBR fields shall be rounded upwards.
|
||||||
*/
|
*/
|
||||||
ogs_uint64_to_buffer(target.uplink / 1000, 5,
|
target = (bitrate->uplink / 1000) + ((bitrate->uplink % 1000) ? 1 : 0);
|
||||||
|
ogs_uint64_to_buffer(target, 5,
|
||||||
(unsigned char *)octet->data + size);
|
(unsigned char *)octet->data + size);
|
||||||
size += 5;
|
size += 5;
|
||||||
ogs_uint64_to_buffer(target.downlink / 1000, 5,
|
|
||||||
|
target = (bitrate->downlink / 1000) + ((bitrate->downlink % 1000) ? 1 : 0);
|
||||||
|
ogs_uint64_to_buffer(target, 5,
|
||||||
(unsigned char *)octet->data + size);
|
(unsigned char *)octet->data + size);
|
||||||
size += 5;
|
size += 5;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue