xsc: ADD Yunsilicon XSC Ethernet Driver
From: | Xin Tian <tianx-AT-yunsilicon.com> | |
To: | <netdev-AT-vger.kernel.org> | |
Subject: | [PATCH net-next v11 00/14] xsc: ADD Yunsilicon XSC Ethernet Driver | |
Date: | Wed, 23 Apr 2025 18:40:04 +0800 | |
Message-ID: | <20250423103923.2513425-1-tianx@yunsilicon.com> | |
Cc: | <leon-AT-kernel.org>, <andrew+netdev-AT-lunn.ch>, <kuba-AT-kernel.org>, <pabeni-AT-redhat.com>, <edumazet-AT-google.com>, <davem-AT-davemloft.net>, <jeff.johnson-AT-oss.qualcomm.com>, <przemyslaw.kitszel-AT-intel.com>, <weihg-AT-yunsilicon.com>, <wanry-AT-yunsilicon.com>, <jacky-AT-yunsilicon.com>, <horms-AT-kernel.org>, <parthiban.veerasooran-AT-microchip.com>, <masahiroy-AT-kernel.org>, <kalesh-anakkur.purayil-AT-broadcom.com>, <geert+renesas-AT-glider.be>, <pabeni-AT-redhat.com>, <geert-AT-linux-m68k.org> | |
Archive-link: | Article |
The patch series adds the xsc driver, which will support the YunSilicon MS/MC/MV series of network cards. These network cards offer support for high-speed Ethernet and RDMA networking, with speeds of up to 200Gbps. The Ethernet functionality is implemented by two modules. One is a PCI driver(xsc_pci), which provides PCIe configuration, CMDQ service (communication with firmware), interrupt handling, hardware resource management, and other services, while offering common interfaces for Ethernet and future InfiniBand drivers to utilize hardware resources. The other is an Ethernet driver(xsc_eth), which handles Ethernet interface configuration and data transmission/reception. - Patches 1-7 implement the PCI driver - Patches 8-14 implement the Ethernet driver This submission is the first phase, which includes the PF-based Ethernet transmit and receive functionality. Once this is merged, we will submit additional patches to implement support for other features, such as SR-IOV, ethtool support, and a new RDMA driver. Changes v10->v11 Link to v10: https://lore.kernel.org/netdev/20250411065246.2303550-1-t... - patches 09,10,11: Replace "((struct xsc_adapter *)xdev->eth_priv)->netdev" with helper xsc_dev_to_net_dev() (Jakub) - patches 11,13: Use page_pool api to manage dma mapping and unmapping on rx path (Jakub) Changes v9->v10 Link to v9: https://lore.kernel.org/netdev/20250318151449.1376756-1-t... - patch05: Remove GFP_ZERO from dma_alloc_coherent() (Jakub) - patch05: Add XSC_ prefix to all header guards (Jakub) - patch09: Replace ((struct xsc_adapter *)xdev->eth_priv)->netdev with a local variable (Jakub) - patches 02,09,11,12: Unify xsc_cmd_exec() return val: return -EIO for firmware errors. Return the actual ret code when using xsc_cmd_exec (Jakub) - patch09: Use ether_addr_copy() and eth_hw_addr_random() for MAC address handling (Jakub) - patch11: Fix incorrect entry_len calculation per RX channel (Simon) - patch12: Drop redundant adapter and adapter->xdev checks in xsc_eth_xmit_start() (Simon) - patch13: Remove XSC_SET/GET_PFLAG and other priv_flag-related code (Simon) - patch13: Initialize err to 0 in xsc_eth_post_rx_wqes() (Simon) - patch14: Return -ENOMEM if kvzalloc() for adapter->stats fails (Simon) Changes v8->v9: Link to v8: https://lore.kernel.org/netdev/20250307100824.555320-1-ti... - correct netdev feature settings in Patch09 (Paolo) - change sizes from int to unsigned int in Patch02 (Geert) - nit in Patch02: min_t->min, use upper_32_bits/lower_32_bits() (Simon) Changes v7->v8: Link to v7: https://lore.kernel.org/netdev/20250228154122.216053-1-ti... - add Kconfig NET_VENDOR_YUNSILICON depneds on COMPILE_TEST (Jakub) - rm unnecessary "default n" (Jakub) - select PAGE_POOL in ETH driver (Jakub) - simplify dma_mask set (Jakub) - del pci_state and pci_state_mutex (Kalesh) - I checked and droped intf_state and int_state_mutex too - del some no need lables in patch1 (Kalesh) - ensure consistent label naming throughout the patchset (Simon) - WARN_ONCE instead of meaningless comments (Simon) - Patch 7 add Reviewed-by from Leon Romanovsky, thanks Leon - nits Xin Tian (14): xsc: Add xsc driver basic framework xsc: Enable command queue xsc: Add hardware setup APIs xsc: Add qp and cq management xsc: Add eq and alloc xsc: Init pci irq xsc: Init auxiliary device xsc: Add ethernet interface xsc: Init net device xsc: Add eth needed qp and cq apis xsc: ndo_open and ndo_stop xsc: Add ndo_start_xmit xsc: Add eth reception data path xsc: add ndo_get_stats64 MAINTAINERS | 7 + drivers/net/ethernet/Kconfig | 1 + drivers/net/ethernet/Makefile | 1 + drivers/net/ethernet/yunsilicon/Kconfig | 26 + drivers/net/ethernet/yunsilicon/Makefile | 8 + .../yunsilicon/xsc/common/xsc_auto_hw.h | 94 + .../ethernet/yunsilicon/xsc/common/xsc_cmd.h | 630 ++++++ .../yunsilicon/xsc/common/xsc_cmd_api.h | 23 + .../ethernet/yunsilicon/xsc/common/xsc_cmdq.h | 234 ++ .../ethernet/yunsilicon/xsc/common/xsc_core.h | 498 +++++ .../yunsilicon/xsc/common/xsc_device.h | 77 + .../net/ethernet/yunsilicon/xsc/net/Kconfig | 17 + .../net/ethernet/yunsilicon/xsc/net/Makefile | 9 + .../net/ethernet/yunsilicon/xsc/net/main.c | 1980 +++++++++++++++++ .../net/ethernet/yunsilicon/xsc/net/xsc_eth.h | 60 + .../yunsilicon/xsc/net/xsc_eth_common.h | 199 ++ .../ethernet/yunsilicon/xsc/net/xsc_eth_rx.c | 555 +++++ .../yunsilicon/xsc/net/xsc_eth_stats.c | 46 + .../yunsilicon/xsc/net/xsc_eth_stats.h | 34 + .../ethernet/yunsilicon/xsc/net/xsc_eth_tx.c | 320 +++ .../yunsilicon/xsc/net/xsc_eth_txrx.c | 185 ++ .../yunsilicon/xsc/net/xsc_eth_txrx.h | 91 + .../ethernet/yunsilicon/xsc/net/xsc_eth_wq.c | 80 + .../ethernet/yunsilicon/xsc/net/xsc_eth_wq.h | 187 ++ .../net/ethernet/yunsilicon/xsc/net/xsc_pp.h | 38 + .../net/ethernet/yunsilicon/xsc/net/xsc_pph.h | 180 ++ .../ethernet/yunsilicon/xsc/net/xsc_queue.h | 197 ++ .../net/ethernet/yunsilicon/xsc/pci/Kconfig | 14 + .../net/ethernet/yunsilicon/xsc/pci/Makefile | 10 + .../net/ethernet/yunsilicon/xsc/pci/adev.c | 115 + .../net/ethernet/yunsilicon/xsc/pci/adev.h | 14 + .../net/ethernet/yunsilicon/xsc/pci/alloc.c | 234 ++ .../net/ethernet/yunsilicon/xsc/pci/alloc.h | 17 + .../net/ethernet/yunsilicon/xsc/pci/cmdq.c | 1502 +++++++++++++ drivers/net/ethernet/yunsilicon/xsc/pci/cq.c | 148 ++ drivers/net/ethernet/yunsilicon/xsc/pci/cq.h | 14 + drivers/net/ethernet/yunsilicon/xsc/pci/eq.c | 328 +++ drivers/net/ethernet/yunsilicon/xsc/pci/eq.h | 46 + drivers/net/ethernet/yunsilicon/xsc/pci/hw.c | 271 +++ drivers/net/ethernet/yunsilicon/xsc/pci/hw.h | 18 + .../net/ethernet/yunsilicon/xsc/pci/main.c | 326 +++ .../net/ethernet/yunsilicon/xsc/pci/pci_irq.c | 426 ++++ .../net/ethernet/yunsilicon/xsc/pci/pci_irq.h | 14 + drivers/net/ethernet/yunsilicon/xsc/pci/qp.c | 194 ++ drivers/net/ethernet/yunsilicon/xsc/pci/qp.h | 14 + .../net/ethernet/yunsilicon/xsc/pci/vport.c | 34 + 46 files changed, 9516 insertions(+) create mode 100644 drivers/net/ethernet/yunsilicon/Kconfig create mode 100644 drivers/net/ethernet/yunsilicon/Makefile create mode 100644 drivers/net/ethernet/yunsilicon/xsc/common/xsc_auto_hw.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/common/xsc_cmd.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/common/xsc_cmd_api.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/common/xsc_cmdq.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/common/xsc_core.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/common/xsc_device.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/Kconfig create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/Makefile create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/main.c create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_common.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_rx.c create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_stats.c create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_stats.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_tx.c create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_txrx.c create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_txrx.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_wq.c create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_eth_wq.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_pp.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_pph.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/net/xsc_queue.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/Kconfig create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/Makefile create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/adev.c create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/adev.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/alloc.c create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/alloc.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/cmdq.c create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/cq.c create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/cq.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/eq.c create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/eq.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/hw.c create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/hw.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/main.c create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/pci_irq.c create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/pci_irq.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/qp.c create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/qp.h create mode 100644 drivers/net/ethernet/yunsilicon/xsc/pci/vport.c -- 2.43.0