Commit c4d6fd40df38eb4c187565d48807f5f902481ba8

Authored by Maxim Levitsky
Committed by Stefan Richter
1 parent dd23736e09

firewire: net: ratelimit error messages

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>

Showing 1 changed file with 12 additions and 4 deletions Side-by-side Diff

drivers/firewire/net.c
... ... @@ -996,15 +996,23 @@
996 996 static void fwnet_write_complete(struct fw_card *card, int rcode,
997 997 void *payload, size_t length, void *data)
998 998 {
999   - struct fwnet_packet_task *ptask;
  999 + struct fwnet_packet_task *ptask = data;
  1000 + static unsigned long j;
  1001 + static int last_rcode, errors_skipped;
1000 1002  
1001   - ptask = data;
1002   -
1003 1003 if (rcode == RCODE_COMPLETE) {
1004 1004 fwnet_transmit_packet_done(ptask);
1005 1005 } else {
1006   - fw_error("fwnet_write_complete: failed: %x\n", rcode);
1007 1006 fwnet_transmit_packet_failed(ptask);
  1007 +
  1008 + if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) {
  1009 + fw_error("fwnet_write_complete: "
  1010 + "failed: %x (skipped %d)\n", rcode, errors_skipped);
  1011 +
  1012 + errors_skipped = 0;
  1013 + last_rcode = rcode;
  1014 + } else
  1015 + errors_skipped++;
1008 1016 }
1009 1017 }
1010 1018