Skip to content

Commit

Permalink
Rearranged pipeline around gtpuEncap & gtpuDecap.
Browse files Browse the repository at this point in the history
Removed farTunnel FAR action as it does not exist. Replaced it with
farForwardD (for downlink) and farForwardU (for uplink).
Placed GTPUDecap right after pdrLookup.
Placed GTPUEncap right after farLookup.
Converted Counter module to accept multiple (10) IGate links.
Introduced logic for outerHeaderRemoval detection in pfcpiface.

Signed-off-by: Muhammad Asim Jamshed <muhammad.jamshed@intel.com>
  • Loading branch information
ajamshed committed Jul 16, 2020
1 parent eae35b3 commit 72b4efe
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 15 deletions.
27 changes: 19 additions & 8 deletions conf/up4.bess
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Access = 1
Core = 2
Uplink = 0
Downlink = 1
farForwardAction = 0
farTunnelAction = 1
farForwardUAction = 0
farForwardDAction = 1
farDropAction = 2
farNotifyCPAction = 4
interfaces = ["s1u", "sgi"]
Expand Down Expand Up @@ -128,6 +128,7 @@ linkMerge::Merge() \
{'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') \
-> 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,14 +138,28 @@ linkMerge::Merge() \
{'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') \
-> farMerge::Merge() \
-> executeFAR::Split(size=1, attribute='action')

# Add logical pipeline when gtpudecap is needed
needGTPUDecap:1 \
-> etherDecapTrim::GenericDecap(bytes=14) -> gtpuDecap::GtpuDecap() \
-> preQoSCounter

# Add logical pipeline when gtpuencap is needed
needGTPUEncap:1 \
-> etherEncapTrim::GenericDecap(bytes=14) \
-> gtpuEncap::GtpuEncap():1 \
-> farMerge

# Drop unknown packets
pktParse:0 -> badPkts::Sink()
pdrLookup:0 -> pdrLookupFail::Sink()
farLookup:0 -> 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)
Expand Down Expand Up @@ -199,9 +214,7 @@ _in:gate \


# 3. Complete the last part of the DL pipeline
executeFAR:farTunnelAction \
-> etherEncapTrim::GenericDecap(bytes=14) \
-> gtpuEncap::GtpuEncap():1 \
executeFAR:farForwardDAction \
-> s1uEtherAdd::GenericEncap(fields=[
{'size': 6, 'value': {'value_int': 0x0}},
{'size': 6, 'value': {'value_int': mac2hex(macstr_u)}},
Expand All @@ -212,7 +225,6 @@ executeFAR:farTunnelAction \
-> ports[parser.s1u_ifname].rtr

# Drop unknown packets
gtpuEncap:0 -> gtpuEncapFail::Sink()
sgiRxIPCksum:1 -> sgiRxIPCksumFail::Sink()
sgiRxUDPCksum:1 -> sgiRxUDPCksumFail::Sink()
outerIPCsum:1 -> outerIPCsumFail::Sink()
Expand Down Expand Up @@ -268,8 +280,7 @@ _in:gate \
-> linkMerge # Start of the shared pipeline

# 3. Complete the last part of the UL pipeline
executeFAR:farForwardAction \
-> etherDecapTrim::GenericDecap(bytes=14) -> gtpuDecap::GtpuDecap() \
executeFAR:farForwardUAction \
-> sgiEtherAdd::GenericEncap(fields=[
{'size': 6, 'value': {'value_int': 0x0}},
{'size': 6, 'value': {'value_int': mac2hex(macstr_d)}},
Expand Down
1 change: 1 addition & 0 deletions core/modules/counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Counter final : public Module {
Counter() : counters() {}

static const Commands cmds;
static const gate_idx_t kNumIGates = 10;
CommandResponse AddCounter(const bess::pb::CounterAddArg &arg);
CommandResponse RemoveCounter(const bess::pb::CounterRemoveArg &arg);
CommandResponse RemoveAllCounters(const bess::pb::EmptyArg &);
Expand Down
3 changes: 2 additions & 1 deletion pfcpiface/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ type SimModeInfo struct {

// CPIfaceInfo : CPIface interface settings
type CPIfaceInfo struct {
DestIP string `json:"nb_dst_ip"`
DestIP string `json:"nb_dst_ip"`
//SrcIP string `json:"nb_src_ip"`
FQDNHost string `json:"hostname"`
}

Expand Down
12 changes: 10 additions & 2 deletions pfcpiface/pfcpiface.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ func parsePDRFromPFCPSessEstReqPayload(sereq *message.SessionEstablishmentReques
return pdrList, farList
}

_, err = ie1.OuterHeaderRemoval()
if err == nil {
res, err := ie1.OuterHeaderRemovalDescription()
if res == 0 && err == nil { // 0 == GTP-U/UDP/IPv4
outerHeaderRemoval = 1
}
}

for _, ie2 := range pdi {
switch ie2.Type {
case ie.SourceInterface:
Expand Down Expand Up @@ -158,7 +166,7 @@ func parsePDRFromPFCPSessEstReqPayload(sereq *message.SessionEstablishmentReques
far := far{
farID: uint8(farID), // farID currently being truncated to uint8 <--- FIXIT/TODO/XXX
fseID: uint32(fseid.SEID), // fseID currently being truncated to uint32 <--- FIXIT/TODO/XXX
action: farForward,
action: farForwardU,
}
farList = append(farList, far)
}
Expand Down Expand Up @@ -405,7 +413,7 @@ func handleSessionModificationRequest(upf *upf, msg message.Message, addr net.Ad
far := far{
farID: uint8(farID), // farID currently being truncated to uint8 <--- FIXIT/TODO/XXX
fseID: uint32(fseid), // fseID currently being truncated to uint32 <--- FIXIT/TODO/XXX
action: farTunnel,
action: farForwardD,
tunnelType: 0x1,
s1uIP: ip2int(s1uIP4),
eNBIP: ip2int(eNBIP),
Expand Down
8 changes: 4 additions & 4 deletions pfcpiface/upf.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const (
downlink = 0x1

// far-action specific values
farForward = 0x0
farTunnel = 0x1
farForwardU = 0x0
farForwardD = 0x1
)

type pdr struct {
Expand Down Expand Up @@ -133,7 +133,7 @@ func (u *upf) sim(method string) {
farDown := far{
farID: downlink,
fseID: teid + i,
action: farTunnel,
action: farForwardD,
tunnelType: 0x1,
s1uIP: s1uip,
eNBIP: ip2int(enbip) + enbIdx,
Expand All @@ -145,7 +145,7 @@ func (u *upf) sim(method string) {
farUp := far{
farID: uplink,
fseID: teid + i,
action: farForward,
action: farForwardU,
}

switch timeout := 100 * time.Millisecond; method {
Expand Down

0 comments on commit 72b4efe

Please sign in to comment.