nbl driver for Nebulamatrix NICs
Subsystems (4)
illusion.wang
maintainerv2 cover nbl driver for Nebulamatrix NICs
The patch series add the nbl driver, which will support nebula-matrix 18100 and 18110 series of network cards.
This submission is the first phase. which includes the PF-based and VF-based Ethernet transmit and receive functionality. Once this is merged. will submit addition patches to implement support for other features. such as ethtool support, debugfs support and etc.
Changes v1->v2
Link to v1: https://lore.kernel.org/netdev/[email protected]/
1.Format Issues and Compilation Issues
- Paolo Abeni
2.add sysfs patch and drop coexisting patch
- Andrew Lunn
3.delete some unimportant ndo operations
4.add machine generated headers patch
5.Modify the issues found in patch1-2 and apply the same fixes to other
patches
6.modify issues found by nipa
illusion.wang (15):
net/nebula-matrix: add minimum nbl build framework net/nebula-matrix: add simple probe/remove net/nebula-matrix: add HW layer definitions and implementation net/nebula-matrix: add machine-generated headers and chip definitions net/nebula-matrix: add channel layer definitions and implementation net/nebula-matrix: add resource layer definitions and implementation net/nebula-matrix: add intr resource definitions and implementation net/nebula-matrix: add vsi, queue, adminq resource definitions and
implementation
net/nebula-matrix: add flow resource definitions and implementation net/nebula-matrix: add txrx resource definitions and implementation net/nebula-matrix: add Dispatch layer definitions and implementation net/nebula-matrix: add Service layer definitions and implementation net/nebula-matrix: add Dev init,remove operation net/nebula-matrix: add Dev start, stop operation net/nebula-matrix: add st_sysfs and vf name sysfs
.../ethernet/nebula-matrix/m18100.rst | 52 + MAINTAINERS | 10 + drivers/net/ethernet/Kconfig | 1 + drivers/net/ethernet/Makefile | 1 + drivers/net/ethernet/nebula-matrix/Kconfig | 39 + drivers/net/ethernet/nebula-matrix/Makefile | 6 + .../net/ethernet/nebula-matrix/nbl/Makefile | 29 + .../nbl/nbl_channel/nbl_channel.c | 1482 ++++++ .../nbl/nbl_channel/nbl_channel.h | 205 + .../nebula-matrix/nbl/nbl_common/nbl_common.c | 784 +++ .../nebula-matrix/nbl/nbl_common/nbl_common.h | 54 + .../net/ethernet/nebula-matrix/nbl/nbl_core.h | 144 + .../nebula-matrix/nbl/nbl_core/nbl_dev.c | 3194 ++++++++++++ .../nebula-matrix/nbl/nbl_core/nbl_dev.h | 270 ++ .../nebula-matrix/nbl/nbl_core/nbl_dispatch.c | 4265 +++++++++++++++++ .../nebula-matrix/nbl/nbl_core/nbl_dispatch.h | 78 + .../nebula-matrix/nbl/nbl_core/nbl_service.c | 3804 +++++++++++++++ .../nebula-matrix/nbl/nbl_core/nbl_service.h | 240 + .../nebula-matrix/nbl/nbl_core/nbl_sysfs.c | 85 + .../nebula-matrix/nbl/nbl_core/nbl_sysfs.h | 20 + .../nebula-matrix/nbl/nbl_hw/nbl_adminq.c | 1446 ++++++ .../nebula-matrix/nbl/nbl_hw/nbl_adminq.h | 160 + .../nebula-matrix/nbl/nbl_hw/nbl_hw.h | 172 + .../nbl_hw/nbl_hw_leonis/base/nbl_datapath.h | 11 + .../nbl_hw_leonis/base/nbl_datapath_dped.h | 2152 +++++++++ .../nbl_hw_leonis/base/nbl_datapath_dstore.h | 929 ++++ .../nbl_hw_leonis/base/nbl_datapath_ucar.h | 414 ++ .../nbl/nbl_hw/nbl_hw_leonis/base/nbl_ppe.h | 10 + .../nbl_hw/nbl_hw_leonis/base/nbl_ppe_epro.h | 665 +++ .../nbl_hw/nbl_hw_leonis/base/nbl_ppe_ipro.h | 1397 ++++++ .../nbl_hw/nbl_hw_leonis/nbl_flow_leonis.c | 2268 +++++++++ .../nbl_hw/nbl_hw_leonis/nbl_flow_leonis.h | 204 + .../nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c | 3186 ++++++++++++ .../nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.h | 1714 +++++++ .../nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.c | 3863 +++++++++++++++ .../nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.h | 12 + .../nbl_hw/nbl_hw_leonis/nbl_queue_leonis.c | 1430 ++++++ .../nbl_hw/nbl_hw_leonis/nbl_queue_leonis.h | 23 + .../nbl_hw_leonis/nbl_resource_leonis.c | 1067 +++++ .../nbl_hw_leonis/nbl_resource_leonis.h | 28 + .../nebula-matrix/nbl/nbl_hw/nbl_hw_reg.h | 156 + .../nebula-matrix/nbl/nbl_hw/nbl_interrupt.c | 448 ++ .../nebula-matrix/nbl/nbl_hw/nbl_interrupt.h | 13 + .../nebula-matrix/nbl/nbl_hw/nbl_queue.c | 60 + .../nebula-matrix/nbl/nbl_hw/nbl_queue.h | 11 + .../nebula-matrix/nbl/nbl_hw/nbl_resource.c | 444 ++ .../nebula-matrix/nbl/nbl_hw/nbl_resource.h | 878 ++++ .../nebula-matrix/nbl/nbl_hw/nbl_txrx.c | 2150 +++++++++ .../nebula-matrix/nbl/nbl_hw/nbl_txrx.h | 184 + .../nebula-matrix/nbl/nbl_hw/nbl_vsi.c | 168 + .../nebula-matrix/nbl/nbl_hw/nbl_vsi.h | 12 + .../nbl/nbl_include/nbl_def_channel.h | 715 +++ .../nbl/nbl_include/nbl_def_common.h | 410 ++ .../nbl/nbl_include/nbl_def_dev.h | 32 + .../nbl/nbl_include/nbl_def_dispatch.h | 190 + .../nbl/nbl_include/nbl_def_hw.h | 157 + .../nbl/nbl_include/nbl_def_resource.h | 183 + .../nbl/nbl_include/nbl_def_service.h | 156 + .../nbl/nbl_include/nbl_include.h | 542 +++ .../nbl/nbl_include/nbl_product_base.h | 20 + .../net/ethernet/nebula-matrix/nbl/nbl_main.c | 435 ++ 61 files changed, 43278 insertions(+) create mode 100644 Documentation/networking/device_drivers/ethernet/nebula-matrix/m18100.rst create mode 100644 drivers/net/ethernet/nebula-matrix/Kconfig create mode 100644 drivers/net/ethernet/nebula-matrix/Makefile create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/Makefile create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_channel/nbl_channel.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_channel/nbl_channel.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_common/nbl_common.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_common/nbl_common.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dispatch.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dispatch.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_service.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_service.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_sysfs.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_sysfs.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_adminq.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_adminq.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_datapath.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_datapath_dped.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_datapath_dstore.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_datapath_ucar.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_ppe.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_ppe_epro.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_ppe_ipro.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_flow_leonis.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_flow_leonis.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_queue_leonis.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_queue_leonis.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_reg.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_interrupt.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_interrupt.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_queue.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_queue.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_txrx.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_txrx.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_vsi.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_vsi.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_channel.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_common.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_dev.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_dispatch.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_hw.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_resource.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_service.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_include.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_product_base.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c
Signature · 1 line
2.47.3
illusion.wang
maintainerPATCH v2 1/15 net/nebula-matrix: add minimum nbl build framework
1.Add nbl min build infrastructure for nbl driver. 2.Implemented the framework of pci device initialization.
--- .../ethernet/nebula-matrix/m18100.rst | 52 ++++++++ MAINTAINERS | 10 ++ drivers/net/ethernet/Kconfig | 1 + drivers/net/ethernet/Makefile | 1 + drivers/net/ethernet/nebula-matrix/Kconfig | 39 ++++++ drivers/net/ethernet/nebula-matrix/Makefile | 6 + .../net/ethernet/nebula-matrix/nbl/Makefile | 11 ++ .../net/ethernet/nebula-matrix/nbl/nbl_core.h | 29 +++++ .../nbl/nbl_include/nbl_include.h | 24 ++++ .../net/ethernet/nebula-matrix/nbl/nbl_main.c | 117 ++++++++++++++++++ 10 files changed, 290 insertions(+) create mode 100644 Documentation/networking/device_drivers/ethernet/nebula-matrix/m18100.rst create mode 100644 drivers/net/ethernet/nebula-matrix/Kconfig create mode 100644 drivers/net/ethernet/nebula-matrix/Makefile create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/Makefile create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_include.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c
Documentation/networking/device_drivers/ethernet/nebula-matrix/m18100.rst new file +52 -0
@@ -0,0 +1,52 @@ +.. SPDX-License-Identifier: GPL-2.0 + +============================================================ +Linux Base Driver for Nebula-matrix M18100-NIC family +============================================================ + +Overview: +========= +M18100-NIC is a series of network interface card for the Data Center Area. + +The driver supports link-speed 100GbE/25GE/10GE. + +M18100-NIC devices support SR-IOV. This driver is used for both of Physical +Function(PF) and Virtual Function(VF). + +M18100-NIC devices support MSI-X interrupt vector for each Tx/Rx queue and +interrupt moderation. + +M18100-NIC devices support also various offload features such as checksum offload, +Receive-Side Scaling(RSS). + + +Supported PCI vendor ID/device IDs: +=================================== + +1f0f:3403 - M18110 Family PF +1f0f:3404 - M18110 Lx Family PF +1f0f:3405 - M18110 Family BASE-T PF +1f0f:3406 - M18110 Lx Family BASE-T PF +1f0f:3407 - M18110 Family OCP PF +1f0f:3408 - M18110 Lx Family OCP PF +1f0f:3409 - M18110 Family BASE-T OCP PF +1f0f:340a - M18110 Lx Family BASE-T OCP PF +1f0f:340b - M18100 Family PF +1f0f:340c - M18100 Lx Family PF +1f0f:340d - M18100 Family BASE-T PF +1f0f:340e - M18100 Lx Family BASE-T PF +1f0f:340f - M18100 Family OCP PF +1f0f:3410 - M18100 Lx Family OCP PF +1f0f:3411 - M18100 Family BASE-T OCP PF +1f0f:3412 - M18100 Lx Family BASE-T OCP PF +1f0f:3413 - M18100 Family Virtual Function + +Support +======= + +For more information about M18100-NIC, please visit the following URL: +https://www.nebula-matrix.com/ + +If an issue is identified with the released source code on the supported kernel +with a supported adapter, email the specific information related to the issue to [email protected].
MAINTAINERS +10 -0
@@ -18003,6 +18003,16 @@ F: Documentation/devicetree/bindings/hwmon/nuvoton,nct7363.yaml F: Documentation/hwmon/nct7363.rst F: drivers/hwmon/nct7363.c +NEBULA-MATRIX ETHERNET DRIVER (nebula-matrix) +M: llusion.Wang <[email protected]> +M: Dimon.Zhao <[email protected]> +M: Alvin.Wang <[email protected]> +M: Sam Chen <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/networking/device_drivers/ethernet/nebula-matrix/* +F: drivers/net/ethernet/nebula-matrix/ + NETCONSOLE M: Breno Leitao <[email protected]> S: Maintained
drivers/net/ethernet/Kconfig +1 -0
@@ -143,6 +143,7 @@ config FEALNX source "drivers/net/ethernet/ni/Kconfig" source "drivers/net/ethernet/natsemi/Kconfig" +source "drivers/net/ethernet/nebula-matrix/Kconfig" source "drivers/net/ethernet/neterion/Kconfig" source "drivers/net/ethernet/netronome/Kconfig" source "drivers/net/ethernet/8390/Kconfig"
drivers/net/ethernet/Makefile +1 -0
@@ -69,6 +69,7 @@ obj-$(CONFIG_NET_VENDOR_MUCSE) += mucse/ obj-$(CONFIG_NET_VENDOR_MYRI) += myricom/ obj-$(CONFIG_FEALNX) += fealnx.o obj-$(CONFIG_NET_VENDOR_NATSEMI) += natsemi/ +obj-$(CONFIG_NET_VENDOR_NEBULA_MATRIX) += nebula-matrix/ obj-$(CONFIG_NET_VENDOR_NETERION) += neterion/ obj-$(CONFIG_NET_VENDOR_NETRONOME) += netronome/ obj-$(CONFIG_NET_VENDOR_NI) += ni/
drivers/net/ethernet/nebula-matrix/Kconfig new file +39 -0
@@ -0,0 +1,39 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Nebula-matrix network device configuration +# + +config NET_VENDOR_NEBULA_MATRIX + bool "Nebula-matrix devices" + default y + help + If you have a network (Ethernet) card belonging to this class, say Y. + + Note that the answer to this question doesn't directly affect the + kernel: saying N will just cause the configurator to skip all + the questions about Nebula-matrix cards. If you say Y, you will be + asked for your specific card in the following questions. + +if NET_VENDOR_NEBULA_MATRIX + +config NBL_CORE + tristate "Nebula-matrix Ethernet Controller m18110 Family support" + depends on PCI && VFIO + depends on ARM64 || X86_64 + default m + select PLDMFW + select PAGE_POOL + help + This driver supports Nebula-matrix Ethernet Controller m18110 Family of + devices. For more information about this product, go to the product + description with smart NIC: + + <http://www.nebula-matrix.com> + + More specific information on configuring the driver is in + <file:Documentation/networking/device_drivers/ethernet/nebula-matrix/m18110.rst>. + + To compile this driver as a module, choose M here. The module + will be called nbl_core. + +endif # NET_VENDOR_NEBULA_MATRIX
drivers/net/ethernet/nebula-matrix/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for the Nebula-matrix network device drivers. +# + +obj-$(CONFIG_NBL_CORE) += nbl/
drivers/net/ethernet/nebula-matrix/nbl/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2025 Nebula Matrix Limited. +# Author: + +obj-$(CONFIG_NBL_CORE) := nbl_core.o + +nbl_core-objs += nbl_main.o + +# Provide include files +ccflags-y += -I$(srctree)/drivers/net/ethernet/nebula-matrix/nbl/nbl_include/ +ccflags-y += -I$(srctree)/drivers/net/ethernet/nebula-matrix/nbl/
drivers/net/ethernet/nebula-matrix/nbl/nbl_core.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0*/ +/* +* Copyright (c) 2025 Nebula Matrix Limited. +* Author: +*/ + +#ifndef _NBL_CORE_H_ +#define _NBL_CORE_H_ + +#include <linux/pci.h> +#include "nbl_include.h" +#define NBL_CAP_TEST_BIT (val, loc) (((val) >> (loc)) & 0x1) + +#define NBL_CAP_IS_CTRL (val) NBL_CAP_TEST_BIT(val, NBL_CAP_HAS_CTRL_BIT) +#define NBL_CAP_IS_NET (val) NBL_CAP_TEST_BIT(val, NBL_CAP_HAS_NET_BIT) +#define NBL_CAP_IS_VF (val) NBL_CAP_TEST_BIT(val, NBL_CAP_IS_VF_BIT) +#define NBL_CAP_IS_NIC (val) NBL_CAP_TEST_BIT(val, NBL_CAP_IS_NIC_BIT) +#define NBL_CAP_IS_OCP (val) NBL_CAP_TEST_BIT(val, NBL_CAP_IS_OCP_BIT) +#define NBL_CAP_IS_LEONIS (val) NBL_CAP_TEST_BIT(val, NBL_CAP_IS_LEONIS_BIT) + +enum { +NBL_CAP_HAS_CTRL_BIT =0 , +NBL_CAP_HAS_NET_BIT , +NBL_CAP_IS_VF_BIT , +NBL_CAP_IS_NIC_BIT , +NBL_CAP_IS_LEONIS_BIT , +NBL_CAP_IS_OCP_BIT , +}; +#endif
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_include.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0*/ +/* +* Copyright (c) 2025 Nebula Matrix Limited. +* Author: +*/ + +#ifndef _NBL_INCLUDE_H_ +#define _NBL_INCLUDE_H_ + +#include <linux/types.h> + +/* ------ Basic definitions ------- */ +#define NBL_DRIVER_NAME "nbl_core" + +struct nbl_func_caps { +u32 has_ctrl:1 ; +u32 has_net:1 ; +u32 is_vf:1 ; +u32 is_nic:1 ; +u32 is_ocp:1 ; +u32 rsv:27 ; +}; + +#endif
drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c new file +117 -0
117 lines not on this page · raw message
Signature · 1 line
2.47.3
illusion.wang
maintainerPATCH v2 2/15 net/nebula-matrix: add simple probe/remove
In reply to illusion.wangOur driver architecture is relatively complex because the code is highly reusable and designed to support multiple features. Additionally, the codebase supports multiple chip variants, each with distinct hardware-software interactions.
To ensure compatibility, our architecture is divided into the following layers:
1. Dev Layer (Device Layer)
The top-level business logic layer where all operations are device-centric. Every operation is performed relative to the device context. The intergration of base functions encompasses:management(ctrl_dev), network(net_dev), common.
2. Service Layer
The Service layer includes various netops services such as packet receiving/sending, ethtool services, management services, etc. These are provided to the upper layer for use or registered as the operations(ops) of related devices.
It describes all the service capabilities possessed by the device.
3. Dispatch Layer
The distribution from services to specific data operations is mainly divided into two types: direct pass-through and handling by the management PF. It shields the upper layer from the differences in specific underlying locations.
It describes the processing locations and paths of the services.
4. Resource Layer
Handles tasks dispatched from Dispatch Layer. These tasks fall into two categories:
4.1 Hardware control
The Resource Layer further invokes the HW Layer when hardware access is needed, as only the HW Layer has OS-level privileges.
4.2 Software resource management
Operations like packet statistics collection that don't require hardware access.
5. HW Layer (Hardware Layer)
Serves the Resource Layer by interacting with different hardware chipsets.Writes to hardware registers to drive the hardware based on Resource Layer directives.
6. Channel Layer
Handle communication between PF0 and other PF(Our PF0 has ctrl func) /PF and VF , as well as communication with the EMP (Embedded Management Processor),and provide basic interaction channels.
7. Common Layer
Provides fundamental services, including Workqueue management, debug logging, and so on
--- .../net/ethernet/nebula-matrix/nbl/nbl_core.h | 27 +++- .../nbl/nbl_include/nbl_def_common.h | 108 ++++++++++++++ .../nbl/nbl_include/nbl_include.h | 13 +- .../nbl/nbl_include/nbl_product_base.h | 20 +++ .../net/ethernet/nebula-matrix/nbl/nbl_main.c | 138 ++++++++++++++++++ 5 files changed, 304 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_common.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_product_base.h
drivers/net/ethernet/nebula-matrix/nbl/nbl_core.h +26 -1
@@ -8,7 +8,13 @@#define _NBL_CORE_H_#include <linux/pci.h> -#include "nbl_include.h" +#include "nbl_product_base.h" +#include "nbl_def_common.h" + +#define NBL_ADAP_TO_PDEV (adapter) ((adapter)->pdev) +#define NBL_ADAP_TO_DEV (adapter) (&((adapter)->pdev->dev)) +#define NBL_ADAP_TO_COMMON (adapter) (&((adapter)->common)) +#define NBL_ADAP_TO_RPDUCT_BASE_OPS (adapter) ((adapter)->product_base_ops)#define NBL_CAP_TEST_BIT (val, loc) (((val) >> (loc)) & 0x1)#define NBL_CAP_IS_CTRL (val) NBL_CAP_TEST_BIT(val, NBL_CAP_HAS_CTRL_BIT)
@@ -26,4 +32,23 @@ enum {NBL_CAP_IS_LEONIS_BIT , NBL_CAP_IS_OCP_BIT, }; + +struct nbl_interface { +}; + +struct nbl_core { +}; + +struct nbl_adapter { +struct pci_dev *pdev; +struct nbl_core core; +struct nbl_interface intf; +struct nbl_common_info common; +struct nbl_product_base_ops *product_base_ops; +struct nbl_init_param init_param; +}; + +struct nbl_adapter *nbl_core_init (struct pci_dev *pdev, +struct nbl_init_param *param); +void nbl_core_remove (struct nbl_adapter *adapter);#endif
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_common.h new file +108 -0
108 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_include.h +12 -1
@@ -8,10 +8,15 @@#define _NBL_INCLUDE_H_#include <linux/types.h> - +#include <linux/netdevice.h> /* ------ Basic definitions ------- */ #define NBL_DRIVER_NAME "nbl_core" +enum nbl_product_type { +NBL_LEONIS_TYPE , +NBL_PRODUCT_MAX , +}; +struct nbl_func_caps {u32 has_ctrl:1 ;u32 has_net:1 ;
@@ -21,4 +26,10 @@ struct nbl_func_caps { u32 rsv:27; }; +struct nbl_init_param { +struct nbl_func_caps caps; +enum nbl_product_type product_type; +bool pci_using_dac; +}; +#endif
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_product_base.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0*/ +/* +* Copyright (c) 2025 Nebula Matrix Limited. +* Author: +*/ + +#ifndef _NBL_DEF_PRODUCT_BASE_H_ +#define _NBL_DEF_PRODUCT_BASE_H_ + +#include "nbl_include.h" +struct nbl_product_base_ops { +int (*hw_init)(void *p,struct nbl_init_param *param); +void (*hw_remove)(void *p); +int (*res_init)(void *p,struct nbl_init_param *param); +void (*res_remove)(void *p); +int (*chan_init)(void *p,struct nbl_init_param *param); +void (*chan_remove)(void *p); +}; + +#endif
drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c +138 -0
155 lines not on this page · raw message
Signature · 1 line
2.47.3
illusion.wang
maintainerPATCH v2 3/15 net/nebula-matrix: add HW layer definitions and implementation
In reply to illusion.wangadd HW layer related definitions and product ops
--- .../net/ethernet/nebula-matrix/nbl/Makefile | 4 +- .../net/ethernet/nebula-matrix/nbl/nbl_core.h | 11 ++ .../nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c | 179 ++++++++++++++++++ .../nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.h | 13 ++ .../nebula-matrix/nbl/nbl_hw/nbl_hw_reg.h | 156 +++++++++++++++ .../nbl/nbl_include/nbl_def_hw.h | 23 +++ .../nbl/nbl_include/nbl_include.h | 14 ++ .../net/ethernet/nebula-matrix/nbl/nbl_main.c | 19 +- 8 files changed, 416 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_reg.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_hw.h
drivers/net/ethernet/nebula-matrix/nbl/Makefile +3 -1
@@ -4,8 +4,10 @@ obj-$(CONFIG_NBL_CORE) := nbl_core.o -nbl_core-objs += nbl_main.o +nbl_core-objs += nbl_hw/nbl_hw_leonis/nbl_hw_leonis.o \ + nbl_main.o # Provide include files ccflags-y += -I$(srctree)/drivers/net/ethernet/nebula-matrix/nbl/nbl_include/ +ccflags-y += -I$(srctree)/drivers/net/ethernet/nebula-matrix/nbl/nbl_hw ccflags-y += -I$(srctree)/drivers/net/ethernet/nebula-matrix/nbl/
drivers/net/ethernet/nebula-matrix/nbl/nbl_core.h +11 -0
@@ -9,12 +9,16 @@#include <linux/pci.h> #include "nbl_product_base.h" +#include "nbl_def_hw.h" #include "nbl_def_common.h" #define NBL_ADAP_TO_PDEV (adapter) ((adapter)->pdev)#define NBL_ADAP_TO_DEV (adapter) (&((adapter)->pdev->dev))#define NBL_ADAP_TO_COMMON (adapter) (&((adapter)->common))#define NBL_ADAP_TO_RPDUCT_BASE_OPS (adapter) ((adapter)->product_base_ops) + +#define NBL_ADAP_TO_HW_MGT (adapter) ((adapter)->core.hw_mgt) +#define NBL_ADAP_TO_HW_OPS_TBL (adapter) ((adapter)->intf.hw_ops_tbl)#define NBL_CAP_TEST_BIT (val, loc) (((val) >> (loc)) & 0x1)#define NBL_CAP_IS_CTRL (val) NBL_CAP_TEST_BIT(val, NBL_CAP_HAS_CTRL_BIT)
@@ -34,9 +38,16 @@ enum { };struct nbl_interface { +struct nbl_hw_ops_tbl *hw_ops_tbl; };struct nbl_core { +void *hw_mgt; +void *res_mgt; +void *disp_mgt; +void *serv_mgt; +void *dev_mgt; +void *chan_mgt; };struct nbl_adapter {
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c new file +179 -0
179 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0*/ +/* +* Copyright (c) 2025 Nebula Matrix Limited. +* Author: +*/ + +#ifndef _NBL_HW_LEONIS_H_ +#define _NBL_HW_LEONIS_H_ + +#include "nbl_core.h" +#include "nbl_hw_reg.h" + +#endif
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_reg.h new file +156 -0
156 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_hw.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0*/ +/* +* Copyright (c) 2025 Nebula Matrix Limited. +* Author: +*/ + +#ifndef _NBL_DEF_HW_H_ +#define _NBL_DEF_HW_H_ + +#include "nbl_include.h" + +struct nbl_hw_ops { +}; + +struct nbl_hw_ops_tbl { +struct nbl_hw_ops *ops; +void *priv; +}; + +int nbl_hw_init_leonis (void *p,struct nbl_init_param *param); +void nbl_hw_remove_leonis (void *p); + +#endif
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_include.h +14 -0
@@ -12,11 +12,25 @@/* ------ Basic definitions ------- */ #define NBL_DRIVER_NAME "nbl_core" +#define NBL_MAX_PF 8 +#define NBL_NEXT_ID (id, max) \ + ({ \ + typeof(id) _id = (id); \ + ((_id) == (max) ? 0 : (_id) + 1); \ + }) +enum nbl_product_type {NBL_LEONIS_TYPE ,NBL_PRODUCT_MAX , }; +enum nbl_hw_status { +NBL_HW_NOMAL , +/* Most hw module is not work nomal exclude pcie/emp */ +NBL_HW_FATAL_ERR , +NBL_HW_STATUS_MAX , +}; +struct nbl_func_caps {u32 has_ctrl:1 ;u32 has_net:1 ;
drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c +17 -2
@@ -9,8 +9,8 @@static struct nbl_product_base_ops nbl_product_base_ops[NBL_PRODUCT_MAX ] = { { - .hw_init =NULL , - .hw_remove =NULL , + .hw_init = nbl_hw_init_leonis, + .hw_remove = nbl_hw_remove_leonis, .res_init =NULL , .res_remove =NULL , .chan_init =NULL ,
@@ -33,6 +33,7 @@ struct nbl_adapter *nbl_core_init(struct pci_dev *pdev,struct nbl_adapter *adapter;struct nbl_common_info *common;struct nbl_product_base_ops *product_base_ops; +int ret =0 ;if (!pdev)return NULL ;
@@ -60,14 +61,28 @@ struct nbl_adapter *nbl_core_init(struct pci_dev *pdev,nbl_core_setup_product_ops (adapter, param, &product_base_ops); +/* +*every product's hw/chan/res layer has a great difference, +*so call their own init ops +*/ + ret = product_base_ops->hw_init (adapter, param); +if (ret) + goto hw_init_fail; +return adapter; +hw_init_fail: +devm_kfree (&pdev->dev, adapter); +return NULL ; }void nbl_core_remove (struct nbl_adapter *adapter) { +struct nbl_product_base_ops *product_base_ops;struct device *dev; dev =NBL_ADAP_TO_DEV (adapter); + product_base_ops =NBL_ADAP_TO_RPDUCT_BASE_OPS (adapter); + product_base_ops->hw_remove (adapter);devm_kfree (dev, adapter); }
Signature · 1 line
2.47.3
illusion.wang
maintainerPATCH v2 4/15 net/nebula-matrix: add machine-generated headers and chip definitions
In reply to illusion.wang1. nbl_hw_leonis/base/* are machine generated headers
2. nbl_hw.h/nbl_hw_leonis.h
chip-related reg definitions
3. nbl_hw_leonis_regs.c
P4 configuration that will be invoked during chip initialization
--- .../net/ethernet/nebula-matrix/nbl/Makefile | 1 + .../nebula-matrix/nbl/nbl_hw/nbl_hw.h | 172 + .../nbl_hw/nbl_hw_leonis/base/nbl_datapath.h | 11 + .../nbl_hw_leonis/base/nbl_datapath_dped.h | 2152 +++++++++ .../nbl_hw_leonis/base/nbl_datapath_dstore.h | 929 ++++ .../nbl_hw_leonis/base/nbl_datapath_ucar.h | 414 ++ .../nbl/nbl_hw/nbl_hw_leonis/base/nbl_ppe.h | 10 + .../nbl_hw/nbl_hw_leonis/base/nbl_ppe_epro.h | 665 +++ .../nbl_hw/nbl_hw_leonis/base/nbl_ppe_ipro.h | 1397 ++++++ .../nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.h | 1701 ++++++++ .../nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.c | 3863 +++++++++++++++++ .../nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.h | 12 + 12 files changed, 11327 insertions(+) create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_datapath.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_datapath_dped.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_datapath_dstore.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_datapath_ucar.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_ppe.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_ppe_epro.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_ppe_ipro.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.h
drivers/net/ethernet/nebula-matrix/nbl/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_NBL_CORE) := nbl_core.o nbl_core-objs += nbl_hw/nbl_hw_leonis/nbl_hw_leonis.o \ + nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.o \ nbl_main.o # Provide include files
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw.h new file +172 -0
172 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_datapath.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0*/ +/* +* Copyright (c) 2025 Nebula Matrix Limited. +* Author: +*/ +// Code generated by interstellar. DO NOT EDIT. +// Compatible with leonis RTL tag 0710 + +#include "nbl_datapath_ucar.h" +#include "nbl_datapath_dped.h" +#include "nbl_datapath_dstore.h"
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_datapath_dped.h new file +2152 -0
2,152 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_datapath_dstore.h new file +929 -0
658 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_datapath_ucar.h new file +414 -0
414 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_ppe.h new file +10 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_ppe_epro.h new file +665 -0
665 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/base/nbl_ppe_ipro.h new file +1397 -0
1,397 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.h +1701 -0
1,701 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.c new file +3863 -0
3,863 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.h new file +12 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.47.3
Part of the diff is not shown here. View the raw message.
illusion.wang
maintainerPATCH v2 5/15 net/nebula-matrix: add channel layer definitions and implementation
In reply to illusion.wanga channel management layer provides structured approach to handle communication between different components and drivers. Here's a summary of its key functionalities:
1. Message Handling Framework
Message Registration/Unregistration: Functions (nbl_chan_register_msg, nbl_chan_unregister_msg) allow dynamic registration of message handlers for specific message types, enabling extensible communication protocols. Message Sending/Acknowledgment: Core functions (nbl_chan_send_msg, nbl_chan_send_ack) handle message transmission, including asynchronous operations with acknowledgment (ACK) support.
Received ACKs are processed via nbl_chan_recv_ack_msg. Hash-Based Handler Lookup: A hash table (handle_hash_tbl) stores message handlers for efficient O(1) lookup by message type.
2. Channel Types and Queue Management
Dual Channel Support: The driver supports two channel types:
Mailbox Channel: For direct communication between PF and VF. Admin Queue (AdminQ): For privileged operations requiring kernel-level access (e.g., configuration).
Queue Initialization/Teardown: Functions (nbl_chan_init_queue, nbl_chan_teardown_queue) manage transmit (TX) and receive (RX) queues, including DMA buffer allocation/deallocation (dmam_alloc_coherent, dmam_free_coherent).
Queue Configuration: Hardware-specific queue parameters (e.g., buffer sizes, entry counts) are set via nbl_chan_config_queue, with hardware interactions delegated to hw_ops.
3. Hardware Abstraction Layer (HW Ops)
Hardware-Specific Operations: The nbl_hw_ops structure abstracts hardware interactions, allowing different chip variants to implement their own queue configuration (config_mailbox_txq/rxq, config_adminq_txq/rxq), tail pointer updates (update_mailbox_queue_tail_ptr), and DMA error checks (check_mailbox_dma_err, check_adminq_dma_err).
4. Keepalive Mechanism
Heartbeat Monitoring: A keepalive system (nbl_chan_setup_keepalive, nbl_chan_keepalive) ensures
connectivity between drivers by periodically sending heartbeat messages (NBL_CHAN_MSG_KEEP_ALIVE).
Adjusts timeouts dynamically based on success/failure rates.
5. Error Handling and Recovery
DMA Error Detection: Functions like nbl_chan_check_dma_err detect hardware-level errors during TX/RX operations, triggering queue resets (nbl_chan_reset_queue) if needed.
Retry Logic: Message sending includes retry mechanisms (resend_times) for transient failures (e.g., ACK timeouts).
6. Asynchronous Task Support
Delayed Work Queues: Uses Linux kernel delayed work (delayed_work) for background tasks like
keepalive checks (nbl_chan_keepalive) and queue cleanup (nbl_chan_clean_queue_subtask).
7. Initialization and Cleanup
Modular Setup: The nbl_chan_init_common function initializes the channel management layer,
including memory allocation for channel structures (nbl_channel_mgt_leonis), message handlers,
and hardware operations tables (nbl_channel_ops_tbl). Resource Cleanup: Corresponding nbl_chan_remove_common ensures all allocated resources (memory, workqueues, handlers) are freed during driver unloading.:
--- .../net/ethernet/nebula-matrix/nbl/Makefile | 4 +- .../nbl/nbl_channel/nbl_channel.c | 1482 +++++++++++++++++ .../nbl/nbl_channel/nbl_channel.h | 205 +++ .../nebula-matrix/nbl/nbl_common/nbl_common.c | 784 +++++++++ .../nebula-matrix/nbl/nbl_common/nbl_common.h | 54 + .../net/ethernet/nebula-matrix/nbl/nbl_core.h | 5 + .../nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c | 259 +++ .../nbl/nbl_include/nbl_def_channel.h | 715 ++++++++ .../nbl/nbl_include/nbl_def_common.h | 187 +++ .../nbl/nbl_include/nbl_def_hw.h | 27 + .../nbl/nbl_include/nbl_include.h | 67 + .../net/ethernet/nebula-matrix/nbl/nbl_main.c | 10 +- 12 files changed, 3796 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_channel/nbl_channel.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_channel/nbl_channel.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_common/nbl_common.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_common/nbl_common.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_channel.h
drivers/net/ethernet/nebula-matrix/nbl/Makefile +3 -1
@@ -4,7 +4,9 @@ obj-$(CONFIG_NBL_CORE) := nbl_core.o -nbl_core-objs += nbl_hw/nbl_hw_leonis/nbl_hw_leonis.o \ +nbl_core-objs += nbl_common/nbl_common.o \ + nbl_channel/nbl_channel.o \ + nbl_hw/nbl_hw_leonis/nbl_hw_leonis.o \ nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.o \ nbl_main.o
drivers/net/ethernet/nebula-matrix/nbl/nbl_channel/nbl_channel.c new file +1482 -0
1,482 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_channel/nbl_channel.h new file +205 -0
205 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_common/nbl_common.c new file +784 -0
784 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_common/nbl_common.h new file +54 -0
54 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_core.h +5 -0
@@ -9,6 +9,7 @@#include <linux/pci.h> #include "nbl_product_base.h" +#include "nbl_def_channel.h" #include "nbl_def_hw.h" #include "nbl_def_common.h"
@@ -18,7 +19,10 @@#define NBL_ADAP_TO_RPDUCT_BASE_OPS (adapter) ((adapter)->product_base_ops)#define NBL_ADAP_TO_HW_MGT (adapter) ((adapter)->core.hw_mgt) +#define NBL_ADAP_TO_CHAN_MGT (adapter) ((adapter)->core.chan_mgt)#define NBL_ADAP_TO_HW_OPS_TBL (adapter) ((adapter)->intf.hw_ops_tbl) +#define NBL_ADAP_TO_CHAN_OPS_TBL (adapter) ((adapter)->intf.channel_ops_tbl) +#define NBL_CAP_TEST_BIT (val, loc) (((val) >> (loc)) & 0x1)#define NBL_CAP_IS_CTRL (val) NBL_CAP_TEST_BIT(val, NBL_CAP_HAS_CTRL_BIT)
@@ -39,6 +43,7 @@ enum {struct nbl_interface {struct nbl_hw_ops_tbl *hw_ops_tbl; +struct nbl_channel_ops_tbl *channel_ops_tbl; };struct nbl_core {
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c +259 -0
266 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_channel.h new file +715 -0
175 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_common.h +187 -0
187 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_hw.h +27 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_include.h +67 -0
67 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c +8 -2
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.47.3
Part of the diff is not shown here. View the raw message.
illusion.wang
maintainerPATCH v2 6/15 net/nebula-matrix: add resource layer definitions and implementation
In reply to illusion.wangThe Resource layer processes the entries/data of various modules within the processing chip to accomplish specific entry management operations, this describes the module business capabilities of the chip and the data it manages.
The resource layer comprises the following sub-modules: common, adminq, interrupt, txrx, flow, queue, and vsi.
--- .../net/ethernet/nebula-matrix/nbl/Makefile | 3 + .../net/ethernet/nebula-matrix/nbl/nbl_core.h | 7 + .../nebula-matrix/nbl/nbl_hw/nbl_adminq.c | 110 ++ .../nebula-matrix/nbl/nbl_hw/nbl_adminq.h | 160 +++ .../nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c | 319 ++++++ .../nbl_hw_leonis/nbl_resource_leonis.c | 998 ++++++++++++++++++ .../nbl_hw_leonis/nbl_resource_leonis.h | 13 + .../nebula-matrix/nbl/nbl_hw/nbl_resource.c | 427 ++++++++ .../nebula-matrix/nbl/nbl_hw/nbl_resource.h | 860 +++++++++++++++ .../nbl/nbl_include/nbl_def_common.h | 19 + .../nbl/nbl_include/nbl_def_hw.h | 17 +- .../nbl/nbl_include/nbl_def_resource.h | 183 ++++ .../nbl/nbl_include/nbl_include.h | 189 ++++ .../net/ethernet/nebula-matrix/nbl/nbl_main.c | 11 +- 14 files changed, 3312 insertions(+), 4 deletions(-) create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_adminq.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_adminq.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_resource.h
drivers/net/ethernet/nebula-matrix/nbl/Makefile +3 -0
@@ -7,7 +7,10 @@ obj-$(CONFIG_NBL_CORE) := nbl_core.o nbl_core-objs += nbl_common/nbl_common.o \ nbl_channel/nbl_channel.o \ nbl_hw/nbl_hw_leonis/nbl_hw_leonis.o \ + nbl_hw/nbl_hw_leonis/nbl_resource_leonis.o \ nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.o \ + nbl_hw/nbl_resource.o \ + nbl_hw/nbl_adminq.o \ nbl_main.o # Provide include files
drivers/net/ethernet/nebula-matrix/nbl/nbl_core.h +7 -0
@@ -11,6 +11,7 @@#include "nbl_product_base.h" #include "nbl_def_channel.h" #include "nbl_def_hw.h" +#include "nbl_def_resource.h" #include "nbl_def_common.h" #define NBL_ADAP_TO_PDEV (adapter) ((adapter)->pdev)
@@ -19,10 +20,15 @@#define NBL_ADAP_TO_RPDUCT_BASE_OPS (adapter) ((adapter)->product_base_ops)#define NBL_ADAP_TO_HW_MGT (adapter) ((adapter)->core.hw_mgt) +#define NBL_ADAP_TO_RES_MGT (adapter) ((adapter)->core.res_mgt)#define NBL_ADAP_TO_CHAN_MGT (adapter) ((adapter)->core.chan_mgt)#define NBL_ADAP_TO_HW_OPS_TBL (adapter) ((adapter)->intf.hw_ops_tbl) +#define NBL_ADAP_TO_RES_OPS_TBL (adapter) ((adapter)->intf.resource_ops_tbl)#define NBL_ADAP_TO_CHAN_OPS_TBL (adapter) ((adapter)->intf.channel_ops_tbl) +#define NBL_ADAPTER_TO_RES_PT_OPS (adapter) \ + (&(NBL_ADAP_TO_SERV_OPS_TBL(adapter)->pt_ops)) +#define NBL_CAP_TEST_BIT (val, loc) (((val) >> (loc)) & 0x1)#define NBL_CAP_IS_CTRL (val) NBL_CAP_TEST_BIT(val, NBL_CAP_HAS_CTRL_BIT)
@@ -43,6 +49,7 @@ enum {struct nbl_interface {struct nbl_hw_ops_tbl *hw_ops_tbl; +struct nbl_resource_ops_tbl *resource_ops_tbl;struct nbl_channel_ops_tbl *channel_ops_tbl; };
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_adminq.c new file +110 -0
110 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_adminq.h new file +160 -0
160 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c +319 -0
349 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.c new file +998 -0
998 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0*/ +/* +* Copyright (c) 2025 Nebula Matrix Limited. +* Author: +*/ + +#ifndef _NBL_RESOURCE_LEONIS_H_ +#define _NBL_RESOURCE_LEONIS_H_ + +#include "nbl_resource.h" + +#define NBL_MAX_PF_LEONIS 8 +#endif
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.c new file +427 -0
427 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.h new file +860 -0
860 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_common.h +19 -0
@@ -77,6 +77,25 @@ do { \#define NBL_COMMON_TO_BOARD_ID (common) ((common)->board_id)#define NBL_COMMON_TO_LOGIC_ETH_ID (common) ((common)->logic_eth_id) +#define NBL_ONE_ETHERNET_PORT (1) +#define NBL_TWO_ETHERNET_PORT (2) +#define NBL_FOUR_ETHERNET_PORT (4) +#define NBL_DEFAULT_VSI_ID_GAP (1024) +#define NBL_TWO_ETHERNET_VSI_ID_GAP (512) +#define NBL_FOUR_ETHERNET_VSI_ID_GAP (256) + +#define NBL_VSI_ID_GAP (m) \ + ({ \ + typeof(m) _m = (m); \ + _m == NBL_FOUR_ETHERNET_PORT ? \ + NBL_FOUR_ETHERNET_VSI_ID_GAP : \ + (_m == NBL_TWO_ETHERNET_PORT ? \ + NBL_TWO_ETHERNET_VSI_ID_GAP : \ + NBL_DEFAULT_VSI_ID_GAP); \ + }) + +#define NBL_INVALID_QUEUE_ID (0xFFFF) +struct nbl_common_info {struct pci_dev *pdev;struct device *dev;
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_hw.h +15 -2
@@ -21,7 +21,10 @@ struct nbl_hw_ops {u16 (*get_mailbox_rx_tail_ptr)(void *priv);bool (*check_mailbox_dma_err)(void *priv,bool tx);u32 (*get_host_pf_mask)(void *priv); - +u32 (*get_host_pf_fid)(void *priv,u16 func_id); +u32 (*get_real_bus)(void *priv); +u64 (*get_pf_bar_addr)(void *priv,u16 func_id); +u64 (*get_vf_bar_addr)(void *priv,u16 func_id);void (*cfg_mailbox_qinfo)(void *priv,u16 func_id,u16 bus,u16 devid,u16 function); void (*config_adminq_rxq)(void *priv, dma_addr_t dma_addr,
@@ -34,9 +37,19 @@ struct nbl_hw_ops {void (*update_adminq_queue_tail_ptr)(void *priv,u16 tail_ptr,u8 txrx);bool (*check_adminq_dma_err)(void *priv,bool tx); + u8__iomem *(*get_hw_addr)(void *priv, size_t *size);void (*set_hw_status)(void *priv,enum nbl_hw_status hw_status);enum nbl_hw_status (*get_hw_status)(void *priv); - +void (*set_fw_ping)(void *priv,u32 ping);
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_resource.h new file +183 -0
183 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_include.h +189 -0
189 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c +9 -2
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.47.3
Part of the diff is not shown here. View the raw message.
illusion.wang
maintainerPATCH v2 7/15 net/nebula-matrix: add intr resource definitions and implementation
In reply to illusion.wangintr interfaces offer comprehensive interrupt lifecycle management functions (including configuration, enabling, disabling, and destruction), status query capabilities,as well as performance tuning features (such as suppression levels). Additionally, they provide differentiated handling for PF and VF, making them suitable for high-performance networking devices (e.g., in SR-IOV scenarios).
--- .../net/ethernet/nebula-matrix/nbl/Makefile | 1 + .../nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c | 204 ++++++++ .../nbl_hw_leonis/nbl_resource_leonis.c | 18 + .../nebula-matrix/nbl/nbl_hw/nbl_interrupt.c | 448 ++++++++++++++++++ .../nebula-matrix/nbl/nbl_hw/nbl_interrupt.h | 13 + .../nebula-matrix/nbl/nbl_hw/nbl_resource.h | 4 + .../nbl/nbl_include/nbl_def_hw.h | 17 + .../nbl/nbl_include/nbl_include.h | 6 + 8 files changed, 711 insertions(+) create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_interrupt.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_interrupt.h
drivers/net/ethernet/nebula-matrix/nbl/Makefile +1 -0
@@ -10,6 +10,7 @@ nbl_core-objs += nbl_common/nbl_common.o \ nbl_hw/nbl_hw_leonis/nbl_resource_leonis.o \ nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.o \ nbl_hw/nbl_resource.o \ + nbl_hw/nbl_interrupt.o \ nbl_hw/nbl_adminq.o \ nbl_main.o
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c +204 -0
240 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.c +18 -0
@@ -490,6 +490,7 @@ static struct nbl_resource_ops res_ops = {static struct nbl_res_product_ops product_ops = { }; +static bool is_ops_inited;static int nbl_res_setup_res_mgt (struct nbl_common_info *common,struct nbl_resource_mgt_leonis **res_mgt_leonis)
@@ -537,15 +538,28 @@ static int nbl_res_setup_ops(struct device *dev,struct nbl_resource_ops_tbl **res_ops_tbl, struct nbl_resource_mgt_leonis *res_mgt_leonis) { + int ret = 0; + *res_ops_tbl =devm_kzalloc (dev,sizeof (struct nbl_resource_ops_tbl ),GFP_KERNEL );if (!*res_ops_tbl)return -ENOMEM ; +if (!is_ops_inited) { + ret =nbl_intr_setup_ops (&res_ops); +if (ret) + goto setup_fail; + is_ops_inited = true; + } + (*res_ops_tbl)->ops = &res_ops; (*res_ops_tbl)->priv = res_mgt_leonis;return 0 ; + +setup_fail: +nbl_res_remove_ops (dev, res_ops_tbl); +return -EAGAIN ; }static int nbl_res_ctrl_dev_setup_eth_info (struct nbl_resource_mgt *res_mgt)
@@ -851,6 +865,7 @@ static void nbl_res_stop(struct nbl_resource_mgt_leonis *res_mgt_leonis) {struct nbl_resource_mgt *res_mgt = &res_mgt_leonis->res_mgt; +nbl_intr_mgt_stop (res_mgt);nbl_res_ctrl_dev_ustore_stats_remove (res_mgt);nbl_res_ctrl_dev_remove_vsi_info (res_mgt);nbl_res_ctrl_dev_remove_eth_info (res_mgt);
@@ -903,6 +918,9 @@ static int nbl_res_start(struct nbl_resource_mgt_leonis *res_mgt_leonis,if (ret) goto start_fail; + ret =nbl_intr_mgt_start (res_mgt); +if (ret) + goto start_fail;nbl_res_set_fix_capability (res_mgt,NBL_TASK_FW_HB_CAP );nbl_res_set_fix_capability (res_mgt,NBL_TASK_FW_RESET_CAP );nbl_res_set_fix_capability (res_mgt,NBL_TASK_CLEAN_ADMINDQ_CAP );
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_interrupt.c new file +448 -0
448 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_interrupt.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0*/ +/* +* Copyright (c) 2025 Nebula Matrix Limited. +* Author: +*/ + +#ifndef _NBL_INTERRUPT_H_ +#define _NBL_INTERRUPT_H_ + +#include "nbl_resource.h" + +#define NBL_MSIX_MAP_TABLE_MAX_ENTRIES (1024) +#endif
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.h +4 -0
@@ -845,6 +845,10 @@ u8 nbl_res_vsi_id_to_eth_id(struct nbl_resource_mgt *res_mgt, u16 vsi_id);int nbl_adminq_mgt_start (struct nbl_resource_mgt *res_mgt);void nbl_adminq_mgt_stop (struct nbl_resource_mgt *res_mgt);int nbl_adminq_setup_ops (struct nbl_resource_ops *resource_ops); + +int nbl_intr_mgt_start (struct nbl_resource_mgt *res_mgt); +void nbl_intr_mgt_stop (struct nbl_resource_mgt *res_mgt); +int nbl_intr_setup_ops (struct nbl_resource_ops *resource_ops);bool nbl_res_get_fix_capability (void *priv,enum nbl_fix_cap_type cap_type);void nbl_res_set_fix_capability (struct nbl_resource_mgt *res_mgt,enum nbl_fix_cap_type cap_type);
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_hw.h +17 -0
@@ -10,6 +10,14 @@#include "nbl_include.h" struct nbl_hw_ops { +void (*configure_msix_map)(void *priv,u16 func_id,bool valid, +dma_addr_t dma_addr,u8 bus,u8 devid, +u8 function); +void (*configure_msix_info)(void *priv,u16 func_id,bool valid, +u16 interrupt_id,u8 bus,u8 devid, +u8 function,bool net_msix_mask_en); +void (*set_coalesce)(void *priv,u16 interrupt_id,u16 pnum,u16 rate); +void (*update_mailbox_queue_tail_ptr)(void *priv,u16 tail_ptr,u8 txrx); void (*config_mailbox_rxq)(void *priv, dma_addr_t dma_addr,
@@ -27,6 +35,13 @@ struct nbl_hw_ops {u64 (*get_vf_bar_addr)(void *priv,u16 func_id);void (*cfg_mailbox_qinfo)(void *priv,u16 func_id,u16 bus,u16 devid,u16 function); +void (*enable_mailbox_irq)(void *priv,u16 func_id,bool enable_msix, +u16 global_vec_id); +void (*enable_abnormal_irq)(void *priv,bool enable_msix, +u16 global_vec_id); +void (*enable_msix_irq)(void *priv,u16 global_vec_id); +u8 __iomem *(*get_msix_irq_enable_info)(void *priv,u16 global_vec_id, +u32 *irq_data);void (*config_adminq_rxq)(void *priv,dma_addr_t dma_addr,int size_bwid); void (*config_adminq_txq)(void *priv, dma_addr_t dma_addr,
@@ -34,6 +49,8 @@ struct nbl_hw_ops {void (*stop_adminq_rxq)(void *priv);void (*stop_adminq_txq)(void *priv);void (*cfg_adminq_qinfo)(void *priv,u16 bus,u16 devid,u16 function); +void (*enable_adminq_irq)(void *priv,bool enable_msix, +u16 global_vec_id);void (*update_adminq_queue_tail_ptr)(void *priv,u16 tail_ptr,u8 txrx);bool (*check_adminq_dma_err)(void *priv,bool tx);
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_include.h +6 -0
@@ -17,6 +17,10 @@#define NBL_MAX_PF 8 +#define NBL_RATE_MBPS_100G 100000 +#define NBL_RATE_MBPS_25G 25000 +#define NBL_RATE_MBPS_10G 10000 +#define NBL_NEXT_ID (id, max) \ ({ \ typeof(id) _id = (id); \
@@ -25,6 +29,8 @@#define NBL_MAX_FUNC (520)#define NBL_MAX_MTU_NUM 15 +/* Used for macros to pass checkpatch */ +#define NBL_NAME (x) xenum nbl_product_type {NBL_LEONIS_TYPE ,
Signature · 1 line
2.47.3
illusion.wang
maintainerPATCH v2 8/15 net/nebula-matrix: add vsi, queue, adminq resource definitions and implementation
In reply to illusion.wangvsi resource management functions include:
VSI basic operations (promiscuous mode)
Hardware module initialization and de-initialization queue resource management functions include:
queue init, queue deinit
queue alooc, free
queue rss cfg
queue hw cfg
queue qos and rate control
queue desc gother
Adminq resource management functions include:
Hardware Configuration: Send configuration commands to the hardware via AdminQ (such as setting port properties, queue quantities, MAC addresses, etc.).
State Monitoring: Obtain hardware status (such as link status, port properties, etc.).
Firmware Management: Support firmware reading, writing, erasing, checksum verification, and activation.
Event Notification: Handle hardware events (such as link status changes, module insertion and removal).
Command Filtering: Conduct legality checks on commands sent to the hardware.
--- .../net/ethernet/nebula-matrix/nbl/Makefile | 3 + .../nebula-matrix/nbl/nbl_hw/nbl_adminq.c | 1336 +++++++++++++ .../nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c | 1703 ++++++++++++++++- .../nbl_hw/nbl_hw_leonis/nbl_queue_leonis.c | 1430 ++++++++++++++ .../nbl_hw/nbl_hw_leonis/nbl_queue_leonis.h | 23 + .../nbl_hw_leonis/nbl_resource_leonis.c | 30 + .../nbl_hw_leonis/nbl_resource_leonis.h | 12 + .../nebula-matrix/nbl/nbl_hw/nbl_queue.c | 60 + .../nebula-matrix/nbl/nbl_hw/nbl_queue.h | 11 + .../nebula-matrix/nbl/nbl_hw/nbl_resource.c | 17 + .../nebula-matrix/nbl/nbl_hw/nbl_resource.h | 10 + .../nebula-matrix/nbl/nbl_hw/nbl_vsi.c | 168 ++ .../nebula-matrix/nbl/nbl_hw/nbl_vsi.h | 12 + .../nbl/nbl_include/nbl_def_hw.h | 55 + .../nbl/nbl_include/nbl_include.h | 134 ++ 15 files changed, 4996 insertions(+), 8 deletions(-) create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_queue_leonis.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_queue_leonis.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_queue.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_queue.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_vsi.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_vsi.h
drivers/net/ethernet/nebula-matrix/nbl/Makefile +3 -0
@@ -7,10 +7,13 @@ obj-$(CONFIG_NBL_CORE) := nbl_core.o nbl_core-objs += nbl_common/nbl_common.o \ nbl_channel/nbl_channel.o \ nbl_hw/nbl_hw_leonis/nbl_hw_leonis.o \ + nbl_hw/nbl_hw_leonis/nbl_queue_leonis.o \ nbl_hw/nbl_hw_leonis/nbl_resource_leonis.o \ nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.o \ nbl_hw/nbl_resource.o \ nbl_hw/nbl_interrupt.o \ + nbl_hw/nbl_queue.o \ + nbl_hw/nbl_vsi.o \ nbl_hw/nbl_adminq.o \ nbl_main.o
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_adminq.c +1336 -0
1,351 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c +1695 -8
1,636 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_queue_leonis.c new file +1430 -0
1,430 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_queue_leonis.h new file +23 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.c +30 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.h +12 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_queue.c new file +60 -0
60 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_queue.h new file +11 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.c +17 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.h +10 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_vsi.c new file +168 -0
168 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_vsi.h new file +12 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_hw.h +55 -0
55 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_include.h +134 -0
134 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.47.3
Part of the diff is not shown here. View the raw message.
Re: [PATCH v2 net-next 08/15] net/nebula-matrix: add vsi, queue, adminq resource definitions and implementation
Quoted 75 lines
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_adminq.c +75
-0+static s32 nbl_res_aq_get_module_bitrate (struct nbl_resource_mgt *res_mgt, +u8 eth_id) +{ +struct device *dev =NBL_COMMON_TO_DEV (res_mgt->common); +struct nbl_eth_info *eth_info =NBL_RES_MGT_TO_ETH_INFO (res_mgt); +u8 data[SFF_8472_SIGNALING_RATE_MAX +1 ]; +u32 result; +u8 br_nom; +u8 br_max; +u8 identifier; +u8 encoding =0 ; +int port_max_rate; +int ret; + +if (res_mgt->resource_info->board_info.eth_speed == +NBL_FW_PORT_SPEED_100G ) { + ret =nbl_res_aq_turn_module_eeprom_page (res_mgt, eth_id,0 ); +if (ret) { +dev_err (dev, +"eth %d get_module_eeprom_info failed %d\n" , + eth_info->logic_eth_id[eth_id], ret); +return NBL_PORT_MAX_RATE_UNKNOWN ; + } + } + + ret =nbl_res_aq_get_module_eeprom (res_mgt, eth_id,I2C_DEV_ADDR_A0 ,0 , +0 ,0 , +SFF_8472_SIGNALING_RATE_MAX +1 , + data); +if (ret) { +dev_err (dev,"eth %d get_module_eeprom_info failed %d\n" , + eth_info->logic_eth_id[eth_id], ret); +return NBL_PORT_MAX_RATE_UNKNOWN ; + } + +if (res_mgt->resource_info->board_info.eth_speed == +NBL_FW_PORT_SPEED_100G ) { + ret =nbl_res_aq_get_module_eeprom (res_mgt, eth_id, +I2C_DEV_ADDR_A0 ,0 ,0 , +SFF_8636_VENDOR_ENCODING ,1 , + &encoding); +if (ret) { +dev_err (dev, +"eth %d get_module_eeprom_info failed %d\n" , + eth_info->logic_eth_id[eth_id], ret); +return NBL_PORT_MAX_RATE_UNKNOWN ; + } + } + + br_nom = data[SFF_8472_SIGNALING_RATE ]; + br_max = data[SFF_8472_SIGNALING_RATE_MAX ]; + identifier = data[SFF_8472_IDENTIFIER ]; + +/* sff-8472 section 5.6 */ +if (br_nom ==255 ) + result = (u32 )br_max *250 ; +else if (br_nom ==0 ) + result =0 ; +else + result = (u32 )br_nom *100 ; + +switch (result /1000 ) { +case 25 : + port_max_rate =NBL_PORT_MAX_RATE_25G ; +break ; +case 10 : + port_max_rate =NBL_PORT_MAX_RATE_10G ; +break ; +case 1 : + port_max_rate =NBL_PORT_MAX_RATE_1G ; +break ; +default : + port_max_rate =NBL_PORT_MAX_RATE_UNKNOWN ; +break ; + }
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_adminq.c int nbl_res_open_sfp(struct nbl_resource_mgt *res_mgt, u8 eth_id) · line 726
Quoted 10 lines
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_adminq.c +10
-0+ +if (identifier ==SFF_IDENTIFIER_QSFP28 ) + port_max_rate =NBL_PORT_MAX_RATE_100G ; + +if (identifier ==SFF_IDENTIFIER_PAM4 || + encoding ==SFF_8636_ENCODING_PAM4 ) + port_max_rate =NBL_PORT_MAX_RATE_100G_PAM4 ; + +return port_max_rate; +}
Please could you pull everything dealing with the SFP into a patch of its own. We will want to review this code and think about if you should be using phylink.
Do you also have a PCS which the driver is configuring? If so, please make that a separate patch as well.
Andrew
illusion.wang
maintainerPATCH v2 9/15 net/nebula-matrix: add flow resource definitions and implementation
In reply to illusion.wangflow resource management functions include:
Flow Configuration: Setting the actions and key-value pairs for flows. Flow Management: Allocating/releasing flow IDs, TCAM IDs, MCC IDs, etc. Multicast Control: Managing multicast control groups.
Hash Table Management: Enabling rapid lookup of flow entries. LLDP/LACP Flow Management: Managing flows related to link-layer protocols.
Multicast Flow Management: Managing multicast flows.
MTU Management: Managing the MTU of Virtual Switching Instances (VSIs). Initialization and Cleanup: Initializing/cleaning up the flow management module.
--- .../net/ethernet/nebula-matrix/nbl/Makefile | 1 + .../nbl_hw/nbl_hw_leonis/nbl_flow_leonis.c | 2268 +++++++++++++++++ .../nbl_hw/nbl_hw_leonis/nbl_flow_leonis.h | 204 ++ .../nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c | 519 ++++ .../nbl_hw_leonis/nbl_resource_leonis.c | 10 + .../nbl_hw_leonis/nbl_resource_leonis.h | 3 + .../nbl/nbl_include/nbl_def_common.h | 87 + .../nbl/nbl_include/nbl_def_hw.h | 18 + 8 files changed, 3110 insertions(+) create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_flow_leonis.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_flow_leonis.h
drivers/net/ethernet/nebula-matrix/nbl/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_NBL_CORE) := nbl_core.o nbl_core-objs += nbl_common/nbl_common.o \ nbl_channel/nbl_channel.o \ nbl_hw/nbl_hw_leonis/nbl_hw_leonis.o \ + nbl_hw/nbl_hw_leonis/nbl_flow_leonis.o \ nbl_hw/nbl_hw_leonis/nbl_queue_leonis.o \ nbl_hw/nbl_hw_leonis/nbl_resource_leonis.o \ nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.o \
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_flow_leonis.c new file +2268 -0
2,268 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_flow_leonis.h new file +204 -0
204 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c +519 -0
521 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.c +10 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.h +3 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_common.h +87 -0
87 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_hw.h +18 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.47.3
Part of the diff is not shown here. View the raw message.
illusion.wang
maintainerPATCH v2 10/15 net/nebula-matrix: add txrx resource definitions and implementation
In reply to illusion.wangtxrx resource management functions include:
TX/RX Ring Management: Allocate/release DMA memory and descriptors. Data Transmission: Support TSO (TCP Segmentation Offload), checksum
offloading, and VLAN tag insertion.
Data Reception: Support NAPI interrupt aggregation, checksum
offloading, and VLAN tag stripping.
Resource Management: Cache receive buffers and pre-allocate resources. Statistics and Debugging: Collect transmission/reception statistics.
--- .../net/ethernet/nebula-matrix/nbl/Makefile | 1 + .../net/ethernet/nebula-matrix/nbl/nbl_core.h | 27 + .../nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c | 19 + .../nbl_hw_leonis/nbl_resource_leonis.c | 11 + .../nebula-matrix/nbl/nbl_hw/nbl_resource.h | 4 + .../nebula-matrix/nbl/nbl_hw/nbl_txrx.c | 2150 +++++++++++++++++ .../nebula-matrix/nbl/nbl_hw/nbl_txrx.h | 184 ++ .../nbl/nbl_include/nbl_def_hw.h | 4 + .../nbl/nbl_include/nbl_include.h | 5 + 9 files changed, 2405 insertions(+) create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_txrx.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_txrx.h
drivers/net/ethernet/nebula-matrix/nbl/Makefile +1 -0
@@ -13,6 +13,7 @@ nbl_core-objs += nbl_common/nbl_common.o \ nbl_hw/nbl_hw_leonis/nbl_hw_leonis_regs.o \ nbl_hw/nbl_resource.o \ nbl_hw/nbl_interrupt.o \ + nbl_hw/nbl_txrx.o \ nbl_hw/nbl_queue.o \ nbl_hw/nbl_vsi.o \ nbl_hw/nbl_adminq.o \
drivers/net/ethernet/nebula-matrix/nbl/nbl_core.h +27 -0
@@ -29,6 +29,23 @@#define NBL_ADAPTER_TO_RES_PT_OPS (adapter) \ (&(NBL_ADAP_TO_SERV_OPS_TBL(adapter)->pt_ops)) +#define NBL_NETDEV_PRIV_TO_ADAPTER (priv) ((priv)->adapter) + +#define NBL_NETDEV_TO_ADAPTER (netdev) \ + (NBL_NETDEV_PRIV_TO_ADAPTER( \ + (struct nbl_netdev_priv *)netdev_priv(netdev))) + +#define NBL_NETDEV_TO_SERV_MGT (netdev) \ + (NBL_ADAP_TO_SERV_MGT(NBL_NETDEV_PRIV_TO_ADAPTER(\ + (struct nbl_netdev_priv *)netdev_priv(netdev)))) + +#define NBL_NETDEV_TO_DEV_MGT (netdev) \ + (NBL_ADAP_TO_DEV_MGT(NBL_NETDEV_TO_ADAPTER(netdev))) + +#define NBL_NETDEV_TO_COMMON (netdev) \ + (NBL_ADAP_TO_COMMON(NBL_NETDEV_PRIV_TO_ADAPTER(\ + (struct nbl_netdev_priv *)netdev_priv(netdev)))) +#define NBL_CAP_TEST_BIT (val, loc) (((val) >> (loc)) & 0x1)#define NBL_CAP_IS_CTRL (val) NBL_CAP_TEST_BIT(val, NBL_CAP_HAS_CTRL_BIT)
@@ -71,6 +88,16 @@ struct nbl_adapter {struct nbl_init_param init_param; }; +struct nbl_netdev_priv { +struct nbl_adapter *adapter; +struct net_device *netdev; +u16 tx_queue_num; +u16 rx_queue_num; +u16 queue_size; +u16 data_vsi; +s64 last_st_time; +}; +struct nbl_adapter *nbl_core_init (struct pci_dev *pdev,struct nbl_init_param *param);void nbl_core_remove (struct nbl_adapter *adapter);
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_hw_leonis.c +19 -0
@@ -2435,6 +2435,23 @@ static void nbl_hw_cfg_mailbox_qinfo(void *priv, u16 func_id, u16 bus, (u8 *)&mb_qinfo_map, sizeof(mb_qinfo_map)); } +static void nbl_hw_update_tail_ptr (void *priv,struct nbl_notify_param *param) +{ +struct nbl_hw_mgt *hw_mgt = (struct nbl_hw_mgt *)priv; +u8 __iomem *notify_addr = hw_mgt->hw_addr; +u32 local_qid = param->notify_qid; +u32 tail_ptr = param->tail_ptr; + +writel ((((u32 )tail_ptr <<16 ) | (u32 )local_qid), notify_addr); +} + +static u8 __iomem *nbl_hw_get_tail_ptr (void *priv) +{ +struct nbl_hw_mgt *hw_mgt = (struct nbl_hw_mgt *)priv; + +return hw_mgt->hw_addr; +} +static void nbl_hw_set_promisc_mode (void *priv,u16 vsi_id,u16 eth_id,u16 mode) {
@@ -2980,6 +2997,8 @@ static struct nbl_hw_ops hw_ops = { .update_adminq_queue_tail_ptr = nbl_hw_update_adminq_queue_tail_ptr, .check_adminq_dma_err = nbl_hw_check_adminq_dma_err, + .update_tail_ptr = nbl_hw_update_tail_ptr, + .get_tail_ptr = nbl_hw_get_tail_ptr, .get_hw_addr = nbl_hw_get_hw_addr, .set_fw_ping = nbl_hw_set_fw_ping, .get_fw_pong = nbl_hw_get_fw_pong,
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_hw_leonis/nbl_resource_leonis.c +11 -0
@@ -558,6 +558,10 @@ static int nbl_res_setup_ops(struct device *dev,if (ret) goto setup_fail; + ret =nbl_txrx_setup_ops (&res_ops); +if (ret) + goto setup_fail; + ret =nbl_intr_setup_ops (&res_ops);if (ret) goto setup_fail;
@@ -886,6 +890,7 @@ static void nbl_res_stop(struct nbl_resource_mgt_leonis *res_mgt_leonis)struct nbl_resource_mgt *res_mgt = &res_mgt_leonis->res_mgt;nbl_queue_mgt_stop (res_mgt); +nbl_txrx_mgt_stop (res_mgt);nbl_intr_mgt_stop (res_mgt);nbl_adminq_mgt_stop (res_mgt);nbl_vsi_mgt_stop (res_mgt);
@@ -971,6 +976,12 @@ static int nbl_res_start(struct nbl_resource_mgt_leonis *res_mgt_leonis,nbl_res_set_fix_capability (res_mgt,NBL_NEED_DESTROY_CHIP ); } +if (caps.has_net) { + ret =nbl_txrx_mgt_start (res_mgt); +if (ret) + goto start_fail; + } +nbl_res_set_fix_capability (res_mgt,NBL_TASK_CLEAN_MAILBOX_CAP );nbl_res_set_fix_capability (res_mgt,NBL_TASK_RESET_CAP );
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_resource.h +4 -0
@@ -855,6 +855,10 @@ int nbl_intr_setup_ops(struct nbl_resource_ops *resource_ops);int nbl_queue_mgt_start (struct nbl_resource_mgt *res_mgt);void nbl_queue_mgt_stop (struct nbl_resource_mgt *res_mgt); +int nbl_txrx_mgt_start (struct nbl_resource_mgt *res_mgt); +void nbl_txrx_mgt_stop (struct nbl_resource_mgt *res_mgt); +int nbl_txrx_setup_ops (struct nbl_resource_ops *resource_ops); +int nbl_vsi_mgt_start (struct nbl_resource_mgt *res_mgt);void nbl_vsi_mgt_stop (struct nbl_resource_mgt *res_mgt);int nbl_vsi_setup_ops (struct nbl_resource_ops *resource_ops);
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_txrx.c new file +2150 -0
2,150 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_hw/nbl_txrx.h new file +184 -0
184 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_hw.h +4 -0
@@ -105,6 +105,9 @@ struct nbl_hw_ops {void (*update_adminq_queue_tail_ptr)(void *priv,u16 tail_ptr,u8 txrx);bool (*check_adminq_dma_err)(void *priv,bool tx); +void (*update_tail_ptr)(void *priv,struct nbl_notify_param *param); + u8__iomem *(*get_tail_ptr)(void *priv); +int (*set_vsi_mtu)(void *priv,u16 vsi_id,u16 mtu_sel); u8__iomem *(*get_hw_addr)(void *priv, size_t *size);
@@ -127,6 +130,7 @@ struct nbl_hw_ops { u16 next_mcc_id);void (*update_mcc_next_node)(void *priv,u16 mcc_id,u16 next_mcc_id);int (*init_fem)(void *priv); +void (*set_fw_ping)(void *priv,u32 ping);u32 (*get_fw_pong)(void *priv);void (*set_fw_pong)(void *priv,u32 pong);
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_include.h +5 -0
@@ -227,6 +227,11 @@ struct nbl_hw_stats {struct nbl_ustore_stats start_ustore_stats; }; +struct nbl_notify_param { +u16 notify_qid; +u16 tail_ptr; +}; +enum nbl_port_type {NBL_PORT_TYPE_UNKNOWN =0 ,NBL_PORT_TYPE_FIBRE ,
Signature · 1 line
2.47.3
illusion.wang
maintainerPATCH v2 11/15 net/nebula-matrix: add Dispatch layer definitions and implementation
In reply to illusion.wangTwo routing ways:
Dispatch Layer-> Resource Layer -> HW layer
The Dispatch Layer routes tasks to Resource Layer, which may interact with the HW Layer for hardware writes.
Dispatch Layer->Channel Layer
The Dispatch Layers redirects hooks to the Channel Layer.
The primary challenge at the Dispatch layer lies in determining the routing approach, namely, how to decide which interfaces should directly invoke the Resource layer's interfaces and which should transmit requests via channels to the management PF for processing.
To address this, a ctrl_lvl (control level) mechanism is established, which comprises two parts: the control level declared by each interface and the control level configured by the upper layer. The effect is that when the upper layer configures a specific control level, all interfaces declaring this level will directly call the Resource layer's interfaces; otherwise, they will send requests via channels.
For instance, consider a regular PF that possesses network (net) capabilities but lacks control (ctrl) capabilities. It will only configure NET_LVL at the Dispatch layer. In this scenario, all interfaces declaring NET_LVL will directly invoke the Resource layer's interfaces, while those declaring CTRL_LVL will send requests via channels to the management PF. Conversely, if it is the management PF, it will configure both NET_LVL and CTRL_LVL at the Dispatch layer. Consequently, interfaces declaring CTRL_LVL will also directly call the Resource layer's interfaces without sending requests via channels. This configuration logic can be dynamic.
--- .../net/ethernet/nebula-matrix/nbl/Makefile | 1 + .../net/ethernet/nebula-matrix/nbl/nbl_core.h | 4 + .../nebula-matrix/nbl/nbl_core/nbl_dispatch.c | 4265 +++++++++++++++++ .../nebula-matrix/nbl/nbl_core/nbl_dispatch.h | 78 + .../nbl/nbl_include/nbl_def_dispatch.h | 190 + .../net/ethernet/nebula-matrix/nbl/nbl_main.c | 7 + 6 files changed, 4545 insertions(+) create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dispatch.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dispatch.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_dispatch.h
drivers/net/ethernet/nebula-matrix/nbl/Makefile +1 -0
@@ -17,6 +17,7 @@ nbl_core-objs += nbl_common/nbl_common.o \ nbl_hw/nbl_queue.o \ nbl_hw/nbl_vsi.o \ nbl_hw/nbl_adminq.o \ + nbl_core/nbl_dispatch.o \ nbl_main.o # Provide include files
drivers/net/ethernet/nebula-matrix/nbl/nbl_core.h +4 -0
@@ -12,6 +12,7 @@#include "nbl_def_channel.h" #include "nbl_def_hw.h" #include "nbl_def_resource.h" +#include "nbl_def_dispatch.h" #include "nbl_def_common.h" #define NBL_ADAP_TO_PDEV (adapter) ((adapter)->pdev)
@@ -21,9 +22,11 @@#define NBL_ADAP_TO_HW_MGT (adapter) ((adapter)->core.hw_mgt)#define NBL_ADAP_TO_RES_MGT (adapter) ((adapter)->core.res_mgt) +#define NBL_ADAP_TO_DISP_MGT (adapter) ((adapter)->core.disp_mgt)#define NBL_ADAP_TO_CHAN_MGT (adapter) ((adapter)->core.chan_mgt)#define NBL_ADAP_TO_HW_OPS_TBL (adapter) ((adapter)->intf.hw_ops_tbl)#define NBL_ADAP_TO_RES_OPS_TBL (adapter) ((adapter)->intf.resource_ops_tbl) +#define NBL_ADAP_TO_DISP_OPS_TBL (adapter) ((adapter)->intf.dispatch_ops_tbl)#define NBL_ADAP_TO_CHAN_OPS_TBL (adapter) ((adapter)->intf.channel_ops_tbl)#define NBL_ADAPTER_TO_RES_PT_OPS (adapter) \
@@ -67,6 +70,7 @@ enum {struct nbl_interface {struct nbl_hw_ops_tbl *hw_ops_tbl;struct nbl_resource_ops_tbl *resource_ops_tbl; +struct nbl_dispatch_ops_tbl *dispatch_ops_tbl;struct nbl_channel_ops_tbl *channel_ops_tbl; };
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dispatch.c new file +4265 -0
2,968 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dispatch.h new file +78 -0
78 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_dispatch.h new file +190 -0
190 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c +7 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.47.3
Part of the diff is not shown here. View the raw message.
illusion.wang
maintainerPATCH v2 12/15 net/nebula-matrix: add Service layer definitions and implementation
In reply to illusion.wangService Layer functions include:
1.queue and Ring Management
2.Network Device Operations
3.VLAN and SubMAC Management
4.Interrupt and IRQ Management
5.Flow and Filter Management
6.VF management
7.link state and SFP Management
8.Statistics and Monitoring
9.Firmware and Device Management
--- .../net/ethernet/nebula-matrix/nbl/Makefile | 1 + .../net/ethernet/nebula-matrix/nbl/nbl_core.h | 4 + .../nebula-matrix/nbl/nbl_core/nbl_service.c | 136 +++++++++++ .../nebula-matrix/nbl/nbl_core/nbl_service.h | 214 ++++++++++++++++++ .../nbl/nbl_include/nbl_def_service.h | 24 ++ .../nbl/nbl_include/nbl_include.h | 21 ++ .../net/ethernet/nebula-matrix/nbl/nbl_main.c | 7 + 7 files changed, 407 insertions(+) create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_service.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_service.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_service.h
drivers/net/ethernet/nebula-matrix/nbl/Makefile +1 -0
@@ -18,6 +18,7 @@ nbl_core-objs += nbl_common/nbl_common.o \ nbl_hw/nbl_vsi.o \ nbl_hw/nbl_adminq.o \ nbl_core/nbl_dispatch.o \ + nbl_core/nbl_service.o \ nbl_main.o # Provide include files
drivers/net/ethernet/nebula-matrix/nbl/nbl_core.h +4 -0
@@ -13,6 +13,7 @@#include "nbl_def_hw.h" #include "nbl_def_resource.h" #include "nbl_def_dispatch.h" +#include "nbl_def_service.h" #include "nbl_def_common.h" #define NBL_ADAP_TO_PDEV (adapter) ((adapter)->pdev)
@@ -23,10 +24,12 @@#define NBL_ADAP_TO_HW_MGT (adapter) ((adapter)->core.hw_mgt)#define NBL_ADAP_TO_RES_MGT (adapter) ((adapter)->core.res_mgt)#define NBL_ADAP_TO_DISP_MGT (adapter) ((adapter)->core.disp_mgt) +#define NBL_ADAP_TO_SERV_MGT (adapter) ((adapter)->core.serv_mgt)#define NBL_ADAP_TO_CHAN_MGT (adapter) ((adapter)->core.chan_mgt)#define NBL_ADAP_TO_HW_OPS_TBL (adapter) ((adapter)->intf.hw_ops_tbl)#define NBL_ADAP_TO_RES_OPS_TBL (adapter) ((adapter)->intf.resource_ops_tbl)#define NBL_ADAP_TO_DISP_OPS_TBL (adapter) ((adapter)->intf.dispatch_ops_tbl) +#define NBL_ADAP_TO_SERV_OPS_TBL (adapter) ((adapter)->intf.service_ops_tbl)#define NBL_ADAP_TO_CHAN_OPS_TBL (adapter) ((adapter)->intf.channel_ops_tbl)#define NBL_ADAPTER_TO_RES_PT_OPS (adapter) \
@@ -71,6 +74,7 @@ struct nbl_interface {struct nbl_hw_ops_tbl *hw_ops_tbl;struct nbl_resource_ops_tbl *resource_ops_tbl;struct nbl_dispatch_ops_tbl *dispatch_ops_tbl; +struct nbl_service_ops_tbl *service_ops_tbl;struct nbl_channel_ops_tbl *channel_ops_tbl; };
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_service.c new file +136 -0
136 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_service.h new file +214 -0
214 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_service.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0*/ +/* +* Copyright (c) 2025 Nebula Matrix Limited. +* Author: +*/ + +#ifndef _NBL_DEF_SERVICE_H_ +#define _NBL_DEF_SERVICE_H_ + +#include "nbl_include.h" + +struct nbl_service_ops { +}; + +struct nbl_service_ops_tbl { +struct nbl_resource_pt_ops pt_ops; +struct nbl_service_ops *ops; +void *priv; +}; + +int nbl_serv_init (void *priv,struct nbl_init_param *param); +void nbl_serv_remove (void *priv); + +#endif
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_include.h +21 -0
@@ -155,6 +155,11 @@ struct nbl_queue_cfg_param {u16 half_offload_en; }; +struct nbl_msix_info_param { +u16 msix_num; +struct msix_entry *msix_entries; +}; +struct nbl_queue_stats {u64 packets;u64 bytes;
@@ -232,6 +237,15 @@ struct nbl_notify_param {u16 tail_ptr; }; +struct nbl_common_irq_num { +int mbx_irq_num; +}; + +struct nbl_ctrl_irq_num { +int adminq_irq_num; +int abnormal_irq_num; +}; +enum nbl_port_type {NBL_PORT_TYPE_UNKNOWN =0 ,NBL_PORT_TYPE_FIBRE ,
@@ -429,6 +443,13 @@ enum nbl_performance_mode { NBL_QUIRKS_UVN_PREFETCH_ALIGN, }; +struct nbl_vsi_param { +u16 vsi_id; +u16 queue_offset; +u16 queue_num; +u8 index; +}; +struct nbl_ring_param {u16 tx_ring_num;u16 rx_ring_num;
drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c +7 -0
@@ -80,7 +80,13 @@ struct nbl_adapter *nbl_core_init(struct pci_dev *pdev, ret =nbl_disp_init (adapter, param);if (ret) goto disp_init_fail; + + ret =nbl_serv_init (adapter, param); +if (ret) + goto serv_init_fail;return adapter; +serv_init_fail: +nbl_disp_remove (adapter); disp_init_fail: product_base_ops->res_remove (adapter); res_init_fail:
@@ -99,6 +105,7 @@ void nbl_core_remove(struct nbl_adapter *adapter) dev =NBL_ADAP_TO_DEV (adapter); product_base_ops =NBL_ADAP_TO_RPDUCT_BASE_OPS (adapter); +nbl_serv_remove (adapter);nbl_disp_remove (adapter); product_base_ops->res_remove (adapter); product_base_ops->chan_remove (adapter);
Signature · 1 line
2.47.3
illusion.wang
maintainerPATCH v2 13/15 net/nebula-matrix: add Dev init,remove operation
In reply to illusion.wangsome important steps in dev init:
1.init common dev:setup mailbox channel queue,alloc mbx task,alloc reset task,register mailbox chan task, register common irq and etc. 2.init ctrl dev: register ctrl irq, init chip, start_mgt_flow, set chan qinfo, setup adminq channel queue, register adminq chan task, alloc some task and etc.
3.init net dev: build, register and set up vsi, register net irq and etc.
--- .../net/ethernet/nebula-matrix/nbl/Makefile | 1 + .../net/ethernet/nebula-matrix/nbl/nbl_core.h | 18 + .../nebula-matrix/nbl/nbl_core/nbl_dev.c | 1428 +++++++++++++++++ .../nebula-matrix/nbl/nbl_core/nbl_dev.h | 250 +++ .../nebula-matrix/nbl/nbl_core/nbl_service.c | 1356 ++++++++++++++++ .../nebula-matrix/nbl/nbl_core/nbl_service.h | 4 +- .../nbl/nbl_include/nbl_def_common.h | 9 + .../nbl/nbl_include/nbl_def_dev.h | 26 + .../nbl/nbl_include/nbl_def_service.h | 72 + .../nbl/nbl_include/nbl_include.h | 52 + .../net/ethernet/nebula-matrix/nbl/nbl_main.c | 42 +- 11 files changed, 3256 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.h create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_dev.h
drivers/net/ethernet/nebula-matrix/nbl/Makefile +1 -0
@@ -19,6 +19,7 @@ nbl_core-objs += nbl_common/nbl_common.o \ nbl_hw/nbl_adminq.o \ nbl_core/nbl_dispatch.o \ nbl_core/nbl_service.o \ + nbl_core/nbl_dev.o \ nbl_main.o # Provide include files
drivers/net/ethernet/nebula-matrix/nbl/nbl_core.h +18 -0
@@ -14,6 +14,7 @@#include "nbl_def_resource.h" #include "nbl_def_dispatch.h" #include "nbl_def_service.h" +#include "nbl_def_dev.h" #include "nbl_def_common.h" #define NBL_ADAP_TO_PDEV (adapter) ((adapter)->pdev)
@@ -25,11 +26,13 @@#define NBL_ADAP_TO_RES_MGT (adapter) ((adapter)->core.res_mgt)#define NBL_ADAP_TO_DISP_MGT (adapter) ((adapter)->core.disp_mgt)#define NBL_ADAP_TO_SERV_MGT (adapter) ((adapter)->core.serv_mgt) +#define NBL_ADAP_TO_DEV_MGT (adapter) ((adapter)->core.dev_mgt)#define NBL_ADAP_TO_CHAN_MGT (adapter) ((adapter)->core.chan_mgt)#define NBL_ADAP_TO_HW_OPS_TBL (adapter) ((adapter)->intf.hw_ops_tbl)#define NBL_ADAP_TO_RES_OPS_TBL (adapter) ((adapter)->intf.resource_ops_tbl)#define NBL_ADAP_TO_DISP_OPS_TBL (adapter) ((adapter)->intf.dispatch_ops_tbl)#define NBL_ADAP_TO_SERV_OPS_TBL (adapter) ((adapter)->intf.service_ops_tbl) +#define NBL_ADAP_TO_DEV_OPS_TBL (adapter) ((adapter)->intf.dev_ops_tbl)#define NBL_ADAP_TO_CHAN_OPS_TBL (adapter) ((adapter)->intf.channel_ops_tbl)#define NBL_ADAPTER_TO_RES_PT_OPS (adapter) \
@@ -70,11 +73,25 @@ enum { NBL_CAP_IS_OCP_BIT, }; +enum nbl_adapter_state { +NBL_DOWN , +NBL_RESETTING , +NBL_RESET_REQUESTED , +NBL_INITING , +NBL_INIT_FAILED , +NBL_RUNNING , +NBL_TESTING , +NBL_USER , +NBL_FATAL_ERR , +NBL_STATE_NBITS +}; +struct nbl_interface {struct nbl_hw_ops_tbl *hw_ops_tbl;struct nbl_resource_ops_tbl *resource_ops_tbl;struct nbl_dispatch_ops_tbl *dispatch_ops_tbl;struct nbl_service_ops_tbl *service_ops_tbl; +struct nbl_dev_ops_tbl *dev_ops_tbl;struct nbl_channel_ops_tbl *channel_ops_tbl; };
@@ -94,6 +111,7 @@ struct nbl_adapter {struct nbl_common_info common;struct nbl_product_base_ops *product_base_ops;struct nbl_init_param init_param; +DECLARE_BITMAP (state,NBL_STATE_NBITS ); };struct nbl_netdev_priv {
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.c new file +1428 -0
1,428 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.h new file +250 -0
250 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_service.c +1356 -0
1,263 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_service.h +3 -1
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_common.h +9 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_dev.h new file +26 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_service.h +72 -0
72 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_include.h +52 -0
52 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c +41 -1
42 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.47.3
Part of the diff is not shown here. View the raw message.
illusion.wang
maintainerPATCH v2 14/15 net/nebula-matrix: add Dev start, stop operation
In reply to illusion.wangsome important steps in dev start:
1.start common dev: config msix map table, alloc and enable msix vectors, register mailbox ISR and enable mailbox irq, set up chan keepalive task.
2.start ctrl dev: request abnormal and adminq ISR , enable them. schedule some ctrl tasks such as adapt desc gother task. 3.start net dev:
3.1 alloc netdev with multi-queue support, config private data
and associatess with the adapter.
3.2 alloc tx/rx rings, set up network resource managements(vlan,rate
limiting)
3.3 build the netdev structure, map queues to msix interrupts, init
hw stats.
3.4 register link stats and reset event chan msg.
3.5 start net vsi and register net irq.
3.6 register netdev
--- .../net/ethernet/nebula-matrix/nbl/nbl_core.h | 3 + .../nebula-matrix/nbl/nbl_core/nbl_dev.c | 1620 ++++++++++++- .../nebula-matrix/nbl/nbl_core/nbl_service.c | 2036 ++++++++++++++++- .../nbl/nbl_include/nbl_def_dev.h | 4 + .../nbl/nbl_include/nbl_def_service.h | 56 + .../net/ethernet/nebula-matrix/nbl/nbl_main.c | 49 + 6 files changed, 3737 insertions(+), 31 deletions(-)
drivers/net/ethernet/nebula-matrix/nbl/nbl_core.h +3 -0
@@ -127,4 +127,7 @@ struct nbl_netdev_priv {struct nbl_adapter *nbl_core_init (struct pci_dev *pdev,struct nbl_init_param *param);void nbl_core_remove (struct nbl_adapter *adapter); +int nbl_core_start (struct nbl_adapter *adapter,struct nbl_init_param *param); +void nbl_core_stop (struct nbl_adapter *adapter); +#endif
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.c +1598 -22
1,751 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_service.c +2027 -9
1,242 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_dev.h +4 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_service.h +56 -0
56 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c +49 -0
49 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.47.3
Part of the diff is not shown here. View the raw message.
illusion.wang
maintainerPATCH v2 15/15 net/nebula-matrix: add st_sysfs and vf name sysfs
In reply to illusion.wangAdd st_sysfs to support our private nblconfig tool. The VF netdev sysfs was introduced to address issues where PF names are sometimes too long. The new support also resolves dependencies on specific udev versions.
--- .../net/ethernet/nebula-matrix/nbl/Makefile | 1 + .../net/ethernet/nebula-matrix/nbl/nbl_core.h | 11 + .../nebula-matrix/nbl/nbl_core/nbl_dev.c | 192 +++++++++++- .../nebula-matrix/nbl/nbl_core/nbl_dev.h | 20 ++ .../nebula-matrix/nbl/nbl_core/nbl_service.c | 296 +++++++++++++++++- .../nebula-matrix/nbl/nbl_core/nbl_service.h | 24 ++ .../nebula-matrix/nbl/nbl_core/nbl_sysfs.c | 85 +++++ .../nebula-matrix/nbl/nbl_core/nbl_sysfs.h | 20 ++ .../nbl/nbl_include/nbl_def_dev.h | 2 + .../nbl/nbl_include/nbl_def_service.h | 4 + .../nbl/nbl_include/nbl_include.h | 19 ++ .../net/ethernet/nebula-matrix/nbl/nbl_main.c | 49 +++ 12 files changed, 721 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_sysfs.c create mode 100644 drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_sysfs.h
drivers/net/ethernet/nebula-matrix/nbl/Makefile +1 -0
@@ -19,6 +19,7 @@ nbl_core-objs += nbl_common/nbl_common.o \ nbl_hw/nbl_adminq.o \ nbl_core/nbl_dispatch.o \ nbl_core/nbl_service.o \ + nbl_core/nbl_sysfs.o \ nbl_core/nbl_dev.o \ nbl_main.o
drivers/net/ethernet/nebula-matrix/nbl/nbl_core.h +11 -0
@@ -124,10 +124,21 @@ struct nbl_netdev_priv {s64 last_st_time; }; +#define NBL_ST_MAX_DEVICE_NUM 96 +struct nbl_software_tool_table { + DECLARE_BITMAP(devid, NBL_ST_MAX_DEVICE_NUM); +int major; +dev_t devno; +struct class *cls; +}; +struct nbl_adapter *nbl_core_init (struct pci_dev *pdev,struct nbl_init_param *param);void nbl_core_remove (struct nbl_adapter *adapter);int nbl_core_start (struct nbl_adapter *adapter,struct nbl_init_param *param);void nbl_core_stop (struct nbl_adapter *adapter); +int nbl_st_init (struct nbl_software_tool_table *st_table); +void nbl_st_remove (struct nbl_software_tool_table *st_table); +struct nbl_software_tool_table *nbl_get_st_table (void );#endif
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.c +191 -1
265 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_dev.h +20 -0
@@ -8,6 +8,7 @@#define _NBL_DEV_H_#include "nbl_core.h" +#include "nbl_sysfs.h" #define NBL_DEV_MGT_TO_COMMON (dev_mgt) ((dev_mgt)->common)#define NBL_DEV_MGT_TO_DEV (dev_mgt) \
@@ -15,6 +16,7 @@#define NBL_DEV_MGT_TO_COMMON_DEV (dev_mgt) ((dev_mgt)->common_dev)#define NBL_DEV_MGT_TO_CTRL_DEV (dev_mgt) ((dev_mgt)->ctrl_dev)#define NBL_DEV_MGT_TO_NET_DEV (dev_mgt) ((dev_mgt)->net_dev) +#define NBL_DEV_MGT_TO_ST_DEV (dev_mgt) ((dev_mgt)->st_dev)#define NBL_DEV_COMMON_TO_MSIX_INFO (dev_common) (&(dev_common)->msix_info)#define NBL_DEV_CTRL_TO_TASK_INFO (dev_ctrl) (&(dev_ctrl)->task_info)#define NBL_DEV_MGT_TO_NETDEV_OPS (dev_mgt) ((dev_mgt)->net_dev->ops)
@@ -177,6 +179,17 @@ struct nbl_dev_net {u16 total_queue_num;u16 kernel_queue_num;u16 total_vfs; +struct nbl_st_name st_name; +}; + +/* Unify res tool. All pf has st char dev. For leonis, only pf0 has adminq, +* so other pf's resoure tool use pf0's char dev actually. +*/ +struct nbl_dev_st_dev { +bool resp_msg_registered; +u8 resv[3 ]; +char st_name[NBL_RESTOOL_NAME_LEN ]; +char real_st_name[NBL_RESTOOL_NAME_LEN ]; };struct nbl_dev_mgt {
@@ -186,6 +199,7 @@ struct nbl_dev_mgt {struct nbl_dev_common *common_dev;struct nbl_dev_ctrl *ctrl_dev;struct nbl_dev_net *net_dev; +struct nbl_dev_st_dev *st_dev; };struct nbl_dev_vsi_feature {
@@ -247,4 +261,10 @@ struct nbl_dev_board_id_table {struct nbl_dev_vsi *nbl_dev_vsi_select (struct nbl_dev_mgt *dev_mgt,u8 vsi_index); +void nbl_net_add_name_attr (struct nbl_netdev_name_attr *dev_name_attr, +char *rep_name); +void nbl_net_remove_dev_attr (struct nbl_dev_net *net_dev); +int nbl_netdev_add_st_sysfs (struct net_device *netdev, +struct nbl_dev_net *net_dev); +void nbl_netdev_remove_st_sysfs (struct nbl_dev_net *net_dev);#endif
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_service.c +295 -1
317 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_service.h +24 -0
@@ -9,6 +9,8 @@#include <linux/mm.h> #include <linux/ptr_ring.h> +#include <linux/cdev.h> +#include "nbl_core.h" #define NBL_SERV_MGT_TO_COMMON (serv_mgt) ((serv_mgt)->common)
@@ -20,6 +22,7 @@#define NBL_SERV_MGT_TO_RING_MGT (serv_mgt) (&(serv_mgt)->ring_mgt)#define NBL_SERV_MGT_TO_FLOW_MGT (serv_mgt) (&(serv_mgt)->flow_mgt)#define NBL_SERV_MGT_TO_NET_RES_MGT (serv_mgt) ((serv_mgt)->net_resource_mgt) +#define NBL_SERV_MGT_TO_ST_MGT (serv_mgt) ((serv_mgt)->st_mgt)#define NBL_SERV_MGT_TO_DISP_OPS_TBL (serv_mgt) ((serv_mgt)->disp_ops_tbl)#define NBL_SERV_MGT_TO_DISP_OPS (serv_mgt) \
@@ -191,6 +194,26 @@ struct nbl_serv_net_resource_mgt {int max_tx_rate; }; +#define IOCTL_TYPE 'n' +#define IOCTL_PASSTHROUGH \ + _IOWR(IOCTL_TYPE, 0x01, struct nbl_passthrough_fw_cmd) +#define IOCTL_ST_INFO _IOR(IOCTL_TYPE, 0x02, struct nbl_st_info_param) + +#define IOCTL_ST_INFO_VERSION 0x10/* 1.0 */ + +struct nbl_serv_st_mgt { +void *serv_mgt; +struct cdev cdev; +int major; +int minor; +dev_t devno; +int subdev_id; +char st_name[NBL_RESTOOL_NAME_LEN ]; +char real_st_name[NBL_RESTOOL_NAME_LEN ]; +bool real_st_name_valid; +u8 resv[3 ]; +}; +struct nbl_service_mgt {struct nbl_common_info *common;struct nbl_dispatch_ops_tbl *disp_ops_tbl;
@@ -198,6 +221,7 @@ struct nbl_service_mgt {struct nbl_serv_ring_mgt ring_mgt;struct nbl_serv_flow_mgt flow_mgt;struct nbl_serv_net_resource_mgt *net_resource_mgt; +struct nbl_serv_st_mgt *st_mgt; };struct nbl_serv_notify_vlan_param {
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_sysfs.c new file +85 -0
85 lines not on this page · raw message
drivers/net/ethernet/nebula-matrix/nbl/nbl_core/nbl_sysfs.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0*/ +/* +* Copyright (c) 2025 Nebula Matrix Limited. +* Author: +*/ + +#ifndef _NBL_SYSFS_H_ +#define _NBL_SYSFS_H_ + +struct nbl_sysfs_st_info { +struct nbl_dev_net *net_dev; +struct kobj_attribute kobj_attr; +}; + +struct nbl_st_name { +struct kobject *st_name_kobj; +struct nbl_sysfs_st_info st_info; +}; + +#endif
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_dev.h +2 -0
@@ -27,4 +27,6 @@ void nbl_dev_stop(void *p);int nbl_dev_setup_vf_config (void *p,int num_vfs);void nbl_dev_remove_vf_config (void *p); +void nbl_dev_register_dev_name (void *p); +void nbl_dev_get_dev_name (void *p,char *dev_name);#endif
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_def_service.h +4 -0
@@ -125,6 +125,10 @@ struct nbl_service_ops {bool (*get_product_fix_cap)(void *priv,enum nbl_fix_cap_type cap_type); +int (*setup_st)(void *priv,void *st_table_param,char *st_name); +void (*remove_st)(void *priv,void *st_table_param); +void (*register_real_st_name)(void *priv,char *st_name); +int (*setup_vf_config)(void *priv,int num_vfs,bool is_flush);void (*remove_vf_config)(void *priv);void (*register_dev_name)(void *priv,u16 vsi_id,char *name);
drivers/net/ethernet/nebula-matrix/nbl/nbl_include/nbl_include.h +19 -0
@@ -379,6 +379,25 @@ struct nbl_cmd_vf_num {u16 vf_max_num[NBL_VF_NUM_CMD_LEN ]; }; +#define NBL_RESTOOL_NAME_LEN 32 +#define NBL_ST_INFO_NAME_LEN (64) +#define NBL_ST_INFO_NETDEV_MAX (8) +#define NBL_ST_INFO_RESERVED_LEN (344) +struct nbl_st_info_param { +u8 version; +u8 bus; +u8 devid; +u8 function; +u16 domain; +u16 rsv0; +char driver_name[NBL_ST_INFO_NAME_LEN ]; +char driver_ver[NBL_ST_INFO_NAME_LEN ]; +char netdev_name[NBL_ST_INFO_NETDEV_MAX ][NBL_ST_INFO_NAME_LEN ]; +char real_chrdev_flag; +char real_chrdev_name[31 ]; +u8 rsv[NBL_ST_INFO_RESERVED_LEN ]; +} __packed; +#define NBL_OPS_CALL (func, para) \ do { \ typeof(func) _func = (func); \
drivers/net/ethernet/nebula-matrix/nbl/nbl_main.c +49 -0
85 lines not on this page · raw message
Signature · 1 line
2.47.3
Re: [PATCH v2 net-next 15/15] net/nebula-matrix: add st_sysfs and vf name sysfs
Quoted 1 line · illusion.wang
Add
st_sysfsto support our private nblconfig tool.
Private tools are unlikely to be accepted. I suggest you drop this patch for the moment. Once you get the rest of the driver merged, we can discuss how to do something acceptable.
Andrew
Jakub Kicinski
maintainerQuoted 1 line · On Fri, 9 Jan 2026 18:01:18 +0800 illusion.wang wrote:
61 files changed, 43278 insertions(+)
No way anyone can review 45kLoC.
Please cut this down to a minimal driver - ~5kLoC + patch 4.