All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Nawal Kishor <nkishor@marvell.com>
Cc: <dev@dpdk.org>, <jerinj@marvell.com>, <asekhar@marvell.com>
Subject: Re: [PATCH v2 0/2] cnxk: add HALO support for CN20K mempool
Date: Tue, 13 Jan 2026 22:04:48 -0800	[thread overview]
Message-ID: <20260113220448.56f44b5e@phoenix.local> (raw)
In-Reply-To: <20251205055140.2395369-1-nkishor@marvell.com>

On Fri, 5 Dec 2025 11:21:32 +0530
Nawal Kishor <nkishor@marvell.com> wrote:

> This series of patches adds support for HALO in CNXK mempool driver.
> 
> Changes in v2:
>  * Fixed compilation warnings.
> 
> Nawal Kishor (2):
>   common/cnxk: add support for halos
>   mempool/cnxk: add halo support in mempool
> 
>  drivers/common/cnxk/hw/npa.h                  |  81 ++++++
>  drivers/common/cnxk/roc_idev.c                |  25 ++
>  drivers/common/cnxk/roc_idev.h                |   3 +
>  drivers/common/cnxk/roc_idev_priv.h           |   1 +
>  drivers/common/cnxk/roc_mbox.h                |   6 +
>  drivers/common/cnxk/roc_nix.h                 |   1 +
>  drivers/common/cnxk/roc_nix_queue.c           |  46 ++-
>  drivers/common/cnxk/roc_npa.c                 | 268 ++++++++++++++++--
>  drivers/common/cnxk/roc_npa.h                 |  20 +-
>  drivers/common/cnxk/roc_npa_debug.c           | 201 ++++++++++++-
>  drivers/common/cnxk/roc_npa_priv.h            |   3 +
>  .../common/cnxk/roc_platform_base_symbols.c   |   2 +
>  drivers/common/cnxk/roc_sso.c                 |  35 ++-
>  drivers/common/cnxk/roc_sso.h                 |   1 +
>  drivers/mempool/cnxk/cn10k_mempool_ops.c      |  19 +-
>  drivers/mempool/cnxk/cn20k_mempool_ops.c      |  60 ++++
>  drivers/mempool/cnxk/cn9k_mempool_ops.c       |   2 +-
>  drivers/mempool/cnxk/cnxk_mempool.c           |  40 ++-
>  drivers/mempool/cnxk/cnxk_mempool.h           |  16 +-
>  drivers/mempool/cnxk/cnxk_mempool_ops.c       |  11 +-
>  drivers/mempool/cnxk/meson.build              |   1 +
>  21 files changed, 750 insertions(+), 92 deletions(-)
>  create mode 100644 drivers/mempool/cnxk/cn20k_mempool_ops.c
> 

This patch never got merged because of CI build failures.
Fix and resubmit.

AI review also says:


## Patch Review: cnxk halo support (2-patch series)

### Patch 1/2: `common/cnxk: add support for halos`

#### Commit Message ✓

| Criterion | Status | Notes |
|-----------|--------|-------|
| Subject ≤60 chars | ✓ | 33 characters |
| Correct prefix | ✓ | `common/cnxk:` is appropriate |
| Lowercase after colon | ✓ | |
| Imperative mood | ✓ | "add support" |
| No trailing period | ✓ | |
| Body wrapped ≤75 chars | ✓ | |
| Body not starting with "It" | ✓ | Starts with "In cn9k/cn10k..." |
| Signed-off-by present | ✓ | Real name and valid email |

#### Code Issues

**Warning: Implicit pointer comparison (multiple locations)**

The AGENTS.md specifies:
> `if (!p)             /* Bad - don't use ! on pointers */`

Several instances use `!ptr` style:

```c
// roc_npa.c - npa_halo_alloc()
if (!lf || !halo || !aura_handle)
    return NPA_ERR_PARAM;

// roc_npa.c - npa_halo_free()  
if (!lf || !aura_handle)
    return NPA_ERR_PARAM;
```

**Suggested fix:**
```c
if (lf == NULL || halo == NULL || aura_handle == NULL)
    return NPA_ERR_PARAM;
```

---

**Warning: Non-portable format specifier**

In `roc_npa_debug.c`, function `npa_halo_dump()`:
```c
npa_dump("W9: thresh \t\t%lu\nW9: fc_msh_dst \t\t%d",
         (unsigned long)halo->thresh, halo->fc_msh_dst);
```

The AGENTS.md specifies:
> Forbidden: `%lld`, `%llu`, `%llx` → Preferred: `%PRId64`, `%PRIu64`, `%PRIx64`

While `%lu` with an explicit cast is technically different, for consistency with the rest of the file (which uses `%"PRIx64"` patterns), this should use:
```c
npa_dump("W9: thresh \t\t%" PRIu64 "\nW9: fc_msh_dst \t\t%d",
         (uint64_t)halo->thresh, halo->fc_msh_dst);
```

---

**Warning: New API functions not marked `__rte_experimental`**

New public APIs added to `roc_idev.h`:
```c
int __roc_api roc_idev_npa_halo_ena_get(void);
void __roc_api roc_idev_npa_halo_ena_set(int halo_ena);
```

And new inline function in `roc_npa.h`:
```c
static inline uint32_t
roc_npa_max_block_size(void)
```

Per AGENTS.md:
> New APIs must be marked as `__rte_experimental`

**Note:** These are internal (`__roc_api`) functions in the ROC layer, so `__rte_experimental` may not strictly apply - this depends on whether the ROC API is considered public. However, the pattern in other ROC files should be followed.

---

