Comments (8)
Error: lost 1 packets
is reported directly by the perf system, it indicates that the perf buffer was full when the XDP program tried to copy a packet into it.
You can try increasing the size of the buffer (-buffer
), and also maybe the watermark (-watermark
). man perf_event_open has more info on wakeup_watermark
.
from xdpcap.
Error: lost 1 packets
is reported directly by the perf system, it indicates that the perf buffer was full when the XDP program tried to copy a packet into it.You can try increasing the size of the buffer (
-buffer
), and also maybe the watermark (-watermark
). man perf_event_open has more info onwakeup_watermark
.
Thanks very much !^_^. I get it and run success.
from xdpcap.
resolved!
from xdpcap.
Error: lost 1 packets
is reported directly by the perf system, it indicates that the perf buffer was full when the XDP program tried to copy a packet into it.You can try increasing the size of the buffer (
-buffer
), and also maybe the watermark (-watermark
). man perf_event_open has more info onwakeup_watermark
.
First of all thank you for taking the time to browse my questions!
I found another problem。
background: Xdpcap filters 100Mb packets from 1Gbps.
I add a var all
in main.go for packets statistic.
such as:
var all int64 = 1
for{
_, err := filter.read()
all++
atomic.StoreInt64(&inall, all)
if err !=nil{
fmt.Fprintln(os. Stderr, "Error:", err)
}
}
。。。。
statistic code:
aa := atomic.LoadInt64(&inall)
fmt.Printf("--user model stats inall=%d pkts. avg=%f pa \n", aa, ....)
1:
Xdpcap can't read any packet while I set -watermark = 8191
(-buffer = 8192 )。
It seems that cilium
code was blocked(cilium.ebpf.perf.reader.go func(pr* Reader)Read (Record, error) )
.
root@xxxxxx:/xxx/xxx/xxx# ./xdpcap -watermark 8191
/sys/fs/bpf/xdp/globals/action_map pp.pcap "src 168.168.1.50"
[1] secs...
-- kernel mode> aborted: 0/0 drop: 243979/19717 pass: 0/0 tx: 0/0 redirect: 0/0 (received/matched packets)
--user model stats inall=0 pkts. avg=0.000000 ps
[2] secs...
-- kernel mode> aborted: 0/0 drop: 488084/39488 pass: 0/0 tx: 0/0 redirect: 0/0 (received/matched packets)
--user model stats inall=0 pkts. avg=0.000000 ps
2: There have lost packets while I set -waterbuffer = 8000
root@xxxxxx:/xxx/xxx/xxx# ./xdpcap -watermark 8000 /sys/fs/bpf/xdp/globals/action_map pp.pcap "src 168.168.1.50"
Error: lost 4 packets
Error: lost 1 packets
Error: lost 19 packets
3: I try to resize -buffer size. But a Error happened!
root@xxxxxx:/xxx/xxx/xxx##./xdpcap v -buffer 10240
-watermark 8191 /sys/fs/bpf/xdp/globals/action_map pp.pcap "src 168.168.1.50"
Error: creating filter: can't create perf event reader: failed to create perf ring for CPU 0: invalid argument
So, where is the problem.
Thanks!
from xdpcap.
1:
Xdpcap can't read any packet while I set -watermark = 8191 (-buffer = 8192 )
It seems that cilium code was blocked(cilium.ebpf.perf.reader.go func(pr* Reader)Read (Record, error) ).
Thanks for the report, that's unexpected. I'll have a look.
2: There have lost packets while I set -waterbuffer = 8000
In this case with -watermark 8000
, and the default -buffer 8192
, xdpcap
will only get notified there is something in the buffer once it contains 8000
bytes. This doesn't leave much time for xdpcap
to empty the buffer before it becomes full. I don't have a good feel for how to tune these for the best performance, but I think setting -watermark
to half of -buffer
is a good starting point.
3: I try to resize -buffer size. But a Error happened
I'll have a look at this as well, thanks for letting me know.
from xdpcap.
1:
Xdpcap can't read any packet while I set -watermark = 8191 (-buffer = 8192 )
It seems that cilium code was blocked(cilium.ebpf.perf.reader.go func(pr* Reader)Read (Record, error) ).Thanks for the report, that's unexpected. I'll have a look.
2: There have lost packets while I set -waterbuffer = 8000
In this case with
-watermark 8000
, and the default-buffer 8192
,xdpcap
will only get notified there is something in the buffer once it contains8000
bytes. This doesn't leave much time forxdpcap
to empty the buffer before it becomes full. I don't have a good feel for how to tune these for the best performance, but I think setting-watermark
to half of-buffer
is a good starting point.3: I try to resize -buffer size. But a Error happened
I'll have a look at this as well, thanks for letting me know.
I'm sorry that I didn't reply in time. I spent a lot of time building the environment to test accurately.
I'll follow up on this.
After learning, I learned about the watermark parameter. If this parameter is equal to 4000, does it mean that xdpcap will not receive the notified message if the number of the last batch of packets does not reach 4000.
Does it mean that the last batch of packet is lost?
Is the last batch of packet not available in user mode ?
from xdpcap.
No worries :)
1:
Xdpcap can't read any packet while I set -watermark = 8191 (-buffer = 8192 )
It seems that cilium code was blocked(cilium.ebpf.perf.reader.go func(pr* Reader)Read (Record, error) ).
It turns out this is expected. The kernel will only notify xdpcap
that it can read a packet when the number of bytes in the buffer exceeds the watermark. With watermark = 8191
and buffer = 8192
, the buffer would have to contain 8192
bytes for the kernel to notify xdpd
. However the size of the captured packets is unlikely to add up to 8192
exactly. The buffer is likely to end up almost but not quite full, with not enough room to accept any new packets.
3: I try to resize -buffer size. But a Error happened
This should be fixed by #40 once it's merged
If this parameter is equal to 4000, does it mean that xdpcap will not receive the notified message if the number of the last batch of packets does not reach 4000.
Does it mean that the last batch of packet is lost?
Yes, that is correct. That's why by default watermark = 0
. Userspace could read out the last batch of packets, but we don't currently support it.
from xdpcap.
I forgot about this, but the PR is finally merged. Feel free to re-open this if it doesn't work as expected.
from xdpcap.
Related Issues (20)
- Why i can't capture any packets? HOT 4
- Is xdpcap filtering packets in user mode?
- Why can xdpcap capture packets when tcpdump capture packets from the same port.
- In xdpcap, perfMapSpec's type is PerfEventArray, is there some examples for PerCPUHash or PerCpuArray? HOT 1
- xdpcap & bcc/llvm error: Assertion `Val && "isa<> used on a null pointer"' failed. HOT 2
- xdpcap support for IP-in-IP tunneled packets. HOT 2
- Can not Parse bfd as udp ? HOT 2
- why xdpcap can't capture egress traffic ? HOT 2
- Does xdpcap work similarly to xdpdump, where it can capture packets before and after xdp program execution? HOT 1
- Support capturing via fentry / fexit trace points HOT 6
- 编译出现unexpected NUL in input
- Would this be possible to use with redbpf? HOT 1
- clarify statistics output
- Libbpf 1.0 release
- Timestamp at capture time
- Support attaching xdpcap to XDP programs loaded with xdp.frags mode
- Allow user to dump verifier logs
- Update documentation about defining xdpcap map for libbpf >= 1.0.0
- Feature: add xdpcap_enter as a option since programs may modify packets
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 xdpcap.