David Miller
2015-Feb-11 22:29 UTC
[Bridge] [PATCH] bridge: make it possible for packets to traverse the bridge withour hitting netfilter
From: Imre Palik <imrep.amz at gmail.com> Date: Tue, 10 Feb 2015 10:32:24 +0100> From: "Palik, Imre" <imrep at amazon.de> > > The netfilter code is made with flexibility instead of performance in mind. > So when all we want is to pass packets between different interfaces, the > performance penalty of hitting netfilter code can be considerable, even when > all the firewalling is disabled for the bridge. > > This change makes it possible to disable netfilter both on a per bridge basis, > or for the whole bridging subsystem. In the case interesting to us, this can > lead to more than 10% speedup compared to the case when only bridge-iptables > are disabled. > > Cc: Anthony Liguori <aliguori at amazon.com> > Signed-off-by: Imre Palik <imrep at amazon.de>Sorry, no. If I apply this, someone is going to try to submit a patch for every damn protocol layer to add a stupid hack like this. Makw NF_HOOK() faster instead.
Imre Palik
2015-Feb-13 16:08 UTC
[Bridge] [PATCH] bridge: make it possible for packets to traverse the bridge withour hitting netfilter
On 02/11/15 23:29, David Miller wrote:> From: Imre Palik <imrep.amz at gmail.com> > Date: Tue, 10 Feb 2015 10:32:24 +0100 > >> From: "Palik, Imre" <imrep at amazon.de> >> >> The netfilter code is made with flexibility instead of performance in mind. >> So when all we want is to pass packets between different interfaces, the >> performance penalty of hitting netfilter code can be considerable, even when >> all the firewalling is disabled for the bridge. >> >> This change makes it possible to disable netfilter both on a per bridge basis, >> or for the whole bridging subsystem. In the case interesting to us, this can >> lead to more than 10% speedup compared to the case when only bridge-iptables >> are disabled. >> >> Cc: Anthony Liguori <aliguori at amazon.com> >> Signed-off-by: Imre Palik <imrep at amazon.de> > > Sorry, no. > > If I apply this, someone is going to try to submit a patch for every > damn protocol layer to add a stupid hack like this.Actually this is one of those patches. There is already a "stupid hack like this" for iptables and arptables. (Implemented before git history, and giving me 10% speedup. Many thanks, whoever did it.) I also searched various LKML archives, and it seems the existing "stupid hacks" for iptables and arptables haven't resulted in any related patch submission in the last ten years. (Or my google-fu is weak.) Moreover, I cannot imagine any other reasonable on/off switch for bridge-netfilter than these three. Of course, my imagination might be lacking there.> Makw NF_HOOK() faster instead.As far as I see, flexibility implies trashing the cache/TLB. So it is impossible to have flexibility and performance at the same time. (Except possibly with self modifying code, but that has its own set of problems.)
Florian Westphal
2015-Feb-13 16:37 UTC
[Bridge] [PATCH] bridge: make it possible for packets to traverse the bridge withour hitting netfilter
Imre Palik <imrep.amz at gmail.com> wrote:> On 02/11/15 23:29, David Miller wrote: > > If I apply this, someone is going to try to submit a patch for every > > damn protocol layer to add a stupid hack like this. > > Actually this is one of those patches. There is already a "stupid hack like this" for iptables and arptables. (Implemented before git history, and giving me 10% speedup. Many thanks, whoever did it.) > > I also searched various LKML archives, and it seems the existing "stupid hacks" for iptables and arptables haven't resulted in any related patch submission in the last ten years. (Or my google-fu is weak.) > > Moreover, I cannot imagine any other reasonable on/off switch for bridge-netfilter than these three. Of course, my imagination might be lacking there.Why do you load the bridge netfilter module if you don't want it? Loading it registers the internal hooks for the call-ip(6)tables and sabotage hooks with NF_BRIDGE protocol so most of the NF_HOOK(NF_BRIDGE, ... calls become active.