**Info: Good practices observed**
- Proper error code additions (`NPA_ERR_HALO_INIT`, `NPA_ERR_HALO_FINI`)
- Symbol exports added via `RTE_EXPORT_INTERNAL_SYMBOL`
- Hardware structure properly defined with bitfields
- Consistent use of `mbox_get()`/`mbox_put()` patterns

---

### Patch 2/2: `mempool/cnxk: add halo support in mempool`

#### Commit Message ✓

| Criterion | Status | Notes |
|-----------|--------|-------|
| Subject ≤60 chars | ✓ | 40 characters |
| Correct prefix | ✓ | `mempool/cnxk:` is appropriate |
| Lowercase after colon | ✓ | |
| Imperative mood | ✓ | "add" |
| No trailing period | ✓ | |
| Body wrapped ≤75 chars | ✓ | |
| Body not starting with "It" | ✓ | Starts with "This patch..." |
| Signed-off-by present | ✓ | |

#### License ✓

New file `cn20k_mempool_ops.c`:
```c
/* SPDX-License-Identifier: BSD-3-Clause
 * Copyright(C) 2025 Marvell.
 */
```
- SPDX on first line ✓
- Copyright follows ✓
- Blank line before includes ✓
- BSD-3-Clause appropriate for driver ✓

#### Code Issues

**Warning: Devargs parameter string formatting**

In `cnxk_mempool.c`:
```c
RTE_PMD_REGISTER_PARAM_STRING(mempool_cnxk,
                  CNXK_NPA_MAX_POOLS_PARAM "=<128-1048576>"
                  CNXK_NPA_HALO_ENA_PARAM "=<0-1>");
```

The two parameter strings will concatenate without a space separator, resulting in:
`max_pools=<128-1048576>halo_ena=<0-1>`

**Suggested fix:**
```c
RTE_PMD_REGISTER_PARAM_STRING(mempool_cnxk,
                  CNXK_NPA_MAX_POOLS_PARAM "=<128-1048576> "
                  CNXK_NPA_HALO_ENA_PARAM "=<0-1>");
```

---

**Info: meson.build ordering**

The file list in `meson.build` is not alphabetically ordered:
```python
sources = files(
        ...
        'cn9k_mempool_ops.c',
        'cn10k_mempool_ops.c',
        'cn20k_mempool_ops.c',
        'cn10k_hwpool_ops.c',
)
```

Per AGENTS.md: "Lists alphabetically ordered". However, this follows the existing convention in the file (which was already non-alphabetical), so this is an existing technical debt rather than a new issue introduced by this patch.

---

**Info: Documentation consideration**

The new `halo_ena` devargs parameter should ideally be documented in the driver documentation (`doc/guides/mempool/cnxk.rst` or similar) so users understand what it does and when to use it.

---

### Summary

| Severity | Count | Items |
|----------|-------|-------|
| **Error** | 0 | None |
| **Warning** | 4 | Implicit pointer checks, format specifier, experimental marking, devargs spacing |
| **Info** | 2 | meson.build ordering (pre-existing), documentation gap |

#### Recommended Actions

1. **Should fix:** Change `!ptr` to `ptr == NULL` for pointer comparisons
2. **Should fix:** Use `PRIu64` format specifier in `npa_halo_dump()`
3. **Should fix:** Add space between devargs parameter strings
4. **Consider:** Add documentation for the new `halo_ena` parameter
5. **Consider:** Verify `__rte_experimental` policy for internal ROC APIs

The patches are generally well-structured and follow DPDK conventions. The issues identified are relatively minor style/consistency items rather than functional problems.

  parent reply	other threads:[~2026-01-14  6:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04  6:51 [PATCH 0/2] cnxk: Add HALO support for CN20K mempool Nawal Kishor
2025-12-04  6:51 ` [PATCH 1/2] common/cnxk: add support for halos Nawal Kishor
2025-12-05  5:51   ` [PATCH v2 0/2] cnxk: add HALO support for CN20K mempool Nawal Kishor
2025-12-05  5:51     ` [PATCH v2 1/2] common/cnxk: add support for halos Nawal Kishor
2025-12-05  5:51     ` [PATCH v2 2/2] mempool/cnxk: add halo support in mempool Nawal Kishor
2026-02-17  5:34       ` [PATCH v3 0/2] Add HALO support for CN20K mempool Nawal Kishor
2026-02-17  5:34         ` [PATCH v3 1/2] common/cnxk: add support for halos Nawal Kishor
2026-02-17  5:34         ` [PATCH v3 2/2] mempool/cnxk: add halo support in mempool Nawal Kishor
2026-02-17  8:43         ` [PATCH v3 0/2] Add HALO support for CN20K mempool Jerin Jacob
2026-02-17 10:39       ` [PATCH v4 " Nawal Kishor
2026-02-17 10:39         ` [PATCH v4 1/2] common/cnxk: add support for halos Nawal Kishor
2026-02-19 17:19           ` Stephen Hemminger
2026-02-17 10:39         ` [PATCH v4 2/2] mempool/cnxk: add halo support in mempool Nawal Kishor
2026-02-19 17:33           ` Stephen Hemminger
2026-01-14  6:04     ` Stephen Hemminger [this message]
2026-01-14  7:52       ` [PATCH v2 0/2] cnxk: add HALO support for CN20K mempool Morten Brørup
2026-01-19  5:21       ` [EXTERNAL] " Nawal Kishor
2025-12-04  6:51 ` [PATCH 2/2] mempool/cnxk: add halo support in mempool Nawal Kishor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260113220448.56f44b5e@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=asekhar@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=nkishor@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.