Skip to content

Support up to 8 NICs in FFmpeg TX path#46

Merged
dmkarthi merged 8 commits into
OpenVisualCloud:mainfrom
sunilnom:multiple_nic_ffmpeg
Jul 23, 2026
Merged

Support up to 8 NICs in FFmpeg TX path#46
dmkarthi merged 8 commits into
OpenVisualCloud:mainfrom
sunilnom:multiple_nic_ffmpeg

Conversation

@sunilnom

Copy link
Copy Markdown
Contributor

Multi-NIC (FFmpeg avdevice mtl_st20p path):

  • Register up to DVLEDTX_MAX_NICS (8, MTL_PORT_MAX) NICs with the shared MTL device via p_port/r_port/p2_port..p7_port AVOptions, since mtl_init()/DPDK EAL is only initialised once per process (session 0 registers every configured NIC on first avformat_write_header()).
  • Set r_tx_ip on session 0's r_port slot so st20_tx_create()'s tv_ops_check() doesn't reject it with "invalid ip 0.0.0.0" (slot 1 aliases MTL_SESSION_PORT_R, so it needs a valid destination IP even though slots 2-7 are device-only registrations).
  • Requires a patched mtl_st20p muxer exposing p2_port..p7_port / p2_sip..p7_sip AVOptions (documented in README); the ENABLE_MTL_TX direct pipeline already supports 8 NICs without any FFmpeg patch.
  • Update config/tx_fullhd_multi_nic.json to an 8-NIC/8-session layout and tx_fullhd_single_session.json for this test environment.

Remove PTP (hardware timing) support:

  • Drop ptp_enable/ptp_pi/ptp_unicast from app_context.h and config_reader.h/.c (was hardcoded, not JSON-configurable).
  • Remove the AVOption-setting block in ffmpeg_tx.c — these options were silently failing on every run (not exposed by the compiled mtl_st20p muxer), so this was dead/no-op code.
  • Remove MTL_FLAG_PTP_* setup and the mtl_tx_ptp_sync_notify_cb callback from the direct MTL TX path (mtl_tx.c).

Validated end-to-end on hardware with 8 SR-IOV VFs: all 8 sessions open and transmit cleanly with no PTP-related warnings.

Description

Checklist

Code Quality

  • Code follows project style guidelines
  • No unnecessary debug logs or commented-out code
  • No hardcoded values / secrets

Testing

  • Unit test added/modified accordingly
  • Perform manual basic sanity testing at system level

Review Readiness

  • PR title and description are clear and meaningful
  • Story/Task IDs are linked

Documentation

  • README or relevant docs updated (if applicable)

Security

  • No sensitive data exposed (keys, passwords, tokens)
  • Input validation added where needed

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes
  • Testing
  • Other... Please describe:

sunilnom added 2 commits July 21, 2026 12:03
Multi-NIC (FFmpeg avdevice mtl_st20p path):
- Register up to DVLEDTX_MAX_NICS (8, MTL_PORT_MAX) NICs with the shared
  MTL device via p_port/r_port/p2_port..p7_port AVOptions, since
  mtl_init()/DPDK EAL is only initialised once per process (session 0
  registers every configured NIC on first avformat_write_header()).
- Set r_tx_ip on session 0's r_port slot so st20_tx_create()'s
  tv_ops_check() doesn't reject it with "invalid ip 0.0.0.0" (slot 1
  aliases MTL_SESSION_PORT_R, so it needs a valid destination IP even
  though slots 2-7 are device-only registrations).
- Requires a patched mtl_st20p muxer exposing p2_port..p7_port /
  p2_sip..p7_sip AVOptions (documented in README); the ENABLE_MTL_TX
  direct pipeline already supports 8 NICs without any FFmpeg patch.
- Update config/tx_fullhd_multi_nic.json to an 8-NIC/8-session layout
  and tx_fullhd_single_session.json for this test environment.

Remove PTP (hardware timing) support:
- Drop ptp_enable/ptp_pi/ptp_unicast from app_context.h and
  config_reader.h/.c (was hardcoded, not JSON-configurable).
- Remove the AVOption-setting block in ffmpeg_tx.c — these options were
  silently failing on every run (not exposed by the compiled mtl_st20p
  muxer), so this was dead/no-op code.
- Remove MTL_FLAG_PTP_* setup and the mtl_tx_ptp_sync_notify_cb callback
  from the direct MTL TX path (mtl_tx.c).

Validated end-to-end on hardware with 8 SR-IOV VFs: all 8 sessions open
and transmit cleanly with no PTP-related warnings.
Guard ctx->idx against ctx->app->st20p_sessions and nic_index against
nic_count before indexing session_net[]/nics[], falling back to app-level
defaults / NIC 0 when out of range. Fixes a segfault in
test_open_ffmpeg_tx_uses_app_defaults (pre-existing bug from upstream's
Multiple NIC for Transmission commit).
Comment thread config/tx_fullhd_single_session.json Outdated
Comment thread config/tx_fullhd_multi_nic.json Outdated
Comment thread src/ffmpeg/ffmpeg_tx.c Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the FFmpeg-based TX path to support registering up to 8 NICs with the MTL device at first initialization (to accommodate the “init once per process” DPDK/MTL constraint), and removes legacy/no-op PTP wiring while updating documentation and example configs accordingly.

Changes:

  • Extend FFmpeg TX multi-NIC registration logic to populate device-level port AVOptions for up to 8 NICs.
  • Document the requirement for a patched mtl_st20p muxer to expose p2_port..p7_port / p2_sip..p7_sip AVOptions.
  • Update example JSON configs for an 8-NIC / 8-session test layout.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/ffmpeg/ffmpeg_tx.c Adds multi-NIC (up to 8) AVOption registration logic for the FFmpeg mtl_st20p TX path.
include/ffmpeg/ffmpeg_tx.h Updates public header comments to describe the multi-NIC behavior/constraints.
README.md Documents muxer patch requirements and notes the multi-NIC configuration pattern.
config/tx_fullhd_single_session.json Updates single-session sample config values for the target test environment.
config/tx_fullhd_multi_nic.json Updates multi-NIC sample config to an 8-NIC / 8-session layout.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ffmpeg/ffmpeg_tx.c Outdated
Comment thread src/ffmpeg/ffmpeg_tx.c
Comment thread README.md Outdated
Comment thread config/tx_fullhd_single_session.json Outdated
Comment thread config/tx_fullhd_multi_nic.json Outdated
@sunilnom sunilnom changed the title Support up to 8 NICs in FFmpeg TX path, remove PTP code Support up to 8 NICs in FFmpeg TX path Jul 22, 2026
- Use relative filenames (not absolute paths) for tx_url in example configs
- Fix stale DVLEDTX_NIC_SLOTS reference in ffmpeg_tx.c comment
- Minimize the multi-NIC registration comment in ffmpeg_tx.c
- Fail fast with a clear error if the mtl_st20p muxer lacks p2_port when
  more than 2 NICs are configured, instead of continuing with only warnings
- Fix README's tx_fullhd_multi_nic.json description (was '6-NIC', now
  '8-NIC/8-session')
Comment thread config/tx_fullhd_multi_nic.json
sunilnom added 3 commits July 23, 2026 09:45
Add an explicit "nic_index" field to every interfaces[] entry and
every tx_sessions[] entry across all sample config files, matching
each entry's array position. This makes the schema consistent for
single-NIC and multi-NIC configs alike (tx_fullhd_multi_nic.json
already used this convention for tx_sessions[]).
…json

Local ad-hoc edits (swapping in an available NIC/video file for this
dev environment) were accidentally included in the previous commit,
breaking test_parse_3sessions_interface_fields which asserts the
fixture's original interface name (0000:03:10.1) and tx_url. Restore
both to their committed values; nic_index additions are unaffected.
Parsing now fails fast with a clear error if an interfaces[] entry's
optional nic_index does not equal its actual position in the array,
catching config authoring mistakes (reordered/duplicated entries)
before they silently misroute a tx_session to the wrong NIC.
Interfaces are still stored positionally; nic_index is not otherwise
used to control storage.
Comment thread README.md
Comment thread src/ffmpeg/ffmpeg_tx.c
Comment thread src/util/config_reader.c
sunilnom added 2 commits July 23, 2026 11:34
Covers the new validation added in config_reader.c:
- nic_index omitted (backward compatible)
- nic_index matches actual array position (multi-interface)
- nic_index mismatch on a non-first entry fails parsing
- nic_index mismatch on the first (only) entry fails parsing

@dmkarthi dmkarthi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@dmkarthi
dmkarthi merged commit 6c1ea7e into OpenVisualCloud:main Jul 23, 2026
1 check passed
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.

3 participants