From: Alexey Khoroshilov <khoroshilov@ispras.ru>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
ldv-project@linuxtesting.org
Subject: Re: [PATCH] natsemi: add checks for dma mapping errors
Date: Sat, 19 Dec 2015 15:06:45 +0300 [thread overview]
Message-ID: <56754855.6080808@ispras.ru> (raw)
In-Reply-To: <20151218.213607.1270121670262037282.davem@davemloft.net>
On 19.12.2015 05:36, David Miller wrote:
> From: Alexey Khoroshilov <khoroshilov@ispras.ru>
> Date: Sat, 19 Dec 2015 00:55:37 +0300
>
>> @@ -2093,6 +2099,10 @@ static netdev_tx_t start_tx(struct sk_buff
*skb, struct net_device *dev)
>> np->tx_skbuff[entry] = skb;
>> np->tx_dma[entry] = pci_map_single(np->pci_dev,
>> skb->data,skb->len, PCI_DMA_TODEVICE);
>> + if (pci_dma_mapping_error(np->pci_dev, np->tx_dma[entry])) {
>> + np->tx_skbuff[entry] = NULL;
>> + return NETDEV_TX_BUSY;
>> + }
>>
>> np->tx_ring[entry].addr = cpu_to_le32(np->tx_dma[entry]);
>>
>
> Returning NETDEV_TX_BUSY and freeing the SKB will crash the system.
I do not quite understand what do you mean by 'freeing the SKB'.
At least the patch left skb untouched.
But I saw such pattern, for example, in
drivers/net/ethernet/freescale/fec_main.c:
addr = dma_map_single(&fep->pdev->dev, data, size, DMA_TO_DEVICE);
if (dma_mapping_error(&fep->pdev->dev, addr)) {
dev_kfree_skb_any(skb);
if (net_ratelimit())
netdev_err(ndev, "Tx DMA memory map failed\n");
return NETDEV_TX_BUSY;
}
>
> NETDEV_TX_BUSY is only for buggy drivers that do not manage their
> TX ring busy condition correctly, and thus need retries.
Ok, I will replace NETDEV_TX_BUSY by dropping the packet.
--
Alexey
next prev parent reply other threads:[~2015-12-19 12:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-18 21:55 [PATCH] natsemi: add checks for dma mapping errors Alexey Khoroshilov
2015-12-19 2:36 ` David Miller
2015-12-19 12:06 ` Alexey Khoroshilov [this message]
2015-12-19 12:13 ` [PATCH v2] " Alexey Khoroshilov
2015-12-19 17:59 ` David Miller
2015-12-19 17:54 ` [PATCH] " David Miller
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=56754855.6080808@ispras.ru \
--to=khoroshilov@ispras.ru \
--cc=davem@davemloft.net \
--cc=ldv-project@linuxtesting.org \
--cc=linux-kernel@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).