Build Socketcan on Ubuntu 22.04.2 LTS / 5.19.0-35-generic

Dear Support,

I am getting an error when building the SocketCAN_2_0_378_Modified_PeWu_2022-02-11/ix_active_can_2.0.377-MOD for a IB2x card on mentioned Ubuntu version. Unfortunately we can’t use older versions otherwise our DAQ cards will not work anymore, so I am a bit stuck. I am getting errors with the

pci_alloc_consistent(pdev, intf->dmalen, &intf->dmaadd);
pci_free_consistent(pdev, intf->dmalen, intf->dmavadd, intf->dmaadd);

functions, which seems to have been replaced with dma_ function in the newer kernels. Has there been any work done on this? The LTS versions of Ubuntu that you state on your website are going to be out of support within this year so I was hoping there was something new that is not on the website yet?

Thanks
Tim

Kernel Version
5.19.0-35-generic

Ubuntu Version
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy

Hi @Tim-Destinus,

Please use this version of socketcan:
MOVED TO STAFF NOTE (567.5 KB)

MOVED TO STAFF NOTE (567.5 KB)

MOVED TO STAFF NOTE (567.5 KB)

The forum pulls out all .tar files. Here is a link where you can download it: Sign in to your account

Hi Kyle,

Workes great on

ubuntu@ip-172-31-24-163:~/tmp/SocketCAN_2_0_378_Modified_PeWu_2023-02-20/ix_active_can_2.0.377-MOD$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy
ubuntu@ip-172-31-24-163:~/tmp/SocketCAN_2_0_378_Modified_PeWu_2023-02-20/ix_active_can_2.0.377-MOD$ uname -r
5.15.0-1030-aws
ubuntu@ip-172-31-24-163:~/tmp/SocketCAN_2_0_378_Modified_PeWu_2023-02-20/ix_active_can_2.0.377-MOD$

However failes with the below error on the latest mainline kernel with message below. Any thoughts?

Thanks
Tim

tm@Ctrl-GGS-T40:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy
tm@Ctrl-GGS-T40:~$ uname -r
5.19.0-35-generic
tm@Ctrl-GGS-T40:~$

tm@Ctrl-GGS-T40:~/tmp/SocketCAN_2_0_378_Modified_PeWu_2023-02-20/ix_active_can_2.0.377-MOD$ make
make -C /lib/modules/5.19.0-35-generic/build M=/home/tm/tmp/SocketCAN_2_0_378_Modified_PeWu_2023-02-20/ix_active_can_2.0.377-MOD/kernel/drivers/net/can/ixxat_pci_active CONFIG_CAN_IXXAT_PCI_ACTIVE=m modules
make[1]: Entering directory ‘/usr/src/linux-headers-5.19.0-35-generic’
warning: the compiler differs from the one used to build the kernel
The kernel was built by: x86_64-linux-gnu-gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
You are using: gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
CC [M] /home/tm/tmp/SocketCAN_2_0_378_Modified_PeWu_2023-02-20/ix_active_can_2.0.377-MOD/kernel/drivers/net/can/ixxat_pci_active/ixxat_pci_core.o
/home/tm/tmp/SocketCAN_2_0_378_Modified_PeWu_2023-02-20/ix_active_can_2.0.377-MOD/kernel/drivers/net/can/ixxat_pci_active/ixxat_pci_core.c: In function ‘ixxat_pci_int_ena_req’:
/home/tm/tmp/SocketCAN_2_0_378_Modified_PeWu_2023-02-20/ix_active_can_2.0.377-MOD/kernel/drivers/net/can/ixxat_pci_active/ixxat_pci_core.c:279:22: warning: unused variable ‘intSR’ [-Wunused-variable]
279 | volatile u32 intSR = ioread32(intf->reg1vadd + PCIE_ALTERA_LCR_INTCSR);
| ^~~~~
/home/tm/tmp/SocketCAN_2_0_378_Modified_PeWu_2023-02-20/ix_active_can_2.0.377-MOD/kernel/drivers/net/can/ixxat_pci_active/ixxat_pci_core.c: In function ‘ixxat_pci_register_dev’:
/home/tm/tmp/SocketCAN_2_0_378_Modified_PeWu_2023-02-20/ix_active_can_2.0.377-MOD/kernel/drivers/net/can/ixxat_pci_active/ixxat_pci_core.c:429:25: error: implicit declaration of function ‘pci_alloc_consistent’ [-Werror=implicit-function-declaration]
429 | intf->dmavadd = pci_alloc_consistent(pdev, intf->dmalen, &intf->dmaadd);
| ^~~~~~~~~~~~~~~~~~~~
/home/tm/tmp/SocketCAN_2_0_378_Modified_PeWu_2023-02-20/ix_active_can_2.0.377-MOD/kernel/drivers/net/can/ixxat_pci_active/ixxat_pci_core.c:429:23: warning: assignment to ‘void *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
429 | intf->dmavadd = pci_alloc_consistent(pdev, intf->dmalen, &intf->dmaadd);
| ^
/home/tm/tmp/SocketCAN_2_0_378_Modified_PeWu_2023-02-20/ix_active_can_2.0.377-MOD/kernel/drivers/net/can/ixxat_pci_active/ixxat_pci_core.c:456:9: error: implicit declaration of function ‘pci_free_consistent’ [-Werror=implicit-function-declaration]
456 | pci_free_consistent(pdev, intf->dmalen, intf->dmavadd, intf->dmaadd);
| ^~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:257: /home/tm/tmp/SocketCAN_2_0_378_Modified_PeWu_2023-02-20/ix_active_can_2.0.377-MOD/kernel/drivers/net/can/ixxat_pci_active/ixxat_pci_core.o] Error 1
make[1]: *** [Makefile:1850: /home/tm/tmp/SocketCAN_2_0_378_Modified_PeWu_2023-02-20/ix_active_can_2.0.377-MOD/kernel/drivers/net/can/ixxat_pci_active] Error 2
make[1]: Leaving directory ‘/usr/src/linux-headers-5.19.0-35-generic’
make: *** [Makefile:18: all] Error 2

Here is the latest version. Should compile on all Kernels 4-6.

https://fileshare.hms.se?container=V2Ag8NY9wd2SK2769VE5SV7fT2GM6yY9t89vk9wH5GQ5B

The file share will expire on 2023-03-30 13:22

readme_modified.txt (1.6 KB)

Thank you, will check on Monday when I am back in the office. Really cool/good support!

You’re welcome! Please let me know if you have any other questions or run into any other issues.