All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabor Juhos <juhosg@openwrt.org>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH] ath9k:  Implement rx copy-break.
Date: Mon, 10 Jan 2011 08:14:02 +0100	[thread overview]
Message-ID: <4D2AB1BA.4010205@openwrt.org> (raw)
In-Reply-To: <4D29F512.3050707@candelatech.com>

2011.01.09. 18:49 keltez?ssel, Ben Greear ?rta:
> On 01/09/2011 12:00 AM, Gabor Juhos wrote:
>> Hi Ben,
>>
>>> From: Ben Greear<greearb@candelatech.com>
>>>
>>> This saves us constantly allocating large, multi-page
>>> skbs.  It should fix the order-1 allocation errors reported,
>>> and in a 60-vif scenario, this significantly decreases CPU
>>> utilization, and latency, and increases bandwidth.
>>>
>>> Signed-off-by: Ben Greear<greearb@candelatech.com>
>>> ---
>>> :100644 100644 b2497b8... ea2f67c... M    drivers/net/wireless/ath/ath9k/recv.c
>>>   drivers/net/wireless/ath/ath9k/recv.c |   92 ++++++++++++++++++++++-----------
>>>   1 files changed, 61 insertions(+), 31 deletions(-)
>>
>> <...>
>>
>>> +        if (use_copybreak) {
>>> +            struct pci_dev *pdev = to_pci_dev(sc->dev);
>>
>> This would cause undefined behaviour with ath9k devices sitting on an AHB bus.
>>
>>> +            pci_dma_sync_single_for_cpu(pdev, bf->bf_buf_addr,
>>> +                            len, PCI_DMA_FROMDEVICE);
>>> +            skb_copy_from_linear_data(bf->bf_mpdu, skb->data, len);
>>> +            pci_dma_sync_single_for_device(pdev, bf->bf_buf_addr,
>>> +                               len, PCI_DMA_FROMDEVICE);
>>
>> Please use the bus agnostic equivalents of these DMA functions.
> 
> Any idea what that might be?

Invalid/null pointer dereference probably. The problem is that sc->dev is
pointing to a device structure inside a platform_device structure when it is not
PCI device. Converting sc->dev to 'struct *pci_dev' and using the result as a
parameter for a PCI specific function is not correct in this case.

> Should we just disable copybreak for things on AHB bus?

We should not disable it, order-1 allocation failures are present there as well.

-Gabor

WARNING: multiple messages have this Message-ID (diff)
From: Gabor Juhos <juhosg@openwrt.org>
To: Ben Greear <greearb@candelatech.com>
Cc: linux-wireless@vger.kernel.org, ath9k-devel@venema.h4ckr.net
Subject: Re: [PATCH] ath9k:  Implement rx copy-break.
Date: Mon, 10 Jan 2011 08:14:02 +0100	[thread overview]
Message-ID: <4D2AB1BA.4010205@openwrt.org> (raw)
In-Reply-To: <4D29F512.3050707@candelatech.com>

2011.01.09. 18:49 keltezéssel, Ben Greear írta:
> On 01/09/2011 12:00 AM, Gabor Juhos wrote:
>> Hi Ben,
>>
>>> From: Ben Greear<greearb@candelatech.com>
>>>
>>> This saves us constantly allocating large, multi-page
>>> skbs.  It should fix the order-1 allocation errors reported,
>>> and in a 60-vif scenario, this significantly decreases CPU
>>> utilization, and latency, and increases bandwidth.
>>>
>>> Signed-off-by: Ben Greear<greearb@candelatech.com>
>>> ---
>>> :100644 100644 b2497b8... ea2f67c... M    drivers/net/wireless/ath/ath9k/recv.c
>>>   drivers/net/wireless/ath/ath9k/recv.c |   92 ++++++++++++++++++++++-----------
>>>   1 files changed, 61 insertions(+), 31 deletions(-)
>>
>> <...>
>>
>>> +        if (use_copybreak) {
>>> +            struct pci_dev *pdev = to_pci_dev(sc->dev);
>>
>> This would cause undefined behaviour with ath9k devices sitting on an AHB bus.
>>
>>> +            pci_dma_sync_single_for_cpu(pdev, bf->bf_buf_addr,
>>> +                            len, PCI_DMA_FROMDEVICE);
>>> +            skb_copy_from_linear_data(bf->bf_mpdu, skb->data, len);
>>> +            pci_dma_sync_single_for_device(pdev, bf->bf_buf_addr,
>>> +                               len, PCI_DMA_FROMDEVICE);
>>
>> Please use the bus agnostic equivalents of these DMA functions.
> 
> Any idea what that might be?

Invalid/null pointer dereference probably. The problem is that sc->dev is
pointing to a device structure inside a platform_device structure when it is not
PCI device. Converting sc->dev to 'struct *pci_dev' and using the result as a
parameter for a PCI specific function is not correct in this case.

> Should we just disable copybreak for things on AHB bus?

We should not disable it, order-1 allocation failures are present there as well.

-Gabor

  reply	other threads:[~2011-01-10  7:14 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-08 15:33 [ath9k-devel] [PATCH] ath9k: Implement rx copy-break greearb at candelatech.com
2011-01-08 15:33 ` greearb
2011-01-09  0:20 ` [ath9k-devel] " Felix Fietkau
2011-01-09  0:20   ` Felix Fietkau
2011-01-09  0:36   ` [ath9k-devel] " Ben Greear
2011-01-09  0:36     ` Ben Greear
2011-01-09  0:41     ` [ath9k-devel] " Felix Fietkau
2011-01-09  0:41       ` Felix Fietkau
2011-01-09  1:06       ` [ath9k-devel] " Ben Greear
2011-01-09  1:06         ` Ben Greear
2011-01-09 14:15         ` [ath9k-devel] " Björn Smedman
2011-01-09 14:15           ` Björn Smedman
2011-01-09 14:18           ` [ath9k-devel] " Felix Fietkau
2011-01-09 14:18             ` Felix Fietkau
2011-01-09 15:35             ` [ath9k-devel] " Björn Smedman
2011-01-09 15:35               ` Björn Smedman
2011-01-09 18:13     ` [ath9k-devel] " Jouni Malinen
2011-01-09 18:13       ` Jouni Malinen
2011-01-09 20:14       ` [ath9k-devel] " Christian Lamparter
2011-01-09 20:14         ` Christian Lamparter
2011-01-09 20:24         ` [ath9k-devel] " Felix Fietkau
2011-01-09 20:24           ` Felix Fietkau
2011-01-10 12:40         ` [ath9k-devel] " Jouni Malinen
2011-01-10 12:40           ` Jouni Malinen
2011-01-10  4:32       ` [ath9k-devel] " Ben Greear
2011-01-10  4:32         ` Ben Greear
2011-01-09  8:00 ` [ath9k-devel] " Gabor Juhos
2011-01-09  8:00   ` Gabor Juhos
2011-01-09 17:49   ` [ath9k-devel] " Ben Greear
2011-01-09 17:49     ` Ben Greear
2011-01-10  7:14     ` Gabor Juhos [this message]
2011-01-10  7:14       ` Gabor Juhos

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=4D2AB1BA.4010205@openwrt.org \
    --to=juhosg@openwrt.org \
    --cc=ath9k-devel@lists.ath9k.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.