🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23632

Re: [PATCH v2 07/11] net/xsc: add the ethernet netdev

#23632
From: netdev-bot+sashiko
Date: Fri, 27 Nov 2026 15:57
243 lines
15866 bytes
Thank you for your contribution! Sashiko AI review found 5 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 4

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] At this commit, xsc_eth_probe() registers a netdev whose ops
  table (xsc_netdev_ops in…
- [Low] This patch adds calls to the auxiliary bus API.
- [Low] At this commit, xsc_eth_wq.h declares xsc_eth_cqwq_create(),
  xsc_eth_wq_cyc_create(), xsc_eth_wq_destroy() and…
- [Low] Several comments do not match the code.
- [Low] xsc_eth_l2_addr_init()
  (drivers/net/ethernet/yunsilicon/xsc/net/main.c:156) declares `char…

--

net/xsc: add the ethernet netdev

This patch registers an ethernet auxiliary device from the xsc PCI core and
adds an auxiliary driver that creates a netdev. The netdev queries the MAC
address, sets the hardware MTU, and implements ndo_open/ndo_stop. The queue
and data path are left to follow-up patches.

> diff --git a/drivers/net/ethernet/yunsilicon/xsc/net/Kconfig b/drivers/net/ethernet/yunsilicon/xsc/net/Kconfig
> new file mode 100644
> index 0000000000000..7428b26295b66
> --- /dev/null
> +++ b/drivers/net/ethernet/yunsilicon/xsc/net/Kconfig
> @@ -0,0 +1,17 @@

[ ... ]

> +config YUNSILICON_XSC_ETH
> +	tristate "Yunsilicon XSC ethernet driver"
> +	depends on YUNSILICON_XSC_PCI
> +	depends on NET
> +	select PAGE_POOL

[Severity: Low]

Should this entry select AUXILIARY_BUS? xsc_eth uses
module_auxiliary_driver(). xsc_pci now builds adev.o, and xsc_adev_add()
in that file calls auxiliary_device_init() and auxiliary_device_add().

AUXILIARY_BUS is a bool with no prompt in drivers/base/Kconfig:

config AUXILIARY_BUS
	bool

auxiliary.o is only built under obj-$(CONFIG_AUXILIARY_BUS), and
include/linux/auxiliary_bus.h has no stubs for the disabled case.

If nothing else in the config selects AUXILIARY_BUS, won't the link or
modpost fail with undefined references to __auxiliary_device_add() and
__auxiliary_driver_register()?

At the end of the series, neither YUNSILICON_XSC_PCI nor YUNSILICON_XSC_ETH
selects it.

> diff --git a/drivers/net/ethernet/yunsilicon/xsc/net/main.c b/drivers/net/ethernet/yunsilicon/xsc/net/main.c
> new file mode 100644
> index 0000000000000..b9e75d7e14e78
> --- /dev/null
> +++ b/drivers/net/ethernet/yunsilicon/xsc/net/main.c
> @@ -0,0 +1,263 @@

[ ... ]

> +static const struct net_device_ops xsc_netdev_ops = {
> +	.ndo_open		= xsc_eth_open,
> +	.ndo_stop		= xsc_eth_close,
> +};

[Severity: Medium]

The commit message says the netdev "must not be brought up in this state".
Does anything enforce that?

xsc_netdev_ops has no ndo_start_xmit. xsc_eth_open() always returns 0, so
the interface can be brought up once xsc_eth_probe() has called
register_netdev().

Carrier stays off at this commit, so the qdisc path drops packets. netpoll
does not check carrier, though:

__netpoll_send_skb()
    if (!npinfo || !netif_running(dev) || !netif_device_present(dev)) {
    ...
    netpoll_start_xmit()
        netdev_start_xmit()
            ops->ndo_start_xmit()    <- NULL here

__netpoll_setup() only rejects IFF_DISABLE_NETPOLL devices. Can
configuring netconsole on this interface end in a NULL function pointer
call?

Later in the series, "net/xsc: report link state changes" adds
netif_carrier_on() while xsc_netdev_ops still has no ndo_start_xmit. At
that commit, a plain "ip link set up" with the link up seems to be enough
to hit this.

"net/xsc: add the transmit path" adds .ndo_start_xmit = xsc_eth_xmit, so
the end of the series is fine. The intermediate commits are still
bisectable, though.

Would a stub ndo_start_xmit that drops the skb work until the transmit
patch lands? Failing ndo_open with an error would be another option.

[ ... ]

> +static void xsc_eth_l2_addr_init(struct xsc_adapter *adapter)
> +{
> +	struct net_device *netdev = adapter->netdev;
> +	char mac[6] = {0};
> +	int ret = 0;
> +
> +	ret = xsc_eth_get_mac(adapter->xdev, mac);

[Severity: Low]

Is mac[] guaranteed to be u16 aligned here?

xsc_eth_get_mac() fills it with ether_addr_copy(mac, out->mac). It is then
passed to is_valid_ether_addr(), which calls is_zero_ether_addr().
include/linux/etherdevice.h documents that both need u16 alignment:

 * Please note: dst & src must both be aligned to u16.

A char[6] on the stack is only 1-byte aligned. Without
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS, could these become unaligned u16
accesses?

Would u8 mac[ETH_ALEN] __aligned(2), with xsc_eth_get_mac() taking a u8 *,
avoid this? The code is unchanged at the end of the series.

[ ... ]

> diff --git a/drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_wq.h b/drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_wq.h
> new file mode 100644
> index 0000000000000..35206ddf42f46
> --- /dev/null
> +++ b/drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_wq.h
> @@ -0,0 +1,150 @@

[ ... ]

> +u32 xsc_wq_cyc_get_size(struct xsc_wq_cyc *wq);
> +
> +int xsc_eth_cqwq_create(struct xsc_core_device *xdev,
> +			struct xsc_wq_param *param,
> +			u8 q_log_size,
> +			u8 ele_log_size,
> +			struct xsc_cqwq *wq,
> +			struct xsc_wq_ctrl *wq_ctrl);
> +
> +int xsc_eth_wq_cyc_create(struct xsc_core_device *xdev,
> +			  struct xsc_wq_param *param,
> +			  u8 q_log_size,
> +			  u8 ele_log_size,
> +			  struct xsc_wq_cyc *wq,
> +			  struct xsc_wq_ctrl *wq_ctrl);
> +void xsc_eth_wq_destroy(struct xsc_wq_ctrl *wq_ctrl);

[Severity: Low]

This isn't a bug, but these prototypes have no definitions at this commit.
The net Makefile only builds main.o:

xsc_eth-y := main.o

Several other items are also unused here:

  xsc_queue.h
  the queue parameter structs
  the CQE/WQE layouts
  XSC_INVALID_LKEY and XSC_QUEUE_TYPE_RAW*
  adapter->channel
  select PAGE_POOL

Nothing calls these functions, so this commit builds and links. Later in
the series, "net/xsc: add the single TX/RX channel" adds xsc_eth_wq.c, and
the transmit and receive patches use the rest.

Could these definitions move into the patches that first use them?

[ ... ]

> diff --git a/drivers/net/ethernet/yunsilicon/xsc/pci/adev.c b/drivers/net/ethernet/yunsilicon/xsc/pci/adev.c
> new file mode 100644
> index 0000000000000..3376ed10ba6ca
> --- /dev/null
> +++ b/drivers/net/ethernet/yunsilicon/xsc/pci/adev.c
> @@ -0,0 +1,133 @@

[ ... ]

> +static void xsc_adev_del(struct xsc_core_device *xdev, int idx)
> +{

[ ... ]

> +	/* Clear the slot before teardown: the driver's remove callback runs
> +	 * synchronously inside auxiliary_device_delete() and may re-enter
> +	 * xsc_adev_add() for this index.
> +	 */
> +	xdev->xsc_adev_list[idx] = NULL;

[Severity: Low]

Is this comment accurate? xsc_adev_add() is static, and its only caller is
xsc_adev_init(). xsc_adev_init() is only called from xsc_pci_init().

xsc_eth_remove() never calls back into the PCI layer. It doesn't look like
the remove callback can re-enter xsc_adev_add(). The comment is unchanged
at the end of the series.

A couple of other descriptions don't seem to match the code at this commit
either. xsc_eth_remove() has:

	/* Runs ndo_stop(), so the queues and the HCA are shut down first. */

xsc_eth_close() only clears adapter->opened, turns the carrier off and
sends XSC_PORT_DOWN. Queue and HCA teardown only arrive in later patches.

The commit message says:

  create the device, program the MAC address and MTU

xsc_eth_l2_addr_init() only queries the MAC with XSC_CMD_OP_QUERY_ETH_MAC
and calls eth_hw_addr_set(). Nothing is written to the device.

The commit message also doesn't mention that ndo_open sets the port admin
status to up.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126145711.70868-1-tianx%40yunsilicon.com
Technical Details
Message-ID: <179579507899.3135.7831191822723271418@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372831-linux-kernel-netdev=dewy.ru
References: <20261126145730.70868-8-tianx@yunsilicon.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372831-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v2 07/11] net/xsc: add the ethernet netdev
Date: Fri, 27 Nov 2026 15:57:58 +0000
Organization: Usenet Network
Message-ID: <179579507899.3135.7831191822723271418@kernel.org>
References: <20261126145730.70868-8-tianx@yunsilicon.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="766802"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:5hUcP0o4uAn/2uE6nyJC3DvoJq0= sha256:/CemYIgpHyBcbnrtazog8BXrsPqd40fRySe/wumMckQ= sha1:vev3A5rUKGX4VswEnt+v14wvO7A= sha256:bSo2KIE1HNH3+bBJtQYip6NjlZMe53pzTT0NA/3P7hk=
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 640D5125F63; Fri, 27 Nov 2026 18:58:49 +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 WQaw4xOpfEt6; Fri, 27 Nov 2026 18:58:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-372831-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 646C9125F5E; Fri, 27 Nov 2026 18:58:37 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id F077E26488; Fri, 27 Nov 2026 15:58:34 +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=1795795091; b=2TAan/pnURSiNS7Qjqp/EZok73Kfq4o8c5ZJJdGlYviFQmAZYp9Kt6VhkWq6MoKMm9c8 I8/NqjVcdyqe6KWe/TYQCTcxeyhU1WZyf1wmJ89w8AYdEQhb6reyE1FUEqBoLS13dXFns s240vK/WchzrHLDyPJc6UQIJJyocoO/3M3bur08eERlpaY4ymAiPNM55R04aN4wOaPDF6 OIMm9UaKy690smxSOGKofQ09Li41TYHIId2DGYOKrwz5kz0I2gqQ0j6usXmL5eRKH2Mpf DIkf6tWY7Zu3Uw9xqV1giTkhW6V773q889nYkSiiN29k97bbNA5VuLy8JZQP2HyklLA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795795091; 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=+OsaqsCkNdK9D8OyjJZhYRSnDVykyRA4x+r6AKpq0wk=; b=1T5mKOoY+B5sHbZ/144F+75gbUC4PqVcF3ChGUtcmDYyMo/ztNPo9TQ8SC0duPsiTMoE DNeX0LrNe8wjC+a67Acri7SynVlzCystw39AgHwqlo93qFusRxVLpfp3wZtVl8+sFgyQm g9akhOnur0AZckJYucri9o34HMGpJ3QNS1XBBjsop4cS0REb07mWTUMHMM69nwPwNmFbP 6RentMLMlqHVN471CnhJlFuy8RGKJjb4huCT8VjLaKThJKb7mzBY0gl51r1VDogaU/ENV IAGXLCDdNbJ44Nm7LsX+YrZS6cYJ9waItU99Er20YXlUh84LQeZsWXEN4hw7Rmkhn3g==
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=QGl5RZKP; 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 9511E60A3816; Fri, 27 Nov 2026 15:58:11 +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=QGl5RZKP
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=1795795080; b=KTORLsLZe9NS1X33i70oUmyfdIonhLdyXmbG7l5ACmPnDH2ufgNSsribRDcvEnXP9lMh z4uNzgf3f2cGYOf219l8w1W7FHosDnYn9ngROKETAFSkEQj13VabDyezuCK72UxiE2hI9 34SNVbHlGRccOIETTLdE9KtxaysnzqWKlOGQuo/8QbQdOu5V/pWU6Du3e1dkFgOPSZEQs tmgS17XsGCYwmDkgYT7G0XbH9RJN/rr6r4XwAeHDxufxM6fNUB3uAthkOjYxf/W2OnqjB 8PHU/EJbtBRBBI1Zyi2fAZEvafKfU6dMb1E8jP3qL5r0xsV8asbRQAK+JW1EUVBEciA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795795080; 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=+OsaqsCkNdK9D8OyjJZhYRSnDVykyRA4x+r6AKpq0wk=; b=mpAnIM8zfW4gsj0mJWdwN7s5CgaqxFn/OA9I8lnU0VhZ/tdsclCgVaeIvVW0k7E5nQOy 7O5B+HuFeBn41hmvvdLTJMBHSlTK6GFwaX0ND73CvB/fMW+VKjo5WsDvGiOscyHw48cjL 15pgKFhU1aPDXT6KSGkBSGsIq8Fpndt70MCI7pDuTT0g50sntcIZLyAAW/paLaCdHmwgX 7ENXCvUMntJ+8Meg5s11aVUUe65fHAciSGbntTMKeGXhFUkE3DGRKacHD1+9T8KBLbHZc nqgN3A1qsSHkst4pwwd5vU/RUIHp1f0cZNdQEzLd3jGRHcQafkH6yFUgEP1FICTVnFw==
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=QGl5RZKP; 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 B329E606A69B; Fri, 27 Nov 2026 15:58:00 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 741181F00A21; Fri, 27 Nov 2026 15:57:59 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795795080; bh=+OsaqsCkNdK9D8OyjJZhYRSnDVykyRA4x+r6AKpq0wk=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=QGl5RZKPp3CqfzSCKUEx27+hGxnSyeqhLXDG3IkFsoM3N0uM4ltV/sYYQECiAnpN3 H6RjcAol9UcH+jyHiQhpv5W+Vb01woTiVgrNeFlBlAQwBY4YRB1dLN8dobqybHaY1P KGuWNqopWDnBPZJsCwGEP/k2rGNpZPRPcT5YCIofjnlaHOv0j+Tr2msQbpftr2jCmp Hx2bIDjLwTmCWMn6KUHJBKfiJ9LXv6Dg4mUEA/KjQlQU2kmhgwoHN0M9b2kXTz8DL1 ANhsgm6+M7K3KnSOjSkfqn9kDotMioQxy3sxd39hLEULQlBZ/lgvBe0cqDwDQBRiED bHZ3rzRuDiYqg==
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: <20261126145730.70868-8-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