How ecdufcdrvr/bcmufctdrvr works
This project is a specialized user-mode Fibre Channel (FC) target driver module designed to integrate with the Storage Performance Development Kit (SPDK) NVMe target application. Its purpose is to provide a low-level FC driver (LLD) that supports selected Broadcom/Emulex Fibre Channel devices in a SPDK environment.
Project Components
• SPDK NVMe Target: The external, larger SPDK framework that hosts the FC driver module.
• FC Driver Module: The core of the project, which consists of multiple C source files (in the src directory) and headers (in include). This module implements:
– Initialization routines, device management, configuration, and control interfaces.
– Low-level functionalities such as error handling, debugging (ocs_debug.c/.h), memory buffers, IO operations, and hardware interfacing (e.g., ocs_device, ocs_hal, sli4, etc.).
– Specialized components for Fibre Channel operations (e.g., ocs_els, ocs_fabric, ocs_scsi).
• Build and Configuration Scripts:
– Makefile: Governs the overall build process.
– start_spdk_tgt.sh and create_spdk_cfg.sh: These shell scripts demonstrate the process of unbinding default kernel drivers, binding the VFIO-PCI module, and configuring the SPDK target with the integrated FC driver.
• Integration and Deployment: The project shows clear integration steps (outlined in the README) that explain how to clone, compile, and include the FC driver module on top of SPDK.
Relationships and Interactions
– The SPDK NVMe target interacts with the FC driver module by invoking its APIs and receiving device I/O responses.
– The FC driver provides interfaces (via its ioctls, fabric configuration, etc.) for higher layers to configure and manage underlying Fibre Channel operations.
– Initialization and configuration scripts (start_spdk_tgt.sh, create_spdk_cfg.sh) act as the entry points for setting up the environment, handling device binding, and launching the SPDK target with FC capabilities.
• Module Interactions: Within the FC driver, represent key functional blocks such as:
– Device and driver initialization (ocs_driver, ocs_domain, ocs_device).
– IO and interrupt handling (ocs_io, ocs_ioctl, ocs_hal).
– Support routines for debugging, error recovery, and logging (ocs_debug, ocs_ras, ocs_recovery).
– Specialized protocol components that deal with Fibre Channel communication (ocs_fc and sli4 modules).
Architectural Patterns and Technologies
• Layered Architecture: At the highest level, the system segregates the SPDK target and the FC driver module. Within the FC driver, further separation can be emphasized:
– An abstraction layer where hardware-specific functionalities (sli4, ocs_hal) are separated from higher level management and control logic (ocs_driver, ocs_domain).
– Utility and helper libraries that implement common functionalities (e.g., CRC calculation in crc32.c, list management in ocs_list.c).
• Modular Design: The large number of discrete source files supports a modular approach where each module (e.g., authentication, fabric management, IO) is developed and maintained separately.
• Technology Stack:
– The project is written in C, built with GNU Make, and heavily integrated with SPDK and DPDK libraries (as inferred from the build instructions and the provided SPDK_DIR and DPDK_DIR references).