Skip to content

Conversation

@ovsrobot
Copy link
Owner

@ovsrobot ovsrobot commented Oct 31, 2025

Auto-submission for "http://patchwork.dpdk.org/project/dpdk/list/?series=36536"

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Added allocation failure handling in performance testing paths.
    • Improved VLAN and QinQ packet transmission handling.
  • New Features

    • Added performance mode scaling capability for test scenarios.
  • Refactor

    • Simplified VLAN insertion capability logic for cleaner code paths.
    • Enhanced VLAN tag placement determination in packet transmission.

tmonjalo and others added 4 commits October 31, 2025 12:03
When reserving a specific memory amount, it was possible to pass
the first allocations and fail on a later allocation
where there was no check, resulting in a crash.
It is fixed by stopping the test if allocation failed.

Fixes: fd368e1 ("test/hash: test more corner cases")
Fixes: 9c7d8ee ("test/hash: add RCU tests")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: David Marchand <david.marchand@redhat.com>
When running on limited platforms like GitHub Actions,
the functional unit test "hash_readwrite_func_autotest"
will hit a timeout, especially when running with UBSan:

46/102 DPDK:fast-tests / hash_readwrite_func_autotest  TIMEOUT  30.01s
killed by signal 15 SIGTERM

Similarly to what was done in the
commit fd368e1 ("test/hash: test more corner cases"),
some constants are decreased.
In order to keep the performance test as it was,
a multiplier is kept for performance test case only.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
QinQ insertion was enabled in the bulk transmit function but not the
single packet transmit function. Implement it in the single packet
function.

Also, fix an issue that would arise in the event an mbuf had both the
VLAN and QINQ offload flags set. In this case the L2TAG2 field would be
written to twice and could cause the tag to be corrupted. Reorder the
logic of populating the L2TAG2 field and ensure that the field is only
written to once.

Fixes: 3aa4efa ("net/iavf: support VLAN insertion in AVX512 Tx")

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
Commit fdc3796 ("net/iavf: support QinQ insertion offload in scalar
Tx") broke single VLAN insertion offload in cases where the v2 offload
capability and both inner and outer insertion were supported because it
caused inner VLAN tags to be inserted instead of outer.

When an iavf tx queue is being set up, if v2 offload capability is
supported, the driver queries the insertion capabilities and takes note
of where VLAN tags should be placed in the transmit and/or context
descriptors for insertion offload. In the offending commit, when both
inner and outer insertion was reported as supported, the flag
"vlan_flag" was changed to hold the location for inner VLAN tags.
However this caused inner VLAN tags to be inserted in the case of single
VLAN offload which is incorrect behaviour for this use case.

To fix this, revert the "vlan_flag" back to holding the location for
outer VLAN tags and update the datapath code accordingly.

Fixes: fdc3796 ("net/iavf: support QinQ insertion offload in scalar Tx")

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Sorry @ovsrobot, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai
Copy link

coderabbitai bot commented Oct 31, 2025

Walkthrough

This PR introduces a performance-mode parameter to test infrastructure for scaling allocations and iterations, adds allocation error handling in performance tests, and refactors VLAN/QinQ tag insertion logic in the IAVF driver to use simplified, granular control paths for determining tag placement and descriptor construction.

Changes

Cohort / File(s) Summary
Test Infrastructure
app/test/test_hash_readwrite.c, app/test/test_hash_readwrite_lf_perf.c
Added perf bool parameter to init_params() to scale allocations and loop counts by PERF_MULTIPLIER. Updated all callers to pass perf argument. Added NULL check after allocation with error handling path. Separated functional and perf-specific entry counts using TOTAL_ENTRY and derived totals.
VLAN/QinQ Handling Refactor
drivers/net/intel/iavf/iavf_rxtx.c, drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c, drivers/net/intel/iavf/iavf_rxtx_vec_common.h
Simplified VLAN insertion capability handling by consolidating conditional branches into single paths. Added vlan_flag-based logic to determine tag location (L2TAG1/L2TAG2) for QinQ and VLAN cases. Prioritized QINQ-centric branching in TX path with granular outer/inner tag placement. Updated descriptor construction to clarify tag location semantics and mbuf QinQ state handling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • app/test/test_hash_readwrite.c — Verify perf parameter propagation across all init_params() call sites; confirm PERF_MULTIPLIER scaling is applied correctly to allocations and loop bounds
  • drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c — Requires careful attention to QINQ-first branching logic; confirm outer/inner tag encoding matches expected QW field positions and vlan_flag semantics
  • drivers/net/intel/iavf/iavf_rxtx_vec_common.h — Verify vlan_tci_outer vs. vlan_tci selection aligns with new tag location determination across QinQ and VLAN-only paths

Poem

🐰 A perf-mode hop through testing fields so wide,
VLAN tags now sorted with rabbit-fast pride,
Simplified paths where QinQ takes the lead,
Granular logic planted like a seed,
Descriptors dance with outer-inner flow! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "[PWCI] Fixes for iavf VLAN insertion offload" directly and accurately describes a real and significant portion of the changes in this PR. Three out of five modified files are related to the iavf VLAN insertion offload logic (iavf_rxtx.c, iavf_rxtx_vec_avx512.c, and iavf_rxtx_vec_common.h), with changes that clearly align with the title's focus on VLAN insertion offload improvements. While the PR also includes modifications to test files (test_hash_readwrite.c and test_hash_readwrite_lf_perf.c), the title appropriately emphasizes what appears to be the primary objective of this changeset, as indicated by the patchwork series context.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch series_36536

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c (1)

2197-2204: QinQ tags wiped in ctx offload path

low_ctx_qw{0,1} get their L2TAG2 payload set just above, but iavf_fill_ctx_desc_tunnelling_field() assigns *qw0 = …, so in the offload path we zero out those bits. With VLAN/QinQ plus checksum/TX offloads, the context descriptor is emitted without the required L2TAG2 value and outer/inner tags stop being inserted. Please invoke the tunnelling helper before we populate the VLAN/QinQ fields (or reapply the tag afterwards) so the tag survives.

@@
-    if (pkt[1]->ol_flags & RTE_MBUF_F_TX_QINQ) {
+    if (offload) {
+        iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw1, pkt[1]);
+        iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw0, pkt[0]);
+    }
+
+    if (pkt[1]->ol_flags & RTE_MBUF_F_TX_QINQ) {
@@
-    if (offload) {
-        iavf_txd_enable_offload(pkt[1], &hi_data_qw1, vlan_flag);
-        iavf_txd_enable_offload(pkt[0], &hi_data_qw0, vlan_flag);
-        iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw1, pkt[1]);
-        iavf_fill_ctx_desc_tunnelling_field(&low_ctx_qw0, pkt[0]);
-    }
+    if (offload) {
+        iavf_txd_enable_offload(pkt[1], &hi_data_qw1, vlan_flag);
+        iavf_txd_enable_offload(pkt[0], &hi_data_qw0, vlan_flag);
+    }
🧹 Nitpick comments (1)
app/test/test_hash_readwrite.c (1)

551-551: Consider storing the entry count to avoid hardcoded assumptions.

The hardcoded TOTAL_ENTRY * PERF_MULTIPLIER works currently since test_hash_readwrite_perf always calls init_params with perf=true. However, this creates tight coupling between the init_params call and this memset.

Consider storing hash_params.entries in the tbl_rw_test_param structure during initialization, then using that stored value here. This would make the code more maintainable and less prone to bugs if the initialization logic changes.

Example refactor:

Add to the structure definition (around line 44):

struct {
	uint32_t *keys;
	uint8_t *found;
	uint32_t num_insert;
	uint32_t rounded_tot_insert;
	struct rte_hash *h;
	uint32_t total_entries;  // Add this field
} tbl_rw_test_param;

Store the value in init_params (after line 149):

	tbl_rw_test_param.total_entries = hash_params.entries;

Use it at line 551:

	memset(tbl_rw_test_param.found, 0, tbl_rw_test_param.total_entries);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 39b54f2 and 26e11b2.

📒 Files selected for processing (5)
  • app/test/test_hash_readwrite.c (8 hunks)
  • app/test/test_hash_readwrite_lf_perf.c (1 hunks)
  • drivers/net/intel/iavf/iavf_rxtx.c (3 hunks)
  • drivers/net/intel/iavf/iavf_rxtx_vec_avx512.c (3 hunks)
  • drivers/net/intel/iavf/iavf_rxtx_vec_common.h (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/test/test_hash_readwrite.c (1)
app/test/test_hash_readwrite_lf_perf.c (1)
  • init_params (148-192)
🔇 Additional comments (8)
app/test/test_hash_readwrite_lf_perf.c (1)

1313-1316: LGTM! Proper allocation failure handling added.

The NULL check gracefully handles allocation failure and properly jumps to the error cleanup path, preventing potential null pointer dereference in subsequent operations.

app/test/test_hash_readwrite.c (7)

21-25: LGTM! Clear separation between functional and performance test parameters.

The macro definitions clearly distinguish functional test sizes from performance test sizes, and the comment helps clarify the scaling intent.


75-78: LGTM! Proper allocation failure handling.

The NULL check prevents potential crashes and returns an appropriate error code.


141-141: LGTM! Function signature extended to support performance mode.

The new perf parameter enables conditional scaling of hash table size for performance tests.


149-149: LGTM! Clean conditional scaling for performance mode.

The ternary expression appropriately scales the hash table entries based on the performance mode flag.


186-186: LGTM! Consistent use of computed entry count.

Using hash_params.entries instead of hardcoded TOTAL_ENTRY ensures allocations and loops scale correctly with the performance mode setting.

Also applies to: 192-192, 201-201


230-230: LGTM! Functional tests correctly use non-performance parameters.

The functional test correctly passes false for the perf parameter and uses the appropriate functional test insert counts.

Also applies to: 234-234, 236-236


393-393: LGTM! Performance test correctly enables performance mode.

The performance test appropriately passes true to enable scaled allocations.

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