Re: Xenomai3 network issues

Hannes Diethelm <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
Am 26.05.26 um 15:04 schrieb Jan Kiszka:
> On 20.05.26 01:26, Hannes Diethelm wrote:
>> Hello
>>
>> I don't know if I do something wrong or if there is a bug. However, I
>> can not get any network connectivity from user space over rt_e1000e.
>>
>> Config:
>> Debian Trixie
>> Xenomai3 master d4929cf
>> linux-dovetail v6.12.y-cip-dovetail-rebase e2fc451
>>
>> Setup:
>> modprobe rt_e1000e
> 
> So, you also unbound the device from a e1000e that Linux likely
> provides? Or unloaded that other driver?

Yes, I do:
rmmod e1000e rt_e1000e virtio_balloon
before the commands below.

I run most tests in a VM. There, I also have to remove virtio_balloon
due to an ISR issue. I guess this is a VM issue that could be fixed
with the right config flag. But finding this... Just unload the module,
issue gone.
With virtio_balloon loaded:

rtifconfig rteth0 up 192.168.122.45
ioctl: Device or resource busy

[  153.110152] rt_e1000e: MSI interrupt test failed, using legacy interrupt.
[  153.110612] genirq: Flags mismatch irq 22. 00610000 (rteth0) vs. 00202080 (virtio4)
[  153.110615] ------------[ cut here ]------------
[  153.110616] Trying to free already-free IRQ 22
[  153.110624] WARNING: CPU: 12 PID: 2526 at kernel/irq/manage.c:1974 free_irq+0x202/0x3c0
[  153.110630] Modules linked in: rtudp rtipv4 rt_loopback rt_e1000e nfnetlink_queue nfnetlink_log bluetooth ecdh_generic cfg80211 joydev uinput qrtr rfkill binfmt_misc intel_rapl_msr intel_rapl_common ccp kvm snd_hda_codec_generic irqbypass crct10dif_pclmul ghash_clmulni_intel snd_hda_intel sha512_ssse3 snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec sha256_ssse3 sha1_ssse3 snd_hda_core aesni_intel snd_hwdep gf128mul crypto_simd snd_pcm cryptd pcspkr snd_timer virtio_balloon snd soundcore evdev sg rtnet parport_pc ppdev lp parport configfs efi_pstore nfnetlink vsock_loopback vmw_vsock_virtio_transport_common vmw_vsock_vmci_transport vsock vmw_vmci qemu_fw_cfg virtio_rng ip_tables x_tables autofs4 ext4 crc32c_generic crc16 mbcache jbd2 sr_mod cdrom iTCO_wdt intel_pmc_bxt iTCO_vendor_support virtio_gpu watchdog virtio_dma_buf drm_shmem_helper drm_kms_helper xhci_pci virtio_net psmouse crc32_pclmul ahci net_failover virtio_blk crc32c_intel failover xhci_hcd serio_raw libahci drm libata usbcore scsi_mod usb_common lpc_ich
[  153.110667]  scsi_common i2c_i801 i2c_smbus button [last unloaded: rt_e1000e]
[  153.110671] CPU: 12 UID: 0 PID: 2526 Comm: rtifconfig Not tainted 6.12.85-cip22-xenomai3-54e9c5 #1
[  153.110673] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[  153.110674] IRQ stage: Linux
[  153.110675] RIP: 0010:free_irq+0x202/0x3c0
[  153.110676] Code: 00 00 f0 0f b1 95 c8 00 00 00 0f 85 8b 01 00 00 9c 58 48 89 04 24 e9 c0 fe ff ff 44 89 fe 48 c7 c7 68 09 56 a6 e8 0e 16 f6 ff <0f> 0b 65 f6 05 6f a4 f1 5a 01 74 26 4c 89 ef e8 2a 96 bd 00 90 48
[  153.110678] RSP: 0018:ffffcd5f01ab3aa8 EFLAGS: 00010086
[  153.110679] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000027
[  153.110680] RDX: ffff8bbd2fc20948 RSI: 0000000000000001 RDI: ffff8bbd2fc20940
[  153.110680] RBP: ffff8bb9c2799600 R08: 0000000000000000 R09: ffffcd5f01ab3868
[  153.110681] R10: ffffffffa6cb9f48 R11: 0000000000000003 R12: ffff8bb9e97cc790
[  153.110681] R13: ffff8bb9c27996c8 R14: ffff8bb9c27997a8 R15: 0000000000000016
[  153.110684] FS:  00007f0c9ea86740(0000) GS:ffff8bbd2fc00000(0000) knlGS:0000000000000000
[  153.110688] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  153.110690] CR2: 00007ffa765cd114 CR3: 0000000136d8c000 CR4: 0000000000750ef0
[  153.110691] PKRU: 55555554
[  153.110691] Call Trace:
[  153.110702]  <TASK>
[  153.110706]  rtdm_irq_request+0x7a/0xa0
[  153.110710]  e1000_request_irq+0x202/0x340 [rt_e1000e]
[  153.110718]  e1000_open+0x2f4/0x500 [rt_e1000e]
[  153.110725]  rtdev_open+0x38/0x80 [rtnet]
[  153.110729]  rtdev_up+0xae/0x150 [rtnet]
[  153.110731]  rtnet_core_ioctl+0x89/0x220 [rtnet]
[  153.110734]  ? rtdev_get_by_name+0xcb/0xf0 [rtnet]
[  153.110737]  rtnet_ioctl+0xf6/0x190 [rtnet]
[  153.110739]  __x64_sys_ioctl+0x91/0xd0
[  153.110741]  do_syscall_64+0xc0/0x230
[  153.110744]  ? do_fault+0x395/0x620
[  153.110746]  ? __handle_mm_fault+0x2ae/0x390
[  153.110748]  ? __count_memcg_events+0x67/0x100
[  153.110749]  ? handle_mm_fault+0x1e7/0x2f0
[  153.110750]  ? do_user_addr_fault+0x4c1/0x750
[  153.110752]  ? arch_exit_to_user_mode_prepare.isra.0+0x16/0xa0
[  153.110754]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
[  153.110756] RIP: 0033:0x7f0c9eb9591b
[  153.110771] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 1c 48 8b 44 24 18 64 48 2b 04 25 28 00 00
[  153.110772] RSP: 002b:00007ffc42faee80 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[  153.110773] RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007f0c9eb9591b
[  153.110774] RDX: 0000561f5f8960e0 RSI: 0000000040500000 RDI: 0000000000000003
[  153.110774] RBP: 00007ffc42faf078 R08: 0000000000000003 R09: 0000000000000000
[  153.110775] R10: 0000000000000003 R11: 0000000000000246 R12: 00007ffc42faf6b8
[  153.110775] R13: 00007ffc42faf0a0 R14: 00000000ff7aa8c0 R15: 0000561f5f895dd8
[  153.110776]  </TASK>
[  153.110777] ---[ end trace 0000000000000000 ]---
[  153.110778] rt_e1000e: Unable to allocate interrupt, Error: -16
[  153.110813] rt_e1000e: Interrupt allocation failed

