Comments (4)
Hi,
It would not be enough to modify nm_open
or nmport_open
to support such a syntax.
In the very end, netmap open requests are submitted to the kernel by means of the struct nmeq_register
, and there is no way to setup that struct to specify a range of rings. Furthermore, there is no kernel support for ranges (see netmap_interp_ringid
).
However, you could achieve your goal (and potentially more efficiently than using ranges) with the following scheme:
- Thread TX1 would nm_open("netmap:ens4-${N}/T") for N in [0..3], and poll 4 file descriptors
- Thread TX2 would nm_open("netmap:ens4-${N}/T") for N in [4..7], and poll 4 file descriptors
- Thread RX1 would nm_open("netmap:ens4-${N}/R") for N in [0..3], and poll 4 file descriptors
- Thread RX2 would nm_open("netmap:ens4-${N}/R") for N in [4..7], and poll 4 file descriptors
from netmap.
I see. However, I guess I'm not understanding as much as I thought since what you say is not possible seems to be exactly what is done now when I open the device in "all queue" mode using no suffix as "netmap:ens4"? That is a single fd with multiple rings as well as a single ring_id and it gets access to all the queues. The descriptor has a "first ring" and "last ring" elements for TX and RX so with this in mind, how is ring_id even used?
My concern using multiple fd's is that in my benchmarking, most of the time is spent in the NIOCTXSYNC and NIOCRXSYNC ioctl() calls and now I will need to have my thread loop those calls over multiple fd's. Hopefully the total time spent will be roughly the same as in the end, it will be the same number of packets being processed, but I don't know this for a fact.
Also, is there any benefit to having a separate fd for TX and RX? I currently use a single one for all queues that the TX and RX threads both use and I have not seen any contention. In other words, using this as opposed to your suggestion above...
- Thread TX1 and RX1 would use the result of nm_open("netmap:ens4-${N}") for N in [0..3], and poll 4 file descriptors
- Thread TX2 and RX2 would use the result of nm_open("netmap:ens4-${N}") for N in [4..7], and poll 4 file descriptors
Thanks.
from netmap.
Maybe the misunderstanding is about the "first ring" and "last ring" fields within the userspace library (libnetmap or netmap_user.h
structs. Those are just helpers that allow the programmer to write more general programs, by scanning all the rings that are bound to a given netmap file descriptor. While those fields may induce you to think that they can assume any range of values, however, only some combinations are supported by the kernel.
Things you can do:
- open all the hardware rings (TX+RX, or TX only or RX only)
- open only the host rings (TX+RX, or TX only or RX only)
- open both hardware and host rings (TX+RX, or TX only or RX only)
- open just a single ring (TX+RX, or TX only or RX only)
See theNR_REG_*
macros insys/net/netmap.h
.
Having different fds for different threads is useful to avoid unnecessary wakeups, and to selectively sync only a subset of the rings. If open netmap:ens4
, and have multiple threads using the same fd but accessing different rings, any TX or RX interrupt will wake up all the threads polling that fd, even if they only care about TX or RX wakeups.
Also keep in mind that by using poll()
a single thread can sync multiple file descriptors with a single system call.
from netmap.
Sorry, I forgot to reply, but thanks for your explanation and information. I was able to open fd's for each TX and RX queue and just have my threads loop over them when I have less cores than queues. Thanks again. Closing this.
from netmap.
Related Issues (20)
- Netmap could not allocate memory : netmap_config_obj_allocator requested objsize 140032 out of range [256, 131072]
- Time resolution on rx sync HOT 1
- i4oe driver in version 2.19.3 overflow when bitrate get up of peta bytes
- performance problem with emulated mode (Linux 5.15.0 Ubuntu 22.04) HOT 1
- problem in ring of i40e
- error while executing make command (build)
- netmap_poll should check if interface is up
- pkt-gen txseq issues with ixl
- kernel updated, pkt-gen cause kernel panic HOT 4
- pkt-gen IP randomization differs for jumbo vs. standard frames
- Failure accessing netmap: Invalid argument HOT 1
- netmap causing hang of kernel worker.
- netmap i40e not support 6.6.4
- ProxMox + VirtIO (KVM)
- igc driver does not seem to work HOT 2
- num_slots on RX rings are zero HOT 2
- igb_netmap_rxsync error HOT 1
- Can't build ICE drivers HOT 5
- netmap_ring_reinit problems when running Zeek with netmap pipes
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 netmap.