Skip to content

Commit

Permalink
Removed redundant modules from the pipeline.
Browse files Browse the repository at this point in the history
Split modules can be replaced with more gates in pdrLookup & farLookup.
Moved a few modules up the pipeline.

Still a few more modules can be moved up (e.g. checksum compute
modules) for the downlink sub-pipeline. But the attributes stored in the
packet are most likely getting overwritten when mbuf gets pre-appended
with outer IPv4/UDP/GTP header. Need to revisit exactmatch/wildcardmatch
module(s) before more modules are moved up (TODO).

Signed-off-by: Muhammad Asim Jamshed <muhammad.jamshed@intel.com>
  • Loading branch information
ajamshed committed Jul 16, 2020
1 parent 72b4efe commit 568e5c3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 23 deletions.
42 changes: 23 additions & 19 deletions conf/up4.bess
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}], \
Expand All @@ -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)


# ====================================================
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions cpiface/bess_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions pfcpiface/upf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 568e5c3

Please sign in to comment.