acooks / tn40xx-driver

Linux driver for tn40xx from Tehuti Networks
73 stars 52 forks source link

Debian stable how to compile for ST10GSPEXNB #49

Closed SummerSeaSun closed 2 years ago

SummerSeaSun commented 2 years ago

Hardware: Startech ST10GSPEXNB https://www.startech.com/it-it/ingressi-uscite-reti/st10gspexnb

Software: Debian 11

Hi, can someone please help me to make the driver compatibile with Linux server 5.10.0-13-amd64?

Unfortunately, officialy support is for Linux 3.x to 4.14 LTS Versions only. However, this card could be compatible with Linux server 5.10.0-13-amd64, but startech do not officialy support it.

I've tried to compile official drivers but ends with error:


wget https://sgcdn.startech.com/005329/media/sets/tn4010_Linux_ESXI_Drivers/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card.zip unzip Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card.zip 
cd Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card 

# make all
make -C /lib/modules/5.10.0-13-amd64/build M=/root/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card clean make[1]: ingresso nella directory «/usr/src/linux-headers-5.10.0-13-amd64» make[1]: uscita dalla directory «/usr/src/linux-headers-5.10.0-13-amd64» Generating MV88X3310_phy.h /bin/sh: 3: ./mvidtoh.sh: Permission denied make: *** [Make file:163: MV88X3310_phy.h] Error 126# I've fixed permission on mvidtoh.sh# make all make -C /lib/modules/5.10.0-13-amd64/build M=/root/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card clean make[1]: ingresso nella directory «/usr/src/linux-headers-5.10.0-13-amd64» make[1]: uscita dalla directory «/usr/src/linux-headers-5.10.0-13-amd64» Generating MV88X3310_phy.h /bin/sh: 3: ./mvidtoh.sh: Permission denied make: *** [Make file:163: MV88X3310_phy.h] Errore 126 

# fixed permisson:
root@server:~/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card# chmod +x mvidtoh.sh 

# tried again: make all
make -C /lib/modules/5.10.0-13-amd64/build M=/root/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card clean
make[1]: ingresso nella directory «/usr/src/linux-headers-5.10.0-13-amd64»
make[1]: uscita dalla directory «/usr/src/linux-headers-5.10.0-13-amd64»
Generating MV88X3310_phy.h
Generating MV88E2010_phy.h
Building kernel 5.10.0-13-amd64 resume supported
make -C /lib/modules/5.10.0-13-amd64/build M=/root/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card modules 
make[1]: ingresso nella directory «/usr/src/linux-headers-5.10.0-13-amd64»
  CC [M]  /root/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card/tn40.o
/root/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card/tn40.c: In function ‘bdx_tx_map_skb’:
/root/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card/tn40.c:3644:13: error: assignment to ‘struct skb_frag_struct *’ from incompatible pointer type ‘skb_frag_t *’ {aka ‘struct bio_vec *’} [-Werror=incompatible-pointer-types]
 3644 |    frag     = &skb_shinfo(skb)->frags[i];
      |             ^
/root/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card/tn40.c:3648:62: error: invalid use of undefined type ‘struct skb_frag_struct’
 3648 |    dmaAddr = skb_frag_dma_map(&priv->pdev->dev, frag, 0, frag->size, PCI_DMA_TODEVICE);
      |                                                              ^~
/root/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card/tn40.c:3648:49: error: passing argument 2 of ‘skb_frag_dma_map’ from incompatible pointer type [-Werror=incompatible-pointer-types]
 3648 |    dmaAddr = skb_frag_dma_map(&priv->pdev->dev, frag, 0, frag->size, PCI_DMA_TODEVICE);
      |                                                 ^~~~
      |                                                 |
      |                                                 struct skb_frag_struct *
In file included from /usr/src/linux-headers-5.10.0-13-common/include/linux/if_ether.h:19,
                 from /usr/src/linux-headers-5.10.0-13-common/include/uapi/linux/ethtool.h:19,
                 from /usr/src/linux-headers-5.10.0-13-common/include/linux/ethtool.h:18,
                 from /usr/src/linux-headers-5.10.0-13-common/include/linux/netdevice.h:37,
                 from /root/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card/tn40.h:16,
                 from /root/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card/tn40.c:9:
/usr/src/linux-headers-5.10.0-13-common/include/linux/skbuff.h:3113:26: note: expected ‘const skb_frag_t *’ {aka ‘const struct bio_vec *’} but argument is of type ‘struct skb_frag_struct *’
 3113 |        const skb_frag_t *frag,
      |        ~~~~~~~~~~~~~~~~~~^~~~
/root/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card/tn40.c:3651:33: error: invalid use of undefined type ‘struct skb_frag_struct’
 3651 |    bdx_setTxdb(db, dmaAddr, frag->size);
      |                                 ^~
cc1: some warnings being treated as errors
make[3]: *** [/usr/src/linux-headers-5.10.0-13-common/scripts/Makefile.build:285: /root/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card/tn40.o] Errore 1
make[2]: *** [/usr/src/linux-headers-5.10.0-13-common/Makefile:1846: /root/Tehuti_TN4010_Linux_PCIe_10_Gigabit_Network_Card] Errore 2
make[1]: *** [/usr/src/linux-headers-5.10.0-13-common/Makefile:185: __sub-make] Errore 2
make[1]: uscita dalla directory «/usr/src/linux-headers-5.10.0-13-amd64»
make: *** [Makefile:147: all] Errore 2
SummerSeaSun commented 2 years ago

I've tried also the patched code by https://github.com/christasich available from: https://github.com/acooks/tn40xx-driver/issues/40


 2792.108711] perf: interrupt took too long (3136 > 3133), lowering kernel.perf_event_max_sample_rate to 63750
