Re: [PATCH v4 1/2] common/cnxk: add support for halos

Stephen Hemminger
2026-02-19T17:52:10Z

On Tue, 17 Feb 2026 16:09:21 +0530
Nawal Kishor <nkishor@marvell.com> wrote:

> +int
> +roc_idev_npa_halo_ena_get(void)
> +{
> + struct idev_cfg *idev;
> + int halo_ena;
> +
> + idev = idev_get_cfg();
> + halo_ena = 0;
> + if (idev != NULL)
> + halo_ena = __atomic_load_n(&idev->halo_ena, __ATOMIC_ACQUIRE);

Do not use __atomic_load_n, DPDK has migrated to rte_atomic_load_explicit

> diff --git a/drivers/common/cnxk/roc_idev_priv.h b/drivers/common/cnxk/roc_idev_priv.h
> index 98b6286bfe..dde555535b 100644
> --- a/drivers/common/cnxk/roc_idev_priv.h
> +++ b/drivers/common/cnxk/roc_idev_priv.h
> @@ -30,6 +30,7 @@ struct idev_cfg {
> struct npa_lf *npa;
> uint16_t npa_refcnt;
> uint32_t max_pools;
> + int halo_ena;

Using int for a flag value is legacy C code style.
Use bool to save space and have some type safety.

> + if (roc_feature_npa_has_halo() && roc_nix->sqb_halo_ena) {
> + struct npa_cn20k_halo_s halo;
> +
> + memset(&halo, 0, sizeof(struct npa_cn20k_halo_s));
> + halo.nat_align = 1;
> + halo.fc_ena = 1;
> + halo.fc_stype = 0x3; /* STSTP */
> + halo.fc_addr = (uint64_t)sq->fc;
> + halo.fc_hyst_bits = 0; /* Store count on all updates */
> + halo.unified_ctx = 1;

Using structure initialization is preferred over memset and individual values.