Skip to content

Conversation

@ovsrobot
Copy link
Owner

@ovsrobot ovsrobot commented Oct 27, 2025

NOTE: This is an auto submission for "net/mlx5: remove representor matching devarg".

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

Summary by Sourcery

Remove the deprecated 'representor matching' device argument and all associated code paths, templates and checks from the mlx5 PMD and documentation.

Enhancements:

  • Eliminate the repr_matching configuration flag and its devarg handling from the shared config and startup logic
  • Remove legacy default Tx metadata copy flow rules, templates and related helper functions
  • Simplify hardware steering setup by dropping repr_matching-based conditional branches
  • Clean up trigger, flow, txq and OS integration code by removing repr_matching checks
  • Purge documentation entries and headers describing the deprecated repr_matching parameter

Documentation:

  • Remove references to repr_matching from driver documentation and release notes

Summary by CodeRabbit

Release Notes

  • Removed Features

    • Removed the repr_matching_en device argument from mlx5 driver. Use RTE_FLOW_ACTION_TYPE_RSS in transfer flow rules to achieve equivalent traffic distribution behavior.
  • Documentation

    • Updated driver guides and release notes to reflect removal of representor matching parameter and related configuration options.

As announced in 25.07 release deprecation notice [1],
this patch removes repr_matching_en device argument from mlx5 driver.

Applications which disabled this option were able to receive traffic
from any physical port/VF/SF on any representor.
Specifically, in most cases, this was used to process all traffic
on representor which is a transfer proxy port.
Similar behavior in mlx5 PMD can be achieved without
the use of additional device arguments, by using
RTE_FLOW_ACTION_TYPE_RSS flow action in transfer flow rules.

[1] https://doc.dpdk.org/guides-25.07/rel_notes/deprecation.html

Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
@sourcery-ai
Copy link

sourcery-ai bot commented Oct 27, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This patch removes the deprecated "repr_matching" configuration and all associated code paths from the MLX5 PMD. It simplifies various flow-setup conditional checks by eliminating representor-matching guards and cleans up default Tx metadata-copy routines and documentation accordingly.

Sequence diagram for simplified flow setup without repr_matching

sequenceDiagram
participant "mlx5_dev_spawn()"
participant "mlx5_shared_dev_ctx_args_config()"
participant "mlx5_flow_isolate()"
"mlx5_dev_spawn()"->>"mlx5_shared_dev_ctx_args_config()": configure device
"mlx5_shared_dev_ctx_args_config()"-->>"mlx5_dev_spawn()": returns config
"mlx5_dev_spawn()"->>"mlx5_flow_isolate()": (no longer checks repr_matching)
"mlx5_flow_isolate()"-->>"mlx5_dev_spawn()": isolated mode set if requested
Loading

Sequence diagram for flow setup with dv_esw_en (repr_matching removed)

sequenceDiagram
participant "mlx5_traffic_enable_hws()"
participant "mlx5_flow_hw_tx_repr_matching_flow()"
"mlx5_traffic_enable_hws()"->>"mlx5_flow_hw_tx_repr_matching_flow()": create tx repr matching flow (no repr_matching check)
"mlx5_flow_hw_tx_repr_matching_flow()"-->>"mlx5_traffic_enable_hws()": returns status
Loading

Class diagram for removal of repr_matching from mlx5_sh_config and related structures

classDiagram
class mlx5_sh_config {
    uint32_t lro_allowed
    uint32_t fdb_def_rule
    uint32_t txq_mem_algn
    cnt_svc cnt_svc_member
}
class cnt_svc {
    uint16_t service_core
    uint32_t cycle_time
}
class mlx5_flow_hw_ctrl_fdb {
    rte_flow_pattern_template *port_items_tmpl
    rte_flow_actions_template *jump_one_actions_tmpl
    rte_flow_template_table *hw_esw_zero_tbl
    rte_flow_pattern_template *lacp_rx_items_tmpl
    rte_flow_actions_template *lacp_rx_actions_tmpl
    rte_flow_template_table *hw_lacp_rx_tbl
}
mlx5_sh_config <|-- mlx5_flow_hw_ctrl_fdb
mlx5_sh_config o-- cnt_svc
Loading

Class diagram for removed function and template creation routines

classDiagram
class mlx5_flow_hw_create_tx_default_mreg_copy_flow {
    // REMOVED
}
class flow_hw_create_tx_default_mreg_copy_pattern_template {
    // REMOVED
}
class flow_hw_create_tx_default_mreg_copy_actions_template {
    // REMOVED
}
class flow_hw_create_tx_default_mreg_copy_table {
    // REMOVED
}
Loading