[27567.213470] tn40xx: Tehuti Network Driver, 0.3.6.17.1
[27567.213478] tn40xx: Supported phys : MV88X3120 MV88X3310  QT2025 TLK10232 AQR105 MUSTANG 
[27567.213627] tn40xx: srom 0x0 HWver 16 build 0 lane# 4 max_pl 0x1 mrrs 0x2
[27567.446165] tn40xx: PHY detected on port 0 ID=2B09AB - MV88X3310 (A1) 10Gbps 10GBase-T
[27570.454300] tn40xx: MV88X3310 initdata applied
[27570.454383] tn40xx: MV88X3310 I/D version is 0.2.8.0
[27570.554649] ------------[ cut here ]------------
[27570.554659] WARNING: CPU: 10 PID: 83133 at net/ethtool/common.c:375 ethtool_check_ops+0x14/0x20
[27570.554660] Modules linked in: tn40xx(OE+) xt_nat veth vboxnetadp(OE) vboxnetflt(OE) xt_tcpudp vboxdrv(OE) md4 sha512_ssse3 sha512_generic cmac xt_conntrack nft_chain_nat xt_MASQUERADE nf_nat nf_conntrack_netlink nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 xfrm_user xfrm_algo nft_counter xt_addrtype nft_compat nf_tables nfnetlink br_netfilter bridge stp llc nls_utf8 cifs overlay libarc4 dns_resolver fscache libdes bonding ipmi_ssif intel_powerclamp coretemp kvm_intel kvm irqbypass ghash_clmulni_intel aesni_intel libaes crypto_simd cryptd glue_helper intel_cstate intel_uncore pcspkr iTCO_wdt intel_pmc_bxt iTCO_vendor_support sg watchdog cp210x joydev usbserial acpi_ipmi ioatdma dca i7core_edac i5500_temp ipmi_si ipmi_devintf ipmi_msghandler evdev acpi_cpufreq fuse configfs ip_tables x_tables autofs4 ext4 crc16 mbcache jbd2 raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c crc32c_generic raid1 raid0 multipath linear md_mod hid_generic usbhid hid
[27570.554745]  sd_mod sr_mod cdrom t10_pi crc_t10dif mgag200 crct10dif_generic i2c_algo_bit drm_kms_helper ahci libahci cec libata uhci_hcd drm ehci_pci ehci_hcd crct10dif_pclmul crct10dif_common crc32_pclmul usbcore e1000e i2c_i801 scsi_mod crc32c_intel lpc_ich i2c_smbus ptp usb_common pps_core button
[27570.554774] CPU: 10 PID: 83133 Comm: modprobe Tainted: G          IOE     5.10.0-13-amd64 #1 Debian 5.10.106-1
[27570.554776] Hardware name: Lenovo 10291BG/S5500BC, BIOS S5500.86B.01.00.0055.112620101923 11/26/2010
[27570.554779] RIP: 0010:ethtool_check_ops+0x14/0x20
[27570.554783] Code: bc f4 ff ff ff eb e6 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 66 66 66 66 90 31 c0 48 83 7f 78 00 74 0d 8b 17 85 d2 75 07 <0f> 0b b8 ea ff ff ff c3 0f 1f 40 00 66 66 66 66 90 4c 8b 8f f8 01
[27570.554784] RSP: 0018:ffffb331c32dfb98 EFLAGS: 00010246
[27570.554787] RAX: 0000000000000000 RBX: ffffffff8f2166c0 RCX: ffffa0545e3e7d90
[27570.554788] RDX: 0000000000000000 RSI: 0000000000000003 RDI: ffffffffc10cd000
[27570.554790] RBP: ffffa0554e57e000 R08: 0000000000000000 R09: 0000000000008010
[27570.554791] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
[27570.554793] R13: ffffb331c0187000 R14: ffffa0554e57e940 R15: ffffa052812740b8
[27570.554795] FS:  00007f7b837c4540(0000) GS:ffffa055dfc80000(0000) knlGS:0000000000000000
[27570.554797] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[27570.554799] CR2: 00007f7b838c0550 CR3: 0000000106370001 CR4: 00000000000226e0
[27570.554800] Call Trace:
[27570.554807]  register_netdevice+0x69/0x650
[27570.554819]  ? MV88X3310_mdio_reset.cold+0x343/0x6f2 [tn40xx]
[27570.554823]  register_netdev+0x1c/0x40
[27570.554831]  bdx_probe+0x2c8/0xb10 [tn40xx]
[27570.554837]  local_pci_probe+0x42/0x80
[27570.554842]  ? _cond_resched+0x16/0x40
[27570.554845]  pci_device_probe+0xfd/0x1b0
[27570.554851]  really_probe+0x222/0x480
[27570.554855]  driver_probe_device+0xe1/0x150
[27570.554858]  device_driver_attach+0xa1/0xb0
[27570.554861]  __driver_attach+0x8a/0x150
[27570.554864]  ? device_driver_attach+0xb0/0xb0
[27570.554866]  ? device_driver_attach+0xb0/0xb0
[27570.554869]  bus_for_each_dev+0x78/0xc0
[27570.554873]  bus_add_driver+0x12b/0x1e0
[27570.554875]  driver_register+0x8b/0xe0
[27570.554883]  ? bdx_tx_timeout+0x20/0x20 [tn40xx]
[27570.554888]  do_one_initcall+0x44/0x1d0
[27570.554893]  ? do_init_module+0x23/0x240
[27570.554896]  ? kmem_cache_alloc_trace+0xf5/0x200
[27570.554899]  do_init_module+0x4c/0x240
[27570.554902]  __do_sys_finit_module+0xb1/0x110
[27570.554908]  do_syscall_64+0x33/0x80
[27570.554911]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[27570.554914] RIP: 0033:0x7f7b838e59b9
[27570.554917] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a7 54 0c 00 f7 d8 64 89 01 48
[27570.554918] RSP: 002b:00007ffdddebf1e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[27570.554921] RAX: ffffffffffffffda RBX: 000056097ddf1c80 RCX: 00007f7b838e59b9
[27570.554922] RDX: 0000000000000000 RSI: 000056097cc0e260 RDI: 0000000000000003
[27570.554924] RBP: 0000000000040000 R08: 0000000000000000 R09: 000056097ddf3c70
[27570.554925] R10: 0000000000000003 R11: 0000000000000246 R12: 000056097cc0e260
[27570.554927] R13: 0000000000000000 R14: 000056097ddf1d90 R15: 000056097ddf1c80
[27570.554930] ---[ end trace 3a3c97faaa9b525a ]---
[27570.554933] tn40xx: register_netdev failed
[27570.554944] ------------[ cut here ]------------
[27570.554949] WARNING: CPU: 10 PID: 83133 at net/core/dev.c:9524 rollback_registered_many+0xb0/0x6c0
[27570.554949] Modules linked in: tn40xx(OE+) xt_nat veth vboxnetadp(OE) vboxnetflt(OE) xt_tcpudp vboxdrv(OE) md4 sha512_ssse3 sha512_generic cmac xt_conntrack nft_chain_nat xt_MASQUERADE nf_nat nf_conntrack_netlink nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 xfrm_user xfrm_algo nft_counter xt_addrtype nft_compat nf_tables nfnetlink br_netfilter bridge stp llc nls_utf8 cifs overlay libarc4 dns_resolver fscache libdes bonding ipmi_ssif intel_powerclamp coretemp kvm_intel kvm irqbypass ghash_clmulni_intel aesni_intel libaes crypto_simd cryptd glue_helper intel_cstate intel_uncore pcspkr iTCO_wdt intel_pmc_bxt iTCO_vendor_support sg watchdog cp210x joydev usbserial acpi_ipmi ioatdma dca i7core_edac i5500_temp ipmi_si ipmi_devintf ipmi_msghandler evdev acpi_cpufreq fuse configfs ip_tables x_tables autofs4 ext4 crc16 mbcache jbd2 raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c crc32c_generic raid1 raid0 multipath linear md_mod hid_generic usbhid hid
[27570.555019]  sd_mod sr_mod cdrom t10_pi crc_t10dif mgag200 crct10dif_generic i2c_algo_bit drm_kms_helper ahci libahci cec libata uhci_hcd drm ehci_pci ehci_hcd crct10dif_pclmul crct10dif_common crc32_pclmul usbcore e1000e i2c_i801 scsi_mod crc32c_intel lpc_ich i2c_smbus ptp usb_common pps_core button
[27570.555043] CPU: 10 PID: 83133 Comm: modprobe Tainted: G        W IOE     5.10.0-13-amd64 #1 Debian 5.10.106-1
[27570.555045] Hardware name: Lenovo 10291BG/S5500BC, BIOS S5500.86B.01.00.0055.112620101923 11/26/2010
[27570.555048] RIP: 0010:rollback_registered_many+0xb0/0x6c0
[27570.555050] Code: 6b 49 8b 44 24 68 4d 8d 7c 24 68 4c 89 e5 48 83 e8 68 49 39 df 74 57 49 89 c4 0f b6 85 d8 04 00 00 84 c0 75 d1 66 66 66 66 90 <0f> 0b 4c 89 ff e8 26 e7 d8 ff 84 c0 74 0f 48 8b 55 68 48 8b 45 70
[27570.555051] RSP: 0018:ffffb331c32dfb38 EFLAGS: 00010246
[27570.555054] RAX: 0000000000000000 RBX: ffffb331c32dfba0 RCX: ffffa055dfc9ca08
[27570.555055] RDX: 0000000000000000 RSI: ffffb331c32dfba0 RDI: ffffffff8f218860
[27570.555057] RBP: ffffa0554e57e000 R08: ffffb331c32dfba0 R09: ffffb331c32dfba0
[27570.555058] R10: ffffb331c32dfa10 R11: ffffffff8f0cb408 R12: ffffb331c32dfb38
[27570.555060] R13: dead000000000122 R14: dead000000000100 R15: ffffa0554e57e068
[27570.555062] FS:  00007f7b837c4540(0000) GS:ffffa055dfc80000(0000) knlGS:0000000000000000
[27570.555064] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[27570.555065] CR2: 00007f7b838c0550 CR3: 0000000106370001 CR4: 00000000000226e0
[27570.555066] Call Trace:
[27570.555071]  unregister_netdevice_queue+0xcf/0x180
[27570.555074]  unregister_netdev+0x18/0x20
[27570.555082]  bdx_probe+0x352/0xb10 [tn40xx]
[27570.555086]  local_pci_probe+0x42/0x80
[27570.555089]  ? _cond_resched+0x16/0x40
[27570.555091]  pci_device_probe+0xfd/0x1b0
[27570.555095]  really_probe+0x222/0x480
[27570.555098]  driver_probe_device+0xe1/0x150
[27570.555101]  device_driver_attach+0xa1/0xb0
[27570.555105]  __driver_attach+0x8a/0x150
[27570.555107]  ? device_driver_attach+0xb0/0xb0
[27570.555110]  ? device_driver_attach+0xb0/0xb0
[27570.555112]  bus_for_each_dev+0x78/0xc0
[27570.555115]  bus_add_driver+0x12b/0x1e0
[27570.555118]  driver_register+0x8b/0xe0
[27570.555125]  ? bdx_tx_timeout+0x20/0x20 [tn40xx]
[27570.555128]  do_one_initcall+0x44/0x1d0
[27570.555131]  ? do_init_module+0x23/0x240
[27570.555133]  ? kmem_cache_alloc_trace+0xf5/0x200
[27570.555136]  do_init_module+0x4c/0x240
[27570.555139]  __do_sys_finit_module+0xb1/0x110
[27570.555143]  do_syscall_64+0x33/0x80
[27570.555145]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[27570.555147] RIP: 0033:0x7f7b838e59b9
[27570.555150] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a7 54 0c 00 f7 d8 64 89 01 48
[27570.555151] RSP: 002b:00007ffdddebf1e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[27570.555154] RAX: ffffffffffffffda RBX: 000056097ddf1c80 RCX: 00007f7b838e59b9
[27570.555155] RDX: 0000000000000000 RSI: 000056097cc0e260 RDI: 0000000000000003
[27570.555157] RBP: 0000000000040000 R08: 0000000000000000 R09: 000056097ddf3c70
[27570.555158] R10: 0000000000000003 R11: 0000000000000246 R12: 000056097cc0e260
[27570.555160] R13: 0000000000000000 R14: 000056097ddf1d90 R15: 000056097ddf1c80
[27570.555163] ---[ end trace 3a3c97faaa9b525b ]---
[27570.555194] network todo 'eth%d' but state 0
[27570.555198] CPU: 10 PID: 83133 Comm: modprobe Tainted: G        W IOE     5.10.0-13-amd64 #1 Debian 5.10.106-1
[27570.555199] Hardware name: Lenovo 10291BG/S5500BC, BIOS S5500.86B.01.00.0055.112620101923 11/26/2010
[27570.555200] Call Trace:
[27570.555206]  dump_stack+0x6b/0x83
[27570.555210]  netdev_run_todo.cold+0x39/0x3e
[27570.555219]  bdx_probe+0x352/0xb10 [tn40xx]
[27570.555223]  local_pci_probe+0x42/0x80
[27570.555226]  ? _cond_resched+0x16/0x40
[27570.555228]  pci_device_probe+0xfd/0x1b0
[27570.555232]  really_probe+0x222/0x480
[27570.555235]  driver_probe_device+0xe1/0x150
[27570.555238]  device_driver_attach+0xa1/0xb0
[27570.555242]  __driver_attach+0x8a/0x150
[27570.555244]  ? device_driver_attach+0xb0/0xb0
[27570.555247]  ? device_driver_attach+0xb0/0xb0
[27570.555249]  bus_for_each_dev+0x78/0xc0
[27570.555252]  bus_add_driver+0x12b/0x1e0
[27570.555255]  driver_register+0x8b/0xe0
[27570.555262]  ? bdx_tx_timeout+0x20/0x20 [tn40xx]
[27570.555265]  do_one_initcall+0x44/0x1d0
[27570.555268]  ? do_init_module+0x23/0x240
[27570.555270]  ? kmem_cache_alloc_trace+0xf5/0x200
[27570.555273]  do_init_module+0x4c/0x240
[27570.555276]  __do_sys_finit_module+0xb1/0x110
[27570.555280]  do_syscall_64+0x33/0x80
[27570.555282]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[27570.555284] RIP: 0033:0x7f7b838e59b9
[27570.555287] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d a7 54 0c 00 f7 d8 64 89 01 48
[27570.555288] RSP: 002b:00007ffdddebf1e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[27570.555291] RAX: ffffffffffffffda RBX: 000056097ddf1c80 RCX: 00007f7b838e59b9
[27570.555292] RDX: 0000000000000000 RSI: 000056097cc0e260 RDI: 0000000000000003
[27570.555294] RBP: 0000000000040000 R08: 0000000000000000 R09: 000056097ddf3c70
[27570.555295] R10: 0000000000000003 R11: 0000000000000246 R12: 000056097cc0e260
[27570.555297] R13: 0000000000000000 R14: 000056097ddf1d90 R15: 000056097ddf1c80
[27570.578405] tn40xx: probe of 0000:03:00.0 failed with error -22
SummerSeaSun commented 2 years ago

https://github.com/acooks/tn40xx-driver/issues/41#issuecomment-1153859406

SOLVED