firewire: net: ratelimit error messages
authorMaxim Levitsky <maximlevitsky@gmail.com>
Mon, 29 Nov 2010 02:09:53 +0000 (04:09 +0200)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Mon, 13 Dec 2010 19:39:15 +0000 (20:39 +0100)
Unfortunately its easy to trigger such error messages by removing the
cable while sending streams of data over the link.

Such errors are normal, and therefore this patch stops firewire-net from
flooding the kernel log with these errors, by combining series of same
errors together.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
(Stefan R:)  Eventually we should remove this logging when firewire-net
and related firewire-ohci facilities have been stabilized.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/firewire/net.c

index 1a467a91fb0b2c8ee4c7ac577f02c497d249e1dc..ea31e3084d671bae2c27797d8d68d9c2511496c6 100644 (file)
@@ -996,15 +996,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++;
        }
 }