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 07/11] net/xsc: add the ethernet netdev
Date: Sun, 6 Dec 2026 17:40:54 +0800 [thread overview]
Message-ID: <6001d62a-9047-4885-ac94-4dc520f0e9fe@yunsilicon.com> (raw)
In-Reply-To: <179579507899.3135.7831191822723271418@kernel.org>
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 · 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.
Done, added to YUNSILICON_XSC_PCI.
>> 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.
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 = 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.
Fixed: changed to u8 mac[ETH_ALEN] __aligned(2).
> [ ... ]
>
>> 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?
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/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.
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).
next prev parent reply other threads:[~2026-12-06 9:41 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
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 [this message]
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=6001d62a-9047-4885-ac94-4dc520f0e9fe@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®