|WARNING| [v3] common/mlx5: fix mkey ordering enum

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Mon Oct 26 14:40:39 CET 2026


Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/172084

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-10-26

# DPDK Patch Review: common/mlx5: fix mkey ordering enum

## ERRORS

**Use of `!` operator on non-boolean variable** (line in `mlx5_common_os.c`):

```c
if (!mlx5_haswell_broadwell_cpu)
```

`mlx5_haswell_broadwell_cpu` should be compared explicitly against 0 or false rather than using truthiness. Per DPDK style guidelines, explicit comparison is required for non-`bool` types. If this is an `int`, write `if (mlx5_haswell_broadwell_cpu == 0)`. If it's a pointer, write `if (mlx5_haswell_broadwell_cpu == NULL)`. If it's a `bool`, the current form is correct.

**Note**: This pattern appears twice in the modified function (both in the original context and the added code). However, only the code the patch introduces is subject to this review. The pre-existing occurrence is flagged below as Info.

---

## WARNINGS

None identified.

---

## INFO

**Pre-existing: Use of `!` operator on non-boolean variable** (context line):

The original code at line ~406 contains:
```c
if (!mlx5_haswell_broadwell_cpu)
```

This is the same style issue as flagged in Errors above, but this occurrence is in code that already existed before this patch. It should be fixed in a separate patch, not as part of this change.

**Enum value removed without deprecation notice**:

The patch removes `MLX5_MKC_RAW_ORDERING_SAO = 0x1` from the `mlx5_mkc_raw_ordering` enum. If this value was used elsewhere in the codebase or by external code, removing it could break compilation. However, since this appears to be correcting the enum to match updated device specifications and the commit message indicates this is a fix for incorrect values, this may be acceptable. Verify that `MLX5_MKC_RAW_ORDERING_SAO` is not referenced elsewhere in the codebase.

**Conditional ordering application logic**:

The new code applies `mlx5_devx_mkey_attr_set_ordering()` only when `attr.mkc_order_write_after_write_ro_only` is set, whereas the original code applied it unconditionally (when not on Haswell/Broadwell). This is a significant behavior change. Ensure this is the intended fix and matches the commit message description about applying read-after-write ordering "only when firmware requires relaxed-order-only mode."

---

## SUMMARY

The patch updates an enum to match revised device specifications and refines the Windows memory registration ordering logic. The primary issue is the use of implicit boolean comparison (`!mlx5_haswell_broadwell_cpu`) which violates DPDK style guidelines. This should be changed to an explicit comparison.

Review-Result: ERROR


More information about the test-report mailing list