From: "Xin Tian" <tianx@yunsilicon.com>
To: <netdev-bot+sashiko@kernel.org>
Cc: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<jgg@ziepe.ca>, <leon@kernel.org>, <huangjunxian6@hisilicon.com>,
<weihg@yunsilicon.com>, <linux-kernel@vger.kernel.org>,
<netdev@vger.kernel.org>, <linux-rdma@vger.kernel.org>,
<kerneljasonxing@gmail.com>
Subject: Re: [PATCH v2 02/11] net/xsc: add doorbell and cmdq MMIO accessors
Date: Sun, 6 Dec 2026 11:14:20 +0800 [thread overview]
Message-ID: <79203797-ecb6-41e9-918b-01ad3d44a770@yunsilicon.com> (raw)
In-Reply-To: <179579507051.3135.14726043842081189942@kernel.org>
On 11/27/2026 11:57 PM, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 3 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 2
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [Medium] xsc_arm_cq(xdev, cqn, next_cid, u8 solicited) in
> drivers/net/ethernet/yunsilicon/xsc/pci/doorbell.c (lines 62-74) puts…
> - [Low] All five doorbell writers in
> drivers/net/ethernet/yunsilicon/xsc/pci/doorbell.c call a full wmb()…
> - [Low] The new file drivers/net/ethernet/yunsilicon/xsc/pci/doorbell.c
> calls EXPORT_SYMBOL_GPL() four times (xsc_update_tx_db,…
>
> --
>
> net/xsc: add doorbell and cmdq MMIO accessors
>
> This commit adds doorbell writers for TX/RX queues, CQs and EQs, along
> with cmdq register accessors. They all operate on fixed offsets in the
> device BAR. The helpers are declared in xsc_core.h, and the TX, RX and
> CQ helpers are exported for use by other modules.
>
>> diff --git a/drivers/net/ethernet/yunsilicon/xsc/pci/doorbell.c b/drivers/net/ethernet/yunsilicon/xsc/pci/doorbell.c
>> new file mode 100644
>> index 0000000000000..5bd64be671646
>> --- /dev/null
>> +++ b/drivers/net/ethernet/yunsilicon/xsc/pci/doorbell.c
>> @@ -0,0 +1,148 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/* Copyright (C) 2024 - 2026, Shanghai Yunsilicon Technology Co., Ltd.
>> + * All rights reserved.
>> + */
>> +
>> +#include <linux/kernel.h>
>> +#include <linux/pci.h>
>> +
>> +#include "common/xsc_core.h"
>> +#include "common/xsc_reg.h"
> [Severity: Low]
> This isn't a bug, but should this file include <linux/export.h> directly?
>
> It uses EXPORT_SYMBOL_GPL() for xsc_update_tx_db(), xsc_update_rx_db(),
> xsc_arm_cq() and xsc_update_cq_ci(). With W=2, the
> check_missing_include_linux_export_h check in scripts/misc-check reports
> this for the file:
>
> EXPORT_SYMBOL() is used, but #include <linux/export.h> is missing
>
> The file builds today only because export.h is pulled in indirectly.
>
> [ ... ]
Added the export.h include here and to the other files in the series that
export symbols.
>> +void xsc_update_tx_db(struct xsc_core_device *xdev, u32 sqn, u32 next_pid)
>> +{
>> + u32 db = FIELD_PREP(XSC_TX_DB_DATA0_NEXT_PID_MASK, next_pid) |
>> + FIELD_PREP(XSC_TX_DB_DATA0_QP_ID_MASK, sqn);
>> +
>> + /* Make sure that descriptors are written before
>> + * updating doorbell record and ringing the doorbell
>> + */
>> + wmb();
>> +
>> + writel(db, xdev->bar + TX_DB_FUNC_MEM_ADDR);
>> +}
> [Severity: Low]
> Is the explicit wmb() needed before writel() here? writel() already
> orders earlier stores to normal and coherent DMA memory before the MMIO
> store:
>
> include/asm-generic/io.h:writel() {
> ...
> __io_bw();
> __raw_writel((u32 __force)__cpu_to_le32(value), addr);
> __io_aw();
> ...
> }
>
> On arm64, __io_bw() is dma_wmb(), so the extra wmb() adds a dsb st to
> every TX doorbell.
>
> xsc_update_rx_db(), xsc_arm_cq(), xsc_update_cq_ci() and
> xsc_update_eq_ci() use the same wmb() plus writel() pattern. Once the
> later "net/xsc: add the transmit path" and "net/xsc: add the receive
> path" patches call these helpers, they are on the hot path.
> xsc_update_cmdq_req_pid() uses a plain writel(), so the barrier usage in
> this file is also inconsistent. The code is unchanged at the end of the
> series.
>
> The comments don't seem to match the code either:
>
> - The TX/RX comments mention "updating doorbell record".
> - xsc_arm_cq() mentions "the doorbell record in host memory".
> - Only a single MMIO word is written, and there is no doorbell record
> in host memory.
> - xsc_update_cq_ci() and xsc_update_eq_ci() say "make sure val write to
> memory done", but there is no val variable.
>
> For the CQ/EQ consumer index updates, the intent may be that the
> CQE/EQE loads finish before the device can reuse the entry. wmb() only
> orders stores, so would a different barrier be needed there?
Dropped all five. writel() already orders prior writes, same as idpf.
The stale doorbell-record / "val" comments go with them, and with no wmb
left in the file.
For the CQ/EQ CI doorbells the wmb() ordered nothing: it can't order the
CQE reads, and there are no stores to order. The read side is handled by
the dma_rmb() after the ownership check in the poll loops.
> [ ... ]
>
>> +void xsc_arm_cq(struct xsc_core_device *xdev, u32 cqn, u32 next_cid,
>> + u8 solicited)
>> +{
>> + u32 db = FIELD_PREP(XSC_CQ_DB_DATA0_NEXT_CID_MASK, next_cid) |
>> + FIELD_PREP(XSC_CQ_DB_DATA0_CQ_ID_MASK, cqn) |
>> + FIELD_PREP(XSC_CQ_DB_DATA0_ARM, !!solicited);
> [Severity: Medium]
> Is the solicited argument meant to set the bit named
> XSC_CQ_DB_DATA0_ARM?
>
> The peer helper xsc_update_eq_ci() sets XSC_EQ_DB_DATA0_ARM from an arm
> argument. Its callers in eq.c pass 1 to arm the EQ at the end of
> xsc_eq_int() and at EQ creation, and 0 for intermediate CI updates.
>
> Later in the series, every caller of xsc_arm_cq() passes 0. The re-arm
> after NAPI completion does this:
>
> xsc_cq_notify_hw_rearm()
> xsc_arm_cq(cq->xdev, cq->xcq.cqn, cq->wq.cc, 0);
>
> So does the initial arm at CQ creation in net/main.c:
>
> xsc_arm_cq(pcq->xdev, pcq->xcq.cqn, pcq->wq.cc, 0);
>
> If BIT(31) is the arm enable bit, as the macro name suggests, do the
> CQs ever get armed? Completion interrupts would then stop after the
> first napi_complete_done(), and the RX/TX datapath would stall.
>
> Another reading is that any write to DB_CQ_FUNC_MEM_ADDR arms the CQ,
> and BIT(31) only selects solicited-only notification. In that case,
> should the macro be renamed so the exported prototype, the
> implementation and the EQ helper agree on what this bit means?
The write always arms the CQ, the bit only picks arm-next vs
arm-solicited, so behavior is fine. Added a comment to make that clear.
next prev parent reply other threads:[~2026-12-06 3:14 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 14:57 [PATCH v2 00/11] net/xsc: add the Yunsilicon XSC ethernet driver Xin Tian
2026-11-26 14:57 ` [PATCH v2 01/11] net/xsc: add Yunsilicon XSC ethernet PCI driver Xin Tian
2026-11-27 15:57 ` netdev-bot+sashiko
2026-12-06 2:56 ` Xin Tian
2026-11-28 17:32 ` Andrew Lunn
2026-12-01 9:48 ` Xin Tian
2026-11-29 2:53 ` Jason Xing
2026-11-26 14:57 ` [PATCH v2 02/11] net/xsc: add doorbell and cmdq MMIO accessors Xin Tian
2026-11-27 15:57 ` netdev-bot+sashiko
2026-12-06 3:14 ` Xin Tian [this message]
2026-11-29 5:47 ` Jason Xing
2026-12-01 9:16 ` Xin Tian
2026-11-26 14:57 ` [PATCH v2 03/11] net/xsc: add the command queue Xin Tian
2026-11-27 15:57 ` netdev-bot+sashiko
2026-12-06 8:58 ` Xin Tian
2026-11-29 7:30 ` Jason Xing
2026-12-01 9:22 ` Xin Tian
2026-12-02 6:21 ` Jason Xing
2026-11-26 14:57 ` [PATCH v2 04/11] net/xsc: query HCA capabilities and reset function Xin Tian
2026-11-27 15:57 ` netdev-bot+sashiko
2026-12-06 9:04 ` Xin Tian
2026-11-29 7:48 ` Jason Xing
2026-12-01 9:24 ` Xin Tian
2026-11-26 14:57 ` [PATCH v2 05/11] net/xsc: add event queues and MSI-X Xin Tian
2026-11-27 15:57 ` netdev-bot+sashiko
2026-12-06 9:11 ` Xin Tian
2026-11-26 14:57 ` [PATCH v2 06/11] net/xsc: add CQ and QP helpers Xin Tian
2026-11-27 15:57 ` netdev-bot+sashiko
2026-12-06 9:36 ` Xin Tian
2026-11-26 14:57 ` [PATCH v2 07/11] net/xsc: add the ethernet netdev Xin Tian
2026-11-27 15:57 ` netdev-bot+sashiko
2026-12-06 9:40 ` Xin Tian
2026-11-28 17:49 ` Andrew Lunn
2026-11-26 14:57 ` [PATCH v2 08/11] net/xsc: add the single TX/RX channel Xin Tian
2026-11-27 15:58 ` netdev-bot+sashiko
2026-12-06 10:47 ` Xin Tian
2026-11-26 14:57 ` [PATCH v2 09/11] net/xsc: report link state changes Xin Tian
2026-11-27 15:58 ` netdev-bot+sashiko
2026-12-06 10:55 ` Xin Tian
2026-11-26 14:57 ` [PATCH v2 10/11] net/xsc: add the transmit path Xin Tian
2026-11-27 15:58 ` netdev-bot+sashiko
2026-12-06 11:00 ` Xin Tian
2026-11-26 14:57 ` [PATCH v2 11/11] net/xsc: add the receive path Xin Tian
2026-11-27 15:58 ` netdev-bot+sashiko
2026-12-06 11:29 ` Xin Tian
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=79203797-ecb6-41e9-918b-01ad3d44a770@yunsilicon.com \
--to=tianx@yunsilicon.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=huangjunxian6@hisilicon.com \
--cc=jgg@ziepe.ca \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=weihg@yunsilicon.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
all inboxes | Powered by JetHome®