netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jpirko@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	shemminger@linux-foundation.org, kaber@trash.net,
	fubar@us.ibm.com, nicolas.2p.debian@gmail.com,
	andy@greyhouse.net
Subject: Re: [RFC patch net-next-2.6] net: convert bonding to use rx_handler
Date: Thu, 17 Feb 2011 14:49:18 +0100	[thread overview]
Message-ID: <20110217134918.GA11679@psychotron.redhat.com> (raw)
In-Reply-To: <1297948835.2604.50.camel@edumazet-laptop>

Thu, Feb 17, 2011 at 02:20:35PM CET, eric.dumazet@gmail.com wrote:
>Le jeudi 17 février 2011 à 13:52 +0100, Jiri Pirko a écrit :
>> Hello.
>> 
>> This is an attempt to convert bonding to use rx_handler. Result should be
>> cleaner __netif_receive_skb() with much less exceptions needed. I think I
>> covered all aspects, not sure though. I gave this quick smoke test on my
>> testing env. Please comment, test.
>> 
>> Thanks!
>> 
>> Signed-off-by: Jiri Pirko <jpirko@redhat.com>
>> ---
>>  drivers/net/bonding/bond_main.c |   75 ++++++++++++++++++++-
>>  include/linux/skbuff.h          |    1 +
>>  net/core/dev.c                  |  144 +++++++++++---------------------------
>>  3 files changed, 117 insertions(+), 103 deletions(-)
>> 
>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>
>
>> +
>> +static struct sk_buff *bond_handle_frame(struct sk_buff *skb)
>> +{
>> +	struct net_device *slave_dev;
>> +	struct net_device *bond_dev;
>> +
>> +	skb = skb_share_check(skb, GFP_ATOMIC);
>> +	if (unlikely(!skb))
>> +		return NULL;
>> +	slave_dev = skb->dev;
>> +	bond_dev = slave_dev->master;
>
>I suggest being 10%% safe here :
>
>	bond_dev = ACCESS_ONCE(slave_dev->master);

Right, will change this.

>
>> +	if (unlikely(!bond_dev))
>> +		return skb;
>> +
>> +	if (bond_dev->priv_flags & IFF_MASTER_ARPMON)
>> +		slave_dev->last_rx = jiffies;
>> +
>> +	if (bond_should_deliver_exact_match(skb, slave_dev, bond_dev)) {
>> +		skb->deliver_no_wcard = 1;
>> +		return skb;
>> +	}
>> +
>> +	skb->dev = bond_dev;
>> +
>> +	if (bond_dev->priv_flags & IFF_MASTER_ALB &&
>> +	    bond_dev->priv_flags & IFF_BRIDGE_PORT &&
>> +	    skb->pkt_type == PACKET_HOST) {
>> +		u16 *dest = (u16 *) eth_hdr(skb)->h_dest;
>> +
>> +		memcpy(dest, bond_dev->dev_addr, ETH_ALEN);
>> +	}
>> +
>> +	netif_rx(skb);
>> +	return NULL;
>> +}
>> +
>
>
>> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
>> index 31f02d0..15b54ea 100644
>> --- a/include/linux/skbuff.h
>> +++ b/include/linux/skbuff.h
>> @@ -325,6 +325,7 @@ struct sk_buff {
>>  
>>  	struct sock		*sk;
>>  	struct net_device	*dev;
>> +	struct net_device	*orig_dev;
>>  
>>  	/*
>>  	 * This is the control buffer. It is free to use for every
>
>Thats a problem. lifetime of this field is so small, I wonder if you
>cant find a solution to handle this differently. Maybe a percpu
>variable, or in cb[] ?

Yes, I was not feeling absolutely comfortable puting this here.
You mean global percpu variable living in net/core/dev.c? I must say I
would probably like skb->orig_dev more than that.

As for cb - I do not like that much. Also I think there might be
collision e.g. with bridge code.

>
>
>

      reply	other threads:[~2011-02-17 13:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-17 12:52 [RFC patch net-next-2.6] net: convert bonding to use rx_handler Jiri Pirko
2011-02-17 13:20 ` Eric Dumazet
2011-02-17 13:49   ` Jiri Pirko [this message]

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=20110217134918.GA11679@psychotron.redhat.com \
    --to=jpirko@redhat.com \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=fubar@us.ibm.com \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.2p.debian@gmail.com \
    --cc=shemminger@linux-foundation.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).