For fast datapath, the router core will only be invoked upon datapath
misses.  And it needs to yield routing decisions in a form that can be
used to configure the in-kernel datapath.  So here we make the router
core yield FlowOps, which represent operations which actually do
something with a packet.  The router core obtains these in turn from
the Bridge or the Overlay, depending on what it wants to do with
a packet.

For fast datapath, it's critical that the router makes decisions based
only on the required packet header information (as the same header
information will be used when configuring the ODP flow rules).  So we
pass only that information into the router core, in the form of
PacketKeys.

The overall effect is to curry the router core: Rather than taking a
packet and doing something with it, it takes packet header information
and returns a function that does something with a packet.
This commit is contained in:
David Wragg committed 2015-09-08 10:44:52 +01:00
1 parent 6e0795253e
commit c2ad4c5633
11 files changed
+235 -119

No files matched your search

+5 -9
View File
@@ -39,8 +39,7 @@ type ForwarderParams struct {
// When a consumer is called, the decoder will already have been used
// to decode the frame.
type OverlayConsumer func(src *Peer, dst *Peer, frame []byte,
dec *EthernetDecoder)
type OverlayConsumer func(ForwardPacketKey) FlowOp
// Crypto settings for a forwarder.
type OverlayCrypto struct {
@@ -58,11 +57,8 @@ type OverlayForwarder interface {
// (e.g. on another thread).
SetListener(OverlayForwarderListener)
// Forward a packet across the connection. The caller must
// supply an EthernetDecoder specific to this thread, which
// has already been used to decode the frame.
Forward(src *Peer, dest *Peer, frame []byte, dec *EthernetDecoder,
broadcast bool)
// Forward a packet across the connection.
Forward(ForwardPacketKey) FlowOp
Stop()
@@ -88,8 +84,8 @@ func (NullOverlay) MakeForwarder(ForwarderParams) (OverlayForwarder, error) {
func (NullOverlay) SetListener(OverlayForwarderListener) {
}
func (NullOverlay) Forward(*Peer, *Peer, []byte, *EthernetDecoder,
bool) {
func (NullOverlay) Forward(ForwardPacketKey) FlowOp {
return nil
}
func (NullOverlay) Stop() {