File-Level Changes

Change Details Files
Eliminate repr_matching config parameter
  • Devarg parsing and default init for repr_matching removed
  • repr_matching field dropped from shared config struct
  • Cleaned up devargs and shared context setup logic
drivers/net/mlx5/mlx5.c
drivers/net/mlx5/mlx5_flow.h
drivers/net/mlx5/mlx5.c
Remove default Tx metadata-copy routines
  • Deleted pattern, actions, and table creation functions for default Tx meta copy
  • Removed control-flow setup and cleanup for Tx meta copy
  • Dropped mlx5_flow_hw_create_tx_default_mreg_copy_flow
drivers/net/mlx5/mlx5_flow_hw.c
drivers/net/mlx5/mlx5_flow.h
Simplify flow setup by dropping repr_matching guards
  • Removed repr_matching checks in dv_xmeta/dv_esw_en conditionals
  • Deleted repr_matching asserts and branches in flow_hw setup and traffic enable
  • Updated error/message logic to no longer reference repr_matching
drivers/net/mlx5/mlx5_flow_hw.c
drivers/net/mlx5/mlx5_trigger.c
drivers/net/mlx5/mlx5_txq.c
Update documentation and release notes
  • Purged repr_matching mentions from user guides
  • Removed repr_matching entries from deprecation and release notes
doc/guides/nics/mlx5.rst
doc/guides/rel_notes/deprecation.rst
doc/guides/rel_notes/release_25_11.rst

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link

coderabbitai bot commented Oct 27, 2025

Walkthrough

This PR removes the repr_matching_en device argument and its associated configuration infrastructure from the mlx5 driver. Changes eliminate argument parsing, configuration flags, control-flow gating, and default TX metadata handling tied to representor matching. Documentation is updated to reflect the removal and changes to flow behavior.

Changes

Cohort / File(s) Summary
Documentation Updates
doc/guides/nics/mlx5.rst, doc/guides/rel_notes/deprecation.rst, doc/guides/rel_notes/release_25_11.rst
Removed repr_matching_en parameter documentation, deprecation notice, and added removal notice to release notes. Simplified narrative descriptions and consolidated behavioral notes.
Data Structure Removals
drivers/net/mlx5/mlx5.h, drivers/net/mlx5/mlx5_flow.h
Removed repr_matching:1 member from struct mlx5_sh_config and three TX metadata template/table members (tx_meta_items_tmpl, tx_meta_actions_tmpl, hw_tx_meta_cpy_tbl) from struct mlx5_flow_hw_ctrl_fdb. Removed function declaration mlx5_flow_hw_create_tx_default_mreg_copy_flow().
Configuration and Initialization
drivers/net/mlx5/mlx5.c, drivers/net/mlx5/linux/mlx5_os.c
Removed MLX5_REPR_MATCHING_EN macro, kvarg parsing, default initialization, and auto-enable logic. Eliminated isolated mode enforcement for disabled representor matching.
Flow Setup and Control
drivers/net/mlx5/mlx5_flow.c, drivers/net/mlx5/mlx5_flow_hw.c
Removed representor-matching gating from isolated mode checks, dv_esw egress logic, and pattern/template creation. Removed default TX metadata copy template/table creation paths. Relaxed representor port item validation constraints.
Traffic and Representor Handling
drivers/net/mlx5/mlx5_trigger.c, drivers/net/mlx5/mlx5_txq.c
Removed representor-matching precondition checks in representor port allowance validation. Eliminated conditional TX metadata region creation. Updated TX repr matching flow enablement to depend solely on dv_esw_en flag.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • drivers/net/mlx5/mlx5_flow_hw.c: Highest attention required—contains multiple interrelated logic gate removals, template/table creation path consolidation, and subtle control-flow shifts affecting pattern validation and TX metadata handling.
  • drivers/net/mlx5/mlx5.c: Removal of kvarg parsing and initialization paths is consistent but scattered across multiple code sections; verify all related code branches are addressed.
  • drivers/net/mlx5/mlx5_trigger.c and drivers/net/mlx5/mlx5_txq.c: Control-flow changes merit verification that TX metadata and representor paths function correctly without the removed preconditions.
  • Cross-file consistency: Ensure all references to repr_matching are eliminated and flow logic behaves correctly under ESW DV configurations.

Poem

