From: Simon Horman <horms@kernel.org>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: netdev@vger.kernel.org, lorenzo.bianconi@redhat.com,
nbd@nbd.name, john@phrozen.org, sean.wang@mediatek.com,
Mark-MC.Lee@mediatek.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
daniel@makrotopia.org, linux-mediatek@lists.infradead.org,
sujuan.chen@mediatek.com, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, devicetree@vger.kernel.org
Subject: Re: [PATCH net-next 13/15] net: ethernet: mtk_wed: introduce hw_rro support for MT7988
Date: Sun, 17 Sep 2023 10:47:28 +0200 [thread overview]
Message-ID: <20230917084728.GI1125562@kernel.org> (raw)
In-Reply-To: <da27f7333fa31808ceae581d9bef5030c6072f33.1694701767.git.lorenzo@kernel.org>
On Thu, Sep 14, 2023 at 04:38:18PM +0200, Lorenzo Bianconi wrote:
> From: Sujuan Chen <sujuan.chen@mediatek.com>
>
> MT7988 SoC support 802.11 receive reordering offload in hw while
> MT7986 SoC implements it through the firmware running on the mcu.
>
> Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
...
Hi Lorenzo,
some minor feedback from my side.
> @@ -565,6 +565,73 @@ mtk_wed_free_tx_buffer(struct mtk_wed_device *dev)
> kfree(page_list);
> }
>
> +static int
> +mtk_wed_hwrro_buffer_alloc(struct mtk_wed_device *dev)
> +{
> + int n_pages = MTK_WED_RX_PG_BM_CNT / MTK_WED_RX_BUF_PER_PAGE;
> + struct mtk_wed_buf *page_list;
> + struct mtk_wed_bm_desc *desc;
> + dma_addr_t desc_phys;
> + int i, page_idx = 0;
> +
> + if (!dev->wlan.hw_rro)
> + return 0;
> +
> + page_list = kcalloc(n_pages, sizeof(*page_list), GFP_KERNEL);
> + if (!page_list)
> + return -ENOMEM;
> +
> + dev->hw_rro.size = dev->wlan.rx_nbuf & ~(MTK_WED_BUF_PER_PAGE - 1);
> + dev->hw_rro.pages = page_list;
> + desc = dma_alloc_coherent(dev->hw->dev,
> + dev->wlan.rx_nbuf * sizeof(*desc),
> + &desc_phys, GFP_KERNEL);
> + if (!desc)
> + return -ENOMEM;
> +
> + dev->hw_rro.desc = desc;
> + dev->hw_rro.desc_phys = desc_phys;
> +
> + for (i = 0; i < MTK_WED_RX_PG_BM_CNT; i += MTK_WED_RX_BUF_PER_PAGE) {
> + dma_addr_t page_phys, buf_phys;
> + struct page *page;
> + void *buf;
> + int s;
> +
> + page = __dev_alloc_page(GFP_KERNEL);
> + if (!page)
> + return -ENOMEM;
> +
> + page_phys = dma_map_page(dev->hw->dev, page, 0, PAGE_SIZE,
> + DMA_BIDIRECTIONAL);
> + if (dma_mapping_error(dev->hw->dev, page_phys)) {
> + __free_page(page);
> + return -ENOMEM;
> + }
> +
> + page_list[page_idx].p = page;
> + page_list[page_idx++].phy_addr = page_phys;
> + dma_sync_single_for_cpu(dev->hw->dev, page_phys, PAGE_SIZE,
> + DMA_BIDIRECTIONAL);
> +
> + buf = page_to_virt(page);
> + buf_phys = page_phys;
> +
> + for (s = 0; s < MTK_WED_RX_BUF_PER_PAGE; s++) {
> + desc->buf0 = cpu_to_le32(buf_phys);
> + desc++;
> +
> + buf += MTK_WED_PAGE_BUF_SIZE;
clang-16 W=1 warns that buf is set but otherwise unused in this function.
> + buf_phys += MTK_WED_PAGE_BUF_SIZE;
> + }
> +
> + dma_sync_single_for_device(dev->hw->dev, page_phys, PAGE_SIZE,
> + DMA_BIDIRECTIONAL);
> + }
> +
> + return 0;
> +}
> +
> static int
> mtk_wed_rx_buffer_alloc(struct mtk_wed_device *dev)
> {
...
next prev parent reply other threads:[~2023-09-17 8:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 14:38 [PATCH net-next 00/15] Add WED support for MT7988 chipset Lorenzo Bianconi
2023-09-14 14:38 ` [PATCH net-next 01/15] dt-bindings: soc: mediatek: mt7986-wo-ccif: add binding for MT7988 SoC Lorenzo Bianconi
2023-09-15 14:56 ` Rob Herring
2023-09-14 14:38 ` [PATCH net-next 02/15] dt-bindings: arm: mediatek: mt7622-wed: add WED " Lorenzo Bianconi
2023-09-15 14:57 ` Rob Herring
2023-09-14 14:38 ` [PATCH net-next 03/15] net: ethernet: mtk_wed: introduce versioning utility routines Lorenzo Bianconi
2023-09-14 14:38 ` [PATCH net-next 04/15] net: ethernet: mtk_wed: introduce mtk_wed_wdma_get_desc_size utility routine Lorenzo Bianconi
2023-09-14 14:38 ` [PATCH net-next 05/15] net: ethernet: mtk_wed: do not configure rx offload if not supported Lorenzo Bianconi
2023-09-14 14:38 ` [PATCH net-next 06/15] net: ethernet: mtk_wed: rename mtk_rxbm_desc in mtk_wed_bm_desc Lorenzo Bianconi
2023-09-14 14:38 ` [PATCH net-next 07/15] net: ethernet: mtk_wed: introduce mtk_wed_buf structure Lorenzo Bianconi
2023-09-14 14:38 ` [PATCH net-next 08/15] net: ethernet: mtk_wed: move mem_region array out of mtk_wed_mcu_load_firmware Lorenzo Bianconi
2023-09-14 14:38 ` [PATCH net-next 09/15] net: ethernet: mtk_wed: make memory region optional Lorenzo Bianconi
2023-09-14 14:38 ` [PATCH net-next 10/15] net: ethernet: mtk_wed: introduce WED support for MT7988 Lorenzo Bianconi
2023-09-15 14:55 ` Rob Herring
2023-09-15 16:28 ` Lorenzo Bianconi
2023-09-14 14:38 ` [PATCH net-next 11/15] net: ethernet: mtk_wed: refactor mtk_wed_check_wfdma_rx_fill routine Lorenzo Bianconi
2023-09-14 14:38 ` [PATCH net-next 12/15] net: ethernet: mtk_wed: introduce partial AMSDU offload support for MT7988 Lorenzo Bianconi
2023-09-14 14:38 ` [PATCH net-next 13/15] net: ethernet: mtk_wed: introduce hw_rro " Lorenzo Bianconi
2023-09-17 8:47 ` Simon Horman [this message]
2023-09-18 7:54 ` Lorenzo Bianconi
2023-09-14 14:38 ` [PATCH net-next 14/15] net: ethernet: mtk_wed: debugfs: move wed_v2 specific regs out of regs array Lorenzo Bianconi
2023-09-14 14:38 ` [PATCH net-next 15/15] net: ethernet: mtk_wed: debugfs: add WED 3.0 debugfs entries Lorenzo Bianconi
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=20230917084728.GI1125562@kernel.org \
--to=horms@kernel.org \
--cc=Mark-MC.Lee@mediatek.com \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=john@phrozen.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh+dt@kernel.org \
--cc=sean.wang@mediatek.com \
--cc=sujuan.chen@mediatek.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).