Documentation
¶
Overview ¶
Copyright 2018 Platina Systems, Inc. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Ethernet hardware interfaces.
Index ¶
- Constants
- Variables
- func FormatRewrite(v *vnet.Vnet, r *vnet.Rewrite) (lines []string)
- func GetBridgeBySi(si vnet.Si) (br *bridgeEntry)
- func GetPacketHeader(r *vnet.Ref) vnet.PacketHeader
- func Init(v *vnet.Vnet, m4, m6 *ip.Main)
- func ParseHeader(b []byte) (h *Header, vs []*VlanHeader, payloadType Type, payload []byte)
- func ProcessChangeUpper(msg *xeth.MsgChangeUpper, action vnet.ActionType, v *vnet.Vnet) (err error)
- func RefString(r *vnet.Ref) string
- func RegisterInterface(v *vnet.Vnet, hi HwInterfacer, config *InterfaceConfig, format string, ...)
- func RegisterLayer(v *vnet.Vnet, t Type, l vnet.Layer)
- func SetBridge(stag uint16, ifname string) *vnet.PortEntry
- func SetInterfaceErrorCorrection(v *vnet.Vnet, hi vnet.Hi, et ErrorCorrectionType) (err error)
- func StartFromFeReceivers()
- func UnregisterLayer(v *vnet.Vnet, t Type) (ok bool)
- func UnsetBridge(stag uint16)
- type Address
- func (a *Address) Add(x uint64)
- func (a *Address) Equal(b Address) bool
- func (a *Address) FromUint64(x vnet.Uint64)
- func (a *Address) IsBroadcast() bool
- func (a *Address) IsLocallyAdministered() bool
- func (a *Address) IsUnicast() bool
- func (a *Address) IsZero() bool
- func (v *Address) MaskedString(r vnet.MaskedStringer) (s string)
- func (a *Address) Parse(in *parse.Input)
- func (a *Address) String() string
- func (a *Address) ToUint64() (x vnet.Uint64)
- type AddressBlock
- type DoubleTaggedInjectNode
- type DoubleTaggedPuntInjectNodes
- type DoubleTaggedPuntNode
- type ErrorCorrectionType
- type Header
- func (h *Header) GetPayload() unsafe.Pointer
- func (h *Header) GetType() Type
- func (h *Header) IsBroadcast() bool
- func (h *Header) IsUnicast() bool
- func (h *Header) Len() uint
- func (h *Header) Parse(in *parse.Input)
- func (h *Header) Read(b []byte) vnet.PacketHeader
- func (h *Header) String() (s string)
- func (h *Header) TypeIs(t Type) bool
- func (h *Header) Write(b []byte)
- type HeaderNoType
- type HeaderParser
- type HwInterfacer
- type IfDuplex
- type IfId
- type IfSpanningTreeState
- type Interface
- func (i *Interface) ConfigureHwIf(in *cli.Input) (ok bool, err error)
- func (hi *Interface) FormatAddress() string
- func (i *Interface) FormatId(aʹ vnet.IfId) (v string)
- func (hi *Interface) FormatRewrite(r *vnet.Rewrite) []string
- func (hi *Interface) GetAddress() []byte
- func (i *Interface) GetInterface() *Interface
- func (i *Interface) LessThanId(aʹ, bʹ vnet.IfId) bool
- func (intf *Interface) ParseId(a *vnet.IfId, in *parse.Input) bool
- func (hi *Interface) ParseRewrite(r *vnet.Rewrite, in *parse.Input)
- func (hi *Interface) SetAddress(a []byte)
- func (i *Interface) SetErrorCorrection() (err error)
- func (hi *Interface) SetRewrite(v *vnet.Vnet, rw *vnet.Rewrite, packetType vnet.PacketType, da []byte)
- func (i *Interface) SupportsArp()
- type InterfaceConfig
- type IpNeighbor
- type Main
- type PhyInterface
- type PortFdbInfo
- type PuntConfig
- type PuntDisposition
- type SingleTaggedInjectNode
- type SingleTaggedPuntInjectNodes
- type SingleTaggedPuntNode
- type Type
- type Vlan
- type VlanHeader
- type VlanTag
- func (v VlanTag) CFI() bool
- func (t VlanTag) FromHost() VlanTag
- func (v VlanTag) Id() uint16
- func (v VlanTag) MaskedString(r vnet.MaskedStringer) (s string)
- func (v VlanTag) Priority() uint8
- func (v *VlanTag) Set(i uint16, p uint8, cfi bool)
- func (v *VlanTag) String() string
- func (t VlanTag) ToHost() VlanTag
- type VlanTypeAndTag
Constants ¶
const ( ErrorCorrectionNone = iota ErrorCorrectionCL74 // IEEE Clause 74 for 10g ethernet ErrorCorrectionCL91 // IEEE Clause 91 for 100g ethernet )
const ( SizeofAddress = 6 SizeofHeader = 14 SizeofVlanHeader = 4 )
const MaxVlan = 1 << 12
const SizeofVlanTypeAndTag = 4
Variables ¶
var BroadcastAddr = Address{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}
var ErrDelUnknownNeighbor = errors.New("delete unknown neighbor")
var PipePortByPortVid map[uint16]uint16 // FIXME remove, not needed for learning lookup
Functions ¶
func GetBridgeBySi ¶
func GetPacketHeader ¶
func GetPacketHeader(r *vnet.Ref) vnet.PacketHeader
func ParseHeader ¶
func ParseHeader(b []byte) (h *Header, vs []*VlanHeader, payloadType Type, payload []byte)
func ProcessChangeUpper ¶
func ProcessChangeUpper(msg *xeth.MsgChangeUpper, action vnet.ActionType, v *vnet.Vnet) (err error)
add/remove port from bridge, no change to netns update fdb map of stag/pipeport to ifindex of bridge member
func RegisterInterface ¶
func RegisterInterface(v *vnet.Vnet, hi HwInterfacer, config *InterfaceConfig, format string, args ...interface{})
func SetBridge ¶
Bridge interface is mapped by name and by stag entry is allocated when creating map by ifname stag may change, so that map must be refreshed
func StartFromFeReceivers ¶
func StartFromFeReceivers()
l2-mod-fifo learning, aging, and flush is posted async from fe1 to vnet
func UnsetBridge ¶
func UnsetBridge(stag uint16)
Types ¶
type Address ¶
type Address [SizeofAddress]byte
func AddressUint64 ¶
func RandomAddress ¶
func RandomAddress() (a Address)
func (*Address) FromUint64 ¶
func (*Address) IsBroadcast ¶
func (*Address) IsLocallyAdministered ¶
func (*Address) MaskedString ¶
func (v *Address) MaskedString(r vnet.MaskedStringer) (s string)
type AddressBlock ¶
type AddressBlock struct { // Base ethernet address (stored in board's EEPROM). Base Address // Number of addresses starting at base. Count uint32 // contains filtered or unexported fields }
Block of ethernet addresses for allocation by a switch.
func (*AddressBlock) Alloc ¶
func (b *AddressBlock) Alloc() (Address, bool)
func (*AddressBlock) Free ¶
func (b *AddressBlock) Free(a *Address)
type DoubleTaggedInjectNode ¶
func (*DoubleTaggedInjectNode) AddDisposition ¶
type DoubleTaggedPuntInjectNodes ¶
type DoubleTaggedPuntInjectNodes struct { Punt DoubleTaggedPuntNode Inject DoubleTaggedInjectNode }
type DoubleTaggedPuntNode ¶
type DoubleTaggedPuntNode vlan_tagged_punt_node
func (*DoubleTaggedPuntNode) AddDisposition ¶
func (n *DoubleTaggedPuntNode) AddDisposition(cf PuntConfig) (i PuntDisposition)
func (*DoubleTaggedPuntNode) DelDisposition ¶
func (n *DoubleTaggedPuntNode) DelDisposition(i PuntDisposition) (ok bool)
type ErrorCorrectionType ¶
type ErrorCorrectionType uint8
func (*ErrorCorrectionType) Parse ¶
func (t *ErrorCorrectionType) Parse(in *parse.Input)
func (ErrorCorrectionType) String ¶
func (x ErrorCorrectionType) String() string
type Header ¶
Header for ethernet packets as they appear on the network.
func (*Header) GetPayload ¶
func (*Header) IsBroadcast ¶
type HeaderNoType ¶
type HeaderNoType header_no_type
type HeaderParser ¶
type HeaderParser struct {
// contains filtered or unexported fields
}
func (*HeaderParser) Sizeof ¶
func (h *HeaderParser) Sizeof() uint
func (*HeaderParser) Write ¶
func (h *HeaderParser) Write(b []byte)
type HwInterfacer ¶
type HwInterfacer interface { GetInterface() *Interface SetErrorCorrection() (err error) vnet.HwInterfacer }
type IfSpanningTreeState ¶
type IfSpanningTreeState int
Spanning Tree State IEEE 802.1d
const ( Disable IfSpanningTreeState = iota + 1 Block Listen Learn Forward )
Possible spanning tree states.
func (IfSpanningTreeState) String ¶
func (x IfSpanningTreeState) String() string
type Interface ¶
type Interface struct { vnet.HwIf InterfaceConfig // contains filtered or unexported fields }
func (*Interface) ConfigureHwIf ¶
func (*Interface) FormatAddress ¶
func (*Interface) GetAddress ¶
func (*Interface) GetInterface ¶
func (*Interface) ParseRewrite ¶
func (*Interface) SetAddress ¶
func (*Interface) SetErrorCorrection ¶
Default implementation: nothing supported.
func (*Interface) SetRewrite ¶
func (*Interface) SupportsArp ¶
func (i *Interface) SupportsArp()
See vnet.Arper interface. Dummy function to mark ethernet interfaces as supporting ARP.
type InterfaceConfig ¶
type InterfaceConfig struct { Address Address PhyInterface PhyInterface NativeVlan Vlan Unprovisioned bool ErrorCorrectionType ErrorCorrectionType }
type Main ¶
func (*Main) AddDelIpNeighbor ¶
func (*Main) SetPortMap ¶
func (m *Main) SetPortMap(fi []PortFdbInfo)
called from fe1 to init map so vnet can call br api by pipe-port
type PhyInterface ¶
type PhyInterface int
Physical interface between ethernet MAC and PHY.
const ( CAUI PhyInterface = iota + 1 CR CR2 CR4 GMII INTERLAKEN KR KR2 KR4 KX LR LR4 MII QSGMII RGMII RXAUI SFI SGMII SPAUI SR SR10 SR2 SR4 XAUI XFI XGMII XLAUI XLAUI2 ZR )
Mac to PHY physical interface types. Sorted alphabetically.
func (PhyInterface) String ¶
func (x PhyInterface) String() string
type PortFdbInfo ¶
learned by pipe_port, lookup bridge member via portvid
type PuntConfig ¶
type PuntConfig struct { // Next hop in vnet packet processing for this dispostion. Next string // Software interface and aux data to use for packet. RefOpaque vnet.RefOpaque // True to advance past vlan/2-vlan tags to layer 3 header. AdvanceL3Header bool NReplaceVlanHeaders uint ReplaceVlanHeaders [2]VlanTypeAndTag Stag uint16 }
type PuntDisposition ¶
type PuntDisposition uint32
func PuntDispositionForTags ¶
func PuntDispositionForTags(outer, inner VlanTag) (i PuntDisposition)
type SingleTaggedInjectNode ¶
func (*SingleTaggedInjectNode) AddDisposition ¶
type SingleTaggedPuntInjectNodes ¶
type SingleTaggedPuntInjectNodes struct { Punt SingleTaggedPuntNode Inject SingleTaggedInjectNode }
type SingleTaggedPuntNode ¶
type SingleTaggedPuntNode vlan_tagged_punt_node
func (*SingleTaggedPuntNode) AddDisposition ¶
func (n *SingleTaggedPuntNode) AddDisposition(cf PuntConfig) PuntDisposition
func (*SingleTaggedPuntNode) DelDisposition ¶
func (n *SingleTaggedPuntNode) DelDisposition(i PuntDisposition) (ok bool)
type Type ¶
Packet type from ethernet header.
const ( // Types < 0x600 (1536) are LLC packet lengths. TYPE_LLC_LENGTH Type = 0x600 TYPE_XNS_IDP Type = 0x600 TYPE_IP4 Type = 0x800 TYPE_ARP Type = 0x806 TYPE_VINES_IP Type = 0x0BAD TYPE_VINES_LOOPBACK Type = 0x0BAE TYPE_VINES_ECHO Type = 0x0BAF TYPE_TRAIN Type = 0x1984 TYPE_CDP Type = 0x2000 TYPE_CGMP Type = 0x2001 TYPE_SRP_CONTROL Type = 0x2007 TYPE_CENTRINO_PROMISC Type = 0x2452 TYPE_DECNET Type = 0x6000 TYPE_DECNET_DUMP_LOAD Type = 0x6001 TYPE_DECNET_REMOTE_CONSOLE Type = 0x6002 TYPE_DECNET_ROUTE Type = 0x6003 TYPE_DEC_LAT Type = 0x6004 TYPE_DEC_DIAGNOSTIC Type = 0x6005 TYPE_DEC_CUSTOMER Type = 0x6006 TYPE_DEC_SCA Type = 0x6007 TYPE_TRANSPARENT_BRIDGING Type = 0x6558 TYPE_RAW_FRAME_RELAY Type = 0x6559 TYPE_REVERSE_ARP Type = 0x8035 TYPE_DEC_LAN_BRIDGE Type = 0x8038 TYPE_DEC_ETHERNET_ENCRYPTION Type = 0x803D TYPE_DEC_LAN_TRAFFIC_MONITOR Type = 0x803F TYPE_DEC_LAST Type = 0x8041 TYPE_APPLETALK Type = 0x809B TYPE_IBM_SNA Type = 0x80D5 TYPE_APPLETALK_AARP Type = 0x80F3 TYPE_WELLFLEET_COMPRESSION Type = 0x80FF TYPE_VLAN Type = 0x8100 TYPE_VLAN_IN_VLAN Type = 0x9100 TYPE_VLAN_802_1AD Type = 0x88a8 TYPE_IPX Type = 0x8137 TYPE_SNMP Type = 0x814C TYPE_CABLETRON_ISMP Type = 0x81FD TYPE_CABLETRON_ISMP_TBFLOOD Type = 0x81FF TYPE_IP6 Type = 0x86DD TYPE_ATOMIC Type = 0x86DF TYPE_TCP_IP_COMPRESSION Type = 0x876B TYPE_IP_AUTONOMOUS_SYSTEMS Type = 0x876C TYPE_SECURE_DATA Type = 0x876D TYPE_MAC_CONTROL Type = 0x8808 TYPE_SLOW_PROTOCOLS Type = 0x8809 TYPE_PPP Type = 0x880B TYPE_MPLS_UNICAST Type = 0x8847 TYPE_MPLS_MULTICAST Type = 0x8848 TYPE_PPPOE_DISCOVERY Type = 0x8863 TYPE_PPPOE_SESSION Type = 0x8864 TYPE_INTEL_ANS Type = 0x886D TYPE_MICROSOFT_NLB_HEARTBEAT Type = 0x886F TYPE_CDMA_2000 Type = 0x8881 TYPE_PROFINET Type = 0x8892 TYPE_HYPERSCSI Type = 0x889a TYPE_AOE Type = 0x88a2 TYPE_BRDWALK Type = 0x88AE TYPE_LOOPBACK Type = 0x9000 TYPE_RTNET_MAC Type = 0x9021 TYPE_RTNET_CONFIG Type = 0x9022 TYPE_PGLAN Type = 0x9999 TYPE_SRP_ISIS Type = 0xFEFE TYPE_RESERVED Type = 0xFFFF )
func (Type) MaskedString ¶
func (v Type) MaskedString(r vnet.MaskedStringer) (s string)
func (*Type) SetPacketType ¶
func (et *Type) SetPacketType(pt vnet.PacketType)
type VlanHeader ¶
type VlanHeader struct { /* 3 bit priority, 1 bit CFI and 12 bit vlan id. */ Tag VlanTag /* Inner ethernet type. */ Type Type }
Tagged packets have VlanHeader after ethernet header.
func (*VlanHeader) GetType ¶
func (h *VlanHeader) GetType() Type
func (*VlanHeader) Len ¶
func (h *VlanHeader) Len() uint
func (*VlanHeader) Parse ¶
func (h *VlanHeader) Parse(sup_in *parse.Input)
func (*VlanHeader) Read ¶
func (h *VlanHeader) Read(b []byte) vnet.PacketHeader
func (*VlanHeader) String ¶
func (h *VlanHeader) String() (s string)
func (*VlanHeader) Write ¶
func (h *VlanHeader) Write(b []byte)
type VlanTag ¶
A 16 bit vlan tag in network byte order.
func PuntTagsForDisposition ¶
func PuntTagsForDisposition(i PuntDisposition) (outer, inner VlanTag)
func (VlanTag) MaskedString ¶
func (v VlanTag) MaskedString(r vnet.MaskedStringer) (s string)
type VlanTypeAndTag ¶
Like a VlanHeader but with fields in reverse order. Packet looks like either of the following:
DST-ETHERNET SRC-ETHERNET TypeAndTag INNER-TYPE DST-ETHERNET SRC-ETHERNET 0x8100 VlanHeader
func (*VlanTypeAndTag) Write ¶
func (h *VlanTypeAndTag) Write(b []byte)