> 
>> modprobe rt_loopback
>> with/without modprobe rtpacket
>> modprobe rtudp
>> modprobe rtipv4
>> rtifconfig rtlo up 127.0.0.1
>> rtifconfig rteth0 up 192.168.122.45
>>
> 
> I suppose you also ran ARP (rtroute solicit) for the targets you want to
> reach, right?

Yes, I use:
rtroute solicit 192.168.122.1 dev rteth0
rtping 192.168.122.1

The connection basically works.

> 
>> I don't need the full RTnet stack, I only need a point to point UDP
>> connection. This
>> is why I manually load the kernel modules and set up the interface.
>> rtnet start
>> blocks while trying to reach a TDMA slave but my device doesn't has this
>> functionality.
>>
>> rtping to any network address works fine, but looking at the rtping
>> code, an ioctl is
>> used, so the data is sent and received in kernel space.
>>
>> I had an issue with my code, so I tried the demo:
>>
>> Without module rtpacket:
>> ./demo/posix/cobalt/eth_p_all
>> There are no packages from the real time driver only from the other
>> network cards
>>
>> ./demo/posix/cobalt/eth_p_all rteth0
>> cannot get interface index: No such device
>>
>> With module rtpacket:
>> ./demo/posix/cobalt/eth_p_all
>> socket cannot be created: Invalid argument
>>
>> ./demo/posix/cobalt/eth_p_all rteth0
>> socket cannot be created: Invalid argument
> 
> Cannot confirm that second experiment yet. Did you compile with
> CONFIG_XENO_DRIVERS_NET_ETH_P_ALL?

Thanks for the hint, now the example works mostly. I just took the only
example for networking I found and it looks like it was not supposed
to do what I needed.

./demo/posix/cobalt/eth_p_all
now shows all incoming packages.

./demo/posix/cobalt/eth_p_all rteth0
Shows nothing. Shouldn't that show all packages on that interface also?

A simple UDP test example I created now works also. CONFIG_XENO_DRIVERS_NET_ETH_P_ALL
is not even needed for this one.

The documentation[1] says still to use rt_dev_* functions, which doesn't exist, at least
with the posix skin. It says "POSIX skin allows you to use socket functions ..." but it took
me some time to figure out that all the rest of the doc is probably outdated or only applicable
to the alchemy skin and I must just use the POSIX functions with the right flags from xeno-config.

Is there any documentation about xenomai3 networking?

Sorry for the false alarm. Now I should be able to get the main application running.

> 
>>
>> rtifconfig
>> rteth0    Medium: Ethernet  Hardware address: 52:54:00:5A:79:C5
>>            IP address: 192.168.122.45  Broadcast address: 192.168.122.255
>>            UP BROADCAST RUNNING  MTU: 1500
>>
>> rtlo      Medium: Local Loopback
>>            IP address: 127.0.0.1
>>            UP LOOPBACK RUNNING  MTU: 1500
>>
>> Regards
>> Hannes
> 
> Jan
> 

[1] https://v3.xenomai.org/rtnet/programming/index.html

Regards
Hannes
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.