Building kernel module with ib client (un)register functions

Written minimal code of a kernel module registering RDMA-client using two functions ib_register_client(), ib_unregister_client(). The compiled code with the source code can be downloaded from the repository: GitHub - sSadin/rdma_core_init: Trying to init RDMA provided by Mellanox adapters in kernel module GitHub - sSadin/rdma_core_init: Trying to init RDMA provided by Mellanox adapters in kernel module

The compilation is successful. However, the module isn’t loading, it generates an error in the system log:

… rdma_init: disagrees about version of symbol ib_unregister_client

… rdma_init: Unknown symbol ib_unregister_client (err -22)

… rdma_init: disagrees about version of symbol ib_register_client

… rdma_init: Unknown symbol ib_register_client (err -22)


Installed OS: Ubunto 16.04

@uname -r

4.4.114

Installed Mellanox software: MLNX_OFED_LINUX-4.4-1.0.0.0-ubuntu16.04-x86_64.tgz

with command:

@./mlnxofedinstall --add-kernel-support

After install, there is new catalogs:

/usr/src/mlnx-ofed-kernel-4.4/include

/usr/src/ofa_kernel/default/include

with includes. But in /usr/src/linux-headers-4.4.0-116/include have “old” versions of files.


@modinfo rdma_core_init.ko

srcversion: 21C176F120C52D1ED6D19F1

depends: ib_core

vermagic: 4.4.114


@modinfo ib_core

filename: /lib/modules/4.4.114/updates/dkms/ib_core.ko

description: core kernel InfiniBand API

srcversion: A1112DAE0CC4C253540C773

depends: mlx_compat

vermagic: 4.4.114

Note: if open the generated file rdma_init.mod.ko:

{ 0x51b43427, __VMLINUX_SYMBOL_STR(ib_register_client) },

and i open file ib_core.ko from path: /lib/modules/4.4.114/build/drivers/infiniband/core

CRC for this function is the same:

0000000051b43427 A __crc_ib_register_client

But command [modinfo ib_core] points to path: /lib/modules/4.4.114/updates/dkms, and CRC for this function is:

00000000b184c3d5 A __crc_ib_register_client

Q: what should I do to compile and load the module correctly?

Mellanox OFED install new set of drivers under /lib/modules/<uname -r>/updates directory and it has higher priority than inbox modules. That’s why modinfo command gives a different location of ib_core module.

For symbols, you might be interested to adjust your Makefile to use newer Module.symvers file that should be under rdma-core directory.