Skip to content

Mesa Hostmot2 Xenomai4 OOB networking support#4199

Draft
hdiethelm wants to merge 2 commits into
LinuxCNC:masterfrom
hdiethelm:hm2_eth_oob_v5
Draft

Mesa Hostmot2 Xenomai4 OOB networking support#4199
hdiethelm wants to merge 2 commits into
LinuxCNC:masterfrom
hdiethelm:hm2_eth_oob_v5

Conversation

@hdiethelm

@hdiethelm hdiethelm commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

This PR adds Xenomai4 EVL out of band networking support for Mesa Hostmot2.

Out of band networking is basically a fast path inside the xenomai real time kernel that enables networking without involving the normal kernel.

Due to some users might want to use Xenomai4 with the standard kernel networking, I decided to create a new component called hm2_eth_evl while hm2_eth behaves exactly like before.

Common code is left in hm2_eth.c and network specific code is moved to hm2_eth_net.c and hm2_eth_net_evl.c.
The linker is used to link hm2_eth_evl and hm2_eth with two different network implementations and the same common code.

A few changes in the existing code where performed:

  • Fix a bug in src/rtapi/uspace_xenomai_evl.cc. This resulted in a while(true) error message when the kernel and the userspace library did not match.
  • Pass board instead of board->fd to network functions.
  • Don't use a cumbersome void pointer casting one line function for SIOCSARP
  • The ifname is fetched in init_board() and stored in board, so the install_firewall_perinterface() loop is simplifyed and I can reuse the name inside the evl implementation
  • The ip address is stored in board because I need it later
  • Print which board is connected, nice if you have more than one board and it throws an error

Things still open:

  • I have to set the Xenomai4 C and LD flags to all modules, I did not find a way to only set it for a specific module in the Makefile. It will only change anything if you have libevl installed.
  • There are more global symbols. Would it make sense to rename fetch_hwaddr to hm2_fetch_hwaddr for example to avoid conflicts?
  • Loading hm2_eth_evl and hm2_eth at the same time would probably create a runtime linker issue which generates undefined behavior.

It's a bit hard to review due to moved code. git diff master:src/hal/drivers/mesa-hostmot2/hm2_eth.c hm2_eth_oob_v5:src/hal/drivers/mesa-hostmot2/hm2_eth_net.c helps.

If this fails, everything beaks and there are a thon of error messages.
So better abort here
Split into two network implementations, one for posix and
one for evl.

There are now two modules: hm2_eth and hm2_eth_evl.
@hdiethelm

Copy link
Copy Markdown
Contributor Author

BTW: I know, rootless xenomai is still todo. I will do that after #4132 is in. It will conflict otherwhise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant