netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxim Levitsky <maximlevitsky@gmail.com>
To: linux1394-devel <linux1394-devel@lists.sourceforge.net>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>,
	netdev@vger.kernel.org, Maxim Levitsky <maximlevitsky@gmail.com>
Subject: [PATCH 5/5] firewire: net: ratelimit error messages
Date: Sun, 28 Nov 2010 03:15:36 +0200	[thread overview]
Message-ID: <1290906936-14472-6-git-send-email-maximlevitsky@gmail.com> (raw)
In-Reply-To: <1290906936-14472-1-git-send-email-maximlevitsky@gmail.com>

This patch ensures that firewire-net won't be able to flood
the logs with errors by combining series of same errors together.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
 drivers/firewire/net.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index d422519..ac563d6 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -999,15 +999,23 @@ static void fwnet_transmit_packet_failed(struct fwnet_packet_task *ptask)
 static void fwnet_write_complete(struct fw_card *card, int rcode,
 				 void *payload, size_t length, void *data)
 {
-	struct fwnet_packet_task *ptask;
-
-	ptask = data;
+	struct fwnet_packet_task *ptask = data;
+	static unsigned long j;
+	static int last_rcode, errors_skipped;
 
 	if (rcode == RCODE_COMPLETE) {
 		fwnet_transmit_packet_done(ptask);
 	} else {
-		fw_error("fwnet_write_complete: failed: %x\n", rcode);
 		fwnet_transmit_packet_failed(ptask);
+
+		if (printk_timed_ratelimit(&j,  1000) || rcode != last_rcode) {
+			fw_error("fwnet_write_complete: "
+				"failed: %x (skipped %d)\n", rcode, errors_skipped);
+
+			errors_skipped = 0;
+			last_rcode = rcode;
+		} else
+			errors_skipped++;
 	}
 }
 
-- 
1.7.1


  parent reply	other threads:[~2010-11-28  1:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-28  1:15 [PATCH 0/5] Firewire networking assorted fixes Maxim Levitsky
2010-11-28  1:15 ` [PATCH 1/5] firewire: ohci: restore GUID register on resume Maxim Levitsky
2010-11-28  1:15 ` [PATCH 2/5] firewire: ohci: restart ISO channels " Maxim Levitsky
2010-11-28  1:15 ` [PATCH 3/5] NET: ARP: allow to invalidate specific ARP entries Maxim Levitsky
2010-11-28  1:15 ` [PATCH 4/5] firewire: net: invalidate ARP entries for removed nodes Maxim Levitsky
2010-11-28  1:15 ` Maxim Levitsky [this message]
2010-11-28  3:02 ` [PATCH 0/5] Firewire networking assorted fixes Maxim Levitsky
  -- strict thread matches above, loose matches on Subject: below --
2010-11-29  2:09 [PATCH 0/5 V2] " Maxim Levitsky
2010-11-29  2:09 ` [PATCH 5/5] firewire: net: ratelimit error messages Maxim Levitsky

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=1290906936-14472-6-git-send-email-maximlevitsky@gmail.com \
    --to=maximlevitsky@gmail.com \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=netdev@vger.kernel.org \
    --cc=stefanr@s5r6.in-berlin.de \
    /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).