Skip to content

Fix latency issue with rl pacing - #1649

Merged
Sakoram merged 6 commits into
mainfrom
fix-latency-issue-with-rl-pacing
Aug 25, 2026
Merged

Sakoram merged 6 commits into
mainfrom
fix-latency-issue-with-rl-pacing

Conversation

@Sakoram

@Sakoram Sakoram commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@Sakoram
Sakoram force-pushed the fix-latency-issue-with-rl-pacing branch from 02a56af to 9b04ad5 Compare July 16, 2026 11:31
@Sakoram
Sakoram force-pushed the fix-latency-issue-with-rl-pacing branch from 9b04ad5 to 9831aaf Compare July 23, 2026 14:10
@Sakoram
Sakoram changed the base branch from main to Fix-complaince-checks July 23, 2026 14:12
@Sakoram
Sakoram force-pushed the Fix-complaince-checks branch 2 times, most recently from dcfa843 to 617c0b6 Compare July 28, 2026 14:17
@Sakoram
Sakoram force-pushed the fix-latency-issue-with-rl-pacing branch from 9831aaf to 6c20f67 Compare July 29, 2026 09:21
@Sakoram
Sakoram force-pushed the Fix-complaince-checks branch 5 times, most recently from 257fe07 to b67b50d Compare July 31, 2026 08:15
@Sakoram
Sakoram force-pushed the fix-latency-issue-with-rl-pacing branch from 6c20f67 to db1e27f Compare July 31, 2026 10:57
Base automatically changed from Fix-complaince-checks to main July 31, 2026 11:39
@Sakoram
Sakoram force-pushed the fix-latency-issue-with-rl-pacing branch 2 times, most recently from dc4e56b to ce013ef Compare August 5, 2026 13:46
@Sakoram
Sakoram marked this pull request as ready for review August 5, 2026 13:47

@DawidWesierski4 DawidWesierski4 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.

Gonna do another PR for now this all

Comment thread lib/src/st2110/st_fmt.c
Comment thread lib/src/st2110/st_tx_video_session.c Outdated
Comment thread lib/src/st2110/st_tx_video_session.c
Comment thread lib/src/st2110/st_tx_video_session.c Outdated
Comment thread lib/src/st2110/st_tx_video_session.c
Hold the first content packet until its target TSC and derive default
gates from the same media-clock instant as the RTP timestamp. Preserve
exact-user TAI requests and cover ST20/ST40 timing boundaries.

Signed-off-by: Kasiewicz, Marek <marek.kasiewicz@intel.com>
Release held mbufs on both ports before replacing shared pools while
preserving sibling queue recovery requests. Cover repeated cleanup,
simultaneous requests, and partial-burst ownership.

Signed-off-by: Kasiewicz, Marek <marek.kasiewicz@intel.com>
Check every default, user, exact, jittered, and interlaced frame
against a hardware-tested 300 us regression ceiling. Keep RTP timing
and frame-count checks strict without percentage outlier state.

Signed-off-by: Kasiewicz, Marek <marek.kasiewicz@intel.com>
Run build and test tools with bounded decoded output and checkout-local
MTL and DPDK libraries. Keep gtest routing shell-free and report
actionable NoCtx assertion failures.

Signed-off-by: Kasiewicz, Marek <marek.kasiewicz@intel.com>
@DawidWesierski4
DawidWesierski4 force-pushed the fix-latency-issue-with-rl-pacing branch from ce013ef to 1f26713 Compare August 19, 2026 08:59
Sakoram added a commit that referenced this pull request Aug 21, 2026
Review feedback on #1649 from DawidWesierski4, plus two defects found while
verifying it.

st_muldiv_u64_round_closest() was exported but has no caller outside
st_fmt.c -- neither the library nor the unit tests, which reach the clock
math through the public st10_* API. Made it static again and dropped it
from st_fmt.h. st_tai_round_to_media_clk_ns() stays non-static: it is
called from both st_tx_video_session.c and st_tx_ancillary_session.c.

st_tai_round_to_media_clk_ns() returned 0 for an invalid sampling rate.
As a TAI that is unconditionally in the past, so time_to_tx_ns collapses
to 0 and the frame goes out at line rate. Degrade to a no-op snap instead.

Hoisted the duplicated "exact user pacing was requested AND a timestamp
was actually supplied" test into a named bool in both sync_pacing paths.
The condition itself is unchanged: with EXACT_USER_PACING set but no
timestamp supplied, start_time_tai comes from the epoch, the same source
as the no-flag path, and still needs the media-clock snap. Gating on the
flag alone would skip it, which the new test pins.

Documented why tv_uinit() releases software-held mbufs before
tv_uinit_hw(): the latter frees and clears s->pad[], after which the pad
references retained by failed bursts can no longer be given back and leak
out of the per-interface tx_mbuf_pool. Freeing extbuf chain mbufs early is
not a use-after-free because sh_info counts every live chain mbuf,
NIC-owned ones included, so tv_frame_free_cb() cannot fire while any
packet of that frame is still in a TX descriptor. Updated the knowledge
base, which described the previous ordering as load-bearing.

Also noted the teardown tv_mempool_free() as deliberately best-effort,
hoisted a loop-invariant NULL check out of the pad release loop, and
fixed a struct rte_mbuf* being assigned false instead of NULL.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Kasiewicz, Marek <marek.kasiewicz@intel.com>
Review feedback on #1649 from DawidWesierski4, plus two defects found while
verifying it.

st_muldiv_u64_round_closest() was exported but has no caller outside
st_fmt.c -- neither the library nor the unit tests, which reach the clock
math through the public st10_* API. Made it static again and dropped it
from st_fmt.h. st_tai_round_to_media_clk_ns() stays non-static: it is
called from both st_tx_video_session.c and st_tx_ancillary_session.c.

st_tai_round_to_media_clk_ns() returned 0 for an invalid sampling rate.
As a TAI that is unconditionally in the past, so time_to_tx_ns collapses
to 0 and the frame goes out at line rate. Degrade to a no-op snap instead.

Hoisted the duplicated "exact user pacing was requested AND a timestamp
was actually supplied" test into a named bool in both sync_pacing paths.
The condition itself is unchanged: with EXACT_USER_PACING set but no
timestamp supplied, start_time_tai comes from the epoch, the same source
as the no-flag path, and still needs the media-clock snap. Gating on the
flag alone would skip it, which the new test pins.

Documented why tv_uinit() releases software-held mbufs before
tv_uinit_hw(): the latter frees and clears s->pad[], after which the pad
references retained by failed bursts can no longer be given back and leak
out of the per-interface tx_mbuf_pool. Freeing extbuf chain mbufs early is
not a use-after-free because sh_info counts every live chain mbuf,
NIC-owned ones included, so tv_frame_free_cb() cannot fire while any
packet of that frame is still in a TX descriptor. Updated the knowledge
base, which described the previous ordering as load-bearing.

Also noted the teardown tv_mempool_free() as deliberately best-effort,
hoisted a loop-invariant NULL check out of the pad release loop, and
fixed a struct rte_mbuf* being assigned false instead of NULL.

Signed-off-by: Kasiewicz, Marek <marek.kasiewicz@intel.com>
st20_tx_queue_fatal_error() now refuses to replace a session's pools when
tv_mempool_free() reports one is still in use, but nothing exercised that
path -- the existing transmitter tests only reach the extracted cleanup
helper, never the recovery entry point or the pool release it gates on.

mt_mempool_free() returns 0 even when it declines to free an in-use pool,
so tv_mempool_free() has to detect that itself and keep the pointer.
Pinning both halves of the ownership split: an owned pool is freed and
cleared, an owned pool with an outstanding mbuf reports busy and stays
reachable, returning the mbuf makes it freeable again, and a pool the
session only borrows (tx_mono_pool, mbuf_mempool_reuse_rx) is cleared but
left alive for whoever else shares it.

Signed-off-by: Kasiewicz, Marek <marek.kasiewicz@intel.com>
@Sakoram
Sakoram force-pushed the fix-latency-issue-with-rl-pacing branch from 168f31a to 24990a2 Compare August 21, 2026 08:47
@Sakoram
Sakoram enabled auto-merge (rebase) August 25, 2026 07:07
@Sakoram
Sakoram merged commit ac2d984 into main Aug 25, 2026
43 of 52 checks passed
Sakoram added a commit that referenced this pull request Aug 25, 2026
Review feedback on #1649 from DawidWesierski4, plus two defects found while
verifying it.

st_muldiv_u64_round_closest() was exported but has no caller outside
st_fmt.c -- neither the library nor the unit tests, which reach the clock
math through the public st10_* API. Made it static again and dropped it
from st_fmt.h. st_tai_round_to_media_clk_ns() stays non-static: it is
called from both st_tx_video_session.c and st_tx_ancillary_session.c.

st_tai_round_to_media_clk_ns() returned 0 for an invalid sampling rate.
As a TAI that is unconditionally in the past, so time_to_tx_ns collapses
to 0 and the frame goes out at line rate. Degrade to a no-op snap instead.

Hoisted the duplicated "exact user pacing was requested AND a timestamp
was actually supplied" test into a named bool in both sync_pacing paths.
The condition itself is unchanged: with EXACT_USER_PACING set but no
timestamp supplied, start_time_tai comes from the epoch, the same source
as the no-flag path, and still needs the media-clock snap. Gating on the
flag alone would skip it, which the new test pins.

Documented why tv_uinit() releases software-held mbufs before
tv_uinit_hw(): the latter frees and clears s->pad[], after which the pad
references retained by failed bursts can no longer be given back and leak
out of the per-interface tx_mbuf_pool. Freeing extbuf chain mbufs early is
not a use-after-free because sh_info counts every live chain mbuf,
NIC-owned ones included, so tv_frame_free_cb() cannot fire while any
packet of that frame is still in a TX descriptor. Updated the knowledge
base, which described the previous ordering as load-bearing.

Also noted the teardown tv_mempool_free() as deliberately best-effort,
hoisted a loop-invariant NULL check out of the pad release loop, and
fixed a struct rte_mbuf* being assigned false instead of NULL.

Signed-off-by: Kasiewicz, Marek <marek.kasiewicz@intel.com>
@Sakoram
Sakoram deleted the fix-latency-issue-with-rl-pacing branch August 25, 2026 09:46
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