Commit 7a5d48c4 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next

Florian Westphal says:

====================
netfilter patches for net-next

Remove GPL license copypastry in uapi files, those have SPDX tags.
From Christophe Jaillet.

Remove unused variable in rpfilter, from Guillaume Nault.

Rework gc resched delay computation in conntrack, from Antoine Tenart.

* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next:
  netfilter: rpfilter: Remove unused variable 'ret'.
  headers: Remove some left-over license text in include/uapi/linux/netfilter/
  netfilter: conntrack: revisit the gc initial rescheduling bias
  netfilter: conntrack: fix the gc rescheduling delay
====================

Link: https://lore.kernel.org/r/20220921095000.29569-1-fw@strlen.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 393d34cb 72f5c898
...@@ -3,10 +3,6 @@ ...@@ -3,10 +3,6 @@
* Patrick Schaaf <bof@bof.de> * Patrick Schaaf <bof@bof.de>
* Martin Josefsson <gandalf@wlug.westbo.se> * Martin Josefsson <gandalf@wlug.westbo.se>
* Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@netfilter.org> * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@netfilter.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/ */
#ifndef _UAPI_IP_SET_H #ifndef _UAPI_IP_SET_H
#define _UAPI_IP_SET_H #define _UAPI_IP_SET_H
......
...@@ -4,10 +4,6 @@ ...@@ -4,10 +4,6 @@
* *
* (C) 2010-2011 Thomas Graf <tgraf@redhat.com> * (C) 2010-2011 Thomas Graf <tgraf@redhat.com>
* (C) 2010-2011 Red Hat, Inc. * (C) 2010-2011 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/ */
#ifndef _XT_AUDIT_TARGET_H #ifndef _XT_AUDIT_TARGET_H
......
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/* Copyright (C) 2002,2004 MARA Systems AB <https://www.marasystems.com>
* by Henrik Nordstrom <hno@marasystems.com>
*/
#ifndef _XT_CONNMARK_H #ifndef _XT_CONNMARK_H
#define _XT_CONNMARK_H #define _XT_CONNMARK_H
#include <linux/types.h> #include <linux/types.h>
/* Copyright (C) 2002,2004 MARA Systems AB <https://www.marasystems.com>
* by Henrik Nordstrom <hno@marasystems.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
enum { enum {
XT_CONNMARK_SET = 0, XT_CONNMARK_SET = 0,
XT_CONNMARK_SAVE, XT_CONNMARK_SAVE,
......
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/* /*
* Copyright (c) 2003+ Evgeniy Polyakov <johnpol@2ka.mxt.ru> * Copyright (c) 2003+ Evgeniy Polyakov <johnpol@2ka.mxt.ru>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _XT_OSF_H #ifndef _XT_OSF_H
......
...@@ -33,7 +33,6 @@ static bool rpfilter_lookup_reverse(struct net *net, struct flowi4 *fl4, ...@@ -33,7 +33,6 @@ static bool rpfilter_lookup_reverse(struct net *net, struct flowi4 *fl4,
const struct net_device *dev, u8 flags) const struct net_device *dev, u8 flags)
{ {
struct fib_result res; struct fib_result res;
int ret __maybe_unused;
if (fib_lookup(net, fl4, &res, FIB_LOOKUP_IGNORE_LINKSTATE)) if (fib_lookup(net, fl4, &res, FIB_LOOKUP_IGNORE_LINKSTATE))
return false; return false;
......
...@@ -67,6 +67,7 @@ struct conntrack_gc_work { ...@@ -67,6 +67,7 @@ struct conntrack_gc_work {
struct delayed_work dwork; struct delayed_work dwork;
u32 next_bucket; u32 next_bucket;
u32 avg_timeout; u32 avg_timeout;
u32 count;
u32 start_time; u32 start_time;
bool exiting; bool exiting;
bool early_drop; bool early_drop;
...@@ -85,10 +86,12 @@ static DEFINE_MUTEX(nf_conntrack_mutex); ...@@ -85,10 +86,12 @@ static DEFINE_MUTEX(nf_conntrack_mutex);
/* clamp timeouts to this value (TCP unacked) */ /* clamp timeouts to this value (TCP unacked) */
#define GC_SCAN_INTERVAL_CLAMP (300ul * HZ) #define GC_SCAN_INTERVAL_CLAMP (300ul * HZ)
/* large initial bias so that we don't scan often just because we have /* Initial bias pretending we have 100 entries at the upper bound so we don't
* three entries with a 1s timeout. * wakeup often just because we have three entries with a 1s timeout while still
* allowing non-idle machines to wakeup more often when needed.
*/ */
#define GC_SCAN_INTERVAL_INIT INT_MAX #define GC_SCAN_INITIAL_COUNT 100
#define GC_SCAN_INTERVAL_INIT GC_SCAN_INTERVAL_MAX
#define GC_SCAN_MAX_DURATION msecs_to_jiffies(10) #define GC_SCAN_MAX_DURATION msecs_to_jiffies(10)
#define GC_SCAN_EXPIRED_MAX (64000u / HZ) #define GC_SCAN_EXPIRED_MAX (64000u / HZ)
...@@ -1466,6 +1469,7 @@ static void gc_worker(struct work_struct *work) ...@@ -1466,6 +1469,7 @@ static void gc_worker(struct work_struct *work)
unsigned int expired_count = 0; unsigned int expired_count = 0;
unsigned long next_run; unsigned long next_run;
s32 delta_time; s32 delta_time;
long count;
gc_work = container_of(work, struct conntrack_gc_work, dwork.work); gc_work = container_of(work, struct conntrack_gc_work, dwork.work);
...@@ -1475,10 +1479,12 @@ static void gc_worker(struct work_struct *work) ...@@ -1475,10 +1479,12 @@ static void gc_worker(struct work_struct *work)
if (i == 0) { if (i == 0) {
gc_work->avg_timeout = GC_SCAN_INTERVAL_INIT; gc_work->avg_timeout = GC_SCAN_INTERVAL_INIT;
gc_work->count = GC_SCAN_INITIAL_COUNT;
gc_work->start_time = start_time; gc_work->start_time = start_time;
} }
next_run = gc_work->avg_timeout; next_run = gc_work->avg_timeout;
count = gc_work->count;
end_time = start_time + GC_SCAN_MAX_DURATION; end_time = start_time + GC_SCAN_MAX_DURATION;
...@@ -1498,8 +1504,8 @@ static void gc_worker(struct work_struct *work) ...@@ -1498,8 +1504,8 @@ static void gc_worker(struct work_struct *work)
hlist_nulls_for_each_entry_rcu(h, n, &ct_hash[i], hnnode) { hlist_nulls_for_each_entry_rcu(h, n, &ct_hash[i], hnnode) {
struct nf_conntrack_net *cnet; struct nf_conntrack_net *cnet;
unsigned long expires;
struct net *net; struct net *net;
long expires;
tmp = nf_ct_tuplehash_to_ctrack(h); tmp = nf_ct_tuplehash_to_ctrack(h);
...@@ -1513,6 +1519,7 @@ static void gc_worker(struct work_struct *work) ...@@ -1513,6 +1519,7 @@ static void gc_worker(struct work_struct *work)
gc_work->next_bucket = i; gc_work->next_bucket = i;
gc_work->avg_timeout = next_run; gc_work->avg_timeout = next_run;
gc_work->count = count;
delta_time = nfct_time_stamp - gc_work->start_time; delta_time = nfct_time_stamp - gc_work->start_time;
...@@ -1528,8 +1535,8 @@ static void gc_worker(struct work_struct *work) ...@@ -1528,8 +1535,8 @@ static void gc_worker(struct work_struct *work)
} }
expires = clamp(nf_ct_expires(tmp), GC_SCAN_INTERVAL_MIN, GC_SCAN_INTERVAL_CLAMP); expires = clamp(nf_ct_expires(tmp), GC_SCAN_INTERVAL_MIN, GC_SCAN_INTERVAL_CLAMP);
expires = (expires - (long)next_run) / ++count;
next_run += expires; next_run += expires;
next_run /= 2u;
if (nf_conntrack_max95 == 0 || gc_worker_skip_ct(tmp)) if (nf_conntrack_max95 == 0 || gc_worker_skip_ct(tmp))
continue; continue;
...@@ -1570,6 +1577,7 @@ static void gc_worker(struct work_struct *work) ...@@ -1570,6 +1577,7 @@ static void gc_worker(struct work_struct *work)
delta_time = nfct_time_stamp - end_time; delta_time = nfct_time_stamp - end_time;
if (delta_time > 0 && i < hashsz) { if (delta_time > 0 && i < hashsz) {
gc_work->avg_timeout = next_run; gc_work->avg_timeout = next_run;
gc_work->count = count;
gc_work->next_bucket = i; gc_work->next_bucket = i;
next_run = 0; next_run = 0;
goto early_exit; goto early_exit;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment