Skip to content

What's the proper way to multithread gonetmap? #9

@ntcong

Description

@ntcong

I tried several ways to multithread gonetmap but it doesn't work

for ringIndex := uint32(0); ringIndex < iface.Nif.RxRings+1; ringIndex++ {
	ring := iface.GetRing(ringIndex, gonetmap.RX)
	go pollingWorker(iface, ring, 1000) // polling specific ring with processRing(ring)
}
for i := uint32(0); i < 8; i++ {
	ring := iface.GetRing(ringIndex, gonetmap.RX)
	go pollingWorker(iface, 1000)  // a loop create ring and use processRing(ring)
}

It's always fail with

ens192 RX0: fail 'cur < head || cur > kring->nr_hwtail' h 47 c 43 t 47 rh 47 rc 43 rt 47
hc 43 ht 47

Seems like different goroutines change cur/head.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions