Skip to content

Commit

Permalink
UPF init fails to recover from af_xdp failure.
Browse files Browse the repository at this point in the history
Pipeline initialization sequence fails to recover when upf-epc is
configured with non-DPDK settings. AF_XDP mode fails to transition
to AF_PACKET socket mode. A temporary fix is to disable AF_XDP mode.

Non-DPDK pipeline is also fixed in this PR.

Signed-off-by: Muhammad Asim Jamshed <muhammad.jamshed@intel.com>
  • Loading branch information
ajamshed committed May 7, 2020
1 parent 4c0030d commit 728414b
Showing 1 changed file with 42 additions and 43 deletions.
85 changes: 42 additions & 43 deletions conf/spgwu.bess
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ class Port:
mode = self.detect_mode()

if mode == 'linux':
try:
#try:
# Initialize kernel fastpath.
# AF_XDP requires that num_rx_qs == num_tx_qs
kwargs = {"vdev" : "net_af_xdp{},iface={},start_queue=0,queue_count={}"
.format(idx, name, workers), "num_out_q": workers, "num_inc_q": workers}
self.init_fastpath(**kwargs)
except:
print('Failed to create AF_XDP socket for {}. Creating AF_PACKET socket instead.'.format(name))
#kwargs = {"vdev" : "net_af_xdp{},iface={},start_queue=0,queue_count={}"
# .format(idx, name, workers), "num_out_q": workers, "num_inc_q": workers}
#self.init_fastpath(**kwargs)
#except:
#print('Failed to create AF_XDP socket for {}. Creating AF_PACKET socket instead.'.format(name))
kwargs = {"vdev" : "net_af_packet{},iface={},qpairs={}".format(idx, name, workers), "num_out_q": workers}
self.init_fastpath(**kwargs)

Expand Down Expand Up @@ -205,43 +205,6 @@ class Port:
# Direct control traffic from kernel to DPDK
spi -> self.fpo

# Direct fast path traffic to Frag module
merge = __bess_module__("{}Merge".format(name), 'Merge')

out = self.fpo

# Attach frag module (if enabled)
if ip_frag_with_eth_mtu is not None:
frag = __bess_module__("{}IP4Frag".format(name), 'IPFrag', mtu=ip_frag_with_eth_mtu)
frag:1 -> out
frag:0 -> Sink()
out = frag

# Attach telemeric module (if enabled)
if measure:
m = Measure()
m -> out
out = m

# Attach nat module (if enabled)
if self.ext_addrs is not None:
# Tokenize the string
addrs = self.ext_addrs.split(' or ')
# Make a list of ext_addr
nat_list = list()
for addr in addrs:
nat_dict = dict()
nat_dict['ext_addr'] = addr
nat_list.append(nat_dict)

# Create the NAT module
self.nat = __bess_module__("{}NAT".format(conf[interface]["ifname"]), 'NAT', ext_addrs=nat_list)
self.nat:1 -> out
out = self.nat

# Attach Merge module to the 'outlist' of modules
merge -> out

tc = 'slow{}'.format(wid)
try:
bess.add_tc(tc, policy='round_robin', wid=wid)
Expand All @@ -262,6 +225,42 @@ class Port:
print('Mirror veth interface: {} misconfigured: {}'.format(name, e))
else:
raise Exception('Invalid mode selected.')
# Direct fast path traffic to Frag module
merge = __bess_module__("{}Merge".format(name), 'Merge')

out = self.fpo

# Attach frag module (if enabled)
if ip_frag_with_eth_mtu is not None:
frag = __bess_module__("{}IP4Frag".format(name), 'IPFrag', mtu=ip_frag_with_eth_mtu)
frag:1 -> out
frag:0 -> Sink()
out = frag

# Attach telemeric module (if enabled)
if measure:
m = Measure()
m -> out
out = m

# Attach nat module (if enabled)
if self.ext_addrs is not None:
# Tokenize the string
addrs = self.ext_addrs.split(' or ')
# Make a list of ext_addr
nat_list = list()
for addr in addrs:
nat_dict = dict()
nat_dict['ext_addr'] = addr
nat_list.append(nat_dict)

# Create the NAT module
self.nat = __bess_module__("{}NAT".format(conf[interface]["ifname"]), 'NAT', ext_addrs=nat_list)
self.nat:1 -> out
out = self.nat

# Attach Merge module to the 'outlist' of modules
merge -> out


# ====================================================
Expand Down

0 comments on commit 728414b

Please sign in to comment.