I have my IB based linux NIC driver that i wanted to compile against mlnx_ofed package that I install.
I have kernel with IB stack enable, but after I install mlnx_ofed my driver symbols wont match with running kernel.
[root@localhost]# modinfo rdma_cm
filename: /lib/modules/5.4.2+/extra/mlnx-ofa_kernel/drivers/infiniband/core/rdma_cm.ko
This is my Makefile(updated) -
obj-m += xyz.o
xyz-y := main.o verbs.o
ccflags-y +=-I$/usr/src/mlnx-ofa_kernel-24.04/include/ -I$/usr/src/mlnx-ofa_kernel-24.04/include/rdma/
BUILD_DIR := $(PWD)/build
BUILD_DIR_MAKEFILE := $(BUILD_DIR)/Makefile
KSYMVERS =/usr/src/ofa_kernel-24.04/source/Module.symvers
all: $(BUILD_DIR_MAKEFILE)
make -C /lib/modules/5.4.2+/extra/ M=$(BUILD_DIR) src=$(PWD) KBUILD_EXTRA_SYMBOLS=“$(KSYMVERS)” modules
$(BUILD_DIR):
mkdir -p “$@”
$(BUILD_DIR_MAKEFILE): $(BUILD_DIR)
touch “$@”
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(BUILD_DIR) src=$(PWD) clean
Anyone build driver based on mlnx_ofed package
Getting this error when Compile driver against mlnx_ofed -
ERROR: “ib_set_device_ops” [/root/xxx-yyy/xxx/xxx.ko] undefined!
Hello atul.raut,
Thanks for posting your inquiry to the NVIDIA Developer Forums.
As part of MLNX_OFED installation, the OS IB stack and libraries are removed and replaced with MLNX_OFED libraries. If you are building a custom module with RDMA in use, that module must be built against MLNX_OFED - and not against the OS stack. If your module is relying on symbols from an older Infiniband API, they may no longer be present in MLNX_OFED.
If you require assistance with developing a kernel module for use with MLNX_OFED, we highly recommend reaching out to our sales and solutions teams (as this sort of activity is out of scope of Enterprise Support). They can assist you with developing a solution which suits your unique business needs.
If you have an account representative, they can assist you with locating a resource. Otherwise, you can get in touch with our Sales and Solutions teams via this contact form: Contact NVIDIA Sales Representatives | NVIDIA
Best regards,
NVIDIA Enterprise Experience
Thank you for your reply, truly appreciated. I don’t have account.
All I need help in getting pointers how to built module against MLNX_OFED.
I tried below in my Makefile but didnt workout. Also copied my driver inside MLNX_OFED source directory & try to build, but failed to load the driver with some undefined symbols error.
KVER := $(shell uname -r)
KDIR := $(MODULES_DIR)/build
MODULES_DIR := /lib/modules/$(KVER)
OFA_KERNEL = /usr/src/ofa_kernel-24.04/source/
ccflags-y += -I$(OFA_KERNEL)/include/ -I$(OFA_KERNEL)/include/rdma
make -C $(KDIR) M=$(PWD) modules
0Tried building mlnx_ofed source code, but getting error missing base.h
cd /usr/src/ofa_kernel-24.04/source
./configure --with-mlx5-mod --with-mlx5_core-mod --with-mlx5_en-mod
make