Comments (4)
@slavc I am eager to use this package to boot the performance of packet rx / tx for my application. Do you have any idea on the potential issue here?
from xdp.
Hm, I can't seem to reproduce with the minimal example nor with e.g. rebroadcast
example in my environment (QEMU/KVM virtual machine, virtio NIC model), see typescript below.
Can you share more details about your environment, like what if any virtual machine are you running in with what NIC driver, are you running the program as root, etc?
root@u005:/home/schagaev/go/src/github.com/asavie/xdp/examples/rebroadcast# git show -s --oneline HEAD
711132c (HEAD -> master, origin/master, origin/HEAD) Add LoadProgram(): loads an external BPF kernel program (.o file) along with the maps in it (#14)
root@u005:/home/schagaev/go/src/github.com/asavie/xdp/examples/rebroadcast# git diff .
diff --git a/examples/rebroadcast/rebroadcast.go b/examples/rebroadcast/rebroadcast.go
index f37ed97..4fb15e4 100644
--- a/examples/rebroadcast/rebroadcast.go
+++ b/examples/rebroadcast/rebroadcast.go
@@ -88,7 +88,7 @@ func main() {
// descriptors and push them onto the Fill ring queue
// for the kernel to fill them with the received
// frames.
- xsk.Fill(xsk.GetDescs(n))
+ xsk.Fill(xsk.GetDescs(n, true))
}
fmt.Printf(" fill=%d, rx=%d, tx=%d, complete=%d\n", xsk.NumFilled(), xsk.NumReceived(), xsk.NumTransmitted(), xsk.NumCompleted())
root@u005:/home/schagaev/go/src/github.com/asavie/xdp/examples/rebroadcast# virt-what
kvm
root@u005:/home/schagaev/go/src/github.com/asavie/xdp/examples/rebroadcast# uname -a
Linux u005 5.4.0-94-generic #106-Ubuntu SMP Thu Jan 6 23:58:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
root@u005:/home/schagaev/go/src/github.com/asavie/xdp/examples/rebroadcast# ulimit -l
65536
root@u005:/home/schagaev/go/src/github.com/asavie/xdp/examples/rebroadcast# ethtool -i enp8s0
driver: virtio_net
version: 1.0.0
firmware-version:
expansion-rom-version:
bus-info: 0000:08:00.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
root@u005:/home/schagaev/go/src/github.com/asavie/xdp/examples/rebroadcast# ethtool -l enp8s0
Channel parameters for enp8s0:
Pre-set maximums:
RX: 0
TX: 0
Other: 0
Combined: 1
Current hardware settings:
RX: 0
TX: 0
Other: 0
Combined: 1
root@u005:/home/schagaev/go/src/github.com/asavie/xdp/examples/rebroadcast# ./rebroadcast -linkname enp8s0
>>> ITERATION 0 <<<
fill=64, rx=0, tx=0, complete=0
waiting for events...
fill=64, rx=1, tx=0, complete=0
received: 1
completed: 0
received frame 0:
hexdump:
00000000 01 80 c2 00 00 00 fe 54 00 8e 5e 7a 00 26 42 42 |.......T..^z.&BB|
00000010 03 00 00 00 00 00 80 00 52 54 00 38 b0 06 00 00 |........RT.8....|
00000020 00 00 80 00 52 54 00 38 b0 06 80 04 00 00 14 00 |....RT.8........|
00000030 02 00 02 00 |....|
PACKET: 52 bytes
- Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..38..] SrcMAC=fe:54:00:8e:5e:7a DstMAC=01:80:c2:00:00:00 EthernetType=LLC Length=38}
- Layer 2 (03 bytes) = LLC {Contents=[66, 66, 3] Payload=[..35..] DSAP=66 IG=false SSAP=66 CR=false Control=3}
- Layer 3 (35 bytes) = STP {Contents=[..35..] Payload=[]}
sent: 1
fill=63, rx=0, tx=1, complete=0
>>> ITERATION 1 <<<
fill=63, rx=0, tx=1, complete=0
waiting for events...
fill=63, rx=0, tx=1, complete=0
received: 0
completed: 0
>>> ITERATION 2 <<<
fill=63, rx=0, tx=1, complete=1
waiting for events...
fill=63, rx=0, tx=0, complete=0
received: 0
completed: 1
>>> ITERATION 3 <<<
fill=63, rx=0, tx=0, complete=0
waiting for events...
fill=63, rx=1, tx=0, complete=0
received: 1
completed: 0
received frame 0:
hexdump:
00000000 01 80 c2 00 00 00 fe 54 00 8e 5e 7a 00 26 42 42 |.......T..^z.&BB|
00000010 03 00 00 00 00 00 80 00 52 54 00 38 b0 06 00 00 |........RT.8....|
00000020 00 00 80 00 52 54 00 38 b0 06 80 04 00 00 14 00 |....RT.8........|
00000030 02 00 02 00 |....|
PACKET: 52 bytes
- Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..38..] SrcMAC=fe:54:00:8e:5e:7a DstMAC=01:80:c2:00:00:00 EthernetType=LLC Length=38}
- Layer 2 (03 bytes) = LLC {Contents=[66, 66, 3] Payload=[..35..] DSAP=66 IG=false SSAP=66 CR=false Control=3}
- Layer 3 (35 bytes) = STP {Contents=[..35..] Payload=[]}
sent: 1
fill=62, rx=0, tx=1, complete=0
>>> ITERATION 4 <<<
fill=62, rx=0, tx=1, complete=1
waiting for events...
fill=62, rx=0, tx=0, complete=0
received: 0
completed: 1
>>> ITERATION 5 <<<
fill=62, rx=0, tx=0, complete=0
waiting for events...
^C
root@u005:/home/schagaev/go/src/github.com/asavie/xdp/examples/rebroadcast#
from xdp.
@slavc I have re-created my VM, and the program works on my new VM now. The difference between my destroyed VM and current in-use VM is the number of queues on the network interfaces. The destroyed VM has 4 queues, and now it's 1. Not sure if this will be the potential issue.
Here is the hardware settings on my current VM:
emu@emu:~$ ethtool -l ens3
Channel parameters for ens3:
Pre-set maximums:
RX: 0
TX: 0
Other: 0
Combined: 1
Current hardware settings:
RX: 0
TX: 0
Other: 0
Combined: 1
from xdp.
I reproduced the same issue on another new VM.
root@emu:/home/emu# ./rebroadcast -linkname ens5
error: failed to attach xdp program to interface: cannot allocate memory
However, when I explicitly set the XDP flag use generic XDP, it's working.
xdp.DefaultXdpFlags = unix.XDP_FLAGS_SKB_MODE
It seems my virtio driver doesn't support native XDP?
@slavc Do you know any method to check if the native XDP mode is supported or not? If possible, any programmatic way?
root@emu:/home/emu# ethtool -i ens4
driver: virtio_net
version: 1.0.0
firmware-version:
expansion-rom-version:
bus-info: 0000:00:04.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
root@emu:/home/emu# ethtool -l ens4
Channel parameters for ens4:
Pre-set maximums:
RX: 0
TX: 0
Other: 0
Combined: 1
Current hardware settings:
RX: 0
TX: 0
Other: 0
Combined: 1
from xdp.
Related Issues (20)
- Allowing offset into frame HOT 1
- Q: what is the correct way to use this for RX and TX at the same time? HOT 4
- Redirecting to another port HOT 1
- xsk stats report Tx_ring_empty_descs when change argument of GetDescs()
- xdp_pass
- error HOT 1
- Filter based on the value of a specific byte
- how to do example rate limiting of ip based on this?
- At high throughput receiving same packet twice at expense of another packet disappearing altogether.
- how do also listen to a specific port and forward to another application port based on ip address? HOT 1
- possible to provide example for tcp and ipv6 together?
- getting error for ubuntu 22.04, golang 1.19 go build sendudp.go
- Detaching program hangs when using SKB mode
- map xdp_stats_map: pin by name: missing MapOptions.PinPath
- Transmit error when using Intel nic / ixgbe driver HOT 7
- error: syscall.Bind SockaddrXDP failed: device or resource busy
- Create a new release to make sure it's in sync with the latest code HOT 1
- cpu reordering / missing memory fences issues?
- Support for XDP_USE_NEED_WAKEUP?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xdp.