Comments (3)
I found the problem, took me a while :-(
"umems": {
"umem0": {
"bufcnt": 2,
"bufsz": 2,
"mtype": "1GB",
"regions": [ 2 ],
"rxdesc": 2,
"txdesc": 2,
},
},
It turns out the code looks correct, except AF_XDP rings have some restrictions. Here is the code from xskdev.c and comments.
/*
* We recommend that you set the fill ring size >= HW RX ring size +
* AF_XDP RX ring size. Make sure you fill up the fill ring
* with buffers at regular intervals, and you will with this setting
* avoid allocation failures in the driver. These are usually quite
* expensive since drivers have not been written to assume that
* allocation failures are common. For regular sockets, kernel
* allocated memory is used that only runs out in OOM situations
* that should be rare.
*/
umem_cfg.fill_size = (cfg->rx_nb_desc * 2);
umem_cfg.comp_size = cfg->tx_nb_desc;
umem_cfg.frame_size = cfg->bufsz;
umem_cfg.frame_headroom = cfg->buf_mgmt.buf_headroom;
if (cfg->flags & LPORT_UMEM_UNALIGNED_BUFFERS)
umem_cfg.flags = XDP_UMEM_UNALIGNED_CHUNK_FLAG;
xu->fq_size = umem_cfg.fill_size;
ret = netdev_get_ring_params(cfg->ifname, &hw_rx_nb_desc, NULL);
if (ret)
CNE_ERR("netdev_get_ring_params failure: %d\n", ret);
else if (umem_cfg.fill_size < hw_rx_nb_desc + cfg->rx_nb_desc)
CNE_INFO(
"For %s recommend setting fill size (currently %d) to be >= HW RX ring size (%d) + "
"AF_XDP Rx ring size (%d)\n",
cfg->ifname, umem_cfg.fill_size, hw_rx_nb_desc, cfg->rx_nb_desc);
Note the FQ size must be >= (hw_rx_nb_desc + rx_nb_desc), but setting these values to does not work.
Please try the following values:
"umems": {
"umem0": {
"bufcnt": 8,
"bufsz": 2,
"mtype": "1GB",
"regions": [ 8 ],
"rxdesc": 2,
"txdesc": 2,
},
},
The minimum values appear to be this:
"umems": {
"umem0": {
"bufcnt": 4,
"bufsz": 2,
"mtype": "1GB",
"regions": [ 4 ],
"rxdesc": 1,
"txdesc": 1,
},
},
Will need to figure out the reason, but it appears the kernel AF_XDP code is failing and adding duplicate entries or pointing to freed buffers.
from cndp.
Thanks.
What Ive found that works for the supplied example and the larger program we have is that I always need to have enough free mbuf entries to fill up the rx ring, fill ring and hw rx ring (which currently would be hw_rx_nb_desc + 3 * rx_nb_desc) to avoid any errors.
I had no errors as long as
bufcnt > hw_rx_nb_desc + 3 * rx_nb_desc + program caches/buffers
program caches/buffers = any program caches/buffers, such as the per thread mbuf cache (including the 1.5 cache multiplier),
the RxBurst receive slice in the example, lockess rings, etc.
Twiddling any of the above sizes I could get the errors, (even just not freeing the first N mbufs).
I can allocate the bufcnt with enough overhead. But I need to give it some margin just on the unlikely case the cache multiplier of fill ring size are changed in the future.
But because of this error I will also have to allocate a large enough bufcnt for the case where one lport could fill all the buffers in a multi threaded program (ddos etc).
from cndp.
Resolved with a work around.
from cndp.
Related Issues (20)
- Example Go application of packet distributor HOT 1
- Improve test coverage for Go Binding API HOT 1
- rust unit tests failing HOT 2
- rust build fail HOT 4
- remove privileged lport flag from rust implementation
- LPORT_UNPRIVILEGED for UDS should be configured under the hood rather than the CNDP app HOT 1
- update cndp af_xdp plugin integration notes to remove ClusterType
- ip_forward node fib lookup tightly coupled with arp entry HOT 1
- cnet: ip4_forward node fib lookup tightly coupled with arp entry HOT 7
- Use wireguard(with cndp) as the client to connect to the wireguard server supported by the normal Linux kernel? HOT 34
- Difficulties in using the wireguard cndp on the public network
- quicly example looks no more working/building HOT 45
- cndp performance reducing when both ingress and egress traffic is there. HOT 15
- Support loading custom bpf programs through the jsonc configuration HOT 1
- Long network device names HOT 4
- Golang: fixup uds to be on a per port basis
- Rust: fixup uds to be on a per port basis
- Documentation for AF_XDP deployment with CNDP it out of date - containerd
- Documentation for AF_XDP deployment with CNDP it out of date - crio
- Add a param to allow one to specify the queue to the jsonc configuration file
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 cndp.