From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: netdev@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH] sh_eth: unmap DMA buffers when freeing rings
Date: Mon, 17 Apr 2017 15:45:47 +0300 [thread overview]
Message-ID: <3cbd0a3d-5af3-5382-34ac-e643e02b61bc@cogentembedded.com> (raw)
In-Reply-To: <ef4b905e-15fa-d257-72b3-bb5ed7f55b80@cogentembedded.com>
Hello!
On 04/17/2017 11:57 AM, Sergei Shtylyov wrote:
>> WARNING: CPU: 0 PID: 1445 at lib/dma-debug.c:519 add_dma_entry+0xe0/0x12c
>> DMA-API: exceeded 7 overlapping mappings of cacheline 0x01b2974d
>>
>> to be printed after repeated initialization of the Ether device, e.g.
>> suspend/resume or 'ifconfig' up/down. This is because DMA buffers mapped
>> using dma_map_single() in sh_eth_ring_format() and sh_eth_start_xmit() are
>> never unmapped. Resolve this problem by unmapping the buffers when freeing
>> the descriptor rings; in order to do it right, we'd have to add an extra
>> parameter to sh_eth_txfree() (we rename this function to sh_eth_tx_free(),
>> while at it).
>>
>> Based on the commit a47b70ea86bd ("ravb: unmap descriptors when freeing
>> rings").
>>
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>
>> ---
>> drivers/net/ethernet/renesas/sh_eth.c | 122
>> ++++++++++++++++++----------------
>> 1 file changed, 67 insertions(+), 55 deletions(-)
>>
>> Index: net/drivers/net/ethernet/renesas/sh_eth.c
>> ===================================================================
>> --- net.orig/drivers/net/ethernet/renesas/sh_eth.c
>> +++ net/drivers/net/ethernet/renesas/sh_eth.c
>> @@ -1127,12 +1127,70 @@ static struct mdiobb_ops bb_ops = {
>> .get_mdio_data = sh_get_mdio,
>> };
>>
>> +/* free Tx skb function */
>> +static int sh_eth_tx_free(struct net_device *ndev, bool sent_only)
>> +{
>> + struct sh_eth_private *mdp = netdev_priv(ndev);
>> + struct sh_eth_txdesc *txdesc;
>> + int free_num = 0;
>> + int entry;
>> + bool sent;
>> +
>> + for (; mdp->cur_tx - mdp->dirty_tx > 0; mdp->dirty_tx++) {
>> + entry = mdp->dirty_tx % mdp->num_tx_ring;
>> + txdesc = &mdp->tx_ring[entry];
>> + sent = txdesc->status & cpu_to_le32(TD_TACT);
>
> Oops, forgot to reverse the condition here. Which means I haven't goved in
s/goved in/given it/. :-)
> enough testing... :-/
TX statistics remained all 0s with this patch...
>> + if (sent_only && !sent)
>> + break;
[...]
MBR, Sergei
prev parent reply other threads:[~2017-04-17 12:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-16 20:01 [PATCH] sh_eth: unmap DMA buffers when freeing rings Sergei Shtylyov
2017-04-17 8:57 ` Sergei Shtylyov
2017-04-17 12:45 ` Sergei Shtylyov [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=3cbd0a3d-5af3-5382-34ac-e643e02b61bc@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).