File: //lib/udev/rules.d/90-rdma-hw-modules.rules
ACTION=="remove", GOTO="rdma_hw_modules_end"
SUBSYSTEM!="net", GOTO="rdma_hw_modules_net_end"
# For Ethernet cards with RoCE support
# Automatically load RDMA specific kernel modules when a multi-function device is installed
# These drivers autoload an ethernet driver based on hardware detection and
# need userspace to load the module that has their RDMA component to turn on
# RDMA.
ENV{ID_NET_DRIVER}=="be2net", RUN{builtin}+="kmod load ocrdma"
ENV{ID_NET_DRIVER}=="bnxt_en", RUN{builtin}+="kmod load bnxt_re"
ENV{ID_NET_DRIVER}=="cxgb4", RUN{builtin}+="kmod load iw_cxgb4"
ENV{ID_NET_DRIVER}=="hns", RUN{builtin}+="kmod load hns_roce"
ENV{ID_NET_DRIVER}=="mlx4_en", RUN{builtin}+="kmod load mlx4_ib"
ENV{ID_NET_DRIVER}=="mlx5_core", RUN{builtin}+="kmod load mlx5_ib"
ENV{ID_NET_DRIVER}=="qede", RUN{builtin}+="kmod load qedr"
# Because most of X722 don't support RDMA, only load i40iw for X722 with specific device IDs.
#define I40E_INTEL_VENDOR_ID 0x8086
#define I40E_DEV_ID_X722 0x37CC
#define I40E_DEV_ID_KX_X722 0x37CE
#define I40E_DEV_ID_QSFP_X722 0x37CF
#define I40E_DEV_ID_SFP_X722 0x37D0
#define I40E_DEV_ID_1G_BASE_T_X722 0x37D1
#define I40E_DEV_ID_10G_BASE_T_X722 0x37D2
#define I40E_DEV_ID_SFP_I_X722 0x37D3
#define I40E_DEV_ID_X722_VF 0x37CD
ENV{ID_NET_DRIVER}=="i40e", ENV{ID_VENDOR_ID}=="0x8086", ENV{ID_MODEL_ID}=="0x37cc", RUN{builtin}+="kmod load i40iw"
ENV{ID_NET_DRIVER}=="i40e", ENV{ID_VENDOR_ID}=="0x8086", ENV{ID_MODEL_ID}=="0x37ce", RUN{builtin}+="kmod load i40iw"
ENV{ID_NET_DRIVER}=="i40e", ENV{ID_VENDOR_ID}=="0x8086", ENV{ID_MODEL_ID}=="0x37cf", RUN{builtin}+="kmod load i40iw"
ENV{ID_NET_DRIVER}=="i40e", ENV{ID_VENDOR_ID}=="0x8086", ENV{ID_MODEL_ID}=="0x37d0", RUN{builtin}+="kmod load i40iw"
ENV{ID_NET_DRIVER}=="i40e", ENV{ID_VENDOR_ID}=="0x8086", ENV{ID_MODEL_ID}=="0x37d1", RUN{builtin}+="kmod load i40iw"
ENV{ID_NET_DRIVER}=="i40e", ENV{ID_VENDOR_ID}=="0x8086", ENV{ID_MODEL_ID}=="0x37d2", RUN{builtin}+="kmod load i40iw"
ENV{ID_NET_DRIVER}=="i40e", ENV{ID_VENDOR_ID}=="0x8086", ENV{ID_MODEL_ID}=="0x37d3", RUN{builtin}+="kmod load i40iw"
ENV{ID_NET_DRIVER}=="i40e", ENV{ID_VENDOR_ID}=="0x8086", ENV{ID_MODEL_ID}=="0x37cd", RUN{builtin}+="kmod load i40iw"
# The user must explicitly load these modules via /etc/modules-load.d/ or otherwise
# rxe
# enic no longer has a userspace verbs driver, this rule should probably be
# owned by libfabric
ENV{ID_NET_DRIVER}=="enic", RUN{builtin}+="kmod load usnic_verbs"
# These providers are single function and autoload RDMA automatically based on
# PCI probing
# hfi1verbs
# ipathverbs
# mthca
# vmw_pvrdma
LABEL="rdma_hw_modules_net_end"
SUBSYSTEM!="pci", GOTO="rdma_hw_modules_pci_end"
# For InfiniBand cards
# Normally the request_module inside the driver will trigger this, but in case that fails due to
# missing modules in the initrd, trigger it again. HW that doesn't create a netdevice will not
# trigger the net based rules above.
ENV{DRIVER}=="mlx4_core", RUN{builtin}+="kmod load mlx4_ib"
ENV{DRIVER}=="mlx5_core", RUN{builtin}+="kmod load mlx5_ib"
LABEL="rdma_hw_modules_pci_end"
LABEL="rdma_hw_modules_end"