# kldload doesn't load module, even after recompiling kernel



## lionsden (Mar 11, 2019)

Hi Everyone,

This is my very first post ever on FreeBSD. Recently I installed dpdk on freebsd 12. After compiling dpdk in /usr/port/net/dpdk and also compiled via downloading source code. 

I tried to load contigmem module required for dpdk.

```
# kenv hw.contigmem.buffer_size=10737418

hw.contigmem.buffer_size="10737418"

# sysctl -a hw.contigmem

sysctl: unknown oid 'hw.contigmem'

# kldload ./kmod/contigmem.ko

kldload: can't load ./kmod/contigmem.ko: No such file or directory

# setenv contigmem_load "YES"

# kldload ./kmod/contigmem.ko
kldload: can't load ./kmod/contigmem.ko: No such file or directory

# kldload ./kmod/nic_uio.ko
kldload: can't load ./kmod/nic_uio.ko: No such file or directory
```
I googled this issue and found out some answers where after recompiling the kernel or reducing the buffer size this issue might go away. It did not happen in my case. Can someone please help?


----------



## SirDice (Mar 11, 2019)

Run `pkg info -D dpdk`:

```
===============================================================================

The Intel(R) DPDK requires two kernel modules to be loaded in order to run.
To load these modules add loading lines to /boot/loader.conf

	contigmem_load="YES"
	nic_uio_load="YES"

The modules each take a number of parameters. These should be set in loader.conf
before the above two lines to load the module.

* The "contigmem" module is used to reserve contiguous blocks of physical memory
  for packet buffer use. It takes parameters for the number and size of blocks
  to be reserved. An example is below, reserving a single 1G block:

	hw.contigmem.num_buffers=1
	hw.contigmem.buffer_size=1073741824

* The "nic_uio" module is used to expose the network card (NIC) hardware
  directly to userspace for use with the Intel(R) DPDK. If the NIC ports to be
  used are in use by an existing driver, the nic_uio module can unbind the port
  from its existing driver when requested to do so. This is done by passing the
  relevant PCI bus, device and function settings to the driver as parameters.
  For example:

	hw.nic_uio.bdfs="2:0:0,2:0:1"

===============================================================================
```


----------



## Ordoban (Mar 11, 2019)

lionsden said:


> kldload: can't load ./kmod/contigmem.ko: No such file or directory


Does this not mean the path or filename is wrong?
You can try to use an absolute path:

```
root@FreeBSD-test:~ # pwd
/root
root@FreeBSD-test:~ # kldload ./kernel/smbfs.ko
kldload: can't load ./kernel/smbfs.ko: No such file or directory
root@FreeBSD-test:~ # kldload /boot/kernel/smbfs.ko
root@FreeBSD-test:~ # kldstat
Id Refs Address            Size     Name
 1   24 0xffffffff80200000 20647f8  kernel
 2    1 0xffffffff82266000 381080   zfs.ko
 3    2 0xffffffff825e8000 a380     opensolaris.ko
 4    1 0xffffffff82819000 6fc4     tmpfs.ko
 5    1 0xffffffff82820000 1780     uhid.ko
 8    1 0xffffffff82822000 16684    smbfs.ko
 9    2 0xffffffff82839000 2ee8     libiconv.ko
10    2 0xffffffff8283c000 1ddc     libmchain.ko
root@FreeBSD-test:~ # kldunload smbfs.ko
```


----------



## lionsden (Mar 12, 2019)

I tried whole path and pkg info -D dpdk but same error.

By the way, if I run "pkg info -D dpdk" do i still have to run this kload command?


----------



## Ordoban (Mar 12, 2019)

lionsden said:


> By the way, if I run "pkg info -D dpdk" do i still have to run this kload command?


Is this a serious question? So you should read the manual and try to understand what this commands are doing. You can read the command help by typing
`man pkg` and `man kldload`


----------

