summaryrefslogtreecommitdiff
path: root/ring.h
AgeCommit message (Collapse)AuthorFilesLines
2014-02-24ring: Get rid of unnecessary wrapper for get_sockopt_tpacketTobias Klauser1-13/+8
get_sockopt_tpacket is never used in the "raw" version and the wrapper does no additional checking anyway, so get rid of it. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2013-12-11trafgen: speedup TX only path by avoiding kernel packet_rcv() callJesper Dangaard Brouer1-1/+1
The tool trafgen is used in a pktgen style transmit only scenario. We discovered a performance bottleneck in the kernel, when running trafgen, where the kernel stalled on a lock in packet_rcv(). This call is unnecessary for trafgen given its transmit only nature. This packet_rcv() call can, easily be avoided by instructing the RAW/PF_PACKET socket, to not listen to any protocols (by passing protocol argument zero, when creating the socket). The performance gain is huge, increasing performance from approx max 2Mpps to 12Mpps, basically causing trafgen to scale with the number of CPUs. Following tests were run on a 2xCPU E5-2650 with Intel 10Gbit/s ixgbe: Trafgen using sendto() syscall via parameter -t0: * # CPUs -- *with* -- *without* packet_rcv() call * 1 CPU == 1,232,244 -- 1,236,144 pkts/sec * 2 CPUs == 1,592,720 -- 2,593,620 pkts/sec * 3 CPUs == 1,635,623 -- 3,692,216 pkts/sec * 4 CPUs == 1,567,768 -- 4,102,866 pkts/sec * 5 CPUs == 1,700,270 -- 5,151,489 pkts/sec * 6 CPUs == 1,762,392 -- 6,124,512 pkts/sec * 7 CPUs == 1,850,139 -- 7,120,496 pkts/sec * 8 CPUs == 1,770,909 -- 8,058,710 pkts/sec * 9 CPUs == 1,721,072 -- 8,963,192 pkts/sec * 10 CPUs == 1,359,157 -- 9,584,535 pkts/sec * 11 CPUs == 1,175,520 -- 10,498,038 pkts/sec * 12 CPUs == 1,075,867 -- 11,189,292 pkts/sec * 13 CPUs == 1,012,602 -- 12,048,836 pkts/sec * [...] * 20 CPUs == 1,030,446 -- 11,202,449 pkts/sec Trafgen using mmap() TX tpacket_v2 (default) * # CPUs -- *with* -- *without* packet_rcv() call * 1 CPU == 920,682 -- 927,984 pkts/sec * 2 CPUs == 1,607,940 -- 2,061,406 pkts/sec * 3 CPUs == 1,668,488 -- 2,979,463 pkts/sec * 4 CPUs == 1,423,066 -- 3,169,565 pkts/sec * 5 CPUs == 1,507,708 -- 3,910,756 pkts/sec * 6 CPUs == 1,555,616 -- 4,625,844 pkts/sec * 7 CPUs == 1,560,961 -- 5,298,441 pkts/sec * 8 CPUs == 1,596,092 -- 6,000,465 pkts/sec * 9 CPUs == 1,575,139 -- 6,722,130 pkts/sec * 10 CPUs == 1,311,676 -- 7,114,202 pkts/sec * 11 CPUs == 1,157,650 -- 7,859,399 pkts/sec * 12 CPUs == 1,060,366 -- 8,491,004 pkts/sec * 13 CPUs == 1,012,956 -- 9,269,761 pkts/sec * [...] * 20 CPUs == 955,716 -- 8,653,947 pkts/sec It is fairly strange that the mmap() version runs slower than the sendto() version. This is likely another performance problem related to mmap() which seems worth fixing. Note, that the mmap() version speed can be improved by reducing the default --ring-size to around 1-2 MiB. But this does not fix general trend with mmap() performance. Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
2013-08-20configure: allow trafgen build when only TPACKET_V2 is availableDaniel Borkmann1-0/+9
On machines like RHEL6 that do not have support for TPACKET_V3, we should still allow at least trafgen to be built for network testing. Thus, do something useful with the TPACKET_V3 configure check and comment out in ring.h relevant structures. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-06-04xutils: eliminate xutils, move rest to epoll2Daniel Borkmann1-1/+0
Finally eliminate xutils.{c,h} and move the rest to epoll2. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-06-04xutils: move device management functions out of xutilsDaniel Borkmann1-0/+1
Move those functions out so that they can be more easily maintained in its separate file. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-31ring: netsniff-ng: migrate capture only to TPACKET_V3Daniel Borkmann1-0/+7
Lets migrate capturing to TPACKET_V3, since it will bring a better performance due to fewer page cache misses caused by a higher density of packets, since now they are contigous placed in the ring buffer. It is said that TPACKET_V3 brings the following benefits: *) ~15 - 20% reduction in CPU-usage *) ~20% increase in packet capture rate *) ~2x increase in packet density *) Port aggregation analysis *) Non static frame size to capture entire packet payload Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-31ring: setup frame structure for v2/v3 in a generic wayDaniel Borkmann1-1/+1
Prepare TPACKET_V3 for allowing to transparently setting up the frame structure such that we do not need to change much in the netsniff-ng/trafgen code. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-31ring: move duplicate/generic code parts from rx/tx into ring.cDaniel Borkmann1-0/+4
We do not want to maintain duplicate code, so move this into a separate file and name those *_generic() helpers. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-31ring: fix wrong error message text in __get_sockopt_tpacketDaniel Borkmann1-1/+1
Arg, this was a leftover when copying the other function. So fix it! Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-31ring: implement setup of tpacket v3 ringDaniel Borkmann1-0/+18
Implement ring setup routines and structures for TPACKET_V3. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-30ring: prepare setup_rx_ring_layout for support in v2/v3Daniel Borkmann1-0/+7
Prepare setup_rx_ring_layout for both, v2 and v3. Also do some checks during compile time if offsets stay the same as we operate on different union mappings. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-30ring: add necessary structures and helper functions for v3Daniel Borkmann1-1/+10
Prepare and add some structures an helper functions for TPACKET_V3. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-30ring: move poll related fallback define to built_in.hDaniel Borkmann1-10/+0
It rather belongs to built_in.h, and not here. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-30ring: minor: remove define since only used onceDaniel Borkmann1-3/+1
We only use it once and nowhere else, so just replace the correct value right away. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-30ring: add set_sockopt_tpacket_v3 and refactor othersDaniel Borkmann1-4/+12
Add set_sockopt_tpacket_v3() in preparation for TPACKET_V3. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-30ring: set_sockopt_tpacket: rename to set_sockopt_tpacket_v2Daniel Borkmann1-1/+1
Rename it to set_sockopt_tpacket_v2 so that we later on can also add other versions and have it clearly stated which one we use. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-30ring: remove fanout related bitsDaniel Borkmann1-20/+0
We currently do not support it, so do not keep it here. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-05-13ring: break out timestamping since not directly relatedDaniel Borkmann1-35/+0
Break out the timestamping part of the ring.h file, since it's not directly related to the {t,r}x_ring. Also inlining doesn't make sense here. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-04-23ring: tstamp: no need for tx tsDaniel Borkmann1-1/+1
Set TX timestamping to HWTSTAMP_TX_OFF. We do not use it, therefore do not waist time keeping track of it. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-03-16ring: don't care if we cannot active hw timestampingDaniel Borkmann1-13/+8
Hw timestaming is currently done, if we have the header file from the kernel available. If it fails, we currently bail out, which is bullshit. Just returning is enough, since some users might have the header available, but not a NIC supporting hw timestaming. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
2013-03-15all: import netsniff-ng 0.5.8-rc0 sourceDaniel Borkmann1-0/+174
We decided to get rid of the old Git history and start a new one for several reasons: *) Allow / enforce only high-quality commits (which was not the case for many commits in the history), have a policy that is more close to the one from the Linux kernel. With high quality commits, we mean code that is logically split into commits and commit messages that are signed-off and have a proper subject and message body. We do not allow automatic Github merges anymore, since they are total bullshit. However, we will either cherry-pick your patches or pull them manually. *) The old archive was about ~27MB for no particular good reason. This basically derived from the bad decision that also some PDF files where stored there. From this moment onwards, no binary objects are allowed to be stored in this repository anymore. The old archive is not wiped away from the Internet. You will still be able to find it, e.g. on git.cryptoism.org etc. Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>