Skip to content

Conversation

@ovsrobot
Copy link
Owner

@ovsrobot ovsrobot commented Dec 1, 2025

NOTE: This is an auto submission for "[v5] acl: support custom memory allocators in rte_acl_build".

See "http://patchwork.dpdk.org/project/dpdk/list/?series=36819" for details.

Summary by CodeRabbit

  • New Features

    • Added memory callback support to ACL library, enabling custom memory allocation and deallocation functions.
  • Documentation

    • Updated driver documentation for cxgbe, ipn3ke, and mlx5 with device compatibility clarifications.
  • Chores

    • Released version 25.11.0 final.

✏️ Tip: You can customize this high-level summary in your review settings.

tmonjalo and others added 4 commits November 30, 2025 15:40
Starting with NVIDIA ConnectX-9, the future devices will support
only hardware steering (HWS) flow engine.
The software steering options (legacy Verbs and Direct Verbs)
have lower performances, and won't be available for new devices.
Both flow APIs (sync and async template) will still be supported
with the hardware steering flow engine.

Fixes: 1b55eeb ("common/mlx5: add ConnectX-9 SuperNIC")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
The tool ripgrep allows to find files not ending with a line break:
	rg -Ul '[^\n]\z'

The files with a trailing blank lines are shown with this command:
	rg -Ul '\n\n\z'

Files are fixed to end with a single line break.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Allow users to provide custom
memory allocation callbacks for runtime memory in rte_acl_ctx, via
struct rte_acl_mem_cb.

Key changes:
- Added struct rte_acl_mem_cb with zalloc, free, and udata.
- Added rte_acl_set_mem_cb() / rte_acl_get_mem_cb() to set/get callbacks.
- Default allocation uses existing rte_zmalloc_socket/rte_free.
- Modified ACL code to call callbacks for runtime allocations instead
  of rte_zmalloc_socket/rte_free directly.

v5:
- Remove temporary memory allocation callback for build stage.
- Introduce new API (rte_acl_set_mem_cb / rte_acl_get_mem_cb) instead of
  modifying existing rte_acl_config to preserve ABI compatibility.

Signed-off-by: YongFeng Wang <mannywang@tencent.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 Dec 1, 2025

Walkthrough

Version bump to 25.11.0 (final release), ACL memory callback infrastructure added for custom allocator support, test additions for callback validation, documentation updates for driver features, and widespread trailing newline formatting corrections across multiple files.

Changes

