Commit 467baf48 authored by Mihai Budiu's avatar Mihai Budiu Committed by Brenden Blanco

fixed bugs in control-flow generation

Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
parent 8a04fb39
...@@ -483,12 +483,10 @@ class EbpfProgram(object): ...@@ -483,12 +483,10 @@ class EbpfProgram(object):
done = set() done = set()
while len(nodestoadd) > 0: while len(nodestoadd) > 0:
todo = nodestoadd.pop() todo = nodestoadd.pop()
if todo is None:
todo = nextEntryPoint
if todo is None:
continue
if todo in done: if todo in done:
continue continue
if todo is None:
continue
print("Generating ", todo.name) print("Generating ", todo.name)
...@@ -503,3 +501,6 @@ class EbpfProgram(object): ...@@ -503,3 +501,6 @@ class EbpfProgram(object):
for e in self.entryPoints: for e in self.entryPoints:
todo.add(e) todo.add(e)
self.generatePipelineInternal(serializer, todo, self.egressEntry) self.generatePipelineInternal(serializer, todo, self.egressEntry)
todo = set()
todo.add(self.egressEntry)
self.generatePipelineInternal(serializer, todo, None)
...@@ -365,6 +365,12 @@ class EbpfTable(object): ...@@ -365,6 +365,12 @@ class EbpfTable(object):
serializer.newline() serializer.newline()
serializer.blockEnd(True) serializer.blockEnd(True)
if not "hit" in nextNode:
# Catch-all
serializer.emitIndent()
serializer.appendFormat("goto end;")
serializer.newline()
serializer.blockEnd(True) serializer.blockEnd(True)
def runAction(self, serializer, tableName, valueName, program, nextNode): def runAction(self, serializer, tableName, valueName, program, nextNode):
......
...@@ -86,4 +86,3 @@ class Graph(object): ...@@ -86,4 +86,3 @@ class Graph(object):
return None return None
return topo_sorting return topo_sorting
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment