Netdev List
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: Thomas Graf <tgraf@suug.ch>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [RFC 5/7] neighbour: convert lookup to sequence lock
Date: Mon, 14 Aug 2006 15:37:43 -0700	[thread overview]
Message-ID: <20060814153743.0ab60955@localhost.localdomain> (raw)
In-Reply-To: <20060814222220.GQ14627@postel.suug.ch>

On Tue, 15 Aug 2006 00:22:20 +0200
Thomas Graf <tgraf@suug.ch> wrote:

> * Stephen Hemminger <shemminger@osdl.org> 2006-08-14 14:20
> > --- net-2.6.19.orig/net/core/neighbour.c
> > +++ net-2.6.19/net/core/neighbour.c
> > @@ -1160,19 +1164,24 @@ int neigh_resolve_output(struct sk_buff 
> >  	if (!neigh_event_send(neigh, skb)) {
> >  		int err;
> >  		struct net_device *dev = neigh->dev;
> > +		unsigned short type = ntohs(skb->protocol);
> > +
> >  		if (dev->hard_header_cache && !dst->hh) {
> > -			write_lock_bh(&neigh->lock);
> > +			write_seqlock_bh(&neigh->lock);
> >  			if (!dst->hh)
> >  				neigh_hh_init(neigh, dst, dst->ops->protocol);
> > -			err = dev->hard_header(skb, dev, ntohs(skb->protocol),
> > +			err = dev->hard_header(skb, dev, type,
> >  					       neigh->ha, NULL, skb->len);
> > -			write_unlock_bh(&neigh->lock);
> > +			write_sequnlock_bh(&neigh->lock);
> >  		} else {
> > -			read_lock_bh(&neigh->lock);
> > -			err = dev->hard_header(skb, dev, ntohs(skb->protocol),
> > -					       neigh->ha, NULL, skb->len);
> > -			read_unlock_bh(&neigh->lock);
> > +			unsigned seq;
> > +			do {
> > +				seq = read_seqbegin(&neigh->lock);
> > +				err = dev->hard_header(skb, dev, type,
> > +						       neigh->ha, NULL, skb->len);
> > +			} while (read_seqretry(&neigh->lock, seq));
> 
> Don't you need to pull in order to undo the push that probably
> happened in dev->hard_header()?

Probably just record the headroom() and undo that?

  reply	other threads:[~2006-08-14 22:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-14 21:20 [RFC 0/7] neighbour table lockless read Stephen Hemminger
2006-08-14 21:20 ` [RFC 1/7] net neighbor: convert top level list to RCU Stephen Hemminger
2006-08-14 21:20 ` [RFC 2/7] neighbour: convert neighbour hash table to hlist Stephen Hemminger
2006-08-14 21:20 ` [RFC 3/7] neighbour: convert pneigh " Stephen Hemminger
2006-08-14 21:20 ` [RFC 4/7] net neighbour: convert to RCU Stephen Hemminger
2006-08-14 21:20 ` [RFC 5/7] neighbour: convert lookup to sequence lock Stephen Hemminger
2006-08-14 22:22   ` Thomas Graf
2006-08-14 22:37     ` Stephen Hemminger [this message]
2006-08-14 23:17       ` Thomas Graf
2006-08-15  0:42         ` Alexey Kuznetsov
2006-08-14 21:20 ` [RFC 6/7] neighbour: convert hard header cache to sequence number Stephen Hemminger
2006-08-14 21:20 ` [RFC 7/7] neighbour: reduce exports Stephen Hemminger

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=20060814153743.0ab60955@localhost.localdomain \
    --to=shemminger@osdl.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=tgraf@suug.ch \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox