Skip to content

V1 Header support WIP - #215

Merged
nayakned merged 16 commits into
COVESA:mainfrom
HHN:feature/v1_2025_common_headers
Oct 4, 2026
Merged

nayakned merged 16 commits into
COVESA:mainfrom
HHN:feature/v1_2025_common_headers

Conversation

@SebastianSchildt

@SebastianSchildt SebastianSchildt commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

Some additions and refactoring to support 2025 V1 Common header

High Level Description:

  • Supports V0 and V1 for the AVTPDU based headers (CommonStream, Control and Alternative)
  • To enable highest performance this basically spells put field descriptors for every frame version AND adds versioned accessors for each field sufixxed with -v0 or _v1 (see Readme for details)
    • There /are/ also convenience accessors without the suffix that will check the version field and dispatch to a correct accessor version
      • There is a cost. (see added micro benchmark for details)
  • This also finally inlines the field accessor engine (utils.c). Was an oversight from earlier, and it is sort of the hottest function we have
  • Existing tests still work (there are changes obviously, but those should be mostly addtions or "mecahnical"

How to review?

As you like. Changes are mostly mechanical, to not get lost I do recommend

  • Read updated docs / doc diff as they explain the concept
  • Check the existing examples, so you see the API changes
  • I recommend checking the acf-can examples, especially the bridge: It can generate all variants: TSCFv0, TSCFv1, NTSCFv0, NTSCFv1. On sending it should generate the correct frame (check wirshark), on receiving it automagically accepts anything and should decode it correctly

Note to copilot: This does break API. And that is ok.

@codecov-commenter

codecov-commenter commented Sep 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@e0a9fca). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #215   +/-   ##
=======================================
  Coverage        ?   99.54%           
=======================================
  Files           ?       60           
  Lines           ?     9221           
  Branches        ?      228           
=======================================
  Hits            ?     9179           
  Misses          ?       41           
  Partials        ?        1           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>
Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>
Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>
Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>
…readability

Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>
Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>
Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>
Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>
…asons

Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>
Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>
@SebastianSchildt
SebastianSchildt force-pushed the feature/v1_2025_common_headers branch from d921230 to 612bc37 Compare September 20, 2026 21:13
…e instrumentation

Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>
@SebastianSchildt
SebastianSchildt marked this pull request as ready for review September 30, 2026 10:40
@nayakned
nayakned requested a balanced review from Copilot October 1, 2026 14:33

Copilot AI left a comment

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.

Copilot review overview

🟡 Changes recommended

Unaligned field access, unchecked receive lengths, and incorrect V0 sequence wrap handling can cause runtime failures.

Review effort: Balanced
Findings: 2 High severity · 2 Medium severity

Open (4)
What changed in this PR

Adds IEEE 1722-2025 V1 header support while retaining V0 compatibility.

Changes:

  • Adds versioned headers, accessors, validation, and tests.
  • Updates ACF examples for selectable V0/V1 transport.
  • Inlines field access and adds performance benchmarks.
File Description
unit/​test-tscf.c Expands TSCF version tests.
unit/​test-ntscf.c Expands NTSCF version tests.
unit/​test-cvf.c Adds CVF V1 coverage.
unit/​test-commonstreamheader.c Tests common stream headers.
unit/​test-commonheader.c Tests version support.
unit/​test-avtp.c Removes legacy API tests.
unit/​test-alternativeheader.c Tests alternative headers.
unit/​test-aaf.c Adds AAF V1 coverage.
unit/​CMakeLists.txt Registers tests and adjusts coverage.
src/​avtp/​Utils.c Removes out-of-line field engine.
src/​avtp/​export/​InlineExports.c Exports inline APIs.
src/​avtp/​CommonHeader.c Removes out-of-line common header code.
include/​avtp/​Utils.h Inlines field access.
include/​avtp/​CommonHeader.h Adds inline version-aware common API.
include/​avtp/​AlternativeHeader.h Adds alternative-header API.
examples/​hello-world/​hello-world-talker.c Uses typed V0 accessors.
examples/​cvf/​cvf-talker.c Uses typed V0 accessors.
examples/​cvf/​cvf-listener.c Uses typed V0 accessors.
examples/​crf/​crf-talker.c Uses typed V0 accessors.
examples/​crf/​crf-listener.c Uses typed V0 accessors.
examples/​acf-vss/​acf-vss-talker.c Uses typed V0 accessors.
examples/​acf-can/​zephyr/​Kconfig Adds header-version settings.
examples/​acf-can/​zephyr/​acf-can-bridge.c Selects V0/V1 formats.
examples/​acf-can/​linux/​README.md Documents version options.
examples/​acf-can/​linux/​acf-can-talker.c Adds runtime format selection.
examples/​acf-can/​linux/​acf-can-listener.c Widens sequence tracking.
examples/​acf-can/​linux/​acf-can-bridge.c Adds runtime format selection.
examples/​acf-can/​linux-kernel-mod/​Makefile Removes obsolete objects.
examples/​acf-can/​linux-kernel-mod/​1722ethernet.c Uses typed V0 accessors.
examples/​acf-can/​acf-can-common.h Extends format API.
examples/​acf-can/​acf-can-common.c Encodes and decodes all variants.
examples/​aaf/​aaf-talker.c Uses typed V0 accessors.
examples/​aaf/​aaf-listener.c Uses typed V0 accessors.
docs/​inline.md Documents inline exports and coverage.
docs/​api-design.md Documents versioned APIs.
CMakeLists.txt Adds benchmark subdirectory.
bench/​README.md Documents benchmarks.
bench/​CMakeLists.txt Defines benchmark target.
bench/​check-folding.sh Checks accessor optimization.
bench/​bench-field-access.c Benchmarks accessor performance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread examples/acf-can/acf-can-common.c
Comment thread include/avtp/Utils.h
Comment thread examples/acf-can/acf-can-common.c Outdated
Comment thread examples/acf-can/zephyr/Kconfig
Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>
Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>
Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>

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

Looks good. Maybe a few points to discuss.

Comment thread include/avtp/CommonHeader.h Outdated
Comment thread examples/acf-can/acf-can-common.c
Comment thread examples/acf-can/acf-can-common.c Outdated
Comment thread include/avtp/acf/Ntscf.h Outdated
uint8_t header[AVTP_NTSCF_HEADER_LEN];
uint8_t header[AVTP_NTSCF_HEADER_LEN_V0];
uint8_t payload[0];
} __attribute__((packed)) Avtp_Ntscf_t;

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.

How about also adding typedef struct Avtp_Ntscf_t Avtp_NtscfV0_t?
Same for TSCF as well. We have then both versions of the format explicitly. By default version 0 gets chosen.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

now we have an explicit Avtp_NtscfV0_t , Avtp_Ntscf_t is typedeffed to V0, but also enables agnostic accessors. Init gets a a version where you device at RUNTIME (parameter) whether you want V0 or V1. Other places where it applies use a similar pattern.

Comment thread include/avtp/acf/Ntscf.h
Comment thread include/avtp/acf/Tscf.h
Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>
…eneric alias that can be used for version agnostic access

Signed-off-by: Sebastian Schildt <sebastian.schildt@hs-heilbronn.de>

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

Code and APIs look good. CAN examples tested with CAN, CANV2 formats using NTSCF v0 and v1 combinations.
PCAPs looked as expected.

@nayakned
nayakned merged commit 4f67a56 into COVESA:main Oct 4, 2026
8 checks 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.

4 participants