nft_kpi: add rate_ctr gtpu:ue_bytes:ul,dl
So far we have the nftables based counters for total GTP-U bytes (UL, DL), as well as a packet count. Add another counter for the computed UE payload bytes: total_bytes - packets * (20 + 8 + 8) Related: SYS#6773 Change-Id: Ib2f0a9252715ea4b2fe9c367aa65f771357768ca
This commit is contained in:
parent
8809baafc4
commit
532968d766
|
@ -139,8 +139,10 @@ enum hnb_rate_ctr {
|
|||
|
||||
HNB_CTR_GTPU_PACKETS_UL,
|
||||
HNB_CTR_GTPU_TOTAL_BYTES_UL,
|
||||
HNB_CTR_GTPU_UE_BYTES_UL,
|
||||
HNB_CTR_GTPU_PACKETS_DL,
|
||||
HNB_CTR_GTPU_TOTAL_BYTES_DL,
|
||||
HNB_CTR_GTPU_UE_BYTES_DL,
|
||||
};
|
||||
|
||||
enum hnb_stat {
|
||||
|
|
|
@ -6,7 +6,8 @@ struct hnb_persistent;
|
|||
|
||||
struct nft_kpi_val {
|
||||
uint64_t packets;
|
||||
uint64_t bytes;
|
||||
uint64_t total_bytes;
|
||||
uint64_t ue_bytes;
|
||||
|
||||
bool handle_present;
|
||||
int64_t handle;
|
||||
|
|
|
@ -468,6 +468,10 @@ const struct rate_ctr_desc hnb_ctr_description[] = {
|
|||
"gtpu:total_bytes:ul",
|
||||
"Count of total GTP-U bytes received from the HNB, including the GTP-U/UDP/IP headers",
|
||||
},
|
||||
[HNB_CTR_GTPU_UE_BYTES_UL] = {
|
||||
"gtpu:ue_bytes:ul",
|
||||
"Assuming an IP header length of 20 bytes, GTP-U bytes received from the HNB, excluding the GTP-U/UDP/IP headers",
|
||||
},
|
||||
[HNB_CTR_GTPU_PACKETS_DL] = {
|
||||
"gtpu:packets:dl",
|
||||
"Count of GTP-U packets sent to the HNB",
|
||||
|
@ -476,6 +480,10 @@ const struct rate_ctr_desc hnb_ctr_description[] = {
|
|||
"gtpu:total_bytes:dl",
|
||||
"Count of total GTP-U bytes sent to the HNB, including the GTP-U/UDP/IP headers",
|
||||
},
|
||||
[HNB_CTR_GTPU_UE_BYTES_DL] = {
|
||||
"gtpu:ue_bytes:dl",
|
||||
"Assuming an IP header length of 20 bytes, GTP-U bytes sent to the HNB, excluding the GTP-U/UDP/IP headers",
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -268,7 +268,21 @@ static void hnb_update_counters(struct hnb_persistent *hnbp, bool ul, int64_t pa
|
|||
&val->packets, packets);
|
||||
update_ctr(hnbp->ctrs,
|
||||
ul ? HNB_CTR_GTPU_TOTAL_BYTES_UL : HNB_CTR_GTPU_TOTAL_BYTES_DL,
|
||||
&val->bytes, bytes);
|
||||
&val->total_bytes, bytes);
|
||||
|
||||
/* Assuming an IP header of 20 bytes, derive the GTP-U payload size:
|
||||
*
|
||||
* [...] \ \
|
||||
* [ UDP ][ TCP ] | UE payload | nft reports these bytes
|
||||
* [ IP ] / |
|
||||
* -- payload -- |
|
||||
* [ GTP-U 8 bytes ] | \
|
||||
* [ UDP 8 bytes ] | | need to subtract these, ~20 + 8 + 8
|
||||
* [ IP 20 bytes ] / /
|
||||
*/
|
||||
update_ctr(hnbp->ctrs,
|
||||
ul ? HNB_CTR_GTPU_UE_BYTES_UL : HNB_CTR_GTPU_UE_BYTES_DL,
|
||||
&val->ue_bytes, bytes - OSMO_MIN(bytes, packets * (20 + 8 + 8)));
|
||||
}
|
||||
|
||||
/* In the string section *pos .. end, find the first occurrence of after_str and return the following token, which ends
|
||||
|
|
Loading…
Reference in New Issue