From: Christoph Hellwig <hch@infradead.org>
To: Jian-Hong Pan <jian-hong@endlessm.com>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>,
Kalle Valo <kvalo@codeaurora.org>,
"David S . Miller" <davem@davemloft.net>,
Larry Finger <Larry.Finger@lwfinger.net>,
David Laight <David.Laight@aculab.com>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux@endlessm.com,
Daniel Drake <drake@endlessm.com>
Subject: Re: [PATCH v2 2/2] rtw88: pci: Use DMA sync instead of remapping in RX ISR
Date: Tue, 9 Jul 2019 09:15:50 -0700 [thread overview]
Message-ID: <20190709161550.GA8703@infradead.org> (raw)
In-Reply-To: <20190709102059.7036-2-jian-hong@endlessm.com>
On Tue, Jul 09, 2019 at 06:21:01PM +0800, Jian-Hong Pan wrote:
> Since each skb in RX ring is reused instead of new allocation, we can
> treat the DMA in a more efficient way by DMA synchronization.
>
> Signed-off-by: Jian-Hong Pan <jian-hong@endlessm.com>
> ---
> drivers/net/wireless/realtek/rtw88/pci.c | 35 ++++++++++++++++++++++--
> 1 file changed, 32 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c
> index e9fe3ad896c8..28ca76f71dfe 100644
> --- a/drivers/net/wireless/realtek/rtw88/pci.c
> +++ b/drivers/net/wireless/realtek/rtw88/pci.c
> @@ -206,6 +206,35 @@ static int rtw_pci_reset_rx_desc(struct rtw_dev *rtwdev, struct sk_buff *skb,
> return 0;
> }
>
> +static int rtw_pci_sync_rx_desc_cpu(struct rtw_dev *rtwdev, dma_addr_t dma)
> +{
> + struct device *dev = rtwdev->dev;
> + int buf_sz = RTK_PCI_RX_BUF_SIZE;
> +
> + dma_sync_single_for_cpu(dev, dma, buf_sz, PCI_DMA_FROMDEVICE);
> +
> + return 0;
> +}
No need to return a value from this helper. In fact I'm not even sure
you need the helper at all. Also please use the DMA_FROM_DEVICE
constant instead of the deprecated PCI variant.
> +static int rtw_pci_sync_rx_desc_device(struct rtw_dev *rtwdev, dma_addr_t dma,
> + struct rtw_pci_rx_ring *rx_ring,
> + u32 idx, u32 desc_sz)
> +{
> + struct device *dev = rtwdev->dev;
> + struct rtw_pci_rx_buffer_desc *buf_desc;
> + int buf_sz = RTK_PCI_RX_BUF_SIZE;
> +
> + dma_sync_single_for_device(dev, dma, buf_sz, PCI_DMA_FROMDEVICE);
> +
> + buf_desc = (struct rtw_pci_rx_buffer_desc *)(rx_ring->r.head +
> + idx * desc_sz);
> + memset(buf_desc, 0, sizeof(*buf_desc));
> + buf_desc->buf_size = cpu_to_le16(RTK_PCI_RX_BUF_SIZE);
> + buf_desc->dma = cpu_to_le32(dma);
> +
> + return 0;
> +}
Same comment on the PCI constant and the return value here.
next prev parent reply other threads:[~2019-07-09 16:16 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-08 6:32 [PATCH] rtw88/pci: Rearrange the memory usage for skb in RX ISR Jian-Hong Pan
2019-07-08 7:23 ` Tony Chuang
2019-07-08 8:07 ` Jian-Hong Pan
2019-07-08 9:00 ` Tony Chuang
2019-07-08 9:18 ` David Laight
2019-07-08 8:36 ` David Laight
2019-07-08 18:01 ` Larry Finger
2019-07-09 10:20 ` [PATCH v2 1/2] rtw88: pci: " Jian-Hong Pan
2019-07-10 8:36 ` Tony Chuang
2019-07-10 8:54 ` Jian-Hong Pan
2019-07-09 10:21 ` [PATCH v2 2/2] rtw88: pci: Use DMA sync instead of remapping " Jian-Hong Pan
2019-07-09 16:15 ` Christoph Hellwig [this message]
2019-07-10 8:38 ` [PATCH v3 1/2] rtw88: pci: Rearrange the memory usage for skb " Jian-Hong Pan
2019-07-10 8:57 ` David Laight
2019-07-11 3:50 ` Jian-Hong Pan
2019-07-11 5:24 ` [PATCH v4 " Jian-Hong Pan
2019-07-11 5:24 ` [PATCH v4 2/2] rtw88: pci: Use DMA sync instead of remapping " Jian-Hong Pan
2019-07-11 5:30 ` Jian-Hong Pan
2019-07-11 5:28 ` [PATCH v4 1/2] rtw88: pci: Rearrange the memory usage for skb " Jian-Hong Pan
2019-07-24 6:13 ` Jian-Hong Pan
2019-07-24 11:49 ` Kalle Valo
2019-08-15 20:25 ` [PATCH v3 " Brian Norris
2019-07-10 8:38 ` [PATCH v3 2/2] rtw88: pci: Use DMA sync instead of remapping " Jian-Hong Pan
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=20190709161550.GA8703@infradead.org \
--to=hch@infradead.org \
--cc=David.Laight@aculab.com \
--cc=Larry.Finger@lwfinger.net \
--cc=davem@davemloft.net \
--cc=drake@endlessm.com \
--cc=jian-hong@endlessm.com \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linux@endlessm.com \
--cc=netdev@vger.kernel.org \
--cc=yhchuang@realtek.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;
as well as URLs for NNTP newsgroup(s).