[netfilter-cvslog] r4249 -
trunk/patch-o-matic-ng/patchlets/connrate/linux/net/ipv4/netfilter
kaber at netfilter.org
kaber at netfilter.org
Mon Aug 29 22:51:59 CEST 2005
Author: kaber at netfilter.org
Date: 2005-08-29 22:51:58 +0200 (Mon, 29 Aug 2005)
New Revision: 4249
Modified:
trunk/patch-o-matic-ng/patchlets/connrate/linux/net/ipv4/netfilter/ip_conntrack_rate.c
Log:
[NETFILTER] Kill lockhelp.h for connrate (Samir Bellabes <sbellabes at mandriva.com>)
Modified: trunk/patch-o-matic-ng/patchlets/connrate/linux/net/ipv4/netfilter/ip_conntrack_rate.c
===================================================================
--- trunk/patch-o-matic-ng/patchlets/connrate/linux/net/ipv4/netfilter/ip_conntrack_rate.c 2005-08-29 12:50:20 UTC (rev 4248)
+++ trunk/patch-o-matic-ng/patchlets/connrate/linux/net/ipv4/netfilter/ip_conntrack_rate.c 2005-08-29 20:51:58 UTC (rev 4249)
@@ -13,7 +13,6 @@
#include <linux/skbuff.h>
#include <linux/jiffies.h>
#include <linux/netfilter_ipv4/ip_conntrack_rate.h>
-#include <linux/netfilter_ipv4/lockhelp.h>
/*
I wanted to build a simpler and more robust rate estimator than the
@@ -96,7 +95,7 @@
#define MAX_TOKENS_IN_WINDOW (0xffffffff - MAX_PACKET_IN_TOKENS)
/* Synchronizes all accesses to ip_conntrack_rate structures. */
-static DECLARE_RWLOCK(rate_lock);
+static DEFINE_RWLOCK(rate_lock);
void
ip_conntrack_rate_count(struct ip_conntrack_rate *ctr, unsigned int len)
@@ -104,7 +103,7 @@
u_int32_t new_bytes;
unsigned long now = jiffies;
- WRITE_LOCK(&rate_lock);
+ write_lock_bh(&rate_lock);
new_bytes = (ctr->avgrate * IP_CONNTRACK_RATE_INTERVAL +
len * IP_CONNTRACK_RATE_SCALE);
if(new_bytes > MAX_TOKENS_IN_WINDOW)
@@ -113,7 +112,7 @@
ctr->avgrate = new_bytes / (now - ctr->prev +
IP_CONNTRACK_RATE_INTERVAL);
ctr->prev = now;
- WRITE_UNLOCK(&rate_lock);
+ write_unlock_bh(&rate_lock);
}
u_int32_t
@@ -121,12 +120,12 @@
{
u_int32_t rate;
- READ_LOCK(&rate_lock);
+ read_lock_bh(&rate_lock);
/* Rate can not overflow here if IP_CONNTRACK_RATE_INTERVAL is
atleast HZ. If it is not, we could change the order of
calculations at the possible cost of precision. */
rate = ctr->avgrate * HZ / IP_CONNTRACK_RATE_SCALE;
- READ_UNLOCK(&rate_lock);
+ read_unlock_bh(&rate_lock);
return rate;
}
More information about the netfilter-cvslog
mailing list