Fast datapath

This commit is contained in:
David Wragg committed 2015-06-12 21:24:10 +01:00
1 parent 00b3d5bf98
commit 62de82f349
10 files changed
+764 -57

No files matched your search

+23 -1
View File
@@ -45,6 +45,28 @@ func (mfop *MultiFlowOp) Add(ops ...FlowOp) {
func (mfop *MultiFlowOp) Send(frame []byte, dec *EthernetDecoder,
broadcast bool) {
for _, op := range mfop.ops {
op.Send(frame, dec, mfop.broadcast)
if op != nil {
op.Send(frame, dec, mfop.broadcast)
}
}
}
func FlattenFlowOp(fop FlowOp) []FlowOp {
return collectFlowOps(nil, fop)
}
func collectFlowOps(into []FlowOp, fop FlowOp) []FlowOp {
if fop == nil {
return into
}
if mfop, ok := fop.(*MultiFlowOp); ok {
for _, op := range mfop.ops {
into = collectFlowOps(into, op)
}
return into
}
return append(into, fop)
}