scsi: Add LeapRAID driver support
Subsystems (3)
Dongdong Hao
maintainerv4 cover scsi: Add LeapRAID driver support
This series adds the LeapRAID driver and its documentation.
Changes in v4:
- Fix the documented multipath module parameter name to enable_mp
- Polish documentation wording and naming consistency
Dongdong Hao (2):
scsi: leapraid: Add new SCSI driver
scsi: leapraid: Add driver documentation
Documentation/scsi/index.rst | 1 + Documentation/scsi/leapraid.rst | 139 + MAINTAINERS | 7 + drivers/scsi/Kconfig | 1 + drivers/scsi/Makefile | 1 + drivers/scsi/leapraid/Kconfig | 14 + drivers/scsi/leapraid/Makefile | 10 + drivers/scsi/leapraid/leapraid.h | 2050 +++++ drivers/scsi/leapraid/leapraid_app.c | 699 ++ drivers/scsi/leapraid/leapraid_func.c | 8980 ++++++++++++++++++++ drivers/scsi/leapraid/leapraid_func.h | 1558 ++++ drivers/scsi/leapraid/leapraid_os.c | 2516 ++++++ drivers/scsi/leapraid/leapraid_transport.c | 1387 +++ 13 files changed, 17363 insertions(+) create mode 100644 Documentation/scsi/leapraid.rst create mode 100644 drivers/scsi/leapraid/Kconfig create mode 100644 drivers/scsi/leapraid/Makefile create mode 100644 drivers/scsi/leapraid/leapraid.h create mode 100644 drivers/scsi/leapraid/leapraid_app.c create mode 100644 drivers/scsi/leapraid/leapraid_func.c create mode 100644 drivers/scsi/leapraid/leapraid_func.h create mode 100644 drivers/scsi/leapraid/leapraid_os.c create mode 100644 drivers/scsi/leapraid/leapraid_transport.c
Signature · 1 line
2.25.1
Dongdong Hao
maintainerPATCH v4 1/2 scsi: leapraid: Add new SCSI driver
The LeapRAID driver provides support for LeapRAID PCIe RAID controllers, enabling communication between the host operating system, firmware, and hardware for efficient storage management.
The driver is organized into several logical modules, each with a clear responsibility:
leapraid_os.c: Integrates with the Linux SCSI subsystem, handling host template callbacks, PCIe device probing, and initialization.
leapraid_func.c: Contains low-level routines for firmware/hardware interaction, interrupt handling, and reset logic.
leapraid_app.c: Provides the ioctl interface for user-space tools.
leapraid_transport.c: Manages interactions with the SCSI transport layer for SAS PHYs and ports.
leapraid_func.h: Contains internal definitions shared among driver modules.
leapraid.h: Contains low-level hardware definitions for driver/firmware interaction.
The leapraid_probe() function orchestrates the setup: it allocates the adapter structure and SCSI host, configures hardware interfaces, and registers it with the SCSI mid-layer. Following registration, scsi_scan_host() is invoked to initiate device discovery, with firmware reporting devices via interrupt-driven events.
This initial commit provides the necessary infrastructure for subsequent development of full I/O path handling, error recovery, and advanced management features.
--- MAINTAINERS | 7 + drivers/scsi/Kconfig | 1 + drivers/scsi/Makefile | 1 + drivers/scsi/leapraid/Kconfig | 14 + drivers/scsi/leapraid/Makefile | 10 + drivers/scsi/leapraid/leapraid.h | 2050 +++++ drivers/scsi/leapraid/leapraid_app.c | 699 ++ drivers/scsi/leapraid/leapraid_func.c | 8980 ++++++++++++++++++++ drivers/scsi/leapraid/leapraid_func.h | 1558 ++++ drivers/scsi/leapraid/leapraid_os.c | 2516 ++++++ drivers/scsi/leapraid/leapraid_transport.c | 1387 +++ 11 files changed, 17223 insertions(+) create mode 100644 drivers/scsi/leapraid/Kconfig create mode 100644 drivers/scsi/leapraid/Makefile create mode 100644 drivers/scsi/leapraid/leapraid.h create mode 100644 drivers/scsi/leapraid/leapraid_app.c create mode 100644 drivers/scsi/leapraid/leapraid_func.c create mode 100644 drivers/scsi/leapraid/leapraid_func.h create mode 100644 drivers/scsi/leapraid/leapraid_os.c create mode 100644 drivers/scsi/leapraid/leapraid_transport.c
MAINTAINERS +7 -0
@@ -14507,6 +14507,13 @@ S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening F: scripts/leaking_addresses.pl +LEAPIO SCSI RAID DRIVER +M: Dongdong Hao <[email protected]> +L: [email protected] +S: Supported +F: Documentation/scsi/leapraid.rst +F: drivers/scsi/leapraid/ + LED SUBSYSTEM M: Lee Jones <[email protected]> M: Pavel Machek <[email protected]>
drivers/scsi/Kconfig +1 -0
@@ -499,6 +499,7 @@ source "drivers/scsi/esas2r/Kconfig" source "drivers/scsi/megaraid/Kconfig.megaraid" source "drivers/scsi/mpt3sas/Kconfig" source "drivers/scsi/mpi3mr/Kconfig" +source "drivers/scsi/leapraid/Kconfig" source "drivers/scsi/smartpqi/Kconfig" config SCSI_HPTIOP
drivers/scsi/Makefile +1 -0
@@ -91,6 +91,7 @@ obj-$(CONFIG_SCSI_BFA_FC) += bfa/ obj-$(CONFIG_SCSI_CHELSIO_FCOE) += csiostor/ obj-$(CONFIG_SCSI_DMX3191D) += dmx3191d.o obj-$(CONFIG_SCSI_HPSA) += hpsa.o +obj-$(CONFIG_SCSI_LEAPRAID) += leapraid/ obj-$(CONFIG_SCSI_SMARTPQI) += smartpqi/ obj-$(CONFIG_SCSI_SYM53C8XX_2) += sym53c8xx_2/ obj-$(CONFIG_SCSI_ZALON) += zalon7xx.o
drivers/scsi/leapraid/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +config SCSI_LEAPRAID + tristate "LeapIO RAID Adapter" + depends on PCI && SCSI + select SCSI_SAS_ATTRS + help + This driver supports LeapIO PCIe-based storage + and RAID controllers. + + <http://www.leap-io.com> + + To compile this driver as a module, choose M here: the + resulting kernel module will be named leapraid.
drivers/scsi/leapraid/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for the LEAPRAID drivers. +# + +obj-$(CONFIG_SCSI_LEAPRAID) += leapraid.o +leapraid-objs += leapraid_func.o \ + leapraid_os.o \ + leapraid_transport.o \ + leapraid_app.o
drivers/scsi/leapraid/leapraid.h new file +2050 -0
2,050 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_app.c new file +699 -0
699 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_func.c new file +8980 -0
200 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_func.h new file +1558 -0
1,558 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_os.c new file +2516 -0
2,516 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_transport.c new file +1387 -0
1,387 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.25.1
Part of the diff is not shown here. View the raw message.
Dongdong Hao
maintainerPATCH v4 2/2 scsi: leapraid: Add driver documentation
In reply to Dongdong HaoThis patch adds the necessary documentation for the LeapRAID SCSI driver to the kernel's documentation tree.
--- Documentation/scsi/index.rst | 1 + Documentation/scsi/leapraid.rst | 139 ++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 Documentation/scsi/leapraid.rst
Documentation/scsi/index.rst +1 -0
@@ -56,6 +56,7 @@ SCSI host adapter drivers g_NCR5380 hpsa hptiop + leapraid libsas lpfc megaraid
Documentation/scsi/leapraid.rst new file +139 -0
139 lines not on this page · raw message
Signature · 1 line
2.25.1
[email protected]
AI reviewRe: [PATCH v4 2/2] scsi: leapraid: Add driver documentation
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [Medium] Custom sysfs attributes introduced for standard SCSI/SAS features. - [Medium] Kernel-space SMART…
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] Custom sysfs attributes introduced for standard SCSI/SAS features.
- [Medium] Kernel-space SMART polling thread violates separation of concerns.
- [Medium] Custom module parameters introduced for interrupt routing management. --
commit 60c41a7c6ea7e2df6e1711553263bb526e40d738
Author: Dongdong Hao <[email protected]>
scsi: leapraid: Add driver documentation
This patch adds the necessary documentation for the LeapRAID SCSI driver to the kernel's documentation tree.
Quoted 5 lines
Documentation/scsi/leapraid.rst new file +0
-0
[ ... ]
Quoted 28 lines
Documentation/scsi/leapraid.rst new file +28
-0+LeapRAID specific host attributes +================================= + +:: + + /sys/class/scsi_host/host*/fw_queue_depth + /sys/class/scsi_host/host*/host_sas_address + /sys/class/scsi_host/host*/board_name + +The host "fw_queue_depth" read-only attribute shows the firmware queue +depth of the host. + +The host "host_sas_address" read-only attribute shows the SAS address +of the host. + +The host "board_name" read-only attribute shows the board name reported +by manufacturing page 0. + +LeapRAID specific disk attributes +================================= + +:: + + /sys/class/scsi_disk/host:bus:target:lun/device/sas_address + /sys/class/scsi_disk/host:bus:target:lun/device/sas_device_handle + /sys/class/scsi_disk/host:bus:target:lun/device/sas_ncq + +The disk "sas_address" read-only attribute shows the SAS address of the
Documentation/scsi/leapraid.rst line 67
Quoted 10 lines
Documentation/scsi/leapraid.rst new file +10
-0+disk. + +The read-only attribute "sas_device_handle" represents the disk's device +handle, which is a unique identifier maintained by the firmware. + +This attribute "sas_ncq" controls the Native Command Queuing (NCQ) feature +for SATA devices. A value of 0 indicates that NCQ is currently disabled or +not supported. Writing 1 attempts to enable NCQ on the device. If the +operation succeeds, the value remains 1, indicating that NCQ has been +successfully enabled.
[Severity: Medium]
Should these features be exposed via custom driver-specific sysfs nodes rather than using standard kernel mechanisms?
In Linux, SAS topologies and addresses should generally be exposed via the standard scsi_transport_sas class, and NCQ is typically managed through the standard SCSI queue_depth interface. Introducing driver-specific sysfs nodes for standard capabilities creates UAPI fragmentation and breaks compatibility with standard userspace tools.
[ ... ]
Quoted 13 lines
+3.
msix_disable
+---------------Documentation/scsi/leapraid.rst new file +11
-0+ +This parameter specifies whether MSI-X interrupts should be disabled. By +default, 0 keeps MSI-X enabled, providing high-performance interrupt +handling. Setting this parameter to 1 disables MSI-X, causing the driver +to fall back to legacy INTx interrupts. + +4. max_msix_vectors +------------------- + +This parameter sets the upper limit on the number of MSI-X interrupt +vectors that the driver will request during initialization. The default
Documentation/scsi/leapraid.rst line 114
Quoted 10 lines
Documentation/scsi/leapraid.rst new file +10
-0+value of -1 allows the driver to use all available vectors as provided +by the device. Setting a positive integer restricts the number of vectors. + +5. interrupt_mode +----------------- + +This parameter defines which interrupt delivery mechanism is used by the +driver. A value of 0 selects MSI-X mode (default), providing the highest +performance and scalability. A value of 1 switches to MSI mode, while 2 +forces the driver to use legacy INTx interrupts.
[Severity: Medium]
Is it appropriate to expose these low-level interrupt routing knobs to users via module parameters?
The Linux PCI core (pci_alloc_irq_vectors()) is designed to automatically handle vector allocation and gracefully fall back from MSI-X to MSI to INTx. If there are hardware quirks or broken MSI-X implementations, shouldn't they be handled programmatically via standard PCI quirks rather than shifting the configuration burden to users?
[ ... ]
Documentation/scsi/leapraid.rst line 128
Quoted 7 lines
+7.
smart_poll
+-------------Documentation/scsi/leapraid.rst new file +5
-0+ +This parameter controls the SMART polling mechanism for SATA drives. When +enabled (1), the driver periodically checks the health of connected SATA +devices, allowing early detection of potential drive failures. The default +value is 0, which disables SMART polling.
[Severity: Medium]
Does this background SMART polling belong in the kernel driver?
SMART monitoring and health polling are typically userspace policy domains handled by tools like smartd via standard ATA pass-through. Implementing this in the kernel duplicates userspace functionality, unnecessarily bloats the kernel, and could lead to concurrent ATA command collisions with standard monitoring tools.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2