From a4cf31cded71dbb49c998d57cfef677b758eee2b Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Wed, 1 Sep 2021 14:22:53 -0700 Subject: [PATCH 01/22] Add static rate limit on slice traffic --- conf/parser.py | 16 ++++++++++++++++ conf/up4.bess | 20 ++++++++++++++++++++ conf/upf.json | 8 ++++++++ 3 files changed, 44 insertions(+) diff --git a/conf/parser.py b/conf/parser.py index 0987ffdde..c50d6d46f 100644 --- a/conf/parser.py +++ b/conf/parser.py @@ -49,6 +49,10 @@ def __init__(self, fname): self.enable_ntf = False self.notify_sockaddr = "/tmp/notifycp" self.endmarker_sockaddr = "/tmp/pfcpport" + self.slice_uplink_rate_limit_bps = None + self.slice_downlink_rate_limit_bps = None + self.slice_uplink_burst_bits = None + self.slice_downlink_burst_bits = None def parse(self, ifaces): # Maximum number of flows to manage ip4 frags for re-assembly @@ -149,6 +153,18 @@ def parse(self, ifaces): print('Can\'t parse interface name(s)! Setting it to default values ({}, {})'.format( "access", "core")) + # Slice rate limits + try: + self.slice_uplink_rate_limit_bps = self.conf["slice_rate_limit_config"]["uplink_bps"] + self.slice_uplink_burst_bits = self.conf["slice_rate_limit_config"]["uplink_burst_bits"] + except KeyError: + print("No slice uplink rate limit! Disabling rate limit.") + try: + self.slice_downlink_rate_limit_bps = self.conf["slice_rate_limit_config"]["downlink_bps"] + self.slice_downlink_burst_bits = self.conf["slice_rate_limit_config"]["downlink_burst_bits"] + except KeyError: + print("No slice downlink rate limit! Disabling rate limit.") + # UnixPort Paths try: self.notify_sockaddr = self.conf["notify_sockaddr"] diff --git a/conf/up4.bess b/conf/up4.bess index 338150990..a02ce3d6b 100644 --- a/conf/up4.bess +++ b/conf/up4.bess @@ -289,8 +289,18 @@ _in:gate \ # 3. Complete the last part of the DL pipeline executeFAR:farForwardDAction \ -> postDLQoSCounter::Counter(name_id='ctr_id', check_exist=True, total=parser.max_sessions) \ + -> dlRateLimiter::Queue(size=128) \ -> ports[parser.access_ifname].rtr +if parser.slice_downlink_rate_limit_bps is not None: + burst = None + if parser.slice_downlink_burst_bits is not None: + burst = {'bit': parser.slice_downlink_burst_bits} + bess.add_tc('dl_rate_limiter', policy='rate_limit', resource='bit', + limit={'bit': parser.slice_downlink_rate_limit_bps}, + max_burst=burst) + dlRateLimiter.attach_task(parent='dl_rate_limiter') + # Drop unknown packets coreRxIPCksum:1 -> coreRxIPCksumFail::Sink() coreRxUDPCksum:1 -> coreRxUDPCksumFail::Sink() @@ -347,8 +357,18 @@ _in:gate \ # 3. Complete the last part of the UL pipeline executeFAR:farForwardUAction \ -> postULQoSCounter::Counter(name_id='ctr_id', check_exist=True, total=parser.max_sessions) \ + -> ulRateLimiter::Queue(size=128) \ -> ports[parser.core_ifname].rtr +if parser.slice_uplink_rate_limit_bps is not None: + burst = None + if parser.slice_uplink_burst_bits is not None: + burst = {'bit': parser.slice_uplink_burst_bits} + bess.add_tc('ul_rate_limiter', policy='rate_limit', resource='bit', + limit={'bit': parser.slice_uplink_rate_limit_bps}, + max_burst=burst) + ulRateLimiter.attach_task(parent='ul_rate_limiter') + # 4. GTP Echo response pipeline accessFastBPF:GTPUEchoGate \ -> gtpuEcho::GtpuEcho(s1u_sgw_ip=ip2long(access_ip[0])):1 \ diff --git a/conf/upf.json b/conf/upf.json index 239522fd0..67e957db2 100644 --- a/conf/upf.json +++ b/conf/upf.json @@ -89,6 +89,14 @@ "priority": 5 } ], + + "slice_rate_limit_config": { + "uplink_bps": 500000000, + "uplink_burst_bits": 12000, + "downlink_bps": 500000000, + "downlink_burst_bits": 12000 + }, + "": "Control plane controller settings", "cpiface": { "enable_ue_ip_alloc": false, From 4574de899963e989ec6e33168912e79613b75ed5 Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Thu, 2 Sep 2021 15:02:42 -0700 Subject: [PATCH 02/22] Implement metering with QoS module --- conf/parser.py | 20 ++++++++++------- conf/up4.bess | 60 ++++++++++++++++++++++++++++++++------------------ conf/upf.json | 4 ++-- 3 files changed, 52 insertions(+), 32 deletions(-) diff --git a/conf/parser.py b/conf/parser.py index c50d6d46f..744574d3f 100644 --- a/conf/parser.py +++ b/conf/parser.py @@ -49,10 +49,10 @@ def __init__(self, fname): self.enable_ntf = False self.notify_sockaddr = "/tmp/notifycp" self.endmarker_sockaddr = "/tmp/pfcpport" - self.slice_uplink_rate_limit_bps = None - self.slice_downlink_rate_limit_bps = None - self.slice_uplink_burst_bits = None - self.slice_downlink_burst_bits = None + self.slice_uplink_rate_limit_bytes_per_second = None + self.slice_downlink_rate_limit_bytes_per_second = None + self.slice_uplink_burst_bytes = None + self.slice_downlink_burst_bytes = None def parse(self, ifaces): # Maximum number of flows to manage ip4 frags for re-assembly @@ -155,14 +155,18 @@ def parse(self, ifaces): # Slice rate limits try: - self.slice_uplink_rate_limit_bps = self.conf["slice_rate_limit_config"]["uplink_bps"] - self.slice_uplink_burst_bits = self.conf["slice_rate_limit_config"]["uplink_burst_bits"] + self.slice_uplink_rate_limit_bytes_per_second = int(self.conf["slice_rate_limit_config"]["uplink_bps"] / 8) + self.slice_uplink_burst_bytes = self.conf["slice_rate_limit_config"]["uplink_burst_bytes"] except KeyError: + self.slice_uplink_rate_limit_bytes_per_second = None + self.slice_uplink_burst_bytes = None print("No slice uplink rate limit! Disabling rate limit.") try: - self.slice_downlink_rate_limit_bps = self.conf["slice_rate_limit_config"]["downlink_bps"] - self.slice_downlink_burst_bits = self.conf["slice_rate_limit_config"]["downlink_burst_bits"] + self.slice_downlink_rate_limit_bytes_per_second = int(self.conf["slice_rate_limit_config"]["downlink_bps"] / 8) + self.slice_downlink_burst_bytes = self.conf["slice_rate_limit_config"]["downlink_burst_bytes"] except KeyError: + self.slice_downlink_rate_limit_bytes_per_second = None + self.slice_downlink_burst_bytes = None print("No slice downlink rate limit! Disabling rate limit.") # UnixPort Paths diff --git a/conf/up4.bess b/conf/up4.bess index a02ce3d6b..f7949bd14 100644 --- a/conf/up4.bess +++ b/conf/up4.bess @@ -204,6 +204,42 @@ _in -> qerLookup::Qos(fields=[ {'attr_name':'src_iface', 'num_bytes':1}, \ {'attr_name':'fseid', 'num_bytes':8}], \ values=[{'attr_name':'qfi', 'num_bytes':1}]) +executeFAR::Split(size=1, attribute='action') +afterFarMerge = executeFAR +if parser.slice_uplink_rate_limit_bytes_per_second is not None or parser.slice_downlink_rate_limit_bytes_per_second is not None: + # sliceMeter enforces a per slice, per direction meter rate limit + sliceMeter::Qos(fields=[{'attr_name':'src_iface', 'num_bytes':1}]) + # Reserved gates, reject rule adds with gate=1/2/3 + m_meter = 0 # Placeholder gate not connected. Will meter if lookup result returns this gate + m_green = 1 # For green traffic + m_yellow = 2 # For yellow traffic + m_red = 3 # For red traffic + # User defined gates + m_fail = 4 # For lookup failure traffic + # Admit green and yellow, drop red + sliceMeter:m_green -> executeFAR + sliceMeter:m_yellow -> executeFAR + sliceMeter:m_red -> red::Sink() + sliceMeter:m_fail -> fail::Sink() + sliceMeter.set_default_gate(gate=m_fail) + # Add two static slice meter entries for uplink and downlink. + # cir and pir are equal, meaning we have no yellow packets. + if parser.slice_uplink_rate_limit_bytes_per_second is not None: + sliceMeter.add(fields=[{'value_int': Access}], + gate=m_meter, + cir=parser.slice_uplink_rate_limit_bytes_per_second, + pir=parser.slice_uplink_rate_limit_bytes_per_second, + cbs=parser.slice_uplink_burst_bytes, + pbs=parser.slice_uplink_burst_bytes) + if parser.slice_downlink_rate_limit_bytes_per_second is not None: + sliceMeter.add(fields=[{'value_int': Core}], + gate=m_meter, + cir=parser.slice_downlink_rate_limit_bytes_per_second, + pir=parser.slice_downlink_rate_limit_bytes_per_second, + cbs=parser.slice_downlink_burst_bytes, + pbs=parser.slice_downlink_burst_bytes) + afterFarMerge = sliceMeter + farLookup::ExactMatch(fields=[{'attr_name':'far_id', 'num_bytes':4}, \ {'attr_name':'fseid', 'num_bytes':8}], \ values=[{'attr_name':'action', 'num_bytes':1}, \ @@ -213,7 +249,7 @@ farLookup::ExactMatch(fields=[{'attr_name':'far_id', 'num_bytes':4}, \ {'attr_name':'tunnel_out_teid', 'num_bytes':4}, \ {'attr_name':'tunnel_out_udp_port', 'num_bytes':2}]):noGTPUEncap \ -> farMerge::Merge() \ - -> executeFAR::Split(size=1, attribute='action') + -> afterFarMerge # Add logical pipeline when gtpudecap is needed pdrLookup:GTPUDecap \ @@ -289,18 +325,8 @@ _in:gate \ # 3. Complete the last part of the DL pipeline executeFAR:farForwardDAction \ -> postDLQoSCounter::Counter(name_id='ctr_id', check_exist=True, total=parser.max_sessions) \ - -> dlRateLimiter::Queue(size=128) \ -> ports[parser.access_ifname].rtr -if parser.slice_downlink_rate_limit_bps is not None: - burst = None - if parser.slice_downlink_burst_bits is not None: - burst = {'bit': parser.slice_downlink_burst_bits} - bess.add_tc('dl_rate_limiter', policy='rate_limit', resource='bit', - limit={'bit': parser.slice_downlink_rate_limit_bps}, - max_burst=burst) - dlRateLimiter.attach_task(parent='dl_rate_limiter') - # Drop unknown packets coreRxIPCksum:1 -> coreRxIPCksumFail::Sink() coreRxUDPCksum:1 -> coreRxUDPCksumFail::Sink() @@ -348,7 +374,7 @@ accessFastBPF:GTPUGate \ _in = accessRxUDPCksum gate = 0 -# 2. Build the remaining first half of the UL pipeline before entering the shard pipeline +# 2. Build the remaining first half of the UL pipeline before entering the shared pipeline #ports[parser.access_ifname].rewrite \ _in:gate \ -> SetMetadata(attrs=[{'name':'src_iface', 'size':1, 'value_int':Access}]) \ @@ -357,18 +383,8 @@ _in:gate \ # 3. Complete the last part of the UL pipeline executeFAR:farForwardUAction \ -> postULQoSCounter::Counter(name_id='ctr_id', check_exist=True, total=parser.max_sessions) \ - -> ulRateLimiter::Queue(size=128) \ -> ports[parser.core_ifname].rtr -if parser.slice_uplink_rate_limit_bps is not None: - burst = None - if parser.slice_uplink_burst_bits is not None: - burst = {'bit': parser.slice_uplink_burst_bits} - bess.add_tc('ul_rate_limiter', policy='rate_limit', resource='bit', - limit={'bit': parser.slice_uplink_rate_limit_bps}, - max_burst=burst) - ulRateLimiter.attach_task(parent='ul_rate_limiter') - # 4. GTP Echo response pipeline accessFastBPF:GTPUEchoGate \ -> gtpuEcho::GtpuEcho(s1u_sgw_ip=ip2long(access_ip[0])):1 \ diff --git a/conf/upf.json b/conf/upf.json index 67e957db2..1b4677b57 100644 --- a/conf/upf.json +++ b/conf/upf.json @@ -92,9 +92,9 @@ "slice_rate_limit_config": { "uplink_bps": 500000000, - "uplink_burst_bits": 12000, + "uplink_burst_bytes": 3000, "downlink_bps": 500000000, - "downlink_burst_bits": 12000 + "downlink_burst_bytes": 3000 }, "": "Control plane controller settings", From be04e837ca42659648f06448291cecc9b0779158 Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Tue, 7 Sep 2021 13:26:45 -0700 Subject: [PATCH 03/22] Naming cleanup and doc comments --- conf/up4.bess | 4 ++-- conf/upf.json | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/up4.bess b/conf/up4.bess index f7949bd14..f5303b02c 100644 --- a/conf/up4.bess +++ b/conf/up4.bess @@ -219,8 +219,8 @@ if parser.slice_uplink_rate_limit_bytes_per_second is not None or parser.slice_d # Admit green and yellow, drop red sliceMeter:m_green -> executeFAR sliceMeter:m_yellow -> executeFAR - sliceMeter:m_red -> red::Sink() - sliceMeter:m_fail -> fail::Sink() + sliceMeter:m_red -> sliceMeterRed::Sink() + sliceMeter:m_fail -> sliceMeterLookupFail::Sink() sliceMeter.set_default_gate(gate=m_fail) # Add two static slice meter entries for uplink and downlink. # cir and pir are equal, meaning we have no yellow packets. diff --git a/conf/upf.json b/conf/upf.json index 1b4677b57..12d0b482f 100644 --- a/conf/upf.json +++ b/conf/upf.json @@ -90,6 +90,7 @@ } ], + "": "Optional slice-wide meter rate limits", "slice_rate_limit_config": { "uplink_bps": 500000000, "uplink_burst_bytes": 3000, From dff0a17f35981721ecb365d9813933b0d829496d Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Tue, 7 Sep 2021 13:29:46 -0700 Subject: [PATCH 04/22] Add packet length adjustment parameter to QoS module This parameter allows adjusting the packet length value passed to the trtrc meter. It can be used to exclude certain headers or to account for encapsulation. --- conf/up4.bess | 10 ++++++---- core/modules/qos.cc | 8 ++++---- core/modules/qos.h | 8 +++++++- patches/bess/0015-Protobuf-changes-for-Qos.patch | 5 +++-- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/conf/up4.bess b/conf/up4.bess index f5303b02c..dbe230f16 100644 --- a/conf/up4.bess +++ b/conf/up4.bess @@ -6,6 +6,7 @@ from conf.parser import * import conf.ports as port import conf.sim as sim +from scapy.all import Ether port.setup_globals() @@ -199,10 +200,11 @@ if ntf: _in -> ntf _in = ntf -_in -> qerLookup::Qos(fields=[ {'attr_name':'src_iface', 'num_bytes':1}, \ - {'attr_name':'qer_id', 'num_bytes':4}, \ - {'attr_name':'fseid', 'num_bytes':8}], \ - values=[{'attr_name':'qfi', 'num_bytes':1}]) +_in -> qerLookup::Qos(fields=[{'attr_name':'src_iface', 'num_bytes':1}, \ + {'attr_name':'qer_id', 'num_bytes':4}, \ + {'attr_name':'fseid', 'num_bytes':8}], \ + values=[{'attr_name':'qfi', 'num_bytes':1}], + adjust_meter_packet_length=-len(Ether())) executeFAR::Split(size=1, attribute='action') afterFarMerge = executeFAR diff --git a/core/modules/qos.cc b/core/modules/qos.cc index 6427c490d..90bf8702d 100644 --- a/core/modules/qos.cc +++ b/core/modules/qos.cc @@ -31,15 +31,12 @@ #include "qos.h" #include "utils/endian.h" -#include "utils/ether.h" #include "utils/format.h" #include #include #include -using bess::utils::Ethernet; - typedef enum { FIELD_TYPE = 0, VALUE_TYPE } Type; using bess::metadata::Attribute; #define metering_test 0 @@ -130,6 +127,9 @@ CommandResponse Qos::Init(const bess::pb::QosArg &arg) { } table_.Init(total_key_size_); + + adjust_meter_packet_length_ = arg.adjust_meter_packet_length(); + return CommandSuccess(); } @@ -190,7 +190,7 @@ void Qos::ProcessBatch(Context *ctx, bess::PacketBatch *batch) { // meter if ogate is 0 if (ogate == METER_GATE) { uint64_t time = rte_rdtsc(); - uint32_t pkt_len = pkt->total_len() - sizeof(Ethernet); + uint32_t pkt_len = pkt->total_len() + adjust_meter_packet_length_; uint8_t color = rte_meter_trtcm_color_blind_check(&val[j]->m, &val[j]->p, time, pkt_len); diff --git a/core/modules/qos.h b/core/modules/qos.h index 76a534773..00aed2680 100644 --- a/core/modules/qos.h +++ b/core/modules/qos.h @@ -83,7 +83,12 @@ class Qos final : public Module { static const Commands cmds; - Qos() : Module(), default_gate_(), total_key_size_(), fields_() { + Qos() + : Module(), + default_gate_(), + total_key_size_(), + fields_(), + adjust_meter_packet_length_() { max_allowed_workers_ = Worker::kMaxWorkers; size_t len = sizeof(mask) / sizeof(uint64_t); for (size_t i = 0; i < len; i++) @@ -118,6 +123,7 @@ class Qos final : public Module { std::vector values_; Metering table_; uint64_t mask[MAX_FIELDS]; + int adjust_meter_packet_length_; }; #endif // BESS_MODULES_QOS_H diff --git a/patches/bess/0015-Protobuf-changes-for-Qos.patch b/patches/bess/0015-Protobuf-changes-for-Qos.patch index 2280b2fc0..ba00ed9fa 100644 --- a/patches/bess/0015-Protobuf-changes-for-Qos.patch +++ b/patches/bess/0015-Protobuf-changes-for-Qos.patch @@ -11,7 +11,7 @@ diff --git a/protobuf/module_msg.proto b/protobuf/module_msg.proto index 25dfc81e..1f7058cd 100644 --- a/protobuf/module_msg.proto +++ b/protobuf/module_msg.proto -@@ -1291,3 +1291,38 @@ message MplsPopArg { +@@ -1291,3 +1291,39 @@ message MplsPopArg { message WorkerSplitArg { map worker_gates = 1; // ogate -> worker mask } @@ -19,6 +19,7 @@ index 25dfc81e..1f7058cd 100644 +message QosArg { + repeated Field fields = 1; + repeated Field values = 2; ++ int64 adjust_meter_packet_length = 3; +} + +message QosCommandAddArg { @@ -50,6 +51,6 @@ index 25dfc81e..1f7058cd 100644 +message QosCommandSetDefaultGateArg { + uint64 gate = 1; +} --- +-- 2.17.1 From 5d91fab922c04e2c3f3834c427db5c596ad602d3 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Tue, 7 Sep 2021 20:47:21 +0000 Subject: [PATCH 05/22] Actions: Updated with changes from CI --- pfcpiface/bess_pb/module_msg.pb.go | 75 +++++++++++++++++------------- 1 file changed, 43 insertions(+), 32 deletions(-) diff --git a/pfcpiface/bess_pb/module_msg.pb.go b/pfcpiface/bess_pb/module_msg.pb.go index 88a2da518..cb12d5432 100644 --- a/pfcpiface/bess_pb/module_msg.pb.go +++ b/pfcpiface/bess_pb/module_msg.pb.go @@ -5900,8 +5900,9 @@ type QosArg struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Fields []*Field `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty"` - Values []*Field `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` + Fields []*Field `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty"` + Values []*Field `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` + AdjustMeterPacketLength int64 `protobuf:"varint,3,opt,name=adjust_meter_packet_length,json=adjustMeterPacketLength,proto3" json:"adjust_meter_packet_length,omitempty"` } func (x *QosArg) Reset() { @@ -5950,6 +5951,13 @@ func (x *QosArg) GetValues() []*Field { return nil } +func (x *QosArg) GetAdjustMeterPacketLength() int64 { + if x != nil { + return x.AdjustMeterPacketLength + } + return 0 +} + type QosCommandAddArg struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -7704,36 +7712,39 @@ var file_module_msg_proto_rawDesc = []byte{ 0x65, 0x72, 0x47, 0x61, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x58, 0x0a, 0x06, 0x51, 0x6f, 0x73, 0x41, - 0x72, 0x67, 0x12, 0x26, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x26, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x62, 0x65, 0x73, - 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x22, 0xd8, 0x01, 0x0a, 0x10, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, - 0x64, 0x41, 0x64, 0x64, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x61, 0x74, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x67, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, - 0x69, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x63, 0x69, 0x72, 0x12, 0x10, 0x0a, - 0x03, 0x70, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x70, 0x69, 0x72, 0x12, - 0x10, 0x0a, 0x03, 0x63, 0x62, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x63, 0x62, - 0x73, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x62, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, - 0x70, 0x62, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x62, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x03, 0x65, 0x62, 0x73, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, - 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, - 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x73, 0x12, 0x2a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x41, 0x0a, - 0x13, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x41, 0x72, 0x67, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, - 0x22, 0x14, 0x0a, 0x12, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x43, 0x6c, - 0x65, 0x61, 0x72, 0x41, 0x72, 0x67, 0x22, 0x31, 0x0a, 0x1b, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, - 0x6d, 0x61, 0x6e, 0x64, 0x53, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x47, 0x61, - 0x74, 0x65, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x04, 0x67, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x95, 0x01, 0x0a, 0x06, 0x51, 0x6f, 0x73, + 0x41, 0x72, 0x67, 0x12, 0x26, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, + 0x65, 0x6c, 0x64, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x26, 0x0a, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x62, 0x65, + 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x1a, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x5f, 0x6d, 0x65, + 0x74, 0x65, 0x72, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x17, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x4d, + 0x65, 0x74, 0x65, 0x72, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x22, 0xd8, 0x01, 0x0a, 0x10, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x41, + 0x64, 0x64, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x04, 0x67, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x63, 0x69, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x70, + 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x70, 0x69, 0x72, 0x12, 0x10, 0x0a, + 0x03, 0x63, 0x62, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x63, 0x62, 0x73, 0x12, + 0x10, 0x0a, 0x03, 0x70, 0x62, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x70, 0x62, + 0x73, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x62, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, + 0x65, 0x62, 0x73, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x07, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, + 0x65, 0x6c, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, + 0x2a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, + 0x61, 0x74, 0x61, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x41, 0x0a, 0x13, 0x51, + 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, + 0x72, 0x67, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, 0x14, + 0x0a, 0x12, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x43, 0x6c, 0x65, 0x61, + 0x72, 0x41, 0x72, 0x67, 0x22, 0x31, 0x0a, 0x1b, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, + 0x6e, 0x64, 0x53, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x47, 0x61, 0x74, 0x65, + 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x04, 0x67, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From 5f61944bdb65bed6fe1e7edfc99705663602b506 Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Tue, 7 Sep 2021 16:13:34 -0700 Subject: [PATCH 06/22] Make meter packet length adjustable per entry This change makes the metering packet length value adjustable per flow entry, from module-wide before. This allows applying different values for uplink and downlink metering. --- conf/up4.bess | 18 ++++++++++-------- core/modules/qos.cc | 10 ++++------ core/modules/qos.h | 5 ++--- .../bess/0015-Protobuf-changes-for-Qos.patch | 2 +- pfcpiface/bess.go | 2 ++ 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/conf/up4.bess b/conf/up4.bess index dbe230f16..32ad2db41 100644 --- a/conf/up4.bess +++ b/conf/up4.bess @@ -6,7 +6,8 @@ from conf.parser import * import conf.ports as port import conf.sim as sim -from scapy.all import Ether +from scapy.all import Ether, IP, UDP +from scapy.contrib.gtp import GTP_U_Header port.setup_globals() @@ -203,11 +204,10 @@ if ntf: _in -> qerLookup::Qos(fields=[{'attr_name':'src_iface', 'num_bytes':1}, \ {'attr_name':'qer_id', 'num_bytes':4}, \ {'attr_name':'fseid', 'num_bytes':8}], \ - values=[{'attr_name':'qfi', 'num_bytes':1}], - adjust_meter_packet_length=-len(Ether())) + values=[{'attr_name':'qfi', 'num_bytes':1}]) executeFAR::Split(size=1, attribute='action') -afterFarMerge = executeFAR +farOrSliceMeter = executeFAR if parser.slice_uplink_rate_limit_bytes_per_second is not None or parser.slice_downlink_rate_limit_bytes_per_second is not None: # sliceMeter enforces a per slice, per direction meter rate limit sliceMeter::Qos(fields=[{'attr_name':'src_iface', 'num_bytes':1}]) @@ -232,15 +232,17 @@ if parser.slice_uplink_rate_limit_bytes_per_second is not None or parser.slice_d cir=parser.slice_uplink_rate_limit_bytes_per_second, pir=parser.slice_uplink_rate_limit_bytes_per_second, cbs=parser.slice_uplink_burst_bytes, - pbs=parser.slice_uplink_burst_bytes) + pbs=parser.slice_uplink_burst_bytes, + adjust_meter_packet_length=-len(Ether())) # Don't count link-level headers if parser.slice_downlink_rate_limit_bytes_per_second is not None: sliceMeter.add(fields=[{'value_int': Core}], gate=m_meter, cir=parser.slice_downlink_rate_limit_bytes_per_second, pir=parser.slice_downlink_rate_limit_bytes_per_second, cbs=parser.slice_downlink_burst_bytes, - pbs=parser.slice_downlink_burst_bytes) - afterFarMerge = sliceMeter + pbs=parser.slice_downlink_burst_bytes, + adjust_meter_packet_length=-len(Ether()/IP()/UDP()/GTP_U_Header())) # Don't count link-level and encapsulation headers + farOrSliceMeter = sliceMeter farLookup::ExactMatch(fields=[{'attr_name':'far_id', 'num_bytes':4}, \ {'attr_name':'fseid', 'num_bytes':8}], \ @@ -251,7 +253,7 @@ farLookup::ExactMatch(fields=[{'attr_name':'far_id', 'num_bytes':4}, \ {'attr_name':'tunnel_out_teid', 'num_bytes':4}, \ {'attr_name':'tunnel_out_udp_port', 'num_bytes':2}]):noGTPUEncap \ -> farMerge::Merge() \ - -> afterFarMerge + -> farOrSliceMeter # Add logical pipeline when gtpudecap is needed pdrLookup:GTPUDecap \ diff --git a/core/modules/qos.cc b/core/modules/qos.cc index 90bf8702d..0d75b9870 100644 --- a/core/modules/qos.cc +++ b/core/modules/qos.cc @@ -127,9 +127,6 @@ CommandResponse Qos::Init(const bess::pb::QosArg &arg) { } table_.Init(total_key_size_); - - adjust_meter_packet_length_ = arg.adjust_meter_packet_length(); - return CommandSuccess(); } @@ -140,7 +137,7 @@ void Qos::ProcessBatch(Context *ctx, bess::PacketBatch *batch) { default_gate = ACCESS_ONCE(default_gate_); int cnt = batch->cnt(); - struct value *val[cnt]; + value *val[cnt]; for (const auto &field : fields_) { int offset; @@ -190,7 +187,7 @@ void Qos::ProcessBatch(Context *ctx, bess::PacketBatch *batch) { // meter if ogate is 0 if (ogate == METER_GATE) { uint64_t time = rte_rdtsc(); - uint32_t pkt_len = pkt->total_len() + adjust_meter_packet_length_; + uint32_t pkt_len = pkt->total_len() + val[j]->adjust_meter_packet_length; uint8_t color = rte_meter_trtcm_color_blind_check(&val[j]->m, &val[j]->p, time, pkt_len); @@ -377,7 +374,7 @@ CommandResponse Qos::CommandAdd(const bess::pb::QosCommandAddArg &arg) { MeteringKey key = {{0}}; MKey l; - struct value v; + value v; v.ogate = gate; CommandResponse err = ExtractKeyMask(arg, &key, &v.Data, &l); @@ -391,6 +388,7 @@ CommandResponse Qos::CommandAdd(const bess::pb::QosCommandAddArg &arg) { v.cbs = arg.cbs(); v.pbs = arg.pbs(); v.ebs = arg.ebs(); + v.adjust_meter_packet_length = arg.adjust_meter_packet_length(); DLOG(INFO) << "Adding entry" << " cir: " << v.cir << " pir: " << v.pir << " cbs: " << v.cbs diff --git a/core/modules/qos.h b/core/modules/qos.h index 00aed2680..9c4e12aaa 100644 --- a/core/modules/qos.h +++ b/core/modules/qos.h @@ -67,6 +67,7 @@ struct value { uint64_t cbs; uint64_t pbs; uint64_t ebs; + int64_t adjust_meter_packet_length; struct rte_meter_trtcm_profile p; struct rte_meter_trtcm m; MeteringKey Data; @@ -87,8 +88,7 @@ class Qos final : public Module { : Module(), default_gate_(), total_key_size_(), - fields_(), - adjust_meter_packet_length_() { + fields_() { max_allowed_workers_ = Worker::kMaxWorkers; size_t len = sizeof(mask) / sizeof(uint64_t); for (size_t i = 0; i < len; i++) @@ -123,7 +123,6 @@ class Qos final : public Module { std::vector values_; Metering table_; uint64_t mask[MAX_FIELDS]; - int adjust_meter_packet_length_; }; #endif // BESS_MODULES_QOS_H diff --git a/patches/bess/0015-Protobuf-changes-for-Qos.patch b/patches/bess/0015-Protobuf-changes-for-Qos.patch index ba00ed9fa..4a3a57fd6 100644 --- a/patches/bess/0015-Protobuf-changes-for-Qos.patch +++ b/patches/bess/0015-Protobuf-changes-for-Qos.patch @@ -19,7 +19,6 @@ index 25dfc81e..1f7058cd 100644 +message QosArg { + repeated Field fields = 1; + repeated Field values = 2; -+ int64 adjust_meter_packet_length = 3; +} + +message QosCommandAddArg { @@ -29,6 +28,7 @@ index 25dfc81e..1f7058cd 100644 + uint64 cbs = 4; + uint64 pbs = 5; + uint64 ebs = 6; ++ int64 adjust_meter_packet_length = 9; + repeated FieldData fields = 7; + repeated FieldData values = 8; +} diff --git a/pfcpiface/bess.go b/pfcpiface/bess.go index bb4270486..5d8ad4eb7 100644 --- a/pfcpiface/bess.go +++ b/pfcpiface/bess.go @@ -746,6 +746,7 @@ func (b *bess) addQER(ctx context.Context, done chan<- bool, qer qer) { Cbs: cbs, /* committed burst size */ Pbs: pbs, /* Peak burst size */ Ebs: ebs, /* Excess burst size */ + AdjustMeterPacketLength: 14, /* Exclude Ethernet header */ Fields: []*pb.FieldData{ intEnc(uint64(srcIface)), /* Src Intf */ intEnc(uint64(qer.qerID)), /* qer_id */ @@ -786,6 +787,7 @@ func (b *bess) addQER(ctx context.Context, done chan<- bool, qer qer) { Cbs: cbs, /* committed burst size */ Pbs: pbs, /* Peak burst size */ Ebs: ebs, /* Excess burst size */ + AdjustMeterPacketLength: 14, /* Exclude Ethernet header */ Fields: []*pb.FieldData{ intEnc(uint64(srcIface)), /* Src Intf */ intEnc(uint64(qer.qerID)), /* qer_id */ From 4c170902a85fba32f7eecc1c1126bd0a4f467885 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Tue, 7 Sep 2021 23:33:31 +0000 Subject: [PATCH 07/22] Actions: Updated with changes from CI --- core/modules/qos.h | 6 +- pfcpiface/bess.go | 28 ++++---- pfcpiface/bess_pb/module_msg.pb.go | 100 ++++++++++++++--------------- 3 files changed, 65 insertions(+), 69 deletions(-) diff --git a/core/modules/qos.h b/core/modules/qos.h index 9c4e12aaa..630409202 100644 --- a/core/modules/qos.h +++ b/core/modules/qos.h @@ -84,11 +84,7 @@ class Qos final : public Module { static const Commands cmds; - Qos() - : Module(), - default_gate_(), - total_key_size_(), - fields_() { + Qos() : Module(), default_gate_(), total_key_size_(), fields_() { max_allowed_workers_ = Worker::kMaxWorkers; size_t len = sizeof(mask) / sizeof(uint64_t); for (size_t i = 0; i < len; i++) diff --git a/pfcpiface/bess.go b/pfcpiface/bess.go index 5d8ad4eb7..aba045768 100644 --- a/pfcpiface/bess.go +++ b/pfcpiface/bess.go @@ -740,13 +740,13 @@ func (b *bess) addQER(ctx context.Context, done chan<- bool, qer qer) { } q := &pb.QosCommandAddArg{ - Gate: gate, - Cir: cir, /* committed info rate */ - Pir: pir, /* peak info rate */ - Cbs: cbs, /* committed burst size */ - Pbs: pbs, /* Peak burst size */ - Ebs: ebs, /* Excess burst size */ - AdjustMeterPacketLength: 14, /* Exclude Ethernet header */ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ + AdjustMeterPacketLength: 14, /* Exclude Ethernet header */ Fields: []*pb.FieldData{ intEnc(uint64(srcIface)), /* Src Intf */ intEnc(uint64(qer.qerID)), /* qer_id */ @@ -781,13 +781,13 @@ func (b *bess) addQER(ctx context.Context, done chan<- bool, qer qer) { } q = &pb.QosCommandAddArg{ - Gate: gate, - Cir: cir, /* committed info rate */ - Pir: pir, /* peak info rate */ - Cbs: cbs, /* committed burst size */ - Pbs: pbs, /* Peak burst size */ - Ebs: ebs, /* Excess burst size */ - AdjustMeterPacketLength: 14, /* Exclude Ethernet header */ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ + AdjustMeterPacketLength: 14, /* Exclude Ethernet header */ Fields: []*pb.FieldData{ intEnc(uint64(srcIface)), /* Src Intf */ intEnc(uint64(qer.qerID)), /* qer_id */ diff --git a/pfcpiface/bess_pb/module_msg.pb.go b/pfcpiface/bess_pb/module_msg.pb.go index cb12d5432..d794814d4 100644 --- a/pfcpiface/bess_pb/module_msg.pb.go +++ b/pfcpiface/bess_pb/module_msg.pb.go @@ -5900,9 +5900,8 @@ type QosArg struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Fields []*Field `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty"` - Values []*Field `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` - AdjustMeterPacketLength int64 `protobuf:"varint,3,opt,name=adjust_meter_packet_length,json=adjustMeterPacketLength,proto3" json:"adjust_meter_packet_length,omitempty"` + Fields []*Field `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty"` + Values []*Field `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` } func (x *QosArg) Reset() { @@ -5951,26 +5950,20 @@ func (x *QosArg) GetValues() []*Field { return nil } -func (x *QosArg) GetAdjustMeterPacketLength() int64 { - if x != nil { - return x.AdjustMeterPacketLength - } - return 0 -} - type QosCommandAddArg struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Gate uint64 `protobuf:"varint,1,opt,name=gate,proto3" json:"gate,omitempty"` - Cir uint64 `protobuf:"varint,2,opt,name=cir,proto3" json:"cir,omitempty"` - Pir uint64 `protobuf:"varint,3,opt,name=pir,proto3" json:"pir,omitempty"` - Cbs uint64 `protobuf:"varint,4,opt,name=cbs,proto3" json:"cbs,omitempty"` - Pbs uint64 `protobuf:"varint,5,opt,name=pbs,proto3" json:"pbs,omitempty"` - Ebs uint64 `protobuf:"varint,6,opt,name=ebs,proto3" json:"ebs,omitempty"` - Fields []*FieldData `protobuf:"bytes,7,rep,name=fields,proto3" json:"fields,omitempty"` - Values []*FieldData `protobuf:"bytes,8,rep,name=values,proto3" json:"values,omitempty"` + Gate uint64 `protobuf:"varint,1,opt,name=gate,proto3" json:"gate,omitempty"` + Cir uint64 `protobuf:"varint,2,opt,name=cir,proto3" json:"cir,omitempty"` + Pir uint64 `protobuf:"varint,3,opt,name=pir,proto3" json:"pir,omitempty"` + Cbs uint64 `protobuf:"varint,4,opt,name=cbs,proto3" json:"cbs,omitempty"` + Pbs uint64 `protobuf:"varint,5,opt,name=pbs,proto3" json:"pbs,omitempty"` + Ebs uint64 `protobuf:"varint,6,opt,name=ebs,proto3" json:"ebs,omitempty"` + AdjustMeterPacketLength int64 `protobuf:"varint,9,opt,name=adjust_meter_packet_length,json=adjustMeterPacketLength,proto3" json:"adjust_meter_packet_length,omitempty"` + Fields []*FieldData `protobuf:"bytes,7,rep,name=fields,proto3" json:"fields,omitempty"` + Values []*FieldData `protobuf:"bytes,8,rep,name=values,proto3" json:"values,omitempty"` } func (x *QosCommandAddArg) Reset() { @@ -6047,6 +6040,13 @@ func (x *QosCommandAddArg) GetEbs() uint64 { return 0 } +func (x *QosCommandAddArg) GetAdjustMeterPacketLength() int64 { + if x != nil { + return x.AdjustMeterPacketLength + } + return 0 +} + func (x *QosCommandAddArg) GetFields() []*FieldData { if x != nil { return x.Fields @@ -7712,39 +7712,39 @@ var file_module_msg_proto_rawDesc = []byte{ 0x65, 0x72, 0x47, 0x61, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x95, 0x01, 0x0a, 0x06, 0x51, 0x6f, 0x73, - 0x41, 0x72, 0x67, 0x12, 0x26, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x26, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x62, 0x65, - 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x12, 0x3b, 0x0a, 0x1a, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x5f, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x17, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x4d, - 0x65, 0x74, 0x65, 0x72, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x22, 0xd8, 0x01, 0x0a, 0x10, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x41, - 0x64, 0x64, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x04, 0x67, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x63, 0x69, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x70, - 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x70, 0x69, 0x72, 0x12, 0x10, 0x0a, - 0x03, 0x63, 0x62, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x63, 0x62, 0x73, 0x12, - 0x10, 0x0a, 0x03, 0x70, 0x62, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x70, 0x62, - 0x73, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x62, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, - 0x65, 0x62, 0x73, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x07, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, - 0x2a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, - 0x61, 0x74, 0x61, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x41, 0x0a, 0x13, 0x51, - 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, - 0x72, 0x67, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x58, 0x0a, 0x06, 0x51, 0x6f, 0x73, 0x41, + 0x72, 0x67, 0x12, 0x26, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x26, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x62, 0x65, 0x73, + 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x22, 0x95, 0x02, 0x0a, 0x10, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x64, 0x41, 0x64, 0x64, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x61, 0x74, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x67, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, + 0x69, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x63, 0x69, 0x72, 0x12, 0x10, 0x0a, + 0x03, 0x70, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x70, 0x69, 0x72, 0x12, + 0x10, 0x0a, 0x03, 0x63, 0x62, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x63, 0x62, + 0x73, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x62, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, + 0x70, 0x62, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x62, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x03, 0x65, 0x62, 0x73, 0x12, 0x3b, 0x0a, 0x1a, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x5f, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x17, 0x61, 0x64, 0x6a, 0x75, 0x73, + 0x74, 0x4d, 0x65, 0x74, 0x65, 0x72, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x4c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, 0x14, - 0x0a, 0x12, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x43, 0x6c, 0x65, 0x61, - 0x72, 0x41, 0x72, 0x67, 0x22, 0x31, 0x0a, 0x1b, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, - 0x6e, 0x64, 0x53, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x47, 0x61, 0x74, 0x65, - 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x04, 0x67, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x2a, + 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, + 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x61, + 0x74, 0x61, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x41, 0x0a, 0x13, 0x51, 0x6f, + 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x72, + 0x67, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, + 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, 0x14, 0x0a, + 0x12, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x43, 0x6c, 0x65, 0x61, 0x72, + 0x41, 0x72, 0x67, 0x22, 0x31, 0x0a, 0x1b, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x64, 0x53, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x47, 0x61, 0x74, 0x65, 0x41, + 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x04, 0x67, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From 56223a614a85dfd69d89b2763c253f46af975faf Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Tue, 7 Sep 2021 19:01:10 -0700 Subject: [PATCH 08/22] Make pfciagent configure slice metering --- conf/up4.bess | 20 +------- pfcpiface/bess.go | 121 ++++++++++++++++++++++++++++++++++++++++++++++ pfcpiface/main.go | 40 +++++++++------ 3 files changed, 147 insertions(+), 34 deletions(-) diff --git a/conf/up4.bess b/conf/up4.bess index 32ad2db41..569abf91e 100644 --- a/conf/up4.bess +++ b/conf/up4.bess @@ -218,30 +218,14 @@ if parser.slice_uplink_rate_limit_bytes_per_second is not None or parser.slice_d m_red = 3 # For red traffic # User defined gates m_fail = 4 # For lookup failure traffic + m_unmeter = 5 # For unmetered traffic # Admit green and yellow, drop red sliceMeter:m_green -> executeFAR sliceMeter:m_yellow -> executeFAR sliceMeter:m_red -> sliceMeterRed::Sink() sliceMeter:m_fail -> sliceMeterLookupFail::Sink() + sliceMeter:m_unmeter -> executeFAR sliceMeter.set_default_gate(gate=m_fail) - # Add two static slice meter entries for uplink and downlink. - # cir and pir are equal, meaning we have no yellow packets. - if parser.slice_uplink_rate_limit_bytes_per_second is not None: - sliceMeter.add(fields=[{'value_int': Access}], - gate=m_meter, - cir=parser.slice_uplink_rate_limit_bytes_per_second, - pir=parser.slice_uplink_rate_limit_bytes_per_second, - cbs=parser.slice_uplink_burst_bytes, - pbs=parser.slice_uplink_burst_bytes, - adjust_meter_packet_length=-len(Ether())) # Don't count link-level headers - if parser.slice_downlink_rate_limit_bytes_per_second is not None: - sliceMeter.add(fields=[{'value_int': Core}], - gate=m_meter, - cir=parser.slice_downlink_rate_limit_bytes_per_second, - pir=parser.slice_downlink_rate_limit_bytes_per_second, - cbs=parser.slice_downlink_burst_bytes, - pbs=parser.slice_downlink_burst_bytes, - adjust_meter_packet_length=-len(Ether()/IP()/UDP()/GTP_U_Header())) # Don't count link-level and encapsulation headers farOrSliceMeter = sliceMeter farLookup::ExactMatch(fields=[{'attr_name':'far_id', 'num_bytes':4}, \ diff --git a/pfcpiface/bess.go b/pfcpiface/bess.go index aba045768..c136d0133 100644 --- a/pfcpiface/bess.go +++ b/pfcpiface/bess.go @@ -41,6 +41,13 @@ const ( qerGateUnmeter ) +const ( + // Internal gates for Slice meter. + sliceMeterGateMeter uint64 = iota + sliceMeterGateLookupFail = iota + 4 + sliceMeterGateUnmeter +) + var intEnc = func(u uint64) *pb.FieldData { return &pb.FieldData{Encoding: &pb.FieldData_ValueInt{ValueInt: u}} } @@ -400,6 +407,17 @@ func (b *bess) setUpfInfo(u *upf, conf *Conf) { go b.endMarkerSendLoop(b.endMarkerChan) } + + if conf.SliceMeterConfig.UplinkRateBps > 0 || conf.SliceMeterConfig.DownlinkRateBps > 0 { + ctx, cancel := context.WithTimeout(context.Background(), Timeout) + defer cancel() + done := make(chan bool) + b.addSliceMeter(ctx, done, conf.SliceMeterConfig) + rc := b.GRPCJoin(1, Timeout, done) + if !rc { + log.Errorln("Unable to make GRPC calls") + } + } } func (b *bess) sim(u *upf, method string) { @@ -1012,6 +1030,109 @@ func (b *bess) delCounter(ctx context.Context, done chan<- bool, ctrID uint32, c }() } +func (b *bess) processSliceMeter(ctx context.Context, any *anypb.Any, method upfMsgType) { + if method != upfMsgTypeAdd && method != upfMsgTypeDel && method != upfMsgTypeClear { + log.Errorln("Invalid method name: ", method) + return + } + + methods := [...]string{"add", "add", "delete", "clear"} + + _, err := b.client.ModuleCommand( + ctx, &pb.CommandRequest{ + Name: "sliceMeter", + Cmd: methods[method], + Arg: any, + }, + ) + if err != nil { + log.Errorln("sliceMeter method failed!:", err) + } +} + +func (b *bess) addSliceMeter(ctx context.Context, done chan<- bool, meterConfig SliceMeterConfig) { + go func() { + var ( + any *anypb.Any + err error + cir, pir, cbs, ebs, pbs, gate uint64 + ) + + // Uplink slice meter config + if meterConfig.UplinkRateBps != 0 { + gate = sliceMeterGateMeter + cir = 1 // Mark all traffic as yellow + pir = meterConfig.UplinkRateBps / 8 // bit/s to byte/s + } else { + gate = sliceMeterGateUnmeter + } + if meterConfig.UplinkBurstBytes != 0 { + cbs = 1 // Mark all traffic as yellow + pbs = meterConfig.UplinkBurstBytes + ebs = 0 // Unused + } else { + cbs = DefaultBurstSize + pbs = DefaultBurstSize + ebs = 0 // Unused + } + q := &pb.QosCommandAddArg{ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ + AdjustMeterPacketLength: -14, /* Exclude Ethernet header */ + Fields: []*pb.FieldData{ + intEnc(uint64(access)), /* Source interface */ + }, + } + any, err = anypb.New(q) + if err != nil { + log.Errorln("Error marshalling the rule", q, err) + return + } + b.processSliceMeter(ctx, any, upfMsgTypeAdd) + + // Downlink slice meter config + if meterConfig.DownlinkRateBps != 0 { + gate = sliceMeterGateMeter + cir = 1 // Mark all traffic as yellow + pir = meterConfig.DownlinkRateBps / 8 // bit/s to byte/s + } else { + gate = sliceMeterGateUnmeter + } + if meterConfig.DownlinkBurstBytes != 0 { + cbs = 1 // Mark all traffic as yellow + pbs = meterConfig.DownlinkBurstBytes + ebs = 0 // Unused + } else { + cbs = DefaultBurstSize + pbs = DefaultBurstSize + ebs = 0 // Unused + } + q = &pb.QosCommandAddArg{ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ + AdjustMeterPacketLength: -50, /* Exclude Ethernet,IP,UDP,GTP header */ + Fields: []*pb.FieldData{ + intEnc(uint64(core)), /* Source interface */ + }, + } + any, err = anypb.New(q) + if err != nil { + log.Errorln("Error marshalling the rule", q, err) + return + } + b.processSliceMeter(ctx, any, upfMsgTypeAdd) + done <- true + }() +} + func (b *bess) removeAllPDRs(ctx context.Context, done chan<- bool) { go func() { var ( diff --git a/pfcpiface/main.go b/pfcpiface/main.go index d3c69f0a2..516b81181 100644 --- a/pfcpiface/main.go +++ b/pfcpiface/main.go @@ -25,22 +25,23 @@ var ( // Conf : Json conf struct. type Conf struct { - Mode string `json:"mode"` - MaxSessions uint32 `json:"max_sessions"` - AccessIface IfaceType `json:"access"` - CoreIface IfaceType `json:"core"` - CPIface CPIfaceInfo `json:"cpiface"` - P4rtcIface P4rtcInfo `json:"p4rtciface"` - EnableP4rt bool `json:"enable_p4rt"` - SimInfo SimModeInfo `json:"sim"` - ConnTimeout uint32 `json:"conn_timeout"` - ReadTimeout uint32 `json:"read_timeout"` - EnableNotifyBess bool `json:"enable_notify_bess"` - EnableEndMarker bool `json:"enable_end_marker"` - NotifySockAddr string `json:"notify_sockaddr"` - EndMarkerSockAddr string `json:"endmarker_sockaddr"` - LogLevel string `json:"log_level"` - QciQosConfig []QciQosConfig `json:"qci_qos_config"` + Mode string `json:"mode"` + MaxSessions uint32 `json:"max_sessions"` + AccessIface IfaceType `json:"access"` + CoreIface IfaceType `json:"core"` + CPIface CPIfaceInfo `json:"cpiface"` + P4rtcIface P4rtcInfo `json:"p4rtciface"` + EnableP4rt bool `json:"enable_p4rt"` + SimInfo SimModeInfo `json:"sim"` + ConnTimeout uint32 `json:"conn_timeout"` + ReadTimeout uint32 `json:"read_timeout"` + EnableNotifyBess bool `json:"enable_notify_bess"` + EnableEndMarker bool `json:"enable_end_marker"` + NotifySockAddr string `json:"notify_sockaddr"` + EndMarkerSockAddr string `json:"endmarker_sockaddr"` + LogLevel string `json:"log_level"` + QciQosConfig []QciQosConfig `json:"qci_qos_config"` + SliceMeterConfig SliceMeterConfig `json:"slice_rate_limit_config"` } // QciQosConfig : Qos configured attributes. @@ -52,6 +53,13 @@ type QciQosConfig struct { SchedulingPriority uint32 `json:"priority"` } +type SliceMeterConfig struct { + UplinkRateBps uint64 `json:"uplink_bps"` + UplinkBurstBytes uint64 `json:"uplink_burst_bytes"` + DownlinkRateBps uint64 `json:"downlink_bps"` + DownlinkBurstBytes uint64 `json:"downlink_burst_bytes"` +} + // SimModeInfo : Sim mode attributes. type SimModeInfo struct { StartUEIP net.IP `json:"start_ue_ip"` From f8c996de43fc3fc2f3db4b7159bf790a73a86fd4 Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Wed, 8 Sep 2021 19:39:45 -0700 Subject: [PATCH 09/22] Cleanup and minor fixes --- conf/parser.py | 20 ++++---------------- conf/up4.bess | 2 +- pfcpiface/bess.go | 4 ++-- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/conf/parser.py b/conf/parser.py index 744574d3f..cf0cb1fb8 100644 --- a/conf/parser.py +++ b/conf/parser.py @@ -49,10 +49,7 @@ def __init__(self, fname): self.enable_ntf = False self.notify_sockaddr = "/tmp/notifycp" self.endmarker_sockaddr = "/tmp/pfcpport" - self.slice_uplink_rate_limit_bytes_per_second = None - self.slice_downlink_rate_limit_bytes_per_second = None - self.slice_uplink_burst_bytes = None - self.slice_downlink_burst_bytes = None + self.enable_slice_metering = False def parse(self, ifaces): # Maximum number of flows to manage ip4 frags for re-assembly @@ -155,19 +152,10 @@ def parse(self, ifaces): # Slice rate limits try: - self.slice_uplink_rate_limit_bytes_per_second = int(self.conf["slice_rate_limit_config"]["uplink_bps"] / 8) - self.slice_uplink_burst_bytes = self.conf["slice_rate_limit_config"]["uplink_burst_bytes"] + self.conf["slice_rate_limit_config"] + self.enable_slice_metering = True except KeyError: - self.slice_uplink_rate_limit_bytes_per_second = None - self.slice_uplink_burst_bytes = None - print("No slice uplink rate limit! Disabling rate limit.") - try: - self.slice_downlink_rate_limit_bytes_per_second = int(self.conf["slice_rate_limit_config"]["downlink_bps"] / 8) - self.slice_downlink_burst_bytes = self.conf["slice_rate_limit_config"]["downlink_burst_bytes"] - except KeyError: - self.slice_downlink_rate_limit_bytes_per_second = None - self.slice_downlink_burst_bytes = None - print("No slice downlink rate limit! Disabling rate limit.") + print("No slice rate limit! Disabling meter.") # UnixPort Paths try: diff --git a/conf/up4.bess b/conf/up4.bess index 569abf91e..303ba9d2d 100644 --- a/conf/up4.bess +++ b/conf/up4.bess @@ -208,7 +208,7 @@ _in -> qerLookup::Qos(fields=[{'attr_name':'src_iface', 'num_bytes':1}, \ executeFAR::Split(size=1, attribute='action') farOrSliceMeter = executeFAR -if parser.slice_uplink_rate_limit_bytes_per_second is not None or parser.slice_downlink_rate_limit_bytes_per_second is not None: +if parser.enable_slice_metering: # sliceMeter enforces a per slice, per direction meter rate limit sliceMeter::Qos(fields=[{'attr_name':'src_iface', 'num_bytes':1}]) # Reserved gates, reject rule adds with gate=1/2/3 diff --git a/pfcpiface/bess.go b/pfcpiface/bess.go index c136d0133..0fd0fc318 100644 --- a/pfcpiface/bess.go +++ b/pfcpiface/bess.go @@ -764,7 +764,7 @@ func (b *bess) addQER(ctx context.Context, done chan<- bool, qer qer) { Cbs: cbs, /* committed burst size */ Pbs: pbs, /* Peak burst size */ Ebs: ebs, /* Excess burst size */ - AdjustMeterPacketLength: 14, /* Exclude Ethernet header */ + AdjustMeterPacketLength: -14, /* Exclude Ethernet header */ Fields: []*pb.FieldData{ intEnc(uint64(srcIface)), /* Src Intf */ intEnc(uint64(qer.qerID)), /* qer_id */ @@ -805,7 +805,7 @@ func (b *bess) addQER(ctx context.Context, done chan<- bool, qer qer) { Cbs: cbs, /* committed burst size */ Pbs: pbs, /* Peak burst size */ Ebs: ebs, /* Excess burst size */ - AdjustMeterPacketLength: 14, /* Exclude Ethernet header */ + AdjustMeterPacketLength: -14, /* Exclude Ethernet header */ Fields: []*pb.FieldData{ intEnc(uint64(srcIface)), /* Src Intf */ intEnc(uint64(qer.qerID)), /* qer_id */ From afe69c6ac8c7c34df4690fced27db350b47888fc Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Thu, 9 Sep 2021 09:49:34 -0700 Subject: [PATCH 10/22] Adjust QoS metering example --- bessctl/module_tests/metering.bess | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bessctl/module_tests/metering.bess b/bessctl/module_tests/metering.bess index 0760dfa8c..93b53a9d2 100644 --- a/bessctl/module_tests/metering.bess +++ b/bessctl/module_tests/metering.bess @@ -66,27 +66,31 @@ Metering.add(fields=[{'value_int': 1}, {'value_bin': convert('L', 2)}, {'value_bin': convert('Q', 4)}], values=[{'value_int': 1}], # S:1 - gate=m_meter, cir=1 * MPPS , pir=1 * MPPS, cbs=2048, pbs=2048) + gate=m_meter, cir=1 * MPPS , pir=1 * MPPS, cbs=2048, pbs=2048, + adjust_meter_packet_length=-14]) Metering.add(fields=[{'value_int': 1}, {'value_bin': convert('L', 3)}, {'value_bin': convert('Q', 6)}], values=[{'value_int': 2}], # S:2 - gate=m_meter, cir=5 * MPPS, pir=5 * MPPS, cbs=2048, pbs=2048) + gate=m_meter, cir=5 * MPPS, pir=5 * MPPS, cbs=2048, pbs=2048, + adjust_meter_packet_length=-14) # GBR/MBR Metering.add(fields=[{'value_int': 1}, {'value_bin': convert('L', 4)}, {'value_bin': convert('Q', 8)}], values=[{'value_int': 3}], # S:3 - gate=m_meter, cir=3 * MPPS, pir=6 * MPPS, cbs=2048, pbs=2048) + gate=m_meter, cir=3 * MPPS, pir=6 * MPPS, cbs=2048, pbs=2048, + adjust_meter_packet_length=-14) # MBR only Metering.add(fields=[{'value_int': 1}, {'value_bin': convert('L', 5)}, {'value_bin': convert('Q', 10)}], values=[{'value_int': 4}], # S:4 - gate=m_meter, cir=1, pir=6 * MPPS, cbs=2048, pbs=2048) + gate=m_meter, cir=1, pir=6 * MPPS, cbs=2048, pbs=2048, + adjust_meter_packet_length=-14) # Unmeter Metering.add(fields=[{'value_int': 1}, From 20815a529d23c7c1cda90d66799a71972f6391d5 Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Thu, 16 Sep 2021 14:12:24 -0700 Subject: [PATCH 11/22] Rename `adjust_meter_packet_length` to `deduct_len` --- bessctl/module_tests/metering.bess | 8 +-- core/modules/qos.cc | 4 +- core/modules/qos.h | 2 +- .../bess/0015-Protobuf-changes-for-Qos.patch | 2 +- pfcpiface/bess.go | 56 +++++++++---------- pfcpiface/bess_pb/module_msg.pb.go | 22 ++++---- 6 files changed, 47 insertions(+), 47 deletions(-) diff --git a/bessctl/module_tests/metering.bess b/bessctl/module_tests/metering.bess index 93b53a9d2..b6913813d 100644 --- a/bessctl/module_tests/metering.bess +++ b/bessctl/module_tests/metering.bess @@ -67,14 +67,14 @@ Metering.add(fields=[{'value_int': 1}, {'value_bin': convert('Q', 4)}], values=[{'value_int': 1}], # S:1 gate=m_meter, cir=1 * MPPS , pir=1 * MPPS, cbs=2048, pbs=2048, - adjust_meter_packet_length=-14]) + deduct_len=14]) Metering.add(fields=[{'value_int': 1}, {'value_bin': convert('L', 3)}, {'value_bin': convert('Q', 6)}], values=[{'value_int': 2}], # S:2 gate=m_meter, cir=5 * MPPS, pir=5 * MPPS, cbs=2048, pbs=2048, - adjust_meter_packet_length=-14) + deduct_len=14) # GBR/MBR Metering.add(fields=[{'value_int': 1}, @@ -82,7 +82,7 @@ Metering.add(fields=[{'value_int': 1}, {'value_bin': convert('Q', 8)}], values=[{'value_int': 3}], # S:3 gate=m_meter, cir=3 * MPPS, pir=6 * MPPS, cbs=2048, pbs=2048, - adjust_meter_packet_length=-14) + deduct_len=14) # MBR only Metering.add(fields=[{'value_int': 1}, @@ -90,7 +90,7 @@ Metering.add(fields=[{'value_int': 1}, {'value_bin': convert('Q', 10)}], values=[{'value_int': 4}], # S:4 gate=m_meter, cir=1, pir=6 * MPPS, cbs=2048, pbs=2048, - adjust_meter_packet_length=-14) + deduct_len=14) # Unmeter Metering.add(fields=[{'value_int': 1}, diff --git a/core/modules/qos.cc b/core/modules/qos.cc index 0d75b9870..4be6c1f6d 100644 --- a/core/modules/qos.cc +++ b/core/modules/qos.cc @@ -187,7 +187,7 @@ void Qos::ProcessBatch(Context *ctx, bess::PacketBatch *batch) { // meter if ogate is 0 if (ogate == METER_GATE) { uint64_t time = rte_rdtsc(); - uint32_t pkt_len = pkt->total_len() + val[j]->adjust_meter_packet_length; + uint32_t pkt_len = pkt->total_len() - val[j]->deduct_len; uint8_t color = rte_meter_trtcm_color_blind_check(&val[j]->m, &val[j]->p, time, pkt_len); @@ -388,7 +388,7 @@ CommandResponse Qos::CommandAdd(const bess::pb::QosCommandAddArg &arg) { v.cbs = arg.cbs(); v.pbs = arg.pbs(); v.ebs = arg.ebs(); - v.adjust_meter_packet_length = arg.adjust_meter_packet_length(); + v.deduct_len = arg.deduct_len(); DLOG(INFO) << "Adding entry" << " cir: " << v.cir << " pir: " << v.pir << " cbs: " << v.cbs diff --git a/core/modules/qos.h b/core/modules/qos.h index 630409202..e6a7b896a 100644 --- a/core/modules/qos.h +++ b/core/modules/qos.h @@ -67,7 +67,7 @@ struct value { uint64_t cbs; uint64_t pbs; uint64_t ebs; - int64_t adjust_meter_packet_length; + uint64_t deduct_len; struct rte_meter_trtcm_profile p; struct rte_meter_trtcm m; MeteringKey Data; diff --git a/patches/bess/0015-Protobuf-changes-for-Qos.patch b/patches/bess/0015-Protobuf-changes-for-Qos.patch index 4a3a57fd6..b2cf629cd 100644 --- a/patches/bess/0015-Protobuf-changes-for-Qos.patch +++ b/patches/bess/0015-Protobuf-changes-for-Qos.patch @@ -28,7 +28,7 @@ index 25dfc81e..1f7058cd 100644 + uint64 cbs = 4; + uint64 pbs = 5; + uint64 ebs = 6; -+ int64 adjust_meter_packet_length = 9; ++ uint64 deduct_len = 9; + repeated FieldData fields = 7; + repeated FieldData values = 8; +} diff --git a/pfcpiface/bess.go b/pfcpiface/bess.go index 0fd0fc318..3795e74a5 100644 --- a/pfcpiface/bess.go +++ b/pfcpiface/bess.go @@ -758,13 +758,13 @@ func (b *bess) addQER(ctx context.Context, done chan<- bool, qer qer) { } q := &pb.QosCommandAddArg{ - Gate: gate, - Cir: cir, /* committed info rate */ - Pir: pir, /* peak info rate */ - Cbs: cbs, /* committed burst size */ - Pbs: pbs, /* Peak burst size */ - Ebs: ebs, /* Excess burst size */ - AdjustMeterPacketLength: -14, /* Exclude Ethernet header */ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ + DeductLen: 14, /* Exclude Ethernet header */ Fields: []*pb.FieldData{ intEnc(uint64(srcIface)), /* Src Intf */ intEnc(uint64(qer.qerID)), /* qer_id */ @@ -799,13 +799,13 @@ func (b *bess) addQER(ctx context.Context, done chan<- bool, qer qer) { } q = &pb.QosCommandAddArg{ - Gate: gate, - Cir: cir, /* committed info rate */ - Pir: pir, /* peak info rate */ - Cbs: cbs, /* committed burst size */ - Pbs: pbs, /* Peak burst size */ - Ebs: ebs, /* Excess burst size */ - AdjustMeterPacketLength: -14, /* Exclude Ethernet header */ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ + DeductLen: 14, /* Exclude Ethernet header */ Fields: []*pb.FieldData{ intEnc(uint64(srcIface)), /* Src Intf */ intEnc(uint64(qer.qerID)), /* qer_id */ @@ -1076,13 +1076,13 @@ func (b *bess) addSliceMeter(ctx context.Context, done chan<- bool, meterConfig ebs = 0 // Unused } q := &pb.QosCommandAddArg{ - Gate: gate, - Cir: cir, /* committed info rate */ - Pir: pir, /* peak info rate */ - Cbs: cbs, /* committed burst size */ - Pbs: pbs, /* Peak burst size */ - Ebs: ebs, /* Excess burst size */ - AdjustMeterPacketLength: -14, /* Exclude Ethernet header */ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ + DeductLen: 14, /* Exclude Ethernet header */ Fields: []*pb.FieldData{ intEnc(uint64(access)), /* Source interface */ }, @@ -1112,13 +1112,13 @@ func (b *bess) addSliceMeter(ctx context.Context, done chan<- bool, meterConfig ebs = 0 // Unused } q = &pb.QosCommandAddArg{ - Gate: gate, - Cir: cir, /* committed info rate */ - Pir: pir, /* peak info rate */ - Cbs: cbs, /* committed burst size */ - Pbs: pbs, /* Peak burst size */ - Ebs: ebs, /* Excess burst size */ - AdjustMeterPacketLength: -50, /* Exclude Ethernet,IP,UDP,GTP header */ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ + DeductLen: 50, /* Exclude Ethernet,IP,UDP,GTP header */ Fields: []*pb.FieldData{ intEnc(uint64(core)), /* Source interface */ }, diff --git a/pfcpiface/bess_pb/module_msg.pb.go b/pfcpiface/bess_pb/module_msg.pb.go index d794814d4..9100471da 100644 --- a/pfcpiface/bess_pb/module_msg.pb.go +++ b/pfcpiface/bess_pb/module_msg.pb.go @@ -5955,15 +5955,15 @@ type QosCommandAddArg struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Gate uint64 `protobuf:"varint,1,opt,name=gate,proto3" json:"gate,omitempty"` - Cir uint64 `protobuf:"varint,2,opt,name=cir,proto3" json:"cir,omitempty"` - Pir uint64 `protobuf:"varint,3,opt,name=pir,proto3" json:"pir,omitempty"` - Cbs uint64 `protobuf:"varint,4,opt,name=cbs,proto3" json:"cbs,omitempty"` - Pbs uint64 `protobuf:"varint,5,opt,name=pbs,proto3" json:"pbs,omitempty"` - Ebs uint64 `protobuf:"varint,6,opt,name=ebs,proto3" json:"ebs,omitempty"` - AdjustMeterPacketLength int64 `protobuf:"varint,9,opt,name=adjust_meter_packet_length,json=adjustMeterPacketLength,proto3" json:"adjust_meter_packet_length,omitempty"` - Fields []*FieldData `protobuf:"bytes,7,rep,name=fields,proto3" json:"fields,omitempty"` - Values []*FieldData `protobuf:"bytes,8,rep,name=values,proto3" json:"values,omitempty"` + Gate uint64 `protobuf:"varint,1,opt,name=gate,proto3" json:"gate,omitempty"` + Cir uint64 `protobuf:"varint,2,opt,name=cir,proto3" json:"cir,omitempty"` + Pir uint64 `protobuf:"varint,3,opt,name=pir,proto3" json:"pir,omitempty"` + Cbs uint64 `protobuf:"varint,4,opt,name=cbs,proto3" json:"cbs,omitempty"` + Pbs uint64 `protobuf:"varint,5,opt,name=pbs,proto3" json:"pbs,omitempty"` + Ebs uint64 `protobuf:"varint,6,opt,name=ebs,proto3" json:"ebs,omitempty"` + DeductLen uint64 `protobuf:"varint,9,opt,name=deduct_len,json=DeductLen,proto3" json:"deduct_len,omitempty"` + Fields []*FieldData `protobuf:"bytes,7,rep,name=fields,proto3" json:"fields,omitempty"` + Values []*FieldData `protobuf:"bytes,8,rep,name=values,proto3" json:"values,omitempty"` } func (x *QosCommandAddArg) Reset() { @@ -6040,9 +6040,9 @@ func (x *QosCommandAddArg) GetEbs() uint64 { return 0 } -func (x *QosCommandAddArg) GetAdjustMeterPacketLength() int64 { +func (x *QosCommandAddArg) GetDeductLen() uint64 { if x != nil { - return x.AdjustMeterPacketLength + return x.DeductLen } return 0 } From 5d397f64924b4d261763d83e6b34750316e027bf Mon Sep 17 00:00:00 2001 From: Github Actions Date: Thu, 16 Sep 2021 21:29:29 +0000 Subject: [PATCH 12/22] Actions: Updated with changes from CI --- conf/upf.json | 10 +++++--- pfcpiface/bess.go | 30 +++++++++++----------- pfcpiface/bess_pb/module_msg.pb.go | 40 ++++++++++++++---------------- pfcpiface/main.go | 8 +++--- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/conf/upf.json b/conf/upf.json index 12d0b482f..25b1b05d3 100644 --- a/conf/upf.json +++ b/conf/upf.json @@ -92,10 +92,12 @@ "": "Optional slice-wide meter rate limits", "slice_rate_limit_config": { - "uplink_bps": 500000000, - "uplink_burst_bytes": 3000, - "downlink_bps": 500000000, - "downlink_burst_bytes": 3000 + "": "uplink policer", + "n6_bps": 500000000, + "n6_burst_bytes": 3000, + "": "downlink policer", + "n3_bps": 500000000, + "n3_burst_bytes": 3000 }, "": "Control plane controller settings", diff --git a/pfcpiface/bess.go b/pfcpiface/bess.go index 3795e74a5..e2f98e6ce 100644 --- a/pfcpiface/bess.go +++ b/pfcpiface/bess.go @@ -408,7 +408,7 @@ func (b *bess) setUpfInfo(u *upf, conf *Conf) { go b.endMarkerSendLoop(b.endMarkerChan) } - if conf.SliceMeterConfig.UplinkRateBps > 0 || conf.SliceMeterConfig.DownlinkRateBps > 0 { + if conf.SliceMeterConfig.N6RateBps > 0 || conf.SliceMeterConfig.N3RateBps > 0 { ctx, cancel := context.WithTimeout(context.Background(), Timeout) defer cancel() done := make(chan bool) @@ -1058,17 +1058,17 @@ func (b *bess) addSliceMeter(ctx context.Context, done chan<- bool, meterConfig cir, pir, cbs, ebs, pbs, gate uint64 ) - // Uplink slice meter config - if meterConfig.UplinkRateBps != 0 { + // Uplink N6 slice meter config + if meterConfig.N6RateBps != 0 { gate = sliceMeterGateMeter - cir = 1 // Mark all traffic as yellow - pir = meterConfig.UplinkRateBps / 8 // bit/s to byte/s + cir = 1 // Mark all traffic as yellow + pir = meterConfig.N6RateBps / 8 // bit/s to byte/s } else { gate = sliceMeterGateUnmeter } - if meterConfig.UplinkBurstBytes != 0 { + if meterConfig.N6BurstBytes != 0 { cbs = 1 // Mark all traffic as yellow - pbs = meterConfig.UplinkBurstBytes + pbs = meterConfig.N6BurstBytes ebs = 0 // Unused } else { cbs = DefaultBurstSize @@ -1082,7 +1082,7 @@ func (b *bess) addSliceMeter(ctx context.Context, done chan<- bool, meterConfig Cbs: cbs, /* committed burst size */ Pbs: pbs, /* Peak burst size */ Ebs: ebs, /* Excess burst size */ - DeductLen: 14, /* Exclude Ethernet header */ + DeductLen: 14, /* Exclude Ethernet header */ Fields: []*pb.FieldData{ intEnc(uint64(access)), /* Source interface */ }, @@ -1094,17 +1094,17 @@ func (b *bess) addSliceMeter(ctx context.Context, done chan<- bool, meterConfig } b.processSliceMeter(ctx, any, upfMsgTypeAdd) - // Downlink slice meter config - if meterConfig.DownlinkRateBps != 0 { + // Downlink N3 slice meter config + if meterConfig.N3RateBps != 0 { gate = sliceMeterGateMeter - cir = 1 // Mark all traffic as yellow - pir = meterConfig.DownlinkRateBps / 8 // bit/s to byte/s + cir = 1 // Mark all traffic as yellow + pir = meterConfig.N3RateBps / 8 // bit/s to byte/s } else { gate = sliceMeterGateUnmeter } - if meterConfig.DownlinkBurstBytes != 0 { + if meterConfig.N3BurstBytes != 0 { cbs = 1 // Mark all traffic as yellow - pbs = meterConfig.DownlinkBurstBytes + pbs = meterConfig.N3BurstBytes ebs = 0 // Unused } else { cbs = DefaultBurstSize @@ -1118,7 +1118,7 @@ func (b *bess) addSliceMeter(ctx context.Context, done chan<- bool, meterConfig Cbs: cbs, /* committed burst size */ Pbs: pbs, /* Peak burst size */ Ebs: ebs, /* Excess burst size */ - DeductLen: 50, /* Exclude Ethernet,IP,UDP,GTP header */ + DeductLen: 50, /* Exclude Ethernet,IP,UDP,GTP header */ Fields: []*pb.FieldData{ intEnc(uint64(core)), /* Source interface */ }, diff --git a/pfcpiface/bess_pb/module_msg.pb.go b/pfcpiface/bess_pb/module_msg.pb.go index 9100471da..f016557d9 100644 --- a/pfcpiface/bess_pb/module_msg.pb.go +++ b/pfcpiface/bess_pb/module_msg.pb.go @@ -5961,7 +5961,7 @@ type QosCommandAddArg struct { Cbs uint64 `protobuf:"varint,4,opt,name=cbs,proto3" json:"cbs,omitempty"` Pbs uint64 `protobuf:"varint,5,opt,name=pbs,proto3" json:"pbs,omitempty"` Ebs uint64 `protobuf:"varint,6,opt,name=ebs,proto3" json:"ebs,omitempty"` - DeductLen uint64 `protobuf:"varint,9,opt,name=deduct_len,json=DeductLen,proto3" json:"deduct_len,omitempty"` + DeductLen uint64 `protobuf:"varint,9,opt,name=deduct_len,json=deductLen,proto3" json:"deduct_len,omitempty"` Fields []*FieldData `protobuf:"bytes,7,rep,name=fields,proto3" json:"fields,omitempty"` Values []*FieldData `protobuf:"bytes,8,rep,name=values,proto3" json:"values,omitempty"` } @@ -7718,7 +7718,7 @@ var file_module_msg_proto_rawDesc = []byte{ 0x6c, 0x64, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x26, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x22, 0x95, 0x02, 0x0a, 0x10, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x65, 0x73, 0x22, 0xf7, 0x01, 0x0a, 0x10, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x67, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x63, 0x69, 0x72, 0x12, 0x10, 0x0a, @@ -7726,25 +7726,23 @@ var file_module_msg_proto_rawDesc = []byte{ 0x10, 0x0a, 0x03, 0x63, 0x62, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x63, 0x62, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x62, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x70, 0x62, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x62, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x03, 0x65, 0x62, 0x73, 0x12, 0x3b, 0x0a, 0x1a, 0x61, 0x64, 0x6a, 0x75, 0x73, 0x74, 0x5f, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x17, 0x61, 0x64, 0x6a, 0x75, 0x73, - 0x74, 0x4d, 0x65, 0x74, 0x65, 0x72, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x4c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x07, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x2a, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x61, - 0x74, 0x61, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x41, 0x0a, 0x13, 0x51, 0x6f, - 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x72, - 0x67, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, 0x14, 0x0a, - 0x12, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x43, 0x6c, 0x65, 0x61, 0x72, - 0x41, 0x72, 0x67, 0x22, 0x31, 0x0a, 0x1b, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, - 0x64, 0x53, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x47, 0x61, 0x74, 0x65, 0x41, - 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x04, 0x67, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x03, 0x65, 0x62, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x65, 0x64, 0x75, 0x63, 0x74, 0x5f, + 0x6c, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x64, 0x65, 0x64, 0x75, 0x63, + 0x74, 0x4c, 0x65, 0x6e, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x07, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, + 0x12, 0x2a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, + 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x41, 0x0a, 0x13, + 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x41, 0x72, 0x67, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, + 0x65, 0x6c, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, + 0x14, 0x0a, 0x12, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x43, 0x6c, 0x65, + 0x61, 0x72, 0x41, 0x72, 0x67, 0x22, 0x31, 0x0a, 0x1b, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, + 0x61, 0x6e, 0x64, 0x53, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x47, 0x61, 0x74, + 0x65, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x04, 0x67, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pfcpiface/main.go b/pfcpiface/main.go index 516b81181..5088170c4 100644 --- a/pfcpiface/main.go +++ b/pfcpiface/main.go @@ -54,10 +54,10 @@ type QciQosConfig struct { } type SliceMeterConfig struct { - UplinkRateBps uint64 `json:"uplink_bps"` - UplinkBurstBytes uint64 `json:"uplink_burst_bytes"` - DownlinkRateBps uint64 `json:"downlink_bps"` - DownlinkBurstBytes uint64 `json:"downlink_burst_bytes"` + N6RateBps uint64 `json:"n6_bps"` + N6BurstBytes uint64 `json:"n6_burst_bytes"` + N3RateBps uint64 `json:"n3_bps"` + N3BurstBytes uint64 `json:"n3_burst_bytes"` } // SimModeInfo : Sim mode attributes. From 49870bc2a6b11ed71904749b6182a823e276d82a Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Thu, 16 Sep 2021 17:43:12 -0700 Subject: [PATCH 13/22] Use `action` and `tunnel_out_type` as slice meter keys --- conf/up4.bess | 9 +++++---- pfcpiface/bess.go | 8 +++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/conf/up4.bess b/conf/up4.bess index 303ba9d2d..5fae19de5 100644 --- a/conf/up4.bess +++ b/conf/up4.bess @@ -207,10 +207,11 @@ _in -> qerLookup::Qos(fields=[{'attr_name':'src_iface', 'num_bytes':1}, \ values=[{'attr_name':'qfi', 'num_bytes':1}]) executeFAR::Split(size=1, attribute='action') -farOrSliceMeter = executeFAR +_in = executeFAR if parser.enable_slice_metering: # sliceMeter enforces a per slice, per direction meter rate limit - sliceMeter::Qos(fields=[{'attr_name':'src_iface', 'num_bytes':1}]) + sliceMeter::Qos(fields=[{'attr_name':'action', 'num_bytes':1}, \ + {'attr_name':'tunnel_out_type', 'num_bytes':1}]) # Reserved gates, reject rule adds with gate=1/2/3 m_meter = 0 # Placeholder gate not connected. Will meter if lookup result returns this gate m_green = 1 # For green traffic @@ -226,7 +227,7 @@ if parser.enable_slice_metering: sliceMeter:m_fail -> sliceMeterLookupFail::Sink() sliceMeter:m_unmeter -> executeFAR sliceMeter.set_default_gate(gate=m_fail) - farOrSliceMeter = sliceMeter + _in = sliceMeter farLookup::ExactMatch(fields=[{'attr_name':'far_id', 'num_bytes':4}, \ {'attr_name':'fseid', 'num_bytes':8}], \ @@ -237,7 +238,7 @@ farLookup::ExactMatch(fields=[{'attr_name':'far_id', 'num_bytes':4}, \ {'attr_name':'tunnel_out_teid', 'num_bytes':4}, \ {'attr_name':'tunnel_out_udp_port', 'num_bytes':2}]):noGTPUEncap \ -> farMerge::Merge() \ - -> farOrSliceMeter + -> _in # Add logical pipeline when gtpudecap is needed pdrLookup:GTPUDecap \ diff --git a/pfcpiface/bess.go b/pfcpiface/bess.go index e2f98e6ce..5c9b6825c 100644 --- a/pfcpiface/bess.go +++ b/pfcpiface/bess.go @@ -1082,9 +1082,10 @@ func (b *bess) addSliceMeter(ctx context.Context, done chan<- bool, meterConfig Cbs: cbs, /* committed burst size */ Pbs: pbs, /* Peak burst size */ Ebs: ebs, /* Excess burst size */ - DeductLen: 14, /* Exclude Ethernet header */ + DeductLen: 0, /* Exclude Ethernet header */ Fields: []*pb.FieldData{ - intEnc(uint64(access)), /* Source interface */ + intEnc(uint64(farForwardU)), /* Action */ + intEnc(uint64(0)), /* tunnel_out_type */ }, } any, err = anypb.New(q) @@ -1120,7 +1121,8 @@ func (b *bess) addSliceMeter(ctx context.Context, done chan<- bool, meterConfig Ebs: ebs, /* Excess burst size */ DeductLen: 50, /* Exclude Ethernet,IP,UDP,GTP header */ Fields: []*pb.FieldData{ - intEnc(uint64(core)), /* Source interface */ + intEnc(uint64(farForwardD)), /* Action */ + intEnc(uint64(1)), /* tunnel_out_type */ }, } any, err = anypb.New(q) From f7acb305fe1b61a1aaf36d1e4551aefe7d3e6542 Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Thu, 16 Sep 2021 19:12:42 -0700 Subject: [PATCH 14/22] Add N9 meter entry --- conf/upf.json | 2 ++ pfcpiface/bess.go | 37 +++++++++++++++++++++++++++++++++++++ pfcpiface/main.go | 2 ++ 3 files changed, 41 insertions(+) diff --git a/conf/upf.json b/conf/upf.json index 25b1b05d3..0320c801c 100644 --- a/conf/upf.json +++ b/conf/upf.json @@ -95,6 +95,8 @@ "": "uplink policer", "n6_bps": 500000000, "n6_burst_bytes": 3000, + "n9_bps": 500000000, + "n9_burst_bytes": 3000, "": "downlink policer", "n3_bps": 500000000, "n3_burst_bytes": 3000 diff --git a/pfcpiface/bess.go b/pfcpiface/bess.go index 5c9b6825c..328855848 100644 --- a/pfcpiface/bess.go +++ b/pfcpiface/bess.go @@ -1095,6 +1095,43 @@ func (b *bess) addSliceMeter(ctx context.Context, done chan<- bool, meterConfig } b.processSliceMeter(ctx, any, upfMsgTypeAdd) + // Uplink N9 slice meter config + if meterConfig.N9RateBps != 0 { + gate = sliceMeterGateMeter + cir = 1 // Mark all traffic as yellow + pir = meterConfig.N9RateBps / 8 // bit/s to byte/s + } else { + gate = sliceMeterGateUnmeter + } + if meterConfig.N9BurstBytes != 0 { + cbs = 1 // Mark all traffic as yellow + pbs = meterConfig.N9BurstBytes + ebs = 0 // Unused + } else { + cbs = DefaultBurstSize + pbs = DefaultBurstSize + ebs = 0 // Unused + } + q = &pb.QosCommandAddArg{ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ + DeductLen: 0, /* Exclude Ethernet header */ + Fields: []*pb.FieldData{ + intEnc(uint64(farForwardU)), /* Action */ + intEnc(uint64(1)), /* tunnel_out_type */ + }, + } + any, err = anypb.New(q) + if err != nil { + log.Errorln("Error marshalling the rule", q, err) + return + } + b.processSliceMeter(ctx, any, upfMsgTypeAdd) + // Downlink N3 slice meter config if meterConfig.N3RateBps != 0 { gate = sliceMeterGateMeter diff --git a/pfcpiface/main.go b/pfcpiface/main.go index 5088170c4..2ead401a0 100644 --- a/pfcpiface/main.go +++ b/pfcpiface/main.go @@ -56,6 +56,8 @@ type QciQosConfig struct { type SliceMeterConfig struct { N6RateBps uint64 `json:"n6_bps"` N6BurstBytes uint64 `json:"n6_burst_bytes"` + N9RateBps uint64 `json:"n9_bps"` + N9BurstBytes uint64 `json:"n9_burst_bytes"` N3RateBps uint64 `json:"n3_bps"` N3BurstBytes uint64 `json:"n3_burst_bytes"` } From 8dcf6711b494fd97b5d1263329f917d42c5f749f Mon Sep 17 00:00:00 2001 From: Github Actions Date: Fri, 17 Sep 2021 02:35:20 +0000 Subject: [PATCH 15/22] Actions: Updated with changes from CI --- pfcpiface/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pfcpiface/main.go b/pfcpiface/main.go index 2ead401a0..d53ce48e5 100644 --- a/pfcpiface/main.go +++ b/pfcpiface/main.go @@ -56,8 +56,8 @@ type QciQosConfig struct { type SliceMeterConfig struct { N6RateBps uint64 `json:"n6_bps"` N6BurstBytes uint64 `json:"n6_burst_bytes"` - N9RateBps uint64 `json:"n9_bps"` - N9BurstBytes uint64 `json:"n9_burst_bytes"` + N9RateBps uint64 `json:"n9_bps"` + N9BurstBytes uint64 `json:"n9_burst_bytes"` N3RateBps uint64 `json:"n3_bps"` N3BurstBytes uint64 `json:"n3_burst_bytes"` } From efdf77888c38b3c87025bc90b64e0afe8ff67654 Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Thu, 16 Sep 2021 19:47:03 -0700 Subject: [PATCH 16/22] Import cleanup --- conf/up4.bess | 2 -- 1 file changed, 2 deletions(-) diff --git a/conf/up4.bess b/conf/up4.bess index 5fae19de5..84cc8c535 100644 --- a/conf/up4.bess +++ b/conf/up4.bess @@ -6,8 +6,6 @@ from conf.parser import * import conf.ports as port import conf.sim as sim -from scapy.all import Ether, IP, UDP -from scapy.contrib.gtp import GTP_U_Header port.setup_globals() From 9a7b412033e22f8ddf810cc0fdcde82c79d7e566 Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Fri, 17 Sep 2021 10:25:25 -0700 Subject: [PATCH 17/22] Use `int64` for `deduct_len` field --- core/modules/qos.h | 2 +- patches/bess/0015-Protobuf-changes-for-Qos.patch | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/modules/qos.h b/core/modules/qos.h index e6a7b896a..db58e68e8 100644 --- a/core/modules/qos.h +++ b/core/modules/qos.h @@ -67,7 +67,7 @@ struct value { uint64_t cbs; uint64_t pbs; uint64_t ebs; - uint64_t deduct_len; + int64_t deduct_len; struct rte_meter_trtcm_profile p; struct rte_meter_trtcm m; MeteringKey Data; diff --git a/patches/bess/0015-Protobuf-changes-for-Qos.patch b/patches/bess/0015-Protobuf-changes-for-Qos.patch index b2cf629cd..02c2461c8 100644 --- a/patches/bess/0015-Protobuf-changes-for-Qos.patch +++ b/patches/bess/0015-Protobuf-changes-for-Qos.patch @@ -28,7 +28,7 @@ index 25dfc81e..1f7058cd 100644 + uint64 cbs = 4; + uint64 pbs = 5; + uint64 ebs = 6; -+ uint64 deduct_len = 9; ++ int64 deduct_len = 9; + repeated FieldData fields = 7; + repeated FieldData values = 8; +} From 493d96c91292866fb14491a7fd61771c4f2b4ab0 Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Fri, 17 Sep 2021 10:33:38 -0700 Subject: [PATCH 18/22] Make `deduct_len` optional --- bessctl/module_tests/metering.bess | 12 ++-- core/modules/qos.cc | 7 +- .../bess/0015-Protobuf-changes-for-Qos.patch | 6 +- pfcpiface/bess.go | 68 +++++++++---------- 4 files changed, 47 insertions(+), 46 deletions(-) diff --git a/bessctl/module_tests/metering.bess b/bessctl/module_tests/metering.bess index b6913813d..0760dfa8c 100644 --- a/bessctl/module_tests/metering.bess +++ b/bessctl/module_tests/metering.bess @@ -66,31 +66,27 @@ Metering.add(fields=[{'value_int': 1}, {'value_bin': convert('L', 2)}, {'value_bin': convert('Q', 4)}], values=[{'value_int': 1}], # S:1 - gate=m_meter, cir=1 * MPPS , pir=1 * MPPS, cbs=2048, pbs=2048, - deduct_len=14]) + gate=m_meter, cir=1 * MPPS , pir=1 * MPPS, cbs=2048, pbs=2048) Metering.add(fields=[{'value_int': 1}, {'value_bin': convert('L', 3)}, {'value_bin': convert('Q', 6)}], values=[{'value_int': 2}], # S:2 - gate=m_meter, cir=5 * MPPS, pir=5 * MPPS, cbs=2048, pbs=2048, - deduct_len=14) + gate=m_meter, cir=5 * MPPS, pir=5 * MPPS, cbs=2048, pbs=2048) # GBR/MBR Metering.add(fields=[{'value_int': 1}, {'value_bin': convert('L', 4)}, {'value_bin': convert('Q', 8)}], values=[{'value_int': 3}], # S:3 - gate=m_meter, cir=3 * MPPS, pir=6 * MPPS, cbs=2048, pbs=2048, - deduct_len=14) + gate=m_meter, cir=3 * MPPS, pir=6 * MPPS, cbs=2048, pbs=2048) # MBR only Metering.add(fields=[{'value_int': 1}, {'value_bin': convert('L', 5)}, {'value_bin': convert('Q', 10)}], values=[{'value_int': 4}], # S:4 - gate=m_meter, cir=1, pir=6 * MPPS, cbs=2048, pbs=2048, - deduct_len=14) + gate=m_meter, cir=1, pir=6 * MPPS, cbs=2048, pbs=2048) # Unmeter Metering.add(fields=[{'value_int': 1}, diff --git a/core/modules/qos.cc b/core/modules/qos.cc index 4be6c1f6d..897610704 100644 --- a/core/modules/qos.cc +++ b/core/modules/qos.cc @@ -388,7 +388,12 @@ CommandResponse Qos::CommandAdd(const bess::pb::QosCommandAddArg &arg) { v.cbs = arg.cbs(); v.pbs = arg.pbs(); v.ebs = arg.ebs(); - v.deduct_len = arg.deduct_len(); + if (arg.optional_deduct_len_case() == + bess::pb::QosCommandAddArg::OPTIONAL_DEDUCT_LEN_NOT_SET) { + v.deduct_len = 14; // Exclude Ethernet header by default + } else { + v.deduct_len = arg.deduct_len(); + } DLOG(INFO) << "Adding entry" << " cir: " << v.cir << " pir: " << v.pir << " cbs: " << v.cbs diff --git a/patches/bess/0015-Protobuf-changes-for-Qos.patch b/patches/bess/0015-Protobuf-changes-for-Qos.patch index 02c2461c8..ff98b1bd6 100644 --- a/patches/bess/0015-Protobuf-changes-for-Qos.patch +++ b/patches/bess/0015-Protobuf-changes-for-Qos.patch @@ -11,7 +11,7 @@ diff --git a/protobuf/module_msg.proto b/protobuf/module_msg.proto index 25dfc81e..1f7058cd 100644 --- a/protobuf/module_msg.proto +++ b/protobuf/module_msg.proto -@@ -1291,3 +1291,39 @@ message MplsPopArg { +@@ -1291,3 +1291,41 @@ message MplsPopArg { message WorkerSplitArg { map worker_gates = 1; // ogate -> worker mask } @@ -28,7 +28,9 @@ index 25dfc81e..1f7058cd 100644 + uint64 cbs = 4; + uint64 pbs = 5; + uint64 ebs = 6; -+ int64 deduct_len = 9; ++ oneof optional_deduct_len { ++ int64 deduct_len = 9; ++ } + repeated FieldData fields = 7; + repeated FieldData values = 8; +} diff --git a/pfcpiface/bess.go b/pfcpiface/bess.go index 328855848..fa516e6ec 100644 --- a/pfcpiface/bess.go +++ b/pfcpiface/bess.go @@ -758,13 +758,12 @@ func (b *bess) addQER(ctx context.Context, done chan<- bool, qer qer) { } q := &pb.QosCommandAddArg{ - Gate: gate, - Cir: cir, /* committed info rate */ - Pir: pir, /* peak info rate */ - Cbs: cbs, /* committed burst size */ - Pbs: pbs, /* Peak burst size */ - Ebs: ebs, /* Excess burst size */ - DeductLen: 14, /* Exclude Ethernet header */ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ Fields: []*pb.FieldData{ intEnc(uint64(srcIface)), /* Src Intf */ intEnc(uint64(qer.qerID)), /* qer_id */ @@ -799,13 +798,12 @@ func (b *bess) addQER(ctx context.Context, done chan<- bool, qer qer) { } q = &pb.QosCommandAddArg{ - Gate: gate, - Cir: cir, /* committed info rate */ - Pir: pir, /* peak info rate */ - Cbs: cbs, /* committed burst size */ - Pbs: pbs, /* Peak burst size */ - Ebs: ebs, /* Excess burst size */ - DeductLen: 14, /* Exclude Ethernet header */ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ Fields: []*pb.FieldData{ intEnc(uint64(srcIface)), /* Src Intf */ intEnc(uint64(qer.qerID)), /* qer_id */ @@ -1076,13 +1074,13 @@ func (b *bess) addSliceMeter(ctx context.Context, done chan<- bool, meterConfig ebs = 0 // Unused } q := &pb.QosCommandAddArg{ - Gate: gate, - Cir: cir, /* committed info rate */ - Pir: pir, /* peak info rate */ - Cbs: cbs, /* committed burst size */ - Pbs: pbs, /* Peak burst size */ - Ebs: ebs, /* Excess burst size */ - DeductLen: 0, /* Exclude Ethernet header */ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ + OptionalDeductLen: &pb.QosCommandAddArg_DeductLen{0}, /* Include all headers */ Fields: []*pb.FieldData{ intEnc(uint64(farForwardU)), /* Action */ intEnc(uint64(0)), /* tunnel_out_type */ @@ -1113,13 +1111,13 @@ func (b *bess) addSliceMeter(ctx context.Context, done chan<- bool, meterConfig ebs = 0 // Unused } q = &pb.QosCommandAddArg{ - Gate: gate, - Cir: cir, /* committed info rate */ - Pir: pir, /* peak info rate */ - Cbs: cbs, /* committed burst size */ - Pbs: pbs, /* Peak burst size */ - Ebs: ebs, /* Excess burst size */ - DeductLen: 0, /* Exclude Ethernet header */ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ + OptionalDeductLen: &pb.QosCommandAddArg_DeductLen{0}, /* Include all headers */ Fields: []*pb.FieldData{ intEnc(uint64(farForwardU)), /* Action */ intEnc(uint64(1)), /* tunnel_out_type */ @@ -1150,13 +1148,13 @@ func (b *bess) addSliceMeter(ctx context.Context, done chan<- bool, meterConfig ebs = 0 // Unused } q = &pb.QosCommandAddArg{ - Gate: gate, - Cir: cir, /* committed info rate */ - Pir: pir, /* peak info rate */ - Cbs: cbs, /* committed burst size */ - Pbs: pbs, /* Peak burst size */ - Ebs: ebs, /* Excess burst size */ - DeductLen: 50, /* Exclude Ethernet,IP,UDP,GTP header */ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ + OptionalDeductLen: &pb.QosCommandAddArg_DeductLen{50}, /* Exclude Ethernet,IP,UDP,GTP header */ Fields: []*pb.FieldData{ intEnc(uint64(farForwardD)), /* Action */ intEnc(uint64(1)), /* tunnel_out_type */ From 4dcc6f3060d2cdbf6e1a6f32f7a8ccccfa9219e1 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Fri, 17 Sep 2021 17:53:05 +0000 Subject: [PATCH 19/22] Actions: Updated with changes from CI --- pfcpiface/bess_pb/module_msg.pb.go | 82 +++++++++++++++++++----------- 1 file changed, 53 insertions(+), 29 deletions(-) diff --git a/pfcpiface/bess_pb/module_msg.pb.go b/pfcpiface/bess_pb/module_msg.pb.go index f016557d9..29fde203a 100644 --- a/pfcpiface/bess_pb/module_msg.pb.go +++ b/pfcpiface/bess_pb/module_msg.pb.go @@ -5955,15 +5955,17 @@ type QosCommandAddArg struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Gate uint64 `protobuf:"varint,1,opt,name=gate,proto3" json:"gate,omitempty"` - Cir uint64 `protobuf:"varint,2,opt,name=cir,proto3" json:"cir,omitempty"` - Pir uint64 `protobuf:"varint,3,opt,name=pir,proto3" json:"pir,omitempty"` - Cbs uint64 `protobuf:"varint,4,opt,name=cbs,proto3" json:"cbs,omitempty"` - Pbs uint64 `protobuf:"varint,5,opt,name=pbs,proto3" json:"pbs,omitempty"` - Ebs uint64 `protobuf:"varint,6,opt,name=ebs,proto3" json:"ebs,omitempty"` - DeductLen uint64 `protobuf:"varint,9,opt,name=deduct_len,json=deductLen,proto3" json:"deduct_len,omitempty"` - Fields []*FieldData `protobuf:"bytes,7,rep,name=fields,proto3" json:"fields,omitempty"` - Values []*FieldData `protobuf:"bytes,8,rep,name=values,proto3" json:"values,omitempty"` + Gate uint64 `protobuf:"varint,1,opt,name=gate,proto3" json:"gate,omitempty"` + Cir uint64 `protobuf:"varint,2,opt,name=cir,proto3" json:"cir,omitempty"` + Pir uint64 `protobuf:"varint,3,opt,name=pir,proto3" json:"pir,omitempty"` + Cbs uint64 `protobuf:"varint,4,opt,name=cbs,proto3" json:"cbs,omitempty"` + Pbs uint64 `protobuf:"varint,5,opt,name=pbs,proto3" json:"pbs,omitempty"` + Ebs uint64 `protobuf:"varint,6,opt,name=ebs,proto3" json:"ebs,omitempty"` + // Types that are assignable to OptionalDeductLen: + // *QosCommandAddArg_DeductLen + OptionalDeductLen isQosCommandAddArg_OptionalDeductLen `protobuf_oneof:"optional_deduct_len"` + Fields []*FieldData `protobuf:"bytes,7,rep,name=fields,proto3" json:"fields,omitempty"` + Values []*FieldData `protobuf:"bytes,8,rep,name=values,proto3" json:"values,omitempty"` } func (x *QosCommandAddArg) Reset() { @@ -6040,8 +6042,15 @@ func (x *QosCommandAddArg) GetEbs() uint64 { return 0 } -func (x *QosCommandAddArg) GetDeductLen() uint64 { - if x != nil { +func (m *QosCommandAddArg) GetOptionalDeductLen() isQosCommandAddArg_OptionalDeductLen { + if m != nil { + return m.OptionalDeductLen + } + return nil +} + +func (x *QosCommandAddArg) GetDeductLen() int64 { + if x, ok := x.GetOptionalDeductLen().(*QosCommandAddArg_DeductLen); ok { return x.DeductLen } return 0 @@ -6061,6 +6070,16 @@ func (x *QosCommandAddArg) GetValues() []*FieldData { return nil } +type isQosCommandAddArg_OptionalDeductLen interface { + isQosCommandAddArg_OptionalDeductLen() +} + +type QosCommandAddArg_DeductLen struct { + DeductLen int64 `protobuf:"varint,9,opt,name=deduct_len,json=deductLen,proto3,oneof"` +} + +func (*QosCommandAddArg_DeductLen) isQosCommandAddArg_OptionalDeductLen() {} + type QosCommandDeleteArg struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -7718,7 +7737,7 @@ var file_module_msg_proto_rawDesc = []byte{ 0x6c, 0x64, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x26, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x22, 0xf7, 0x01, 0x0a, 0x10, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, + 0x65, 0x73, 0x22, 0x90, 0x02, 0x0a, 0x10, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x67, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x63, 0x69, 0x72, 0x12, 0x10, 0x0a, @@ -7726,23 +7745,25 @@ var file_module_msg_proto_rawDesc = []byte{ 0x10, 0x0a, 0x03, 0x63, 0x62, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x63, 0x62, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x62, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x70, 0x62, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x62, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x03, 0x65, 0x62, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x65, 0x64, 0x75, 0x63, 0x74, 0x5f, - 0x6c, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x64, 0x65, 0x64, 0x75, 0x63, - 0x74, 0x4c, 0x65, 0x6e, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, - 0x12, 0x2a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, - 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x41, 0x0a, 0x13, - 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x41, 0x72, 0x67, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, - 0x14, 0x0a, 0x12, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x43, 0x6c, 0x65, - 0x61, 0x72, 0x41, 0x72, 0x67, 0x22, 0x31, 0x0a, 0x1b, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, - 0x61, 0x6e, 0x64, 0x53, 0x65, 0x74, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x47, 0x61, 0x74, - 0x65, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x67, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x04, 0x67, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x03, 0x65, 0x62, 0x73, 0x12, 0x1f, 0x0a, 0x0a, 0x64, 0x65, 0x64, 0x75, 0x63, 0x74, 0x5f, + 0x6c, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x09, 0x64, 0x65, 0x64, + 0x75, 0x63, 0x74, 0x4c, 0x65, 0x6e, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, + 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, + 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, + 0x64, 0x73, 0x12, 0x2a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x42, 0x15, + 0x0a, 0x13, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x65, 0x64, 0x75, 0x63, + 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x22, 0x41, 0x0a, 0x13, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, + 0x61, 0x6e, 0x64, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x72, 0x67, 0x12, 0x2a, 0x0a, 0x06, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, + 0x65, 0x73, 0x73, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x44, 0x61, 0x74, 0x61, + 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x6f, 0x73, 0x43, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x41, 0x72, 0x67, 0x22, 0x31, + 0x0a, 0x1b, 0x51, 0x6f, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x53, 0x65, 0x74, 0x44, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x47, 0x61, 0x74, 0x65, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, + 0x04, 0x67, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x67, 0x61, 0x74, + 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -9398,6 +9419,9 @@ func file_module_msg_proto_init() { (*TimestampArg_Offset)(nil), (*TimestampArg_AttrName)(nil), } + file_module_msg_proto_msgTypes[103].OneofWrappers = []interface{}{ + (*QosCommandAddArg_DeductLen)(nil), + } file_module_msg_proto_msgTypes[111].OneofWrappers = []interface{}{ (*GenericEncapArg_EncapField_Attribute)(nil), (*GenericEncapArg_EncapField_Value)(nil), From d6b9e1656514475bfc8d8012072a0136a1c3c191 Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Fri, 17 Sep 2021 12:33:25 -0700 Subject: [PATCH 20/22] Revert "Add N9 meter entry" This reverts commit f7acb305fe1b61a1aaf36d1e4551aefe7d3e6542. N9 is not addressed in this PR, but can be added later. --- conf/upf.json | 2 -- pfcpiface/bess.go | 37 ------------------------------------- pfcpiface/main.go | 2 -- 3 files changed, 41 deletions(-) diff --git a/conf/upf.json b/conf/upf.json index 0320c801c..25b1b05d3 100644 --- a/conf/upf.json +++ b/conf/upf.json @@ -95,8 +95,6 @@ "": "uplink policer", "n6_bps": 500000000, "n6_burst_bytes": 3000, - "n9_bps": 500000000, - "n9_burst_bytes": 3000, "": "downlink policer", "n3_bps": 500000000, "n3_burst_bytes": 3000 diff --git a/pfcpiface/bess.go b/pfcpiface/bess.go index fa516e6ec..83bb95186 100644 --- a/pfcpiface/bess.go +++ b/pfcpiface/bess.go @@ -1093,43 +1093,6 @@ func (b *bess) addSliceMeter(ctx context.Context, done chan<- bool, meterConfig } b.processSliceMeter(ctx, any, upfMsgTypeAdd) - // Uplink N9 slice meter config - if meterConfig.N9RateBps != 0 { - gate = sliceMeterGateMeter - cir = 1 // Mark all traffic as yellow - pir = meterConfig.N9RateBps / 8 // bit/s to byte/s - } else { - gate = sliceMeterGateUnmeter - } - if meterConfig.N9BurstBytes != 0 { - cbs = 1 // Mark all traffic as yellow - pbs = meterConfig.N9BurstBytes - ebs = 0 // Unused - } else { - cbs = DefaultBurstSize - pbs = DefaultBurstSize - ebs = 0 // Unused - } - q = &pb.QosCommandAddArg{ - Gate: gate, - Cir: cir, /* committed info rate */ - Pir: pir, /* peak info rate */ - Cbs: cbs, /* committed burst size */ - Pbs: pbs, /* Peak burst size */ - Ebs: ebs, /* Excess burst size */ - OptionalDeductLen: &pb.QosCommandAddArg_DeductLen{0}, /* Include all headers */ - Fields: []*pb.FieldData{ - intEnc(uint64(farForwardU)), /* Action */ - intEnc(uint64(1)), /* tunnel_out_type */ - }, - } - any, err = anypb.New(q) - if err != nil { - log.Errorln("Error marshalling the rule", q, err) - return - } - b.processSliceMeter(ctx, any, upfMsgTypeAdd) - // Downlink N3 slice meter config if meterConfig.N3RateBps != 0 { gate = sliceMeterGateMeter diff --git a/pfcpiface/main.go b/pfcpiface/main.go index d53ce48e5..5088170c4 100644 --- a/pfcpiface/main.go +++ b/pfcpiface/main.go @@ -56,8 +56,6 @@ type QciQosConfig struct { type SliceMeterConfig struct { N6RateBps uint64 `json:"n6_bps"` N6BurstBytes uint64 `json:"n6_burst_bytes"` - N9RateBps uint64 `json:"n9_bps"` - N9BurstBytes uint64 `json:"n9_burst_bytes"` N3RateBps uint64 `json:"n3_bps"` N3BurstBytes uint64 `json:"n3_burst_bytes"` } From e6effdfec76f18d53cc0cb26c0050c27e56c6b04 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Fri, 17 Sep 2021 19:55:10 +0000 Subject: [PATCH 21/22] Actions: Updated with changes from CI --- pfcpiface/bess.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pfcpiface/bess.go b/pfcpiface/bess.go index 83bb95186..a3befbce9 100644 --- a/pfcpiface/bess.go +++ b/pfcpiface/bess.go @@ -758,12 +758,12 @@ func (b *bess) addQER(ctx context.Context, done chan<- bool, qer qer) { } q := &pb.QosCommandAddArg{ - Gate: gate, - Cir: cir, /* committed info rate */ - Pir: pir, /* peak info rate */ - Cbs: cbs, /* committed burst size */ - Pbs: pbs, /* Peak burst size */ - Ebs: ebs, /* Excess burst size */ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ Fields: []*pb.FieldData{ intEnc(uint64(srcIface)), /* Src Intf */ intEnc(uint64(qer.qerID)), /* qer_id */ @@ -798,12 +798,12 @@ func (b *bess) addQER(ctx context.Context, done chan<- bool, qer qer) { } q = &pb.QosCommandAddArg{ - Gate: gate, - Cir: cir, /* committed info rate */ - Pir: pir, /* peak info rate */ - Cbs: cbs, /* committed burst size */ - Pbs: pbs, /* Peak burst size */ - Ebs: ebs, /* Excess burst size */ + Gate: gate, + Cir: cir, /* committed info rate */ + Pir: pir, /* peak info rate */ + Cbs: cbs, /* committed burst size */ + Pbs: pbs, /* Peak burst size */ + Ebs: ebs, /* Excess burst size */ Fields: []*pb.FieldData{ intEnc(uint64(srcIface)), /* Src Intf */ intEnc(uint64(qer.qerID)), /* qer_id */ From ddae822bdec6a1acc4472e5b9791a1de2bb3ab9e Mon Sep 17 00:00:00 2001 From: pudelkoM Date: Fri, 17 Sep 2021 14:07:22 -0700 Subject: [PATCH 22/22] Add todo about GTPU extension headers --- pfcpiface/bess.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pfcpiface/bess.go b/pfcpiface/bess.go index a3befbce9..b930cc4f8 100644 --- a/pfcpiface/bess.go +++ b/pfcpiface/bess.go @@ -1110,6 +1110,7 @@ func (b *bess) addSliceMeter(ctx context.Context, done chan<- bool, meterConfig pbs = DefaultBurstSize ebs = 0 // Unused } + // TODO: packet deduction should take GTPU extension header into account q = &pb.QosCommandAddArg{ Gate: gate, Cir: cir, /* committed info rate */