netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jay Vosburgh <fubar@us.ibm.com>
To: netdev@vger.kernel.org
Cc: Jeff Garzik <jgarzik@pobox.com>,
	David Miller <davem@davemloft.net>,
	Joe Eykholt <jre@nuovasystems.com>,
	Jay Vosburgh <fubar@us.ibm.com>
Subject: [PATCH 4/5] net/core: Allow certain receives on inactive slave.
Date: Wed,  2 Jul 2008 18:22:01 -0700	[thread overview]
Message-ID: <1215048127619-git-send-email-fubar@us.ibm.com> (raw)
In-Reply-To: <12150481262025-git-send-email-fubar@us.ibm.com>

From: Joe Eykholt <jre@nuovasystems.com>

Allow a packet_type that specifies the exact device to receive
even on an inactive bonding slave devices.  This is important for some
L2 protocols such as LLDP and FCoE.  This can eventually be used
for the bonding special cases as well.

Signed-off-by: Joe Eykholt <jre@nuovasystems.com>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
---
 net/core/dev.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 78114f6..a949664 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2063,6 +2063,7 @@ int netif_receive_skb(struct sk_buff *skb)
 {
 	struct packet_type *ptype, *pt_prev;
 	struct net_device *orig_dev;
+	struct net_device *null_or_orig;
 	int ret = NET_RX_DROP;
 	__be16 type;
 
@@ -2076,13 +2077,13 @@ int netif_receive_skb(struct sk_buff *skb)
 	if (!skb->iif)
 		skb->iif = skb->dev->ifindex;
 
+	null_or_orig = NULL;
 	orig_dev = skb->dev;
 	if (orig_dev->master) {
-		if (skb_bond_should_drop(skb)) {
-			kfree_skb(skb);
-			return NET_RX_DROP;
-		}
-		skb->dev = orig_dev->master;
+		if (skb_bond_should_drop(skb))
+			null_or_orig = orig_dev; /* deliver only exact match */
+		else
+			skb->dev = orig_dev->master;
 	}
 
 	__get_cpu_var(netdev_rx_stat).total++;
@@ -2103,7 +2104,7 @@ int netif_receive_skb(struct sk_buff *skb)
 #endif
 
 	list_for_each_entry_rcu(ptype, &ptype_all, list) {
-		if (!ptype->dev || ptype->dev == skb->dev) {
+		if (ptype->dev == null_or_orig || ptype->dev == skb->dev) {
 			if (pt_prev)
 				ret = deliver_skb(skb, pt_prev, orig_dev);
 			pt_prev = ptype;
@@ -2128,7 +2129,7 @@ ncls:
 	list_for_each_entry_rcu(ptype,
 			&ptype_base[ntohs(type) & PTYPE_HASH_MASK], list) {
 		if (ptype->type == type &&
-		    (!ptype->dev || ptype->dev == skb->dev)) {
+		    (ptype->dev == null_or_orig || ptype->dev == skb->dev)) {
 			if (pt_prev)
 				ret = deliver_skb(skb, pt_prev, orig_dev);
 			pt_prev = ptype;
-- 
1.5.2.4


  reply	other threads:[~2008-07-03  1:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-03  1:21 [PATCH net-next-2.6 0/5] bonding: Refactor, fix, and updates Jay Vosburgh
2008-07-03  1:21 ` [PATCH 1/5] bonding: refactor mii monitor Jay Vosburgh
2008-07-03  1:21   ` [PATCH 2/5] bonding: Don't destroy bonding master when removing slave via sysfs Jay Vosburgh
2008-07-03  1:22     ` [PATCH 3/5] net/core: Uninline skb_bond() Jay Vosburgh
2008-07-03  1:22       ` Jay Vosburgh [this message]
2008-07-03  1:22         ` [PATCH 5/5] net/core: Allow receive on active slaves Jay Vosburgh
2008-07-04 12:45           ` Jeff Garzik
2008-07-06  4:12             ` David Miller
2008-07-06  4:36               ` Joe Eykholt
2008-07-06  4:38                 ` David Miller
2008-07-20  4:20                   ` Joe Eykholt
2008-08-07  8:00   ` [PATCH 1/5] bonding: refactor mii monitor Jeff Garzik
2008-08-06 22:49 ` [PATCH net-next-2.6 0/5] bonding: Refactor, fix, and updates Jay Vosburgh

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=1215048127619-git-send-email-fubar@us.ibm.com \
    --to=fubar@us.ibm.com \
    --cc=davem@davemloft.net \
    --cc=jgarzik@pobox.com \
    --cc=jre@nuovasystems.com \
    --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).