🐰 Off goes the matching gate, a feature once great,
Now flows align with simpler fate;
TX metadata templates cleared away,
The representor path finds a cleaner day!
One less config knob, one less care—
The driver's now lighter in the air! 🌿

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.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 PR title "net/mlx5: remove representor matching devarg" directly and accurately describes the primary objective of the changeset. The modifications across all eight modified files consistently focus on removing the representor matching device argument (MLX5_REPR_MATCHING_EN), including its macro definition, configuration structure members, documentation, deprecation notices, and all dependent code paths. The title is specific, clear, and captures the essence of what is being removed without being vague or overly broad. It allows reviewers scanning the history to immediately understand the core change.
✨ 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_36478

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

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

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `doc/guides/rel_notes/release_25_11.rst:203-204` </location>
<code_context>
+* net/mlx5: ``repr_matching_en`` device argument has been removed.
+  Applications which disabled this option were able to receive traffic
+  from any physical port/VF/SF on any representor.
+  Specifically, in most cases, this was used to process all traffic on representor
+  which is a transfer proxy port.
+  Similar behavior in mlx5 PMD can be achieved without the use of additional device arguments,
+  by using ``RTE_FLOW_ACTION_TYPE_RSS`` flow action in transfer flow rules.
</code_context>

<issue_to_address>
**suggestion (typo):** Consider adding 'a' before 'representor' for grammatical correctness.

Change the sentence to: 'Specifically, in most cases, this was used to process all traffic on a representor, which is a transfer proxy port.'

