Article View: linux.kernel.netdev
Article #23626Re: [PATCH v2 02/11] net/xsc: add doorbell and cmdq MMIO accessors
From: netdev-bot+sashiko
Date: Fri, 27 Nov 2026 15:57
Date: Fri, 27 Nov 2026 15:57
147 lines
13284 bytes
13284 bytes
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.
[ ... ]
> +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?
[ ... ]
> +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?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126145711.70868-1-tianx%40yunsilicon.com
Technical Details
Message-ID:
<179579507051.3135.14726043842081189942@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372826-linux-kernel-netdev=dewy.ruReferences:
<20261126145715.70868-3-tianx@yunsilicon.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372826-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH v2 02/11] net/xsc: add doorbell and cmdq MMIO accessors Date: Fri, 27 Nov 2026 15:57:50 +0000 Organization: Usenet Network Message-ID: <179579507051.3135.14726043842081189942@kernel.org> References: <20261126145715.70868-3-tianx@yunsilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="766472"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:asa4lAlGzTzX1Se0RnLCqeF0Pmk= sha256:Rg9E130dvY/+atk1bwxaO55HabaiDW7BrfDz9eKLREU= sha1:1nzzAZTBXtrdeC8ax40z6XqXqpA= sha256:Dm8VFPCydJK2zbC1WuA2A5hbdATI8Mgr9GJtx/+nyJg= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 165FC125F65; Fri, 27 Nov 2026 18:58:27 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Si1jpSrXjYxx; Fri, 27 Nov 2026 18:58:23 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-372826-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 39AD3125F5E; Fri, 27 Nov 2026 18:58:15 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 59AEB3BD40; Fri, 27 Nov 2026 15:58:00 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795795078; b=W6uHbmSDz9tnyMSIo+QjALTdIQ38XSWnwXUzHcIpw6qCkD55EwwsV/TaEieVkEKeRZsv NCN5FoAQPZjlUaAn7jfHCTd16dKJfxlQsuiUEdf+xVxdmYcP/hOQWq4COI3YUftPkYbRk pwfnhHs2mts7p7UE5tVBIgYCItViUlXmEa5ByJOACdtrXK14mMyGFAfrL9jWZG2bI6eVN aS6YLRIvKZvx/WjFgyOq7UPPZr1QK3leaYVs0pbZb0QiuZvZoCyYiGyy+VfMpC5EJbk9H OUcRTY+I5xLN+IAcgLJOmtpkNaEmcu+5ZIN3bzO4tzlhBw8p+ZQTiscQrOL4II1w/pQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795795078; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=K6q75vYgcwJtpJbOOJpD4SrFC6bX8iiseg0lw4gxjSo=; b=cUtT4ebtlSJXL8qAnbJpi3q5gD3tcU8NG5JJEFnhlL+fq0/ReUvRvGV6bNK+JWkY62gi feWYmY9cvqDDyL2PgivMoBmi6Qz7QI9LYI6bE9XvULr4XlFJMHunhr0Mk0vG/1CvpgNbZ RqvI5AeenSVBJO2WsCIbvfbQLOa1O6fhJeFT5R88GQr87PxEmFtzL4Ou23kcCW+2bZEQT FRsxcFgVHUm2CATro7EVml+IfRRV/vWEaFcuLWv5OJa6M+JxFNl9mKNCojvJ7iFROHMvm KBNMxtTs84ndsjEss+7Q3oFav5w1HSC6uNJ7YuO7K6UIw3xPdJlXEGEq9v7YIswezHg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LoIqQRyB; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D932606A69F; Fri, 27 Nov 2026 15:57:58 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LoIqQRyB X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795795072; b=qMsufbrqxGXcif4bMBgbXAVMHpHH0s4WwUAVSU0bD4fU86ZFFpeReZt6oa371aco46pa PR9KUgO0sdUyl+39kcSVeXpTt8JYQMAXr2rDVutdlyY2KbZFeAkRnSJUEq8cBWqueaU0/ HAyiDuAxnIgepTHrti3KPsVAcWFQ/QnKUzWhlUSsYtntY4zQ5h3I5yi8Wqjqtwv/D1Li+ iTvMZ/Tt4rrdN3AOMgzirtBk9NGtaQaONvUnyHfCrXCvE8HhpSqRlhex1mHbLyy7nNaBW oUpNmWzzQuj6KS2Vazt6qqUHAxkK6pqWlaXecxT1zTkXyFRqMlD98kw7VbsLqe0xxAw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795795072; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=K6q75vYgcwJtpJbOOJpD4SrFC6bX8iiseg0lw4gxjSo=; b=ArqAeUYd/QVOmAwGaHQvKoJly+1/WRXpikWpk8HX6yUMNYGmXhbizy/vTcjS+vtwHVEj WNgHyr3ax/qYFB6/3B6yxUxxZ1qjB95a4QIAiRXqIlUVUOIwUIHrvPQPwjncq/P7JIQwW kuslubhZpa/Jk/RaT3H5htuhdqyUvOvHDp/DuJPUZmEEBbw0dXMwExSS7pYx4Imp1Vm4S uDu4167dWV4O+Eb5RAwwSe3QQcdEHNzDOxfxGUVIxuhsZcrHoFe26jPxBpVPW24jiNCSt F9/AhLVm/tRqcYdYbLXRMDjj8mpIS1GHFFlpPlbpnp/C7Hlc3AkpVHDE8c5j7RbI7ag== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LoIqQRyB; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A56F606A31E; Fri, 27 Nov 2026 15:57:51 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F20B71F0089A; Fri, 27 Nov 2026 15:57:50 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795795071; bh=K6q75vYgcwJtpJbOOJpD4SrFC6bX8iiseg0lw4gxjSo=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=LoIqQRyBfa698WOSTCA+56eK/O9LUgmZXzI5folrOq/M+JWs/mhjeaXFbjuP/JfwS 1Is3upfc9XGM70v5EIiGKpAyj5sCAy4eWnr2GKNHD7ytabwKYyrkEsv+xvae/+9pVl BM4HEHkXiwd/T6R4K4aXceegIKYJ/4drcJfU04GvZzedNrai6zxzzi/XjvCO2r6fO1 nLUzeZFMaNLxOM/aFao8DqR/0gzmmvVOwAcy53e08SCWfQTtnk68wQjhFwhbrzktKs tZV/vb15VruO7xtpHhoL8ZkPQI6d+REb8LOrCotvRS1qESY8wza2S9eDKNsGNv5Nh0 eoRjbjbGRO/UA== X-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 X-In-Reply-To: <20261126145715.70868-3-tianx@yunsilicon.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list