Cohort / File(s) Summary
Version & Release
VERSION
Bumped version from 25.11.0-rc4 to 25.11.0, removing RC suffix for final release.
ACL Library Core
lib/acl/rte_acl.h, lib/acl/acl.h, lib/acl/rte_acl.c, lib/acl/acl_bld.c, lib/acl/acl_gen.c
Introduced memory callback infrastructure: added rte_acl_mem_cb structure with zalloc/free callbacks and udata, added public API functions rte_acl_set_mem_cb() and rte_acl_get_mem_cb() for runtime callback configuration, integrated callback usage in acl_build_reset, rte_acl_gen, and rte_acl_free for custom memory allocation.
ACL Test
app/test/test_acl.c
Added acl_ctx_wrapper_t structure and memory management helpers (running_alloc, running_free) to support custom allocator testing; added test_mem_cb function to validate memory callback setup and ACL operations with custom allocators.
Test Data Files
app/test-bbdev/test_vectors/bbdev_null.data, app/test-bbdev/test_vectors/turbo_dec_c1_k6144_r0_e10376_crc24b_sbd_negllr_high_snr.data, app/test-bbdev/test_vectors/turbo_dec_c1_k6144_r0_e10376_crc24b_sbd_negllr_low_snr.data, app/test-bbdev/test_vectors/turbo_dec_c1_k6144_r0_e34560_sbd_posllr.data, app/test-bbdev/test_vectors/turbo_dec_c2_k3136_r0_e4920_sbd_negllr_crc24b.data, app/test-bbdev/test_vectors/turbo_enc_c1_k6144_r0_e18448_crc24a.data, app/test-bbdev/test_vectors/turbo_enc_c3_k4800_r2_e14412_crc24b.data
Added missing trailing newlines to test vector data files; formatting-only changes.
Network Driver Documentation
doc/guides/nics/cxgbe.rst, doc/guides/nics/ipn3ke.rst, doc/guides/nics/mlx5.rst
Updated cxgbe.rst limitations section; removed "Limitations or Known issues" section from ipn3ke.rst; clarified mlx5.rst device compatibility notes for dv_flow_en and Hardware Steering modes.
Network Driver Trailing Newlines
drivers/net/bnxt/tf_core/tf_em_common.c, drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_act.c, drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_class.c, drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_defs.h, drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c, drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor2_class.c, drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c, drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c, drivers/net/gve/base/gve_adminq.c, drivers/net/gve/gve_rss.c, drivers/net/gve/gve_rss.h, drivers/net/intel/e1000/base/e1000_82575.c, drivers/net/intel/e1000/base/e1000_mbx.c, drivers/net/intel/e1000/base/e1000_vf.c, drivers/net/intel/i40e/base/i40e_adminq.c, drivers/net/intel/ice/base/ice_flex_pipe.c, drivers/net/intel/ice/base/ice_hw_autogen.h, drivers/net/intel/ixgbe/base/ixgbe_dcb_82599.c, drivers/net/intel/ixgbe/base/ixgbe_x540.h, drivers/net/mlx5/hws/mlx5dr_buddy.c, drivers/net/nfp/nfp_ipsec.c, drivers/net/nfp/nfpcore/nfp_elf.c, drivers/net/ngbe/base/ngbe_dummy.h, drivers/net/ngbe/base/ngbe_phy.c, drivers/net/octeontx/base/octeontx_bgx.h, drivers/net/txgbe/base/txgbe_dcb.c, drivers/net/txgbe/base/txgbe_dcb_hw.c, drivers/net/txgbe/base/txgbe_dummy.h, drivers/net/txgbe/base/txgbe_eeprom.c, drivers/net/virtio/virtio_cvq.c
Removed trailing blank lines; formatting-only changes across network drivers.
Other Driver Trailing Newlines
drivers/net/hinic/base/hinic_pmd_mbox.c, drivers/net/hinic/base/hinic_pmd_niccfg.c, drivers/event/dlb2/dlb2_iface.c, drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_selftest.c, drivers/vdpa/mlx5/mlx5_vdpa_event.c
Removed trailing blank lines; formatting-only changes.
Build Configuration
drivers/net/hinic/base/meson.build
Removed explicit 'hash' library dependency from build configuration.
Configuration & License
dts/configurations/tests_config.example.yaml, license/Linux-syscall-note
Minor configuration and license file formatting adjustments (trailing newlines).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Key areas requiring attention:

  • ACL memory callback integration (lib/acl/rte_acl.c, lib/acl/acl_bld.c, lib/acl/acl_gen.c): Verify callback chain initialization, error handling for null callbacks, and socket-aware allocation correctness.
  • Test additions (app/test/test_acl.c): Ensure custom allocator wrapper properly interacts with ACL operations and resource cleanup.
  • Build system change (drivers/net/hinic/base/meson.build): Confirm 'hash' dependency removal doesn't cause linking issues elsewhere.
  • Driver data structure alignment (drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c): Verify closing brace deletion doesn't cause compilation errors.

Poem

🐰 A final release hops into view,
Callbacks now dance through ACL's new,
Newlines all trimmed, the codebase so clean,
The tidiest version we've ever seen! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% 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 title clearly and specifically describes the main change: adding support for custom memory allocators in the rte_acl_build function, with the version tag indicating this is the fifth iteration of the patch.
✨ 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_36819

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: 2

🧹 Nitpick comments (3)
doc/guides/nics/mlx5.rst (1)

1337-1365: Clarify device support scope for Hardware Steering.

Line 1343-1344 states HWS is "the only mode supported on device ConnectX-9 and later," but the requirements table (lines 1352-1358) shows HWS minimum hardware is ConnectX-6 Dx. This appears inconsistent—line 1343-1344 suggests exclusive support on ConnectX-9+, while the requirements table and earlier context indicate HWS is supported on older devices.

Consider revising line 1343-1344 to clarify the distinction: HWS may be the preferred or only stable mode on ConnectX-9+, but it is supported (with limitations) on earlier hardware like ConnectX-6 Dx.

lib/acl/rte_acl.c (1)

575-600: Document callback lifecycle constraints.

The implementation is correct. Consider adding a note in the header documentation that rte_acl_set_mem_cb should be called before rte_acl_build, or after rte_acl_reset, to avoid mismatched allocator/deallocator pairs for existing runtime structures.

app/test/test_acl.c (1)

1732-1749: Alignment parameter is ignored.

