Ethernet Bridge development
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: bridge@linux-foundation.org
Subject: [Bridge] [RFT 2/2] bridge: network device statistics changes
Date: Tue, 29 Apr 2008 10:06:03 -0700	[thread overview]
Message-ID: <20080429100603.7348f36d@extreme> (raw)
In-Reply-To: <20080429100458.58249ba7@extreme>

The other untested patch for 2.6.25
--------------------------------------
Keep track of dropped frames in bridge.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 net/bridge/br_forward.c |   30 +++++++++++++++++++-----------
 net/bridge/br_input.c   |    3 +++
 2 files changed, 22 insertions(+), 11 deletions(-)

--- a/net/bridge/br_forward.c	2008-04-29 09:09:01.000000000 -0700
+++ b/net/bridge/br_forward.c	2008-04-29 09:16:18.000000000 -0700
@@ -34,20 +34,28 @@ static inline unsigned packet_length(con
 
 int br_dev_queue_push_xmit(struct sk_buff *skb)
 {
+	struct net_device *dev = skb->dev;
+	struct net_bridge_port *p;
+
 	/* drop mtu oversized packets except gso */
-	if (packet_length(skb) > skb->dev->mtu && !skb_is_gso(skb))
-		kfree_skb(skb);
-	else {
-		/* ip_refrag calls ip_fragment, doesn't copy the MAC header. */
-		if (nf_bridge_maybe_copy_header(skb))
-			kfree_skb(skb);
-		else {
-			skb_push(skb, ETH_HLEN);
+	if (packet_length(skb) > dev->mtu && !skb_is_gso(skb))
+		goto drop;
 
-			dev_queue_xmit(skb);
-		}
-	}
+	/* ip_refrag calls ip_fragment, doesn't copy the MAC header. */
+	if (nf_bridge_maybe_copy_header(skb))
+		goto drop;
+
+	skb_push(skb, ETH_HLEN);
 
+	dev_queue_xmit(skb);
+	return 0;
+
+drop:
+	p = rcu_dereference(dev->br_port);
+	if (p && p->br)
+		p->br->dev->stats.tx_dropped++;
+
+	kfree_skb(skb);
 	return 0;
 }
 
--- a/net/bridge/br_input.c	2008-04-29 09:15:56.000000000 -0700
+++ b/net/bridge/br_input.c	2008-04-29 09:25:57.000000000 -0700
@@ -89,6 +89,8 @@ int br_handle_frame_finish(struct sk_buf
 out:
 	return 0;
 drop:
+	if (p && p->br)
+		p->br->dev->stats.rx_dropped++;
 	kfree_skb(skb);
 	goto out;
 }
@@ -165,6 +167,7 @@ struct sk_buff *br_handle_frame(struct n
 		break;
 	default:
 drop:
+		p->br->dev->stats.rx_dropped++;
 		kfree_skb(skb);
 	}
 	return NULL;

      reply	other threads:[~2008-04-29 17:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-29 17:04 [Bridge] [RFT 1/2] bridge: internal statistics Stephen Hemminger
2008-04-29 17:06 ` Stephen Hemminger [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=20080429100603.7348f36d@extreme \
    --to=shemminger@vyatta.com \
    --cc=bridge@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