netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jpirko@redhat.com>
To: "Nicolas de Pesloüan" <nicolas.2p.debian@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	kaber@trash.net, eric.dumazet@gmail.com, netdev@vger.kernel.org,
	shemminger@linux-foundation.org, fubar@us.ibm.com,
	andy@greyhouse.net
Subject: Re: [patch net-next-2.6 V3] net: convert bonding to use rx_handler
Date: Sun, 27 Feb 2011 21:06:30 +0100	[thread overview]
Message-ID: <20110227200628.GA2984@psychotron.redhat.com> (raw)
In-Reply-To: <4D6A5CDD.4020009@gmail.com>

Sun, Feb 27, 2011 at 03:17:01PM CET, nicolas.2p.debian@gmail.com wrote:
>Le 23/02/2011 20:05, Jiri Pirko a écrit :
>>This patch converts bonding to use rx_handler. Results in cleaner
>>__netif_receive_skb() with much less exceptions needed. Also
>>bond-specific work is moved into bond code.
>>
>>Did performance test using pktgen and counting incoming packets by
>>iptables. No regression noted.
>>
>>Signed-off-by: Jiri Pirko<jpirko@redhat.com>
>>
>>v1->v2:
>>         using skb_iif instead of new input_dev to remember original
>>	device
>>
>>v2->v3:
>>	do another loop in case skb->dev is changed. That way orig_dev
>>	core can be left untouched.
>>
>>Signed-off-by: Jiri Pirko<jpirko@redhat.com>
>>---
>
>[snip]
>
>>+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 = 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;
>
>Shouldn't we return NULL here ?

No we shouldn't. We need sbk to be delivered to exact match.

>
>>+	}
>>+
>>+	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);
>>+	}
>>+
>>+	return skb;
>>+}
>>+
>
>[snip]
>
>>+static void vlan_on_bond_hook(struct sk_buff *skb)
>>  {
>>-	if (skb->pkt_type == PACKET_HOST) {
>>-		u16 *dest = (u16 *) eth_hdr(skb)->h_dest;
>>+	/*
>>+	 * Make sure ARP frames received on VLAN interfaces stacked on
>>+	 * bonding interfaces still make their way to any base bonding
>>+	 * device that may have registered for a specific ptype.
>>+	 */
>>+	if (skb->dev->priv_flags&  IFF_802_1Q_VLAN&&
>>+	    vlan_dev_real_dev(skb->dev)->priv_flags&  IFF_BONDING&&
>>+	    skb->protocol == htons(ETH_P_ARP)) {
>
>The vlan_on_bond case used to be cost effective. Now, we clone the skb and call netif_rx...

This should not cost too much overhead considering only few packets are
going thru this. This hook shouldn't have exited in the fisrt place. I
think introducing this functionality was a big mistake.
>
>>+		struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
>>
>>-		memcpy(dest, master->dev_addr, ETH_ALEN);
>>+		if (!skb2)
>>+			return;
>>+		skb2->dev = vlan_dev_real_dev(skb->dev);
>>+		netif_rx(skb2);
>>  	}
>>  }
>
>[snip]
>
>>  	if (rx_handler) {
>>+		struct net_device *prev_dev;
>>+
>>  		if (pt_prev) {
>>  			ret = deliver_skb(skb, pt_prev, orig_dev);
>>  			pt_prev = NULL;
>>  		}
>>+		prev_dev = skb->dev;
>>  		skb = rx_handler(skb);
>>  		if (!skb)
>>  			goto out;
>
>I would instead consider NULL as meaning exact-match-delivery-only.
>(The same effect as dev_bond_should_drop() returning true).

we can change the behaviour later on.

>
>>+		if (skb->dev != prev_dev)
>>+			goto another_round;
>>  	}
>
>Anyway, all my comments can't be postponed to follow-up patchs. Thanks Jiri.
>
>Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>

  reply	other threads:[~2011-02-27 20:06 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-18 13:25 [patch net-next-2.6] net: convert bonding to use rx_handler Jiri Pirko
2011-02-18 13:29 ` Eric Dumazet
2011-02-18 14:14   ` Jiri Pirko
2011-02-18 14:27     ` Eric Dumazet
2011-02-18 14:46       ` Patrick McHardy
2011-02-18 14:58         ` Jiri Pirko
2011-02-18 15:50           ` Patrick McHardy
2011-02-18 16:14             ` Eric Dumazet
2011-02-18 18:47               ` Jiri Pirko
2011-02-18 19:17                 ` Eric Dumazet
2011-02-18 19:28                   ` Jiri Pirko
2011-02-18 19:58                     ` Eric Dumazet
2011-02-18 20:03                       ` Jiri Pirko
2011-02-18 20:06           ` David Miller
2011-02-18 20:13             ` Jiri Pirko
2011-02-18 20:58             ` [patch net-next-2.6 V2] " Jiri Pirko
2011-02-18 23:06               ` Jay Vosburgh
2011-02-19  7:44                 ` Jiri Pirko
2011-02-19  8:05                 ` [patch net-next-2.6 V3] " Jiri Pirko
2011-02-19  8:37                   ` Eric Dumazet
2011-02-19  8:58                     ` Jiri Pirko
2011-02-19  9:22                       ` Eric Dumazet
2011-02-19 10:56                   ` Nicolas de Pesloüan
2011-02-19 11:08                     ` Jiri Pirko
2011-02-19 11:28                       ` Jiri Pirko
2011-02-19 13:18                         ` Nicolas de Pesloüan
2011-02-19 13:46                           ` Jiri Pirko
2011-02-19 14:32                             ` Nicolas de Pesloüan
2011-02-19 20:27                             ` Nicolas de Pesloüan
2011-02-20 10:36                               ` Jiri Pirko
2011-02-20 12:12                                 ` Nicolas de Pesloüan
2011-02-20 15:07                                   ` Jiri Pirko
2011-02-21 23:20                                     ` Nicolas de Pesloüan
2011-02-26 14:24                                       ` Nicolas de Pesloüan
2011-02-26 19:42                                         ` Jay Vosburgh
2011-02-27 12:58                                           ` Jiri Pirko
2011-02-27 20:44                                             ` Nicolas de Pesloüan
2011-02-27 23:22                                             ` David Miller
2011-02-28  7:07                                               ` Jiri Pirko
2011-02-28  7:30                                                 ` David Miller
2011-02-28  9:22                                                   ` Jiri Pirko
2011-02-28  9:35                                                     ` Eric Dumazet
2011-02-28  9:55                                                       ` [patch net-next-2.6] net: convert bonding to use rx_handler - second part Jiri Pirko
2011-02-28 18:49                                                     ` [patch net-next-2.6 V3] net: convert bonding to use rx_handler David Miller
2011-02-23 19:05               ` Jiri Pirko
2011-02-25 23:46                 ` Nicolas de Pesloüan
2011-02-26  7:14                   ` Jiri Pirko
2011-02-26 11:25                     ` Nicolas de Pesloüan
2011-02-26 14:58                       ` Jiri Pirko
2011-02-27 14:17                 ` Nicolas de Pesloüan
2011-02-27 20:06                   ` Jiri Pirko [this message]
2011-02-27 20:59                     ` Nicolas de Pesloüan

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=20110227200628.GA2984@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).