The align parameter is not used, which could cause issues if the ACL code requires specific memory alignment. Since running_buf is allocated with RTE_CACHE_LINE_SIZE alignment, it works for this test, but the comment documents this limitation.

Consider adding an alignment check or at least documenting the assumption:

 static void *running_alloc(void *udata, char *name, size_t size,
 	size_t align, int32_t socket_id)
 {
-	(void)align;
 	(void)name;
 	(void)socket_id;
+	/* running_buf is allocated with RTE_CACHE_LINE_SIZE alignment,
+	 * which should satisfy typical ACL alignment requirements */
+	(void)align;
 	if (size > ACL_RUNNING_BUF_SIZE)
 		return NULL;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1ad3a36 and 55124be.

⛔ Files ignored due to path filters (17)
  • doc/guides/contributing/img/abi_stability_policy.svg is excluded by !**/*.svg
  • doc/guides/contributing/img/what_is_an_abi.svg is excluded by !**/*.svg
  • doc/guides/howto/img/flow_bifurcation_overview.svg is excluded by !**/*.svg
  • doc/guides/howto/img/virtio_user_for_container_networking.svg is excluded by !**/*.svg
  • doc/guides/prog_guide/img/bond-mode-0.svg is excluded by !**/*.svg
  • doc/guides/prog_guide/img/bond-mode-1.svg is excluded by !**/*.svg
  • doc/guides/prog_guide/img/bond-mode-2.svg is excluded by !**/*.svg
  • doc/guides/prog_guide/img/bond-mode-3.svg is excluded by !**/*.svg
  • doc/guides/prog_guide/img/bond-mode-4.svg is excluded by !**/*.svg
  • doc/guides/prog_guide/img/bond-mode-5.svg is excluded by !**/*.svg
  • doc/guides/prog_guide/img/lcore_var_mem_layout.svg is excluded by !**/*.svg
  • doc/guides/prog_guide/img/pdcp_functional_overview.svg is excluded by !**/*.svg
  • doc/guides/prog_guide/img/predictable_snat_1.svg is excluded by !**/*.svg
  • doc/guides/prog_guide/img/predictable_snat_2.svg is excluded by !**/*.svg
  • doc/guides/prog_guide/img/rss_queue_assign.svg is excluded by !**/*.svg
  • doc/guides/prog_guide/img/static_array_mem_layout.svg is excluded by !**/*.svg
  • doc/guides/sample_app_ug/img/overlay_networking.svg is excluded by !**/*.svg
📒 Files selected for processing (55)
  • VERSION (1 hunks)
  • app/test-bbdev/test_vectors/bbdev_null.data (1 hunks)
  • app/test-bbdev/test_vectors/turbo_dec_c1_k6144_r0_e10376_crc24b_sbd_negllr_high_snr.data (1 hunks)
  • app/test-bbdev/test_vectors/turbo_dec_c1_k6144_r0_e10376_crc24b_sbd_negllr_low_snr.data (1 hunks)
  • app/test-bbdev/test_vectors/turbo_dec_c1_k6144_r0_e34560_sbd_posllr.data (1 hunks)
  • app/test-bbdev/test_vectors/turbo_dec_c2_k3136_r0_e4920_sbd_negllr_crc24b.data (1 hunks)
  • app/test-bbdev/test_vectors/turbo_enc_c1_k6144_r0_e18448_crc24a.data (1 hunks)
  • app/test-bbdev/test_vectors/turbo_enc_c3_k4800_r2_e14412_crc24b.data (1 hunks)
  • app/test/test_acl.c (2 hunks)
  • doc/guides/nics/cxgbe.rst (0 hunks)
  • doc/guides/nics/ipn3ke.rst (0 hunks)
  • doc/guides/nics/mlx5.rst (2 hunks)
  • drivers/event/dlb2/dlb2_iface.c (0 hunks)
  • drivers/net/bnxt/tf_core/tf_em_common.c (0 hunks)
  • drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_act.c (0 hunks)
  • drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_class.c (0 hunks)
  • drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_defs.h (0 hunks)
  • drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c (0 hunks)
  • drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor2_class.c (0 hunks)
  • drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c (0 hunks)
  • drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c (0 hunks)
  • drivers/net/gve/base/gve_adminq.c (0 hunks)
  • drivers/net/gve/gve_rss.c (0 hunks)
  • drivers/net/gve/gve_rss.h (0 hunks)
  • drivers/net/hinic/base/hinic_pmd_mbox.c (0 hunks)
  • drivers/net/hinic/base/hinic_pmd_niccfg.c (0 hunks)
  • drivers/net/hinic/base/meson.build (0 hunks)
  • drivers/net/intel/e1000/base/e1000_82575.c (0 hunks)
  • drivers/net/intel/e1000/base/e1000_mbx.c (0 hunks)
  • drivers/net/intel/e1000/base/e1000_vf.c (0 hunks)
  • drivers/net/intel/i40e/base/i40e_adminq.c (0 hunks)
  • drivers/net/intel/ice/base/ice_flex_pipe.c (0 hunks)
  • drivers/net/intel/ice/base/ice_hw_autogen.h (0 hunks)
  • drivers/net/intel/ixgbe/base/ixgbe_dcb_82599.c (0 hunks)
  • drivers/net/intel/ixgbe/base/ixgbe_x540.h (0 hunks)
  • drivers/net/mlx5/hws/mlx5dr_buddy.c (0 hunks)
  • drivers/net/nfp/nfp_ipsec.c (0 hunks)
  • drivers/net/nfp/nfpcore/nfp_elf.c (0 hunks)
  • drivers/net/ngbe/base/ngbe_dummy.h (0 hunks)
  • drivers/net/ngbe/base/ngbe_phy.c (0 hunks)
  • drivers/net/octeontx/base/octeontx_bgx.h (0 hunks)
  • drivers/net/txgbe/base/txgbe_dcb.c (0 hunks)
  • drivers/net/txgbe/base/txgbe_dcb_hw.c (0 hunks)
  • drivers/net/txgbe/base/txgbe_dummy.h (0 hunks)
  • drivers/net/txgbe/base/txgbe_eeprom.c (0 hunks)
  • drivers/net/virtio/virtio_cvq.c (0 hunks)
  • drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_selftest.c (0 hunks)
  • drivers/vdpa/mlx5/mlx5_vdpa_event.c (0 hunks)
  • dts/configurations/tests_config.example.yaml (1 hunks)
  • lib/acl/acl.h (1 hunks)
  • lib/acl/acl_bld.c (1 hunks)
  • lib/acl/acl_gen.c (1 hunks)
  • lib/acl/rte_acl.c (4 hunks)
  • lib/acl/rte_acl.h (1 hunks)
  • license/Linux-syscall-note (0 hunks)
💤 Files with no reviewable changes (39)
  • drivers/net/intel/e1000/base/e1000_vf.c
  • drivers/net/hinic/base/hinic_pmd_mbox.c
  • doc/guides/nics/cxgbe.rst
  • drivers/net/txgbe/base/txgbe_dummy.h
  • drivers/net/virtio/virtio_cvq.c
  • drivers/net/gve/base/gve_adminq.c
  • drivers/net/hinic/base/hinic_pmd_niccfg.c
  • drivers/net/txgbe/base/txgbe_eeprom.c
  • drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_tbl.c
  • drivers/net/intel/ice/base/ice_flex_pipe.c
  • drivers/raw/cnxk_rvu_lf/cnxk_rvu_lf_selftest.c
  • drivers/net/intel/i40e/base/i40e_adminq.c
  • drivers/net/ngbe/base/ngbe_dummy.h
  • drivers/net/gve/gve_rss.c
  • doc/guides/nics/ipn3ke.rst
  • drivers/net/txgbe/base/txgbe_dcb_hw.c
  • drivers/net/txgbe/base/txgbe_dcb.c
  • drivers/net/ngbe/base/ngbe_phy.c
  • drivers/net/gve/gve_rss.h
  • drivers/net/intel/ixgbe/base/ixgbe_dcb_82599.c
  • drivers/net/nfp/nfpcore/nfp_elf.c
  • drivers/net/octeontx/base/octeontx_bgx.h
  • drivers/net/nfp/nfp_ipsec.c
  • drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_class.c
  • drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_defs.h
  • drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_act.c
  • drivers/net/hinic/base/meson.build
  • drivers/net/intel/e1000/base/e1000_82575.c
  • license/Linux-syscall-note
  • drivers/net/mlx5/hws/mlx5dr_buddy.c
  • drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor2_class.c
  • drivers/net/bnxt/tf_core/tf_em_common.c
  • drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_thor_class.c
  • drivers/event/dlb2/dlb2_iface.c
  • drivers/net/intel/ixgbe/base/ixgbe_x540.h
  • drivers/net/intel/e1000/base/e1000_mbx.c
  • drivers/net/bnxt/tf_ulp/generic_templates/ulp_template_db_wh_plus_class.c
  • drivers/vdpa/mlx5/mlx5_vdpa_event.c
  • drivers/net/intel/ice/base/ice_hw_autogen.h
🧰 Additional context used
🧬 Code graph analysis (1)
app/test/test_acl.c (1)
lib/acl/rte_acl.c (1)
  • rte_acl_create (385-455)
🔇 Additional comments (20)
dts/configurations/tests_config.example.yaml (1)

17-17: No concerns.

This is a non-functional trailing whitespace/newline adjustment on a commented configuration line.

app/test-bbdev/test_vectors/turbo_dec_c2_k3136_r0_e4920_sbd_negllr_crc24b.data (1)

676-677: Good: Trailing newline added for POSIX compliance.

The addition of a trailing newline after the expected_status value follows POSIX conventions and is consistent with the PR's broader formatting standardization across test vector files. This change has no functional impact on test execution.

app/test-bbdev/test_vectors/turbo_dec_c1_k6144_r0_e10376_crc24b_sbd_negllr_low_snr.data (1)

640-640: Trailing newline addition aligns with best practices.

The file now ends with a trailing newline, which is consistent with POSIX text file conventions and improves formatting consistency across the test vector files. No functional changes to test data or configuration parameters.

app/test-bbdev/test_vectors/turbo_dec_c1_k6144_r0_e34560_sbd_posllr.data (1)

1221-1222: Formatting-only change; no functional impact.

The modification adds a trailing newline after the expected_status value. This is a consistent formatting improvement across the test vector files with no effect on test execution or data integrity.

app/test-bbdev/test_vectors/turbo_enc_c3_k4800_r2_e14412_crc24b.data (1)

152-153: LGTM!

Adding a trailing newline at EOF is a standard POSIX-compliant formatting improvement. No functional changes to the test vector data.

app/test-bbdev/test_vectors/bbdev_null.data (1)

4-5: LGTM!

Trailing newline addition for POSIX compliance. Consistent with the broader formatting cleanup across test vector files in this PR.

doc/guides/nics/mlx5.rst (1)

692-703: Documentation improvements are clear and well-organized.

The restructuring of the dv_flow_en parameter documentation (lines 692-697) improves readability by:

  • Explicitly stating device availability constraints ("devices older than ConnectX-9")
  • Adding rdma-core requirement note for Value 1
  • Separating values into distinct paragraphs for clarity

The changes maintain consistency with the device support table and enhance user guidance on mode selection.

app/test-bbdev/test_vectors/turbo_dec_c1_k6144_r0_e10376_crc24b_sbd_negllr_high_snr.data (1)

639-640: LGTM!

Adding a trailing newline to the file is a good housekeeping practice for POSIX compliance and cleaner git diffs. No test data or semantics are affected.

VERSION (1)

1-1: LGTM!

Version bump to final release 25.11.0 is appropriate.

lib/acl/rte_acl.h (2)

139-151: Well-designed callback structure.

The rte_acl_mem_cb structure follows DPDK conventions with proper parameters for socket-aware allocation. The udata field enables stateful allocators.


153-179: Clean API design for memory callback accessors.

The set/get functions are well-documented with proper const correctness. Using const struct rte_acl_mem_cb * for input in rte_acl_set_mem_cb is appropriate.

lib/acl/acl_gen.c (1)

481-488: LGTM!

The allocation correctly uses the per-context memory callback with appropriate parameters. Error handling for allocation failure is preserved.

lib/acl/acl.h (1)

177-177: LGTM!

The mem_cb field is appropriately added to the internal context structure, enabling per-context memory callback management.

lib/acl/acl_bld.c (1)

782-782: LGTM!

The deallocation correctly uses the per-context memory callback. The free callback is expected to handle NULL pointers gracefully (as demonstrated by both the default free_dft and the test's running_free).

lib/acl/rte_acl.c (3)

267-279: LGTM!

Default allocator functions properly wrap the standard DPDK memory functions and correctly suppress unused parameter warnings.


379-379: LGTM!

Using the per-context memory callback for freeing runtime memory before freeing the context itself is the correct ordering.


442-444: LGTM!

Context initialization with default memory callbacks ensures backward compatibility - existing code will work without modification.

app/test/test_acl.c (3)

1724-1728: LGTM!

The wrapper structure cleanly encapsulates the ACL context with a pre-allocated buffer and usage flag for tracking.


1803-1841: Good test coverage for memory callback functionality.

The test properly exercises:

  • Setting and retrieving memory callbacks
  • ACL reset/build/classify with custom allocator
  • Multiple iterations to verify callback reuse

The cleanup at lines 1838-1839 is correct.


1864-1865: LGTM!

The new test is properly integrated into the test suite.

Comment on lines +1775 to +1778
if (!g_acl_ctx_wrapper.running_buf) {
printf("Line %i: Error allocing running buf for acl context!\n", __LINE__);
return 1;
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Inconsistent error return value.

Returns 1 on allocation failure, but the test framework and other tests in this file return -1 for errors.

 	if (!g_acl_ctx_wrapper.running_buf) {
 		printf("Line %i: Error allocing running buf for acl context!\n", __LINE__);
-		return 1;
+		rte_acl_free(g_acl_ctx_wrapper.ctx);
+		return -1;
 	}

Note: Also added missing cleanup of the ACL context before returning.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!g_acl_ctx_wrapper.running_buf) {
printf("Line %i: Error allocing running buf for acl context!\n", __LINE__);
return 1;
}
if (!g_acl_ctx_wrapper.running_buf) {
printf("Line %i: Error allocing running buf for acl context!\n", __LINE__);
rte_acl_free(g_acl_ctx_wrapper.ctx);
return -1;
}
🤖 Prompt for AI Agents
In app/test/test_acl.c around lines 1775-1778, the allocation-failure branch
prints an error and returns 1 which is inconsistent with the test framework
convention of returning -1; update the return value to -1 and ensure the ACL
context is cleaned up before returning (free or teardown whatever
g_acl_ctx_wrapper holds and set pointers to NULL as done elsewhere in this file)
so the function exits with consistent error code and no resource leak.

Comment on lines +1786 to +1800
ret = rte_acl_set_mem_cb(g_acl_ctx_wrapper.ctx, &mcb);
if (ret) {
printf("Line %i: Error set mem cb for acl context!\n", __LINE__);
return 1;
}
struct rte_acl_mem_cb new_mcb;
memset(&new_mcb, 0, sizeof(struct rte_acl_mem_cb));
ret = rte_acl_get_mem_cb(g_acl_ctx_wrapper.ctx, &new_mcb);
if (ret) {
printf("Line %i: Error get mem cb for acl context!\n", __LINE__);
return 1;
}
if (memcmp(&mcb, &new_mcb, sizeof(struct rte_acl_mem_cb)) != 0) {
printf("Line %i: Error get mem cb for acl context!\n", __LINE__);
return 1;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Inconsistent error return values and missing cleanup.

Multiple return paths use 1 instead of -1 and don't clean up allocated resources.

 	ret = rte_acl_set_mem_cb(g_acl_ctx_wrapper.ctx, &mcb);
 	if (ret) {
 		printf("Line %i: Error set mem cb for acl context!\n", __LINE__);
-		return 1;
+		goto err;
 	}
 	struct rte_acl_mem_cb new_mcb;
 	memset(&new_mcb, 0, sizeof(struct rte_acl_mem_cb));
 	ret = rte_acl_get_mem_cb(g_acl_ctx_wrapper.ctx, &new_mcb);
 	if (ret) {
 		printf("Line %i: Error get mem cb for acl context!\n", __LINE__);
-		return 1;
+		goto err;
 	}
 	if (memcmp(&mcb, &new_mcb, sizeof(struct rte_acl_mem_cb)) != 0) {
 		printf("Line %i: Error get mem cb for acl context!\n", __LINE__);
-		return 1;
+		goto err;
 	}

Add an error label at the end:

err:
	rte_acl_free(g_acl_ctx_wrapper.ctx);
	rte_free(g_acl_ctx_wrapper.running_buf);
	return -1;
🤖 Prompt for AI Agents
In app/test/test_acl.c around lines 1786 to 1800 the error paths return 1 and
skip cleanup; update those error returns to jump to a new err label (e.g., "goto
err;") so allocated resources are freed; add an err label at the end that calls
rte_acl_free(g_acl_ctx_wrapper.ctx) and rte_free(g_acl_ctx_wrapper.running_buf)
and then returns -1; ensure every early failure in this block uses the goto err
path instead of returning 1 so cleanup always runs and the function returns -1
on error.

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