Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xsk stats report Tx_ring_empty_descs when change argument of GetDescs() #15

Open
seudut opened this issue Dec 4, 2021 · 0 comments
Open
Assignees

Comments

@seudut
Copy link

seudut commented Dec 4, 2021

hi,

I encounter a issue when test this library. Based on the example sendudp.go, I just make two change

  • change the default option (change the size of NufFrames, default is 128, I change it to 16) when create xsk options
  • change the argument when call GetDescs(), the default in sendudp.go is get number of free tx slots, for test, I change the number as 1, just to get one free descrs. here is the detail change of sendudp.go
@@ -51,7 +52,16 @@ func main() {
                panic(err)
        }

-       xsk, err := xdp.NewSocket(link.Attrs().Index, QueueID, nil)
+       options := xdp.SocketOptions{
+               NumFrames:              128,
+               FrameSize:              2048,
+               FillRingNumDescs:       2048,
+               CompletionRingNumDescs: 2048,
+               RxRingNumDescs:         2048,
+               TxRingNumDescs:         2048,
+       }
+
+       xsk, err := xdp.NewSocket(link.Attrs().Index, QueueID, &options)
        if err != nil {
                panic(err)
        }
@@ -122,12 +132,14 @@ func main() {
                        }
                        numPkts = cur.Completed - prev.Completed
                        fmt.Printf("%d packets/s (%d Mb/s)\n", numPkts, (numPkts*uint64(frameLen)*8)/(1000*1000))
+                       ss, _ := json.Marshal(cur)
+                       fmt.Printf("stats:%s\n", string(ss))
                        prev = cur
                }
        }()

        for {
-               descs := xsk.GetDescs(xsk.NumFreeTxSlots())
+               descs := xsk.GetDescs(1)
                for i := range descs {
                        descs[i].Len = uint32(frameLen)
                }
@@ -137,5 +149,6 @@ func main() {
                if err != nil {
                        panic(err)
                }
+               time.Sleep(1000 * time.Millisecond)
        }
 }

the demo still be able to work, but when print the stats, Tx_ring_empty_descs increase as the packet send out, here is the log,

0 packets/s (0 Mb/s)
stats:{"Filled":0,"Received":0,"Transmitted":1,"Completed":0,"KernelStats":{"Rx_dropped":0,"Rx_invalid_descs":0,"Tx_invalid_descs":0,"Rx_ring_full":0,"Rx_fill_ring_empty_descs":0,"Tx_ring_empty_descs":1}}
2 packets/s (0 Mb/s)
stats:{"Filled":0,"Received":0,"Transmitted":3,"Completed":2,"KernelStats":{"Rx_dropped":0,"Rx_invalid_descs":0,"Tx_invalid_descs":0,"Rx_ring_full":0,"Rx_fill_ring_empty_descs":0,"Tx_ring_empty_descs":3}}
1 packets/s (0 Mb/s)
stats:{"Filled":0,"Received":0,"Transmitted":4,"Completed":3,"KernelStats":{"Rx_dropped":0,"Rx_invalid_descs":0,"Tx_invalid_descs":0,"Rx_ring_full":0,"Rx_fill_ring_empty_descs":0,"Tx_ring_empty_descs":4}}
1 packets/s (0 Mb/s)
stats:{"Filled":0,"Received":0,"Transmitted":5,"Completed":4,"KernelStats":{"Rx_dropped":0,"Rx_invalid_descs":0,"Tx_invalid_descs":0,"Rx_ring_full":0,"Rx_fill_ring_empty_descs":0,"Tx_ring_empty_descs":5}}
1 packets/s (0 Mb/s)
stats:{"Filled":0,"Received":0,"Transmitted":6,"Completed":5,"KernelStats":{"Rx_dropped":0,"Rx_invalid_descs":0,"Tx_invalid_descs":0,"Rx_ring_full":0,"Rx_fill_ring_empty_descs":0,"Tx_ring_empty_descs":6}}

check the linux document https://lore.kernel.org/bpf/20200708072835.4427-2-ciara.loftus@intel.com/
Tx_ring_empty_descs means failed to retrieve descriptor from tx ring.

Is this an issue ? and in what situation, will this happen?

@slavc slavc self-assigned this Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants