Skip to content

hostmot2: bound Ethernet packets and check transfers - #4660

Open
sleepybishop wants to merge 10 commits into
LinuxCNC:masterfrom
sleepybishop:hostmot-eth
Open

sleepybishop wants to merge 10 commits into
LinuxCNC:masterfrom
sleepybishop:hostmot-eth

Conversation

@sleepybishop

@sleepybishop sleepybishop commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Split from #4488 as requested. Checks Ethernet transfer lengths and queue bounds, reserves packet-trailer space, and resets queued reads after send failures.

Local builds pass. Mesa hardware validation remains pending.

Route an empty receive queue through the existing soft-error policy before allocating the receive buffer or touching the socket. A failed queued send clears this queue even though HostMot2 still calls receive.

Cover failed and short sends, unchanged destinations, error-limit escalation, user reset, and a successful queued retry with mock I/O.
@sleepybishop
sleepybishop marked this pull request as ready for review October 10, 2026 03:17
@BsAtHome

Copy link
Copy Markdown
Contributor

The test cannot run without a writable RIP source tree. It also includes the raw hm2_eth source and needs to link with hostmot2 code just to build. The construct in the test is fragile and the compile step is not guaranteed to be stable. The compiler flags are also wrong with respect to how the normal code is compiled. There is currently no good way to perform tests like this.

@sleepybishop

Copy link
Copy Markdown
Contributor Author

The test cannot run without a writable RIP source tree. It also includes the raw hm2_eth source and needs to link with hostmot2 code just to build. The construct in the test is fragile and the compile step is not guaranteed to be stable. The compiler flags are also wrong with respect to how the normal code is compiled. There is currently no good way to perform tests like this.

Thank you, should I remove them? Given the constraints they are unnecessary bloat.

@BsAtHome

Copy link
Copy Markdown
Contributor

For inspiration you can take a look at some other tests, like tests/kins-jacobian and tests/kins-frames. They use halcompile to build the test-frame and then run a test with halrun with a .hal file. Tests that use halcompile --install can only run when there is a (writable) source-tree, which is why the skip file tests for doing a build. A test done in this way can also (ab)use the rtapi_app_main() function to perform the test and return a value for success/error of the test.

@sleepybishop

sleepybishop commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Removed the standalone harness and build hook.

Comment thread tests/hostmot2/eth/README Outdated
@@ -0,0 +1,30 @@
HostMot2 Ethernet software regression tests

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment on the test as the pktuart changes.

Comment on lines 1389 to -1406

// terminal block, 10 pins used, enc 0-2
// terminal block
board->llio.ioport_connector_name[1] = "TB1";

// terminal block, 10 pins used, enc 3-5
board->llio.ioport_connector_name[2] = "TB2";

// terminal block, 8 pins used, Step & Dir 0-3
board->llio.ioport_connector_name[3] = "TB3";

// terminal block, 10 pins used, Step & Dir 4,5, serial Rx/Tx/Txen 0,1
board->llio.ioport_connector_name[2] = "TB4";

// terminal block, 8 inputs, 6 SSR outputs
board->llio.ioport_connector_name[3] = "TB5";

// terminal block, 16 inputs
board->llio.ioport_connector_name[2] = "TB6";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the code is incorrect, the replacement is worse. The 7I95 and 7I95T manuals state TB1...TB6 to be present.

This needs to be checked to match reality.

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.

2 participants