netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: David Miller <davem@davemloft.net>
Cc: herbert@gondor.apana.org.au, netdev@vger.kernel.org,
	johnpol@2ka.mipt.ru, bhutchings@solarflare.com
Subject: Re: [PATCH 3/8] net: Add Generic Receive Offload infrastructure
Date: Mon, 15 Dec 2008 16:02:01 -0800	[thread overview]
Message-ID: <20081216000201.GG6759@linux.vnet.ibm.com> (raw)
In-Reply-To: <20081215.153920.105386030.davem@davemloft.net>

On Mon, Dec 15, 2008 at 03:39:20PM -0800, David Miller wrote:
> From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> Date: Mon, 15 Dec 2008 15:29:42 -0800
> 
> > On Sat, Dec 13, 2008 at 12:35:21PM +1100, Herbert Xu wrote:
> > > +static int napi_gro_complete(struct sk_buff *skb)
> > > +{
> > > +	struct packet_type *ptype;
> > > +	__be16 type = skb->protocol;
> > > +	struct list_head *head = &ptype_base[ntohs(type) & PTYPE_HASH_MASK];
> > > +	int err = -ENOENT;
> > > +
> > > +	if (!skb_shinfo(skb)->frag_list)
> > > +		goto out;
> > > +
> > > +	rcu_read_lock();
> > > +	list_for_each_entry_rcu(ptype, head, list) {
> > > +		if (ptype->type != type || ptype->dev || !ptype->gro_complete)
> > > +			continue;
> > > +
> > > +		err = ptype->gro_complete(skb);
> > > +		break;
> > > +	}
> > > +	rcu_read_unlock();
> > > +
> > > +	if (err) {
> > > +		WARN_ON(&ptype->list == head);
> > 
> > Presumably ptype_base[] is a static array rather than a dynamically
> > allocated array that is resized under RCU protection, right?  Otherwise,
> > you could get in trouble if the above raced with the resize operation due
> > to the fact that you are outside of the RCU read-side critical section.
> 
> Yes, and we've been using RCU this way for this table for quite
> some time.  From net/core/dev.c:
> 
> #define PTYPE_HASH_SIZE	(16)
> #define PTYPE_HASH_MASK	(PTYPE_HASH_SIZE - 1)
> 
> static DEFINE_SPINLOCK(ptype_lock);
> static struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
> static struct list_head ptype_all __read_mostly;	/* Taps */

Works for me, then!

							Thanx, Paul

  reply	other threads:[~2008-12-16  0:02 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-12  5:31 [0/8] net: Generic Receive Offload Herbert Xu
2008-12-12  5:31 ` [PATCH 1/8] net: Add frag_list support to skb_segment Herbert Xu
2008-12-12 19:46   ` Evgeniy Polyakov
2008-12-12 21:41     ` Herbert Xu
2008-12-13  2:38       ` Evgeniy Polyakov
2008-12-13  2:43         ` Herbert Xu
2008-12-13  3:11           ` Evgeniy Polyakov
2008-12-13  3:20             ` Herbert Xu
2008-12-12  5:31 ` [PATCH 2/8] net: Add frag_list support to GSO Herbert Xu
2008-12-12  5:31 ` [PATCH 3/8] net: Add Generic Receive Offload infrastructure Herbert Xu
2008-12-12 19:51   ` Evgeniy Polyakov
2008-12-12 21:45     ` Herbert Xu
2008-12-12 22:25   ` Ben Hutchings
2008-12-12 22:56     ` Herbert Xu
2008-12-12 23:11       ` Herbert Xu
2008-12-13  3:43         ` Herbert Xu
2008-12-13 14:03           ` Evgeniy Polyakov
2008-12-12  5:31 ` [PATCH 4/8] ipv4: Add GRO infrastructure Herbert Xu
2008-12-12 22:55   ` Ben Hutchings
2008-12-12 23:04     ` Herbert Xu
2008-12-12  5:31 ` [PATCH 5/8] net: Add skb_gro_receive Herbert Xu
2008-12-12  5:31 ` [PATCH 6/8] tcp: Add GRO support Herbert Xu
2008-12-12 19:56   ` Evgeniy Polyakov
2008-12-12 21:46     ` Herbert Xu
2008-12-13  2:40       ` Evgeniy Polyakov
2008-12-13  2:46         ` Herbert Xu
2008-12-13  3:10           ` Evgeniy Polyakov
2008-12-13  3:19             ` Herbert Xu
2008-12-12  5:31 ` [PATCH 7/8] ethtool: Add GGRO and SGRO ops Herbert Xu
2008-12-12 20:11   ` Ben Hutchings
2008-12-12 21:48     ` Herbert Xu
2008-12-12 22:35       ` Ben Hutchings
2008-12-12 22:49         ` Herbert Xu
2008-12-14 19:36           ` Waskiewicz Jr, Peter P
2008-12-14 21:09             ` Herbert Xu
2008-12-14 22:00               ` Waskiewicz Jr, Peter P
2008-12-15  3:40                 ` Herbert Xu
2008-12-12  5:31 ` [PATCH 8/8] e1000e: Add GRO support Herbert Xu
2008-12-13  1:34 ` [0/8] net: Generic Receive Offload Herbert Xu
2008-12-13  1:35   ` [PATCH 1/8] net: Add frag_list support to skb_segment Herbert Xu
2008-12-16  7:27     ` David Miller
2008-12-13  1:35   ` [PATCH 2/8] net: Add frag_list support to GSO Herbert Xu
2008-12-16  7:30     ` David Miller
2008-12-13  1:35   ` [PATCH 3/8] net: Add Generic Receive Offload infrastructure Herbert Xu
2008-12-15 23:29     ` Paul E. McKenney
2008-12-15 23:39       ` David Miller
2008-12-16  0:02         ` Paul E. McKenney [this message]
2008-12-16  2:04         ` Herbert Xu
2008-12-16 16:37           ` Paul E. McKenney
2008-12-16  7:40     ` David Miller
2008-12-13  1:35   ` [PATCH 4/8] ipv4: Add GRO infrastructure Herbert Xu
2008-12-16  7:41     ` David Miller
2008-12-13  1:35   ` [PATCH 5/8] net: Add skb_gro_receive Herbert Xu
2008-12-13  2:52     ` Herbert Xu
2008-12-16  7:42       ` David Miller
2008-12-13  1:35   ` [PATCH 6/8] tcp: Add GRO support Herbert Xu
2008-12-16  7:43     ` David Miller
2008-12-13  1:35   ` [PATCH 7/8] ethtool: Add GGRO and SGRO ops Herbert Xu
2008-12-16  7:44     ` David Miller
2008-12-13  1:35   ` [PATCH 8/8] e1000e: Add GRO support Herbert Xu
2008-12-16  7:46     ` David Miller

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=20081216000201.GG6759@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=johnpol@2ka.mipt.ru \
    --cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).