[PATCH 01/31] common/cnxk: add aura ref count mechanism
Nithin Dabilpuram
ndabilpuram at marvell.com
Fri Aug 11 10:57:35 CEST 2023
From: Sunil Kumar Kori <skori at marvell.com>
Each RQ can be associated with lpb_aura and spb_aura.
lpb_aura or spb_aura is shared across multiple RQs then
cleanup via one RQ will reset the aura context.
To prevent, adding ref count mechanism.
Signed-off-by: Sunil Kumar Kori <skori at marvell.com>
---
drivers/common/cnxk/roc_nix_fc.c | 6 ++++++
drivers/common/cnxk/roc_npa_priv.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/drivers/common/cnxk/roc_nix_fc.c b/drivers/common/cnxk/roc_nix_fc.c
index d8ca5f9996..1f5ef960da 100644
--- a/drivers/common/cnxk/roc_nix_fc.c
+++ b/drivers/common/cnxk/roc_nix_fc.c
@@ -537,6 +537,7 @@ roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena, ui
plt_err("Enabling backpressue failed on aura 0x%" PRIx64,
pool_id);
} else {
+ lf->aura_attr[aura_id].ref_count++;
plt_info("Ignoring port=%u tc=%u config on shared aura 0x%" PRIx64,
roc_nix->port_id, tc, pool_id);
}
@@ -552,6 +553,8 @@ roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena, ui
if (ena) {
if (roc_npa_aura_bp_configure(pool_id, nix->bpid[tc], bp_intf, bp_thresh, true))
plt_err("Enabling backpressue failed on aura 0x%" PRIx64, pool_id);
+ else
+ lf->aura_attr[aura_id].ref_count++;
} else {
bool found = !!force;
@@ -561,6 +564,9 @@ roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena, ui
found = true;
if (!found)
return;
+ else if ((lf->aura_attr[aura_id].ref_count > 0) &&
+ --lf->aura_attr[aura_id].ref_count)
+ return;
if (roc_npa_aura_bp_configure(pool_id, 0, 0, 0, false))
plt_err("Disabling backpressue failed on aura 0x%" PRIx64, pool_id);
diff --git a/drivers/common/cnxk/roc_npa_priv.h b/drivers/common/cnxk/roc_npa_priv.h
index d2118cc4fb..704d93d5dc 100644
--- a/drivers/common/cnxk/roc_npa_priv.h
+++ b/drivers/common/cnxk/roc_npa_priv.h
@@ -49,6 +49,7 @@ struct npa_aura_lim {
struct npa_aura_attr {
int buf_type[ROC_NPA_BUF_TYPE_END];
+ uint16_t ref_count;
};
struct dev;
--
2.25.1
More information about the dev
mailing list