Give each stream its own ethertype steered to its own rx queue
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
etherType = 0x88b5
|
||||
etherBase = 0x88b5
|
||||
ethHdrLen = 14
|
||||
hdrLen = 24
|
||||
hdrMagic = 0x43424c54
|
||||
@@ -75,16 +75,17 @@ func patternIndex(name string) (int, error) {
|
||||
}
|
||||
|
||||
type frameSpec struct {
|
||||
patIdx int
|
||||
ref []byte
|
||||
crcFor map[int]uint32
|
||||
dstMAC [6]byte
|
||||
srcMAC [6]byte
|
||||
sizes []int
|
||||
maxSize int
|
||||
patIdx int
|
||||
ref []byte
|
||||
crcFor map[int]uint32
|
||||
dstMAC [6]byte
|
||||
srcMAC [6]byte
|
||||
etherType uint16
|
||||
sizes []int
|
||||
maxSize int
|
||||
}
|
||||
|
||||
func newFrameSpec(patIdx int, dst, src [6]byte, sizes []int) *frameSpec {
|
||||
func newFrameSpec(patIdx int, dst, src [6]byte, etherType uint16, sizes []int) *frameSpec {
|
||||
maxSize := 0
|
||||
for _, s := range sizes {
|
||||
if s > maxSize {
|
||||
@@ -98,20 +99,21 @@ func newFrameSpec(patIdx int, dst, src [6]byte, sizes []int) *frameSpec {
|
||||
crcFor[s] = crc32.Checksum(ref[:s-minFrame], crcTable)
|
||||
}
|
||||
return &frameSpec{
|
||||
patIdx: patIdx,
|
||||
ref: ref,
|
||||
crcFor: crcFor,
|
||||
dstMAC: dst,
|
||||
srcMAC: src,
|
||||
sizes: sizes,
|
||||
maxSize: maxSize,
|
||||
patIdx: patIdx,
|
||||
ref: ref,
|
||||
crcFor: crcFor,
|
||||
dstMAC: dst,
|
||||
srcMAC: src,
|
||||
etherType: etherType,
|
||||
sizes: sizes,
|
||||
maxSize: maxSize,
|
||||
}
|
||||
}
|
||||
|
||||
func (f *frameSpec) prefill(buf []byte) {
|
||||
copy(buf[0:6], f.dstMAC[:])
|
||||
copy(buf[6:12], f.srcMAC[:])
|
||||
binary.BigEndian.PutUint16(buf[12:14], etherType)
|
||||
binary.BigEndian.PutUint16(buf[12:14], f.etherType)
|
||||
copy(buf[minFrame:], f.ref)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user