From: Eugene Strulyov <eugene.strulyov@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: NFQUEUE parallelization
Date: Thu, 24 Sep 2015 12:56:26 -0700 [thread overview]
Message-ID: <CAKEqNm=2vnqe_fmSTM4G7xWsHkrXP29f_QxLUf7v7_-f5ESyKQ@mail.gmail.com> (raw)
Hi,
I am implementing a custom filter using the libnetfilter_queue
library. Performance is important, so I am looking at ways to
parallelize it. The options I see are as follows:
- single queue, multiple threads
- multiple queues, multiple threads
- multiple queues, multiple processes (1 per queue)
Which of these options would be most effective?
The guide I found here
https://home.regit.org/netfilter-en/using-nfqueue-and-libnetfilter_queue/
says "the nfq_set_verdict2 and nfq_handle_packet function needs to be
protected by lock mechanism." Does that mean that there can be at most
2 threads per queue?
When using multiple queues, is it valid to call nfq_open() multiple
times in the same process? When I do that I get negative numbers for
peer portid. Is this normal?
$ sudo cat /proc/net/netfilter/nfnetlink_queue
100 27790 0 2 65531 0 0 0 1
101 -4585 0 2 65531 0 0 0 1
102 -4586 0 2 65531 0 0 0 1
103 -4587 0 2 65531 0 0 0 1
Also, how exactly does --queue-balance work? All packets seem to be
directed to one particular queue.
thanks,
Eugene
next reply other threads:[~2015-09-24 19:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-24 19:56 Eugene Strulyov [this message]
2015-09-24 20:48 ` NFQUEUE parallelization Florian Westphal
2015-09-24 21:55 ` Eugene Strulyov
2015-09-24 22:18 ` Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAKEqNm=2vnqe_fmSTM4G7xWsHkrXP29f_QxLUf7v7_-f5ESyKQ@mail.gmail.com' \
--to=eugene.strulyov@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).