netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: disable fragment reassembly if high_thresh is zero
@ 2016-05-27 15:53 Michal Kubecek
  2016-06-06  2:57 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Kubecek @ 2016-05-27 15:53 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, linux-kernel, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy

Before commit 6d7b857d541e ("net: use lib/percpu_counter API for
fragmentation mem accounting"), setting the reassembly high threshold
to 0 prevented fragment reassembly as first fragment would be always
evicted before second could be added to the queue. While inefficient,
some users apparently relied on this method.

Since the commit mentioned above, a percpu counter is used for
reassembly memory accounting and high batch size avoids taking slow path
in most common scenarios. As a result, a whole full sized packet can be
reassembled without the percpu counter's main counter changing its value
so that even with high_thresh set to 0, fragmented packets can be still
reassembled and processed.

Add explicit check preventing reassembly if high threshold is zero.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
---
 net/ipv4/inet_fragment.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 3a88b0c73797..b5e9317eaf9e 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -355,7 +355,7 @@ static struct inet_frag_queue *inet_frag_alloc(struct netns_frags *nf,
 {
 	struct inet_frag_queue *q;
 
-	if (frag_mem_limit(nf) > nf->high_thresh) {
+	if (!nf->high_thresh || frag_mem_limit(nf) > nf->high_thresh) {
 		inet_frag_schedule_worker(f);
 		return NULL;
 	}
-- 
2.8.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net: disable fragment reassembly if high_thresh is zero
  2016-05-27 15:53 [PATCH net-next] net: disable fragment reassembly if high_thresh is zero Michal Kubecek
@ 2016-06-06  2:57 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-06-06  2:57 UTC (permalink / raw)
  To: mkubecek; +Cc: netdev, linux-kernel, kuznet, jmorris, yoshfuji, kaber

From: Michal Kubecek <mkubecek@suse.cz>
Date: Fri, 27 May 2016 17:53:52 +0200

> Before commit 6d7b857d541e ("net: use lib/percpu_counter API for
> fragmentation mem accounting"), setting the reassembly high threshold
> to 0 prevented fragment reassembly as first fragment would be always
> evicted before second could be added to the queue. While inefficient,
> some users apparently relied on this method.
> 
> Since the commit mentioned above, a percpu counter is used for
> reassembly memory accounting and high batch size avoids taking slow path
> in most common scenarios. As a result, a whole full sized packet can be
> reassembled without the percpu counter's main counter changing its value
> so that even with high_thresh set to 0, fragmented packets can be still
> reassembled and processed.
> 
> Add explicit check preventing reassembly if high threshold is zero.
> 
> Signed-off-by: Michal Kubecek <mkubecek@suse.cz>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-06  2:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-27 15:53 [PATCH net-next] net: disable fragment reassembly if high_thresh is zero Michal Kubecek
2016-06-06  2:57 ` David Miller

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).