diff --git a/conf/up4.bess b/conf/up4.bess index abbdfabbe..f446547b7 100644 --- a/conf/up4.bess +++ b/conf/up4.bess @@ -18,10 +18,16 @@ Access = 1 Core = 2 Uplink = 0 Downlink = 1 +noGTPUDecap = 0 +GTPUDecap = 1 +noGTPUEncap = 0 +GTPUEncap = 1 farForwardUAction = 0 farForwardDAction = 1 farDropAction = 2 farNotifyCPAction = 4 +pdrFailGate = 2 +farFailGate = 2 interfaces = ["s1u", "sgi"] parser = Parser('conf/upf.json') parser.parse(interfaces) @@ -127,8 +133,7 @@ linkMerge::Merge() \ {'attr_name':'fseid', 'num_bytes':4}, \ {'attr_name':'ctr_id', 'num_bytes':4}, \ {'attr_name':'far_id', 'num_bytes':4}, \ - {'attr_name':'needs_gtpu_decap', 'num_bytes':1}]):1 \ - -> needGTPUDecap::Split(size=1, attribute='needs_gtpu_decap') \ + {'attr_name':'needs_gtpu_decap', 'num_bytes':1}]):noGTPUDecap \ -> preQoSCounter::Counter(name_id='ctr_id', check_exist=True, total=parser.max_sessions) \ -> farLookup::ExactMatch(fields=[{'attr_name':'far_id', 'num_bytes':4}, \ {'attr_name':'fseid', 'num_bytes':4}], \ @@ -137,33 +142,40 @@ linkMerge::Merge() \ {'attr_name':'tunnel_out_src_ip4addr', 'num_bytes':4}, \ {'attr_name':'tunnel_out_dst_ip4addr', 'num_bytes':4}, \ {'attr_name':'tunnel_out_teid', 'num_bytes':4}, \ - {'attr_name':'tunnel_out_udp_port', 'num_bytes':2}]):1 \ - -> needGTPUEncap::Split(size=1, attribute='tunnel_out_type') \ + {'attr_name':'tunnel_out_udp_port', 'num_bytes':2}]):noGTPUEncap \ + -> sgiEtherAdd::GenericEncap(fields=[ + {'size': 6, 'value': {'value_int': 0x0}}, + {'size': 6, 'value': {'value_int': mac2hex(macstr_d)}}, + {'size': 2, 'value': {'value_int': 0x0800}}]) \ -> farMerge::Merge() \ -> executeFAR::Split(size=1, attribute='action') # Add logical pipeline when gtpudecap is needed -needGTPUDecap:1 \ +pdrLookup:GTPUDecap \ -> etherDecapTrim::GenericDecap(bytes=14) -> gtpuDecap::GtpuDecap() \ -> preQoSCounter # Add logical pipeline when gtpuencap is needed -needGTPUEncap:1 \ +farLookup:GTPUEncap \ -> etherEncapTrim::GenericDecap(bytes=14) \ -> gtpuEncap::GtpuEncap():1 \ + -> s1uEtherAdd::GenericEncap(fields=[ + {'size': 6, 'value': {'value_int': 0x0}}, + {'size': 6, 'value': {'value_int': mac2hex(macstr_u)}}, + {'size': 2, 'value': {'value_int': 0x0800}}]) \ -> farMerge # Drop unknown packets pktParse:0 -> badPkts::Sink() -pdrLookup:0 -> pdrLookupFail::Sink() -farLookup:0 -> farLookupFail::Sink() +pdrLookup:pdrFailGate -> pdrLookupFail::Sink() +farLookup:farFailGate -> farLookupFail::Sink() executeFAR:farDropAction -> farDrop::Sink() executeFAR:farNotifyCPAction -> farNotifyCP::Sink() gtpuEncap:0 -> gtpuEncapFail::Sink() # Set default gates for relevant modules -pdrLookup.set_default_gate(gate=0) -farLookup.set_default_gate(gate=0) +pdrLookup.set_default_gate(gate=pdrFailGate) +farLookup.set_default_gate(gate=farFailGate) # ==================================================== @@ -215,13 +227,9 @@ _in:gate \ # 3. Complete the last part of the DL pipeline executeFAR:farForwardDAction \ - -> s1uEtherAdd::GenericEncap(fields=[ - {'size': 6, 'value': {'value_int': 0x0}}, - {'size': 6, 'value': {'value_int': mac2hex(macstr_u)}}, - {'size': 2, 'value': {'value_int': 0x0800}}]) \ - -> postDLQoSCounter::Counter(name_id='ctr_id', check_exist=True, total=parser.max_sessions) \ -> outerUDPCsum::L4Checksum() \ -> outerIPCsum::IPChecksum() \ + -> postDLQoSCounter::Counter(name_id='ctr_id', check_exist=True, total=parser.max_sessions) \ -> ports[parser.s1u_ifname].rtr # Drop unknown packets @@ -281,10 +289,6 @@ _in:gate \ # 3. Complete the last part of the UL pipeline executeFAR:farForwardUAction \ - -> sgiEtherAdd::GenericEncap(fields=[ - {'size': 6, 'value': {'value_int': 0x0}}, - {'size': 6, 'value': {'value_int': mac2hex(macstr_d)}}, - {'size': 2, 'value': {'value_int': 0x0800}}]) \ -> postULQoSCounter::Counter(name_id='ctr_id', check_exist=True, total=parser.max_sessions) \ -> ports[parser.sgi_ifname].rtr diff --git a/cpiface/bess_control.h b/cpiface/bess_control.h index 608a1bbb7..04ced558b 100644 --- a/cpiface/bess_control.h +++ b/cpiface/bess_control.h @@ -108,7 +108,7 @@ class BessClient { const PDRArgs *pa = (const PDRArgs *)v; bess::pb::WildcardMatchCommandAddArg *wmcaa = new bess::pb::WildcardMatchCommandAddArg(); - wmcaa->set_gate(1); + wmcaa->set_gate(pa->need_decap); wmcaa->set_priority(1); /* SET VALUES */ @@ -317,7 +317,7 @@ class BessClient { const FARArgs *fa = (const FARArgs *)v; bess::pb::ExactMatchCommandAddArg *emcaa = new bess::pb::ExactMatchCommandAddArg(); - emcaa->set_gate(1); + emcaa->set_gate(fa->tuntype); /* SET FIELDS */ /* set far_id value */ diff --git a/pfcpiface/upf.go b/pfcpiface/upf.go index 5a45beaba..2a81bedef 100644 --- a/pfcpiface/upf.go +++ b/pfcpiface/upf.go @@ -270,7 +270,7 @@ func (u *upf) addPDR(ctx context.Context, done chan<- bool, p pdr) { var err error f := &pb.WildcardMatchCommandAddArg{ - Gate: 1, + Gate: uint64(p.needDecap), Priority: 1, Values: []*pb.FieldData{ intEnc(uint64(p.srcIface)), /* src_iface */ @@ -369,7 +369,7 @@ func (u *upf) addFAR(ctx context.Context, done chan<- bool, far far) { var err error f := &pb.ExactMatchCommandAddArg{ - Gate: 1, + Gate: uint64(far.tunnelType), Fields: []*pb.FieldData{ intEnc(uint64(far.farID)), /* far_id */ intEnc(uint64(far.fseID)), /* fseid */