public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Peter Senna Tschudin <peter.senna@gmail.com>
Cc: davem@davemloft.net, hauke@hauke-m.de,
	w-lkml@lebenslange-mailadresse.de, zajec5@gmail.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bgmac: ratelimit warning messages
Date: Fri, 06 Mar 2015 11:50:58 -0800	[thread overview]
Message-ID: <1425671458.12017.41.camel@perches.com> (raw)
In-Reply-To: <1425665874-14870-1-git-send-email-peter.senna@gmail.com>

On Fri, 2015-03-06 at 19:17 +0100, Peter Senna Tschudin wrote:
> On my test environment the troughput of a file transfer drops from
> 4.4Mbps to 116Kbps due the number of repeated warning messages.
> Adding printk_ratelimit() solves the issue without removing the
> warning message.

What value is there for this message being emitted more than once?

> diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c

> @@ -302,7 +302,7 @@ static int bgmac_dma_rx_skb_for_slot(struct bgmac *bgmac,
>  	slot->skb = skb;
>  	slot->dma_addr = dma_addr;
>  
> -	if (slot->dma_addr & 0xC0000000)
> +	if ((slot->dma_addr & 0xC0000000) && printk_ratelimit())
>  		bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n");

Maybe better as a static function

static void check_translate_address(struct bgmac *bgmac, dma_addr_t addr)
{
	static bool printed;

	if (!printed && (addr & (dma_addr_t)0xC0000000)))
		printed = true;
		bgmac_warn(bgmac, etc...);
	}
}

[...]

	check_translate_address(bgmac, slot->dma_addr);

>  	return 0;
> @@ -505,7 +505,7 @@ static int bgmac_dma_alloc(struct bgmac *bgmac)
>  				  ring->mmio_base);
>  			goto err_dma_free;
>  		}
> -		if (ring->dma_base & 0xC0000000)
> +		if ((ring->dma_base & 0xC0000000) && printk_ratelimit())
>  			bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n");
>  
>  		ring->unaligned = bgmac_dma_unaligned(bgmac, ring,
> @@ -536,7 +536,7 @@ static int bgmac_dma_alloc(struct bgmac *bgmac)
>  			err = -ENOMEM;
>  			goto err_dma_free;
>  		}
> -		if (ring->dma_base & 0xC0000000)
> +		if ((ring->dma_base & 0xC0000000) && printk_ratelimit())
>  			bgmac_warn(bgmac, "DMA address using 0xC0000000 bit(s), it may need translation trick\n");
>  
>  		ring->unaligned = bgmac_dma_unaligned(bgmac, ring,




  reply	other threads:[~2015-03-06 19:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06 18:17 [PATCH] bgmac: ratelimit warning messages Peter Senna Tschudin
2015-03-06 19:50 ` Joe Perches [this message]
2015-03-06 23:27 ` Rafał Miłecki
2015-03-07  9:39   ` Peter Senna Tschudin

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=1425671458.12017.41.camel@perches.com \
    --to=joe@perches.com \
    --cc=davem@davemloft.net \
    --cc=hauke@hauke-m.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peter.senna@gmail.com \
    --cc=w-lkml@lebenslange-mailadresse.de \
    --cc=zajec5@gmail.com \
    /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