All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Kuzin Andrey <kuzinandrey@yandex.ru>
Cc: Anders Nilsson Plymoth <lanilsson@gmail.com>,
	netfilter-devel <netfilter-devel@vger.kernel.org>
Subject: Re: netfilter queue throughput slowdown
Date: Thu, 30 Jun 2011 08:47:06 +0200	[thread overview]
Message-ID: <1309416426.2532.119.camel@edumazet-laptop> (raw)
In-Reply-To: <4E0C15A3.9050609@yandex.ru>

Le jeudi 30 juin 2011 à 10:20 +0400, Kuzin Andrey a écrit :
> On 29.06.2011 14:08, Eric Dumazet wrote:
> > Le mercredi 29 juin 2011 à 11:55 +0200, Anders Nilsson Plymoth a écrit :
> >> Hi Eric,
> >>
> >> Thanks for your reply.
> >> Yes, I am sure I set the verdict, as right now I do it on all packets
> >> by default.
> >> I will try upgrading and see if it works. Do you know if commit
> >> c463ac972315a0 solves the problem you mentioned?
> > No, it doesnt solve the problem, only make things faster.
> >
> > But if some packets are never dequeued (because something is wrong with
> > your program, failing to give verdict), they stay forever in the list
> > and each dequeue is slower since it has to go past these packets...
> >
> > 2.6.37 also contains commit 29b4433d991c88d86ca48a4c1cc33c671475be4b
> > (net: percpu net_device refcount) which helps a lot netfilter
> > queue/dequeue if your machine is SMP.
> >
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> >
> Hello.
> I'am using NFQUEUE several years on our main network router, and problem 
> with packets stuck in the queue is still not resolved.
> But in the past when i use libipq, it not have this problem. I try to 
> use simple program with ACCEPT verdict on all packets, and after some
> time queue has packets without any verdict, result is large (and 
> increased) delays on every packet and waste CPU time.
> 
> I'am write patch for this, but it doesn't apply by any netfilter 
> developers. Today i'am not using any kernel without this NFQUEUE patch.
> 
> diff --git a/net/netfilter/nfnetlink_queue.c 
> b/net/netfilter/nfnetlink_queue.c
> index 8c86011..74fc322 100644
> --- a/net/netfilter/nfnetlink_queue.c
> +++ b/net/netfilter/nfnetlink_queue.c
> @@ -169,17 +169,29 @@ __enqueue_entry(struct nfqnl_instance *queue, 
> struct nf_queue_entry *entry)
>          queue->queue_total++;
>   }
> 
> +#define NFQNL_TIMEOUT_ENTRY_DROP 20
> +
>   static struct nf_queue_entry *
>   find_dequeue_entry(struct nfqnl_instance *queue, unsigned int id)
>   {
> -       struct nf_queue_entry *entry = NULL, *i;
> +       struct nf_queue_entry *entry = NULL, *next, *i;
> +       ktime_t kt = ktime_get_real();
> 
>          spin_lock_bh(&queue->lock);
> 
> -       list_for_each_entry(i, &queue->queue_list, list) {
> +       list_for_each_entry_safe(i, next, &queue->queue_list, list) {
>                  if (i->id == id) {
>                          entry = i;
>                          break;
> +                } else {
> +                       struct timeval tv = 
> ktime_to_timeval(ktime_sub(kt, i->skb->tstamp));
> +                       if (tv.tv_sec > NFQNL_TIMEOUT_ENTRY_DROP) {
> +                               printk(KERN_ERR "nf_queue: drop 
> timeouted packet "
> +                                       "(queue_num=%d seq_id=%d)\n", 
> queue->queue_num, i->id);
> +                               list_del(&i->list);
> +                               queue->queue_total--;
> +                               nf_reinject(i, NF_DROP);
> +                       }
>                  }
>          }
> 

You do realize we have to find out what happened to these packets, why
no verdict was given at all ?

Also, where skb->tstamp is set exactly ? This depends on
netstamp_needed ?



--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-06-30  6:47 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-29  9:17 netfilter queue throughput slowdown Anders Nilsson Plymoth
2011-06-29  9:47 ` Eric Dumazet
2011-06-29  9:55   ` Anders Nilsson Plymoth
2011-06-29 10:08     ` Eric Dumazet
2011-06-30  6:20       ` Kuzin Andrey
2011-06-30  6:47         ` Eric Dumazet [this message]
2011-06-30  7:36           ` Kuzin Andrey
2011-06-30 11:34             ` Eric Dumazet
2011-06-30 11:59               ` Patrick McHardy
2011-06-30 15:15                 ` Eric Dumazet
2011-06-30 14:32                   ` Stephen Clark
2011-06-30 14:51                     ` Patrick McHardy
2011-06-30 17:07                       ` Eric Leblond
2011-06-30 17:45                         ` Eric Dumazet
2011-06-30 18:08                           ` Eric Leblond
2011-07-01  6:39                           ` Amos Jeffries
2011-07-01  7:00                           ` [RFC] nfnetlink_queue not scalable Eric Dumazet
2011-07-01  7:49                             ` Florian Westphal
2011-07-01 15:27                               ` [PATCH 1/2] nfnetlink: add RCU in nfnetlink_rcv_msg() Eric Dumazet
2011-07-01 14:11                                 ` Florian Westphal
2011-07-05 13:22                                 ` Patrick McHardy
2011-07-18 14:06                                 ` Patrick McHardy
2011-07-01 15:08                           ` netfilter queue throughput slowdown Anders Nilsson Plymoth
2011-06-30 22:24                   ` Sam Roberts
2011-07-01  4:53                     ` Eric Dumazet
2011-06-30 22:26         ` Sam Roberts
2011-07-01  4:52           ` Eric Dumazet
2011-07-02 12:25 ` Pablo Neira Ayuso

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=1309416426.2532.119.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=kuzinandrey@yandex.ru \
    --cc=lanilsson@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.