netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jpirko@redhat.com>
To: Xiaotian Feng <dfeng@redhat.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Tom Herbert <therbert@google.com>
Subject: Re: [RFC PATCH] net/core: fix skb handling on netif serves for both bridge and vlan
Date: Sat, 5 Mar 2011 11:36:14 +0100	[thread overview]
Message-ID: <20110305103613.GB7799@psychotron.redhat.com> (raw)
In-Reply-To: <1299149713-18740-1-git-send-email-dfeng@redhat.com>

Thu, Mar 03, 2011 at 11:55:13AM CET, dfeng@redhat.com wrote:
>Consider network topology as follows:
>
>eth0  eth1
> |_____|
>    |
>  bond0 --- br0
>    |
>  vlan0 --- br1
>
>bond0 serves for both br0 and vlan0, if a vlan tagged packet was sent
>to br1 through bond0, bridge handling code is seeing the packet on bond0
>and handing it off to my "legacy" bridge before vlan_tx_tag_present
>and vlan_hwaccel_do_receive even haven't a chance to look at it.
>
>Moving the vlan_tx_tag_present before bridge/macvlan handling code could
>cure this.

Wouldn't this break "eth0 - br0 - br0.5"?

>
>Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
>Cc: "David S. Miller" <davem@davemloft.net>
>Cc: Eric Dumazet <eric.dumazet@gmail.com>
>Cc: Tom Herbert <therbert@google.com>
>---
> net/core/dev.c |   20 ++++++++++----------
> 1 files changed, 10 insertions(+), 10 deletions(-)
>
>diff --git a/net/core/dev.c b/net/core/dev.c
>index 8ae6631..d2d12c2 100644
>--- a/net/core/dev.c
>+++ b/net/core/dev.c
>@@ -3079,27 +3079,27 @@ static int __netif_receive_skb(struct sk_buff *skb)
> ncls:
> #endif
> 
>-	/* Handle special case of bridge or macvlan */
>-	rx_handler = rcu_dereference(skb->dev->rx_handler);
>-	if (rx_handler) {
>+	if (vlan_tx_tag_present(skb)) {
> 		if (pt_prev) {
> 			ret = deliver_skb(skb, pt_prev, orig_dev);
> 			pt_prev = NULL;
> 		}
>-		skb = rx_handler(skb);
>-		if (!skb)
>+		if (vlan_hwaccel_do_receive(&skb)) {
>+			ret = __netif_receive_skb(skb);
>+			goto out;
>+		} else if (unlikely(!skb))
> 			goto out;
> 	}
> 
>-	if (vlan_tx_tag_present(skb)) {
>+	/* Handle special case of bridge or macvlan */
>+	rx_handler = rcu_dereference(skb->dev->rx_handler);
>+	if (rx_handler) {
> 		if (pt_prev) {
> 			ret = deliver_skb(skb, pt_prev, orig_dev);
> 			pt_prev = NULL;
> 		}
>-		if (vlan_hwaccel_do_receive(&skb)) {
>-			ret = __netif_receive_skb(skb);
>-			goto out;
>-		} else if (unlikely(!skb))
>+		skb = rx_handler(skb);
>+		if (!skb)
> 			goto out;
> 	}
> 
>-- 
>1.7.1
>
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2011-03-05 10:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03 10:55 [RFC PATCH] net/core: fix skb handling on netif serves for both bridge and vlan Xiaotian Feng
2011-03-03 13:53 ` Ben Hutchings
2011-03-03 21:42   ` Nicolas de Pesloüan
2011-03-05 10:36 ` Jiri Pirko [this message]
2011-03-05 13:53   ` Nicolas de Pesloüan
2011-03-05 14:25     ` 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=20110305103613.GB7799@psychotron.redhat.com \
    --to=jpirko@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dfeng@redhat.com \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=therbert@google.com \
    /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).