From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jiri Pirko <jpirko@redhat.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:20:35 +0100 [thread overview]
Message-ID: <1297948835.2604.50.camel@edumazet-laptop> (raw)
In-Reply-To: <20110217125221.GA10436@psychotron.redhat.com>
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);
> + 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[] ?
next prev parent reply other threads:[~2011-02-17 13:20 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 [this message]
2011-02-17 13:49 ` Jiri Pirko
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=1297948835.2604.50.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=fubar@us.ibm.com \
--cc=jpirko@redhat.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