```suggestion
  Specifically, in most cases, this was used to process all traffic on a representor,
  which is a transfer proxy port.
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +203 to +204
Specifically, in most cases, this was used to process all traffic on representor
which is a transfer proxy port.
Copy link

Choose a reason for hiding this comment

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

suggestion (typo): Consider adding 'a' before 'representor' for grammatical correctness.

Change the sentence to: 'Specifically, in most cases, this was used to process all traffic on a representor, which is a transfer proxy port.'

Suggested change
Specifically, in most cases, this was used to process all traffic on representor
which is a transfer proxy port.
Specifically, in most cases, this was used to process all traffic on a representor,
which is a transfer proxy port.

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 (2)
drivers/net/mlx5/mlx5_txq.c (1)

1456-1461: Preserve original rte_errno when cleaning up on failure.

Destroying the SQ miss flow may overwrite rte_errno, masking the original failure of tx repr-matching flow creation. Save and restore it before returning.

-        if (mlx5_flow_hw_tx_repr_matching_flow(dev, sq_num, true)) {
-            if (sq_miss_created)
-                mlx5_flow_hw_esw_destroy_sq_miss_flow(dev, sq_num);
-            return -rte_errno;
-        }
+        if (mlx5_flow_hw_tx_repr_matching_flow(dev, sq_num, true)) {
+            int saved_errno = rte_errno;
+            if (sq_miss_created)
+                mlx5_flow_hw_esw_destroy_sq_miss_flow(dev, sq_num);
+            rte_errno = saved_errno;
+            return -rte_errno;
+        }
drivers/net/mlx5/mlx5_flow_hw.c (1)

5308-5329: Egress group translation is out of sync with default TX repr-tagging; can leak user flows into reserved group 0

You always create default egress control flows when dv_esw_en is set (see flow_hw_setup_tx_repr_tagging), but here you only bump user-specified egress groups when dv_xmeta_en == MLX5_XMETA_MODE_META32_HWS. If dv_esw_en is true and dv_xmeta_en is not META32_HWS, external flows can still target group 0 and collide with PMD’s reserved egress rules.

Align the conditions by bumping egress groups for any dv_esw_en, not just META32_HWS. Also update the comment accordingly.

Proposed fix:

- } else if (config->dv_esw_en &&
-            config->dv_xmeta_en == MLX5_XMETA_MODE_META32_HWS &&
-            external &&
-            flow_attr->egress) {
+ } else if (config->dv_esw_en &&
+            external &&
+            flow_attr->egress) {
     /*
-     * On E-Switch setups, default egress flow rules are inserted to allow
-     * representor matching and/or preserving metadata across steering domains.
+     * On E-Switch setups, default egress control flows are inserted (group 0)
+     * to support representor TX tagging/preservation. Group 0 is reserved.
      * These flow rules are inserted in group 0 and this group is reserved by PMD
-     * for these purposes.
+     * for these purposes.
      *
-     * As a result, if representor matching or extended metadata mode is enabled,
-     * group provided by the user must be incremented to avoid inserting flow rules
-     * in group 0.
+     * As a result, the user-provided egress group must be incremented to avoid
+     * inserting flow rules in group 0.
      */
🧹 Nitpick comments (5)
doc/guides/nics/mlx5.rst (1)

3164-3166: Wording consistency: prefer “E‑Switch (transfer) domain”.

To align with the rest of the guide, consider rephrasing to explicitly say “In the E‑Switch (transfer) domain, compare is not supported for ingress rules,” preserving the direction detail.

doc/guides/rel_notes/release_25_11.rst (1)

200-207: Add a short migration pointer.

Consider appending one sentence to guide users: “To replicate previous behavior, use RTE_FLOW_ACTION_TYPE_RSS in the E‑Switch (transfer) domain; see Port/Represented Port flow sections in mlx5.rst for examples.”

drivers/net/mlx5/mlx5_trigger.c (1)

1135-1140: dr_ctx check is fine but redundant.

dev_start initializes HWS (dr_ctx) earlier in the same path. Keeping this check is harmless; alternatively drop it to avoid duplicate validation.

drivers/net/mlx5/mlx5_flow_hw.c (2)

8552-8562: Represented-port item domain check OK; consider clearer error text

Blocking represented_port in ingress/egress domains is correct (transfer-only). Consider consolidating the two errors into a single message stating “represented_port item requires transfer domain (no ingress/egress)”, to match action-level validation and reduce confusion.


11907-11912: Unconditional TX repr-tagging setup matches intent; ensure translate_group bump matches

Creating default TX repr-tagging tables whenever dv_esw_en is enabled looks good. This must be paired with egress group translation that always bumps user groups under dv_esw_en (see __translate_group). Otherwise users may target reserved group 0.

📜 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 744ae06.

📒 Files selected for processing (11)
  • doc/guides/nics/mlx5.rst (1 hunks)
  • doc/guides/rel_notes/deprecation.rst (0 hunks)
  • doc/guides/rel_notes/release_25_11.rst (1 hunks)
  • drivers/net/mlx5/linux/mlx5_os.c (0 hunks)
  • drivers/net/mlx5/mlx5.c (0 hunks)
  • drivers/net/mlx5/mlx5.h (0 hunks)
  • drivers/net/mlx5/mlx5_flow.c (1 hunks)
  • drivers/net/mlx5/mlx5_flow.h (0 hunks)
  • drivers/net/mlx5/mlx5_flow_hw.c (3 hunks)
  • drivers/net/mlx5/mlx5_trigger.c (2 hunks)
  • drivers/net/mlx5/mlx5_txq.c (1 hunks)
💤 Files with no reviewable changes (5)
  • drivers/net/mlx5/mlx5.h
  • drivers/net/mlx5/linux/mlx5_os.c
  • drivers/net/mlx5/mlx5.c
  • drivers/net/mlx5/mlx5_flow.h
  • doc/guides/rel_notes/deprecation.rst
🧰 Additional context used
🧬 Code graph analysis (1)
drivers/net/mlx5/mlx5_txq.c (1)
drivers/net/mlx5/mlx5_flow_hw.c (1)
  • mlx5_flow_hw_tx_repr_matching_flow (15805-15859)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Sourcery review
🔇 Additional comments (2)
drivers/net/mlx5/mlx5_flow.c (1)

8783-8807: Isolate-mode gating simplified — verified clean

The devarg repr_matching_en removal is documented in release notes, and the verification confirms no stale references exist. The internal function mlx5_flow_hw_tx_repr_matching_flow() remains active in mlx5_txq.c and mlx5_trigger.c—this is expected and correct. The change to mlx5_flow_isolate() removing the repr_matching-based restriction is consistent with the user-facing devarg removal while allowing internal functionality to continue operating.

drivers/net/mlx5/mlx5_trigger.c (1)

1624-1630: Request verification: TX repr matching gating strategy and SQ miss flow alignment.

The code at lines 1624-1630 calls mlx5_flow_hw_tx_repr_matching_flow() without gating on (priv->representor || priv->master), while the preceding SQ miss flow block (lines 1616-1622) does gate on these conditions. However, the same ungated pattern appears in mlx5_txq.c:1456, suggesting this may be intentional rather than an oversight.

To confirm whether gating is needed:

  1. Verify whether hw_tx_repr_tagging_tbl is always successfully created for non-representor ports when dv_esw_en=1, or whether table creation fails for certain port types.
  2. If the table creation can fail for non-representor ports, both mlx5_trigger.c:1625 and mlx5_txq.c:1456 would need the same fix.
  3. If the table is always created for all dv_esw_en ports, the asymmetry with SQ miss flow may be acceptable (SQ miss has additional fdb_def_rule condition).

The error logged at mlx5_flow_hw.c:15842 suggests the table may not always exist, supporting the review's concern—but the code pattern is consistent across multiple call sites, which requires verification to distinguish between a genuine bug and defensive design.

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