From: Robert Edmonds <edmonds@debian.org>
To: netfilter-devel@lists.netfilter.org
Subject: [PATCH]: ROUTE: convert hh_lock to seqlock
Date: Wed, 23 May 2007 21:57:58 -0400 [thread overview]
Message-ID: <20070524015758.GA6544@mycre.ws> (raw)
hh_cache's lock has been converted to a seqlock in recent kernels.
Signed-off-by: Robert S. Edmonds <edmonds@debian.org>
---
ipv4/netfilter/ipt_ROUTE.c | 19 +++++++++++--------
ipv6/netfilter/ip6t_ROUTE.c | 8 +++++---
2 files changed, 16 insertions(+), 11 deletions(-)
diff -urNad netfilter-extensions-20070520+debian~/net/ipv4/netfilter/ipt_ROUTE.c netfilter-extensions-20070520+debian/net/ipv4/netfilter/ipt_ROUTE.c
--- netfilter-extensions-20070520+debian~/net/ipv4/netfilter/ipt_ROUTE.c 2007-05-23 19:47:12.000000000 -0400
+++ netfilter-extensions-20070520+debian/net/ipv4/netfilter/ipt_ROUTE.c 2007-05-23 20:54:22.000000000 -0400
@@ -118,6 +118,7 @@
struct hh_cache *hh = dst->hh;
struct net_device *dev = dst->dev;
int hh_len = LL_RESERVED_SPACE(dev);
+ unsigned seq;
/* Be paranoid, rather than too clever. */
if (unlikely(skb_headroom(skb) < hh_len && dev->hard_header)) {
@@ -135,12 +136,13 @@
}
if (hh) {
- int hh_alen;
+ do {
+ int hh_alen;
- read_lock_bh(&hh->hh_lock);
- hh_alen = HH_DATA_ALIGN(hh->hh_len);
- memcpy(skb->data - hh_alen, hh->hh_data, hh_alen);
- read_unlock_bh(&hh->hh_lock);
+ seq = read_seqbegin(&hh->hh_lock);
+ hh_alen = HH_DATA_ALIGN(hh->hh_len);
+ memcpy(skb->data - hh_alen, hh->hh_data, hh_alen);
+ } while (read_seqretry(&hh->hh_lock, seq));
skb_push(skb, hh->hh_len);
hh->hh_output(skb);
} else if (dst->neighbour)
diff -urNad netfilter-extensions-20070520+debian~/net/ipv6/netfilter/ip6t_ROUTE.c netfilter-extensions-20070520+debian/net/ipv6/netfilter/ip6t_ROUTE.c
--- netfilter-extensions-20070520+debian~/net/ipv6/netfilter/ip6t_ROUTE.c 2007-05-23 20:54:13.000000000 -0400
+++ netfilter-extensions-20070520+debian/net/ipv6/netfilter/ip6t_ROUTE.c 2007-05-23 21:00:47.000000000 -0400
@@ -120,11 +120,13 @@
{
struct dst_entry *dst = skb->dst;
struct hh_cache *hh = dst->hh;
+ unsigned seq;
if (hh) {
- read_lock_bh(&hh->hh_lock);
- memcpy(skb->data - 16, hh->hh_data, 16);
- read_unlock_bh(&hh->hh_lock);
+ do {
+ seq = read_seqbegin(&hh->hh_lock);
+ memcpy(skb->data - 16, hh->hh_data, 16);
+ } while (read_seqretry(&hh->hh_lock, seq));
skb_push(skb, hh->hh_len);
hh->hh_output(skb);
} else if (dst->neighbour)
next reply other threads:[~2007-05-24 1:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-24 1:57 Robert Edmonds [this message]
2007-05-24 17:45 ` [PATCH]: ROUTE: convert hh_lock to seqlock Patrick McHardy
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=20070524015758.GA6544@mycre.ws \
--to=edmonds@debian.org \
--cc=netfilter-devel@lists.netfilter.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.