mirror of
https://github.com/slackhq/nebula.git
synced 2025-12-06 02:30:57 -08:00
why does it work
This commit is contained in:
parent
17a6917428
commit
c026e8624a
2 changed files with 4 additions and 4 deletions
|
|
@ -313,7 +313,7 @@ func (f *Interface) listenOut(q int) {
|
|||
func (f *Interface) listenIn(reader overlay.TunDev, queueNum int) {
|
||||
runtime.LockOSThread()
|
||||
|
||||
const batch = 64
|
||||
const batch = 128
|
||||
originalPackets := make([][]byte, batch) //todo batch config
|
||||
for i := 0; i < batch; i++ {
|
||||
originalPackets[i] = make([]byte, 0xffff)
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ func (u *StdConn) WriteBatch(pkts []*packet.Packet) (int, error) {
|
|||
iovs := make([][]iovec, 0, len(pkts))
|
||||
|
||||
sent := 0
|
||||
|
||||
const maxIovLen = 48
|
||||
var mostRecentPkt *packet.Packet
|
||||
//segmenting := false
|
||||
idx := 0
|
||||
|
|
@ -221,7 +221,7 @@ func (u *StdConn) WriteBatch(pkts []*packet.Packet) (int, error) {
|
|||
continue
|
||||
}
|
||||
lastIdx := idx - 1
|
||||
if mostRecentPkt != nil && pkt.CompatibleForSegmentationWith(mostRecentPkt) && msgs[lastIdx].Hdr.Iovlen < 4 {
|
||||
if mostRecentPkt != nil && pkt.CompatibleForSegmentationWith(mostRecentPkt) && msgs[lastIdx].Hdr.Iovlen < maxIovLen { //todo math this more good
|
||||
|
||||
msgs[lastIdx].Hdr.Controllen = uint64(len(mostRecentPkt.Control))
|
||||
msgs[lastIdx].Hdr.Control = &mostRecentPkt.Control[0]
|
||||
|
|
@ -233,7 +233,7 @@ func (u *StdConn) WriteBatch(pkts []*packet.Packet) (int, error) {
|
|||
mostRecentPkt.SetSegSizeForTX()
|
||||
} else {
|
||||
msgs = append(msgs, rawMessage{})
|
||||
iovs = append(iovs, make([]iovec, 1, 8)) //todo
|
||||
iovs = append(iovs, make([]iovec, 1, maxIovLen)) //todo
|
||||
iovs[idx][0] = iovec{
|
||||
Base: &pkt.Payload[0],
|
||||
Len: uint64(len(pkt.Payload)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue