From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.127.231.35 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796550064; b=b15AO1IfG9H/kFurThYYCX+g6USH1RstPIdKPO3Q3muSiomh6lbHG2F8atmAdRxtgQ0I 95/DfrE0r2ZNMgD3ZeDajzGVBjPrEB9q/IildlfjzIy2qtdNGBZwPrL1FQBrpGqPuiH6W ewLMdIk06Id5qsZrpbRKAlqJZ0dNt9tKlzMk9ZNqOxoAm4UcVI+GNHW5J4KckuFDmQvEZ uV6hsI0k0+nrugLh3K7qoLKkEDITywsMHwKU20OY3UoynrJVob0l4aEM740chalEB4q8n 0RJA57O7QHVDNaOFlBQlc/xQ3Iyio0Q9qi5ADW5ak18F4WzISnUoJprvTQ+5EqxLfsw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796550064; h=DMARC-Filter:DKIM-Signature:Received:User-Agent:To:Mime-Version: X-Lms-Return-Path:Content-Type:Content-Transfer-Encoding:Date: Message-Id:In-Reply-To:References:Cc:From:Subject:X-Original-From; bh=01M6dYPJwx9M0WYpwWf7s6MTtZEWCveiF3RMXjsGH3o=; b=eN5qmnHNLxufa/C7yEKcEYtqweDpjrwSCUGX/ezS845753H3hlWCE47aKkJnt2DsDk/x +s4RUzUb5xQLIQCg56YuJycPOajyVgs5hnxGVpYjedvkqyYg7aa3Y9REdTxXYND+DjU31 flDPoXKxYIl+hUypPme6KO8cv5hRo/CmaCaWdoRRhrSiuKORo4Os30RTa9VOAT6lIT9zT 4WOB4lyL2AQkDxQSWr9QnuwLUucVPn2x74iKNmpJ/oHSJUqg9/8Iq0Elel9q1cd1TyJ2N XPoEgd8abMOSMqsE4MhPcvoo8QK4C7RaqCbPSiEA8pGBi25C21hHwAJC22QIAW2zhuQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=yunsilicon.com; spf=pass smtp.mailfrom=yunsilicon.com; dkim=pass header.d=yunsilicon.com header.i=@yunsilicon.com header.a=rsa-sha256 header.s=feishu2403070942 header.b=BsDLg4IS; arc=none smtp.remote-ip=209.127.231.35 Received: from va-2-35.ptr.blmpb.com (va-2-35.ptr.blmpb.com [209.127.231.35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAA7C606A324 for ; Sun, 6 Dec 2026 09:41:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AAA7C606A324 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=yunsilicon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yunsilicon.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=yunsilicon.com header.i=@yunsilicon.com header.a=rsa-sha256 header.s=feishu2403070942 header.b=BsDLg4IS DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2403070942; d=yunsilicon.com; t=1796550059; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=01M6dYPJwx9M0WYpwWf7s6MTtZEWCveiF3RMXjsGH3o=; b=BsDLg4IS2PNqZwxEpX1UfXBvU4dNpUVi/VVGMeo/cpKVwzw2HRZ8EfnRcoXfkRPy25YdeO X+6YtChGtY2JABoe+AWkryTF2fvWyYOZClsiw3kTOZM8adqALEYyprlK/JkgJVUDKc/R64 cdueulIeQHwCwZ3NPH1teaZTFhP/HKS5TILjAHtbqHka/9QRNFLfeH43wD1zTboP3MdpX1 bsgMzaydVXUHJCGNif9hJ39jBrKNl4pA0Jwb/7XcVTWhFhrpK3eX06cznOABlNjc+iS3WQ ZK/iTI8XAkYGgJibmS5f1AEUHJurCkn5UoosMPf5AObv7Y78mT7nhTgorY4cfA== Received: from [127.0.0.1] ([183.193.56.225]) by smtp.feishu.cn with ESMTPS; Sun, 06 Dec 2026 17:40:56 +0800 User-Agent: Mozilla Thunderbird To: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 X-Lms-Return-Path: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 6 Dec 2026 17:40:54 +0800 Message-Id: <6001d62a-9047-4885-ac94-4dc520f0e9fe@yunsilicon.com> In-Reply-To: <179579507899.3135.7831191822723271418@kernel.org> References: <20261126145730.70868-8-tianx@yunsilicon.com> <179579507899.3135.7831191822723271418@kernel.org> Cc: , , , , , , , , , , , , From: "Xin Tian" Subject: Re: [PATCH v2 07/11] net/xsc: add the ethernet netdev X-Original-From: Xin Tian On 11/27/2026 11:57 PM, netdev-bot+sashiko@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 5 potential > issue(s) to consider. > > Critical: 0 =C2=B7 High: 0 =C2=B7 Medium: 1 =C2=B7 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 patchwor= k > know by including "pw-bot: cr" as a separate line at the end of your repl= y > (one such reply per series is enough). > > - [Medium] At this commit, xsc_eth_probe() registers a netdev whose ops > table (xsc_netdev_ops in=E2=80=A6 > - [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=E2=80=A6 > - [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=E2= =80=A6 > > -- > > net/xsc: add the ethernet netdev > > This patch registers an ethernet auxiliary device from the xsc PCI core a= nd > adds an auxiliary driver that creates a netdev. The netdev queries the MA= C > address, sets the hardware MTU, and implements ndo_open/ndo_stop. The que= ue > and data path are left to follow-up patches. > >> diff --git a/drivers/net/ethernet/yunsilicon/xsc/net/Kconfig b/drivers/n= et/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_E= TH > selects it. Done, added to YUNSILICON_XSC_PCI. >> diff --git a/drivers/net/ethernet/yunsilicon/xsc/net/main.c b/drivers/ne= t/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 =3D { >> + .ndo_open =3D xsc_eth_open, >> + .ndo_stop =3D 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. netpol= l > 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 =3D xsc_eth_xmit, s= o > 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. Fixed: added a stub ndo_start_xmit that frees the skb and returns NETDEV_TX_OK, replaced by the real xmit in the TX patch. > [ ... ] > >> +static void xsc_eth_l2_addr_init(struct xsc_adapter *adapter) >> +{ >> + struct net_device *netdev =3D adapter->netdev; >> + char mac[6] =3D {0}; >> + int ret =3D 0; >> + >> + ret =3D 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 the= n > 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. Fixed: changed to u8 mac[ETH_ALEN] __aligned(2). > [ ... ] > >> diff --git a/drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_wq.h b/driv= ers/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 :=3D 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, an= d > the transmit and receive patches use the rest. > > Could these definitions move into the patches that first use them? Fixed by moving them into the TX/RX channel patch where their first users are. This patch now only carries the netdev essentials. > [ ... ] > >> diff --git a/drivers/net/ethernet/yunsilicon/xsc/pci/adev.c b/drivers/ne= t/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] =3D NULL; > [Severity: Low] > > Is this comment accurate? xsc_adev_add() is static, and its only caller i= s > 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 lik= e > 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 commi= t > 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. Cleaned up: dropped the wrong adev.c re-entry comment, the wrong remove-callback comment, and fixed the commit message (the MAC is only set via eth_hw_addr_set(), the MTU is what gets programmed).