refactor(ish): make fastdp hold on to interface
rather than just the MTU
This commit is contained in:
1 parent
9f0399f27e
commit
f12ec3b295
1 file changed
+3
-7
+3
-7
@@ -32,7 +32,7 @@ type FastDatapath struct {
|
|||||||
lock sync.Mutex // guards state and synchronises use of dpif
|
lock sync.Mutex // guards state and synchronises use of dpif
|
||||||
dpif *odp.Dpif
|
dpif *odp.Dpif
|
||||||
dp odp.DatapathHandle
|
dp odp.DatapathHandle
|
||||||
mtu int // [1]
|
iface *net.Interface
|
||||||
deleteFlowsCount uint64
|
deleteFlowsCount uint64
|
||||||
missCount uint64
|
missCount uint64
|
||||||
missHandlers map[odp.VportID]missHandler
|
missHandlers map[odp.VportID]missHandler
|
||||||
@@ -59,10 +59,6 @@ type FastDatapath struct {
|
|||||||
|
|
||||||
// forwarders by remote peer
|
// forwarders by remote peer
|
||||||
forwarders map[mesh.PeerName]*fastDatapathForwarder
|
forwarders map[mesh.PeerName]*fastDatapathForwarder
|
||||||
|
|
||||||
// [1] The mtu from the datapath netdev (which should match the
|
|
||||||
// mtus on all the veths hooked up to the datapath). We validate
|
|
||||||
// that we are able to support that mtu.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFastDatapath(dpName string, port int) (*FastDatapath, error) {
|
func NewFastDatapath(dpName string, port int) (*FastDatapath, error) {
|
||||||
@@ -92,7 +88,7 @@ func NewFastDatapath(dpName string, port int) (*FastDatapath, error) {
|
|||||||
dpname: dpName,
|
dpname: dpName,
|
||||||
dpif: dpif,
|
dpif: dpif,
|
||||||
dp: dp,
|
dp: dp,
|
||||||
mtu: iface.MTU,
|
iface: iface,
|
||||||
missHandlers: make(map[odp.VportID]missHandler),
|
missHandlers: make(map[odp.VportID]missHandler),
|
||||||
sendToPort: nil,
|
sendToPort: nil,
|
||||||
sendToMAC: make(map[MAC]bridgeSender),
|
sendToMAC: make(map[MAC]bridgeSender),
|
||||||
@@ -665,7 +661,7 @@ func (fwd *fastDatapathForwarder) sendHeartbeat() {
|
|||||||
|
|
||||||
// the heartbeat payload consists of the 64-bit connection uid
|
// the heartbeat payload consists of the 64-bit connection uid
|
||||||
// followed by the 16-bit packet size.
|
// followed by the 16-bit packet size.
|
||||||
buf := make([]byte, EthernetOverhead+fwd.fastdp.mtu)
|
buf := make([]byte, EthernetOverhead+fwd.fastdp.iface.MTU)
|
||||||
binary.BigEndian.PutUint64(buf[EthernetOverhead:], fwd.connUID)
|
binary.BigEndian.PutUint64(buf[EthernetOverhead:], fwd.connUID)
|
||||||
binary.BigEndian.PutUint16(buf[EthernetOverhead+8:], uint16(len(buf)))
|
binary.BigEndian.PutUint16(buf[EthernetOverhead+8:], uint16(len(buf)))
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user