refactor(ish): make fastdp hold on to interface

rather than just the MTU
This commit is contained in:
Matthias Radestock committed 2016-01-13 13:50:18 +00:00
1 parent 9f0399f27e
commit f12ec3b295
1 file changed
+3 -7
+3 -7
View File
@@ -32,7 +32,7 @@ type FastDatapath struct {
lock sync.Mutex // guards state and synchronises use of dpif
dpif *odp.Dpif
dp odp.DatapathHandle
mtu int // [1]
iface *net.Interface
deleteFlowsCount uint64
missCount uint64
missHandlers map[odp.VportID]missHandler
@@ -59,10 +59,6 @@ type FastDatapath struct {
// forwarders by remote peer
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) {
@@ -92,7 +88,7 @@ func NewFastDatapath(dpName string, port int) (*FastDatapath, error) {
dpname: dpName,
dpif: dpif,
dp: dp,
mtu: iface.MTU,
iface: iface,
missHandlers: make(map[odp.VportID]missHandler),
sendToPort: nil,
sendToMAC: make(map[MAC]bridgeSender),
@@ -665,7 +661,7 @@ func (fwd *fastDatapathForwarder) sendHeartbeat() {
// the heartbeat payload consists of the 64-bit connection uid
// 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.PutUint16(buf[EthernetOverhead+8:], uint16(len(buf)))