Skip to content

gen: add UDP raw listen-port selection - #141

Open
rowanG077 wants to merge 2 commits into
enjoy-digital:masterfrom
rowanG077:udpraw-fix-port-selection
Open

gen: add UDP raw listen-port selection#141
rowanG077 wants to merge 2 commits into
enjoy-digital:masterfrom
rowanG077:udpraw-fix-port-selection

Conversation

@rowanG077

@rowanG077 rowanG077 commented Jul 24, 2023

Copy link
Copy Markdown
Contributor

This rebases Rowan Goemans' original udpraw listen-port fix on current master and adds a small cleanup commit on top.

Background: enjoy-digital/litex#1733

Purpose

udpraw should not use the TX-side sink_dst_port signal as its RX crossbar selector. The receive/listen port and transmitted destination port are different concepts:

  • udp_port in the YAML config now selects the static UDP port received by the raw endpoint.
  • If udp_port is omitted, the generated raw endpoint exposes a dynamic udp_listen_port IO.
  • sink_dst_port remains per-packet TX metadata only.
  • ip_address is rejected for raw ports since raw mode already carries per-packet IP metadata.

Credit

  • Original fix/idea by Rowan Goemans in the first commit.
  • Follow-up cleanup/tests in the second commit.

Tested

  • python3 -m unittest test.test_gen
  • python3 -m py_compile liteeth/gen.py test/test_gen.py
  • git diff --check

@rowanG077
rowanG077 force-pushed the udpraw-fix-port-selection branch from d03e33b to 8740aaf Compare July 24, 2023 14:51
@rowanG077 rowanG077 changed the title gen.py: Add proper way to filter incoming packets in udpraw mode hotfix gen.py: Add proper way to filter incoming packets in udpraw mode Jul 24, 2023
rowanG077 and others added 2 commits July 2, 2026 15:41
Keep Rowan Goemans' original udpraw listen-port idea, but make the generated interface explicit and robust on current master.

The raw UDP RX crossbar now listens on a static udp_port when configured, or on a dedicated udp_listen_port IO when left dynamic. The TX sink_dst_port remains packet metadata and no longer doubles as the receive selector.

Also reject unsupported raw ip_address configuration with ValueError and add generator tests for static, dynamic, and invalid raw-port configurations.
@enjoy-digital
enjoy-digital force-pushed the udpraw-fix-port-selection branch from 8740aaf to b03d9c9 Compare July 2, 2026 13:49
@enjoy-digital enjoy-digital changed the title hotfix gen.py: Add proper way to filter incoming packets in udpraw mode gen: add UDP raw listen-port selection Jul 2, 2026
@enjoy-digital

Copy link
Copy Markdown
Owner

Rebased this PR on current master and added a cleanup commit on top of Rowan's original fix.

The cleaned-up version keeps the original intent but avoids using sink_dst_port as the RX selector: raw ports now listen on static udp_port when configured, or expose a dedicated dynamic udp_listen_port IO when omitted. sink_dst_port remains TX packet metadata only.

I also fixed the dynamic-port ordering issue, changed the unsupported raw ip_address case to a ValueError, and added generator tests for static, dynamic, and invalid raw-port configurations.

Tested with:

  • python3 -m unittest test.test_gen
  • python3 -m py_compile liteeth/gen.py test/test_gen.py
  • git diff --check

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants