From: Manish Kurup <manish.kurup@broadcom.com>
To: dev@dpdk.org
Cc: ajit.khaparde@broadcom.com,
Farah Smith <farah.smith@broadcom.com>,
Jay Ding <jay.ding@broadcom.com>
Subject: [PATCH 05/54] net/bnxt/tf_core: dynamic UPAR support for THOR2
Date: Mon, 29 Sep 2025 20:35:15 -0400 [thread overview]
Message-ID: <20250930003604.87108-6-manish.kurup@broadcom.com> (raw)
In-Reply-To: <20250930003604.87108-1-manish.kurup@broadcom.com>
Changes to support Dynamic UPAR APIs on THOR2.
1. TF core changes
2. ULP Mapper changes
3. RTE parser changes
4. Add 128B encap table type string
Signed-off-by: Manish Kurup <manish.kurup@broadcom.com>
Reviewed-by: Farah Smith <farah.smith@broadcom.com>
Reviewed-by: Jay Ding <jay.ding@broadcom.com>
---
.../bnxt/hcapi/cfa_v3/include/cfa_resources.h | 25 +++-
drivers/net/bnxt/tf_core/tf_util.c | 2 +
drivers/net/bnxt/tf_core/v3/tfc.h | 1 +
drivers/net/bnxt/tf_core/v3/tfc_idx_tbl.c | 51 +++++---
drivers/net/bnxt/tf_core/v3/tfc_msg.c | 121 +++++++++++++++++-
drivers/net/bnxt/tf_core/v3/tfc_msg.h | 13 +-
drivers/net/bnxt/tf_core/v3/tfc_util.c | 2 +
drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c | 29 +++++
8 files changed, 213 insertions(+), 31 deletions(-)
diff --git a/drivers/net/bnxt/hcapi/cfa_v3/include/cfa_resources.h b/drivers/net/bnxt/hcapi/cfa_v3/include/cfa_resources.h
index 7408859a53..d1d62738d3 100644
--- a/drivers/net/bnxt/hcapi/cfa_v3/include/cfa_resources.h
+++ b/drivers/net/bnxt/hcapi/cfa_v3/include/cfa_resources.h
@@ -94,7 +94,18 @@ enum cfa_resource_subtype_idx_tbl {
CFA_RSUBTYPE_IDX_TBL_EM_FKB, /**< EM FKB table */
CFA_RSUBTYPE_IDX_TBL_WC_FKB, /**< WC TCAM FKB table */
CFA_RSUBTYPE_IDX_TBL_EM_FKB_MASK, /**< EM FKB Mask table */
- CFA_RSUBTYPE_IDX_TBL_MAX
+ CFA_RSUBTYPE_IDX_TBL_MAX,
+ /*
+ * Resource subtypes that come after this point are handled "specially"
+ * by code in the TFC core and firmware layers. This #define loses
+ * significance after the Mapper TFC layer.
+ */
+ CFA_RSUBTYPE_IDX_TBL_DYN_UPAR, /**< Dynamic UPAR table */
+ /*
+ * MAX value for custom index tables, i.e. tables that are handled
+ * specially by firmware or layers below mapper.
+ */
+ CFA_RSUBTYPE_CUSTOM_IDX_TBL_MAX
};
/**
@@ -132,6 +143,18 @@ enum cfa_resource_subtype_if_tbl {
CFA_RSUBTYPE_IF_TBL_MAX
};
+/**
+ * Resource sub-types for CFA_BLKTYPE_IDX_TBL
+ */
+enum cfa_resource_blktype_idx_tbl {
+ CFA_IDX_TBL_BLKTYPE_CFA = 0,
+ CFA_IDX_TBL_BLKTYPE_RXP,
+ CFA_IDX_TBL_BLKTYPE_RE_GPARSE,
+ CFA_IDX_TBL_BLKTYPE_TE_GPARSE,
+ CFA_IDX_TBL_BLKTYPE_LAST = CFA_IDX_TBL_BLKTYPE_TE_GPARSE,
+ CFA_IDX_TBL_BLKTYPE_MAX
+};
+
/**
* Resource sub-types for CFA_RTYPE_CMM
*/
diff --git a/drivers/net/bnxt/tf_core/tf_util.c b/drivers/net/bnxt/tf_core/tf_util.c
index 8ce8238b4a..16aea7204c 100644
--- a/drivers/net/bnxt/tf_core/tf_util.c
+++ b/drivers/net/bnxt/tf_core/tf_util.c
@@ -85,6 +85,8 @@ tf_tbl_type_2_str(enum tf_tbl_type tbl_type)
return "Encap 32B";
case TF_TBL_TYPE_ACT_ENCAP_64B:
return "Encap 64B";
+ case TF_TBL_TYPE_ACT_ENCAP_128B:
+ return "Encap 128B";
case TF_TBL_TYPE_ACT_SP_SMAC:
return "Source Properties SMAC";
case TF_TBL_TYPE_ACT_SP_SMAC_IPV4:
diff --git a/drivers/net/bnxt/tf_core/v3/tfc.h b/drivers/net/bnxt/tf_core/v3/tfc.h
index 4176aa01bd..1c7eb51c8c 100644
--- a/drivers/net/bnxt/tf_core/v3/tfc.h
+++ b/drivers/net/bnxt/tf_core/v3/tfc.h
@@ -372,6 +372,7 @@ struct tfc_idx_tbl_info {
enum cfa_resource_subtype_idx_tbl rsubtype; /**< resource subtype */
enum cfa_dir dir; /**< direction rx/tx */
uint16_t id; /**< alloc/free index */
+ enum cfa_resource_blktype_idx_tbl blktype; /**< block type */
};
/**
diff --git a/drivers/net/bnxt/tf_core/v3/tfc_idx_tbl.c b/drivers/net/bnxt/tf_core/v3/tfc_idx_tbl.c
index c8d64c5418..3311b9df65 100644
--- a/drivers/net/bnxt/tf_core/v3/tfc_idx_tbl.c
+++ b/drivers/net/bnxt/tf_core/v3/tfc_idx_tbl.c
@@ -15,6 +15,9 @@
#include "tfc_msg.h"
#include "tfc_util.h"
+#define BLKTYPE_IS_CFA(blktype) \
+ (CFA_IDX_TBL_BLKTYPE_CFA == (blktype))
+
int tfc_idx_tbl_alloc(struct tfc *tfcp, uint16_t fid,
enum cfa_track_type tt,
struct tfc_idx_tbl_info *tbl_info)
@@ -48,9 +51,10 @@ int tfc_idx_tbl_alloc(struct tfc *tfcp, uint16_t fid,
return -EINVAL;
}
- if (tbl_info->rsubtype >= CFA_RSUBTYPE_IDX_TBL_MAX) {
- PMD_DRV_LOG_LINE(ERR, "Invalid idx tbl subtype: %d",
- tbl_info->rsubtype);
+ if (BLKTYPE_IS_CFA(tbl_info->blktype) &&
+ tbl_info->rsubtype >= CFA_RSUBTYPE_IDX_TBL_MAX) {
+ PMD_DRV_LOG_LINE(ERR, "%s: Invalid idx tbl subtype: %d",
+ __func__, tbl_info->rsubtype);
return -EINVAL;
}
@@ -68,7 +72,8 @@ int tfc_idx_tbl_alloc(struct tfc *tfcp, uint16_t fid,
}
rc = tfc_msg_idx_tbl_alloc(tfcp, fid, sid, tt, tbl_info->dir,
- tbl_info->rsubtype, &tbl_info->id);
+ tbl_info->rsubtype, &tbl_info->id,
+ tbl_info->blktype);
if (rc)
PMD_DRV_LOG_LINE(ERR, "hwrm failed: %s:%s %s",
tfc_dir_2_str(tbl_info->dir),
@@ -118,9 +123,10 @@ int tfc_idx_tbl_alloc_set(struct tfc *tfcp, uint16_t fid,
return -EINVAL;
}
- if (tbl_info->rsubtype >= CFA_RSUBTYPE_IDX_TBL_MAX) {
- PMD_DRV_LOG_LINE(ERR, "Invalid idx tbl subtype: %d",
- tbl_info->rsubtype);
+ if (BLKTYPE_IS_CFA(tbl_info->blktype) &&
+ tbl_info->rsubtype >= CFA_RSUBTYPE_IDX_TBL_MAX) {
+ PMD_DRV_LOG_LINE(ERR, "%s: Invalid idx tbl subtype: %d",
+ __func__, tbl_info->rsubtype);
return -EINVAL;
}
@@ -143,7 +149,8 @@ int tfc_idx_tbl_alloc_set(struct tfc *tfcp, uint16_t fid,
rc = tfc_msg_idx_tbl_alloc_set(tfcp, fid, sid, tt, tbl_info->dir,
tbl_info->rsubtype, data,
- data_sz_in_bytes, &tbl_info->id);
+ data_sz_in_bytes, &tbl_info->id,
+ tbl_info->blktype);
if (rc)
PMD_DRV_LOG_LINE(ERR, "hwrm failed: %s:%s %s",
tfc_dir_2_str(tbl_info->dir),
@@ -181,8 +188,9 @@ int tfc_idx_tbl_set(struct tfc *tfcp, uint16_t fid,
return -EINVAL;
}
- if (tbl_info->rsubtype >= CFA_RSUBTYPE_IDX_TBL_MAX) {
- PMD_DRV_LOG_LINE(ERR, "Invalid idx tbl subtype: %d",
+ if (BLKTYPE_IS_CFA(tbl_info->blktype) &&
+ tbl_info->rsubtype >= CFA_RSUBTYPE_IDX_TBL_MAX) {
+ PMD_DRV_LOG_LINE(ERR, "%s: Invalid idx tbl subtype: %d", __func__,
tbl_info->rsubtype);
return -EINVAL;
}
@@ -202,7 +210,8 @@ int tfc_idx_tbl_set(struct tfc *tfcp, uint16_t fid,
rc = tfc_msg_idx_tbl_set(tfcp, fid, sid, tbl_info->dir,
tbl_info->rsubtype, tbl_info->id,
- data, data_sz_in_bytes);
+ data, data_sz_in_bytes,
+ tbl_info->blktype);
if (rc)
PMD_DRV_LOG_LINE(ERR, "hwrm failed: %s:%s %d %s",
tfc_dir_2_str(tbl_info->dir),
@@ -240,9 +249,10 @@ int tfc_idx_tbl_get(struct tfc *tfcp, uint16_t fid,
return -EINVAL;
}
- if (tbl_info->rsubtype >= CFA_RSUBTYPE_IDX_TBL_MAX) {
- PMD_DRV_LOG_LINE(ERR, "Invalid idx tbl subtype: %d",
- tbl_info->rsubtype);
+ if (BLKTYPE_IS_CFA(tbl_info->blktype) &&
+ tbl_info->rsubtype >= CFA_RSUBTYPE_IDX_TBL_MAX) {
+ PMD_DRV_LOG_LINE(ERR, "%s: Invalid idx tbl subtype: %d",
+ __func__, tbl_info->rsubtype);
return -EINVAL;
}
@@ -261,7 +271,8 @@ int tfc_idx_tbl_get(struct tfc *tfcp, uint16_t fid,
rc = tfc_msg_idx_tbl_get(tfcp, fid, sid, tbl_info->dir,
tbl_info->rsubtype, tbl_info->id,
- data, data_sz_in_bytes);
+ data, data_sz_in_bytes,
+ tbl_info->blktype);
if (rc)
PMD_DRV_LOG_LINE(ERR, "hwrm failed: %s:%s %d %s",
tfc_dir_2_str(tbl_info->dir),
@@ -297,9 +308,10 @@ int tfc_idx_tbl_free(struct tfc *tfcp, uint16_t fid,
return -EINVAL;
}
- if (tbl_info->rsubtype >= CFA_RSUBTYPE_IDX_TBL_MAX) {
- PMD_DRV_LOG_LINE(ERR, "Invalid idx tbl subtype: %d",
- tbl_info->rsubtype);
+ if (BLKTYPE_IS_CFA(tbl_info->blktype) &&
+ tbl_info->rsubtype >= CFA_RSUBTYPE_IDX_TBL_MAX) {
+ PMD_DRV_LOG_LINE(ERR, "%s: Invalid idx tbl subtype: %d",
+ __func__, tbl_info->rsubtype);
return -EINVAL;
}
@@ -317,7 +329,8 @@ int tfc_idx_tbl_free(struct tfc *tfcp, uint16_t fid,
}
rc = tfc_msg_idx_tbl_free(tfcp, fid, sid, tbl_info->dir,
- tbl_info->rsubtype, tbl_info->id);
+ tbl_info->rsubtype, tbl_info->id,
+ tbl_info->blktype);
if (rc)
PMD_DRV_LOG_LINE(ERR, "hwrm failed: %s:%s %d %s",
tfc_dir_2_str(tbl_info->dir),
diff --git a/drivers/net/bnxt/tf_core/v3/tfc_msg.c b/drivers/net/bnxt/tf_core/v3/tfc_msg.c
index ef64707233..2ad0b386fa 100644
--- a/drivers/net/bnxt/tf_core/v3/tfc_msg.c
+++ b/drivers/net/bnxt/tf_core/v3/tfc_msg.c
@@ -61,6 +61,79 @@ static int tfc_msg_set_fid(struct bnxt *bp, uint16_t req_fid, uint16_t *msg_fid)
return 0;
}
+/*
+ * Lookup table to map TFC local blocktype values to HWRM equivalents. Does
+ * this on a per HWRM command basis.
+ */
+enum tfc_hwrm_idx_tbl_cmds {
+ IDX_TBL_ALLOC,
+ IDX_TBL_ALLOC_SET,
+ IDX_TBL_SET,
+ IDX_TBL_GET,
+ IDX_TBL_FREE,
+ IDX_TBL_LAST = IDX_TBL_FREE,
+ IDX_TBL_MAX
+};
+
+#define CMD_TO_HWRM_BLKT(tfc_cmd, blktype) \
+ HWRM_TFC_##tfc_cmd##_INPUT_BLKTYPE_BLKTYPE_##blktype
+
+uint8_t cfa_res_to_hwrm_blkt_lkup_tbl[IDX_TBL_MAX][CFA_IDX_TBL_BLKTYPE_MAX] = {
+ [IDX_TBL_ALLOC] = {
+ CMD_TO_HWRM_BLKT(IDX_TBL_ALLOC, CFA),
+ CMD_TO_HWRM_BLKT(IDX_TBL_ALLOC, RXP),
+ CMD_TO_HWRM_BLKT(IDX_TBL_ALLOC, RE_GPARSE),
+ CMD_TO_HWRM_BLKT(IDX_TBL_ALLOC, TE_GPARSE),
+ },
+ [IDX_TBL_ALLOC_SET] = {
+ CMD_TO_HWRM_BLKT(IDX_TBL_ALLOC_SET, CFA),
+ CMD_TO_HWRM_BLKT(IDX_TBL_ALLOC_SET, RXP),
+ CMD_TO_HWRM_BLKT(IDX_TBL_ALLOC_SET, RE_GPARSE),
+ CMD_TO_HWRM_BLKT(IDX_TBL_ALLOC_SET, TE_GPARSE),
+ },
+ [IDX_TBL_SET] = {
+ CMD_TO_HWRM_BLKT(IDX_TBL_SET, CFA),
+ CMD_TO_HWRM_BLKT(IDX_TBL_SET, RXP),
+ CMD_TO_HWRM_BLKT(IDX_TBL_SET, RE_GPARSE),
+ CMD_TO_HWRM_BLKT(IDX_TBL_SET, TE_GPARSE),
+ },
+ [IDX_TBL_GET] = {
+ CMD_TO_HWRM_BLKT(IDX_TBL_GET, CFA),
+ CMD_TO_HWRM_BLKT(IDX_TBL_GET, RXP),
+ CMD_TO_HWRM_BLKT(IDX_TBL_GET, RE_GPARSE),
+ CMD_TO_HWRM_BLKT(IDX_TBL_GET, TE_GPARSE),
+ },
+ [IDX_TBL_FREE] = {
+ CMD_TO_HWRM_BLKT(IDX_TBL_FREE, CFA),
+ CMD_TO_HWRM_BLKT(IDX_TBL_FREE, RXP),
+ CMD_TO_HWRM_BLKT(IDX_TBL_FREE, RE_GPARSE),
+ CMD_TO_HWRM_BLKT(IDX_TBL_FREE, TE_GPARSE),
+ },
+};
+
+/*
+ * Maps TFC local blocktype values to HWRM equivalents. This function is
+ * required as each HWRM idx_tbl msg (alloc, alloc_set, get_set, free) has
+ * their own #defines, even though the values are the same across messages.
+ * Using this macro maps the appropriate TFC block type correctly to its HWRM
+ * msg relative equivalent. Returns an ERROR value if either idxtbl cmd OR
+ * blocktype is invalid.
+ */
+#define HWRM_BLKTYPE_ERR 0xff
+static uint8_t
+cfa_res_to_hwrm_blkt_lkup(enum cfa_resource_blktype_idx_tbl blktype,
+ enum tfc_hwrm_idx_tbl_cmds idxtbl_cmd)
+{
+ if ((idxtbl_cmd) > IDX_TBL_LAST ||
+ (blktype) > CFA_IDX_TBL_BLKTYPE_LAST) {
+ PMD_DRV_LOG_LINE(ERR, "%s: Invalid blocktype [%u]",
+ __func__, (blktype));
+ return -EINVAL;
+ }
+
+ return cfa_res_to_hwrm_blkt_lkup_tbl[idxtbl_cmd][blktype];
+}
+
/**
* Allocates a DMA buffer that can be used for message transfer.
*
@@ -406,7 +479,7 @@ int
tfc_msg_idx_tbl_alloc(struct tfc *tfcp, uint16_t fid, uint16_t sid,
enum cfa_track_type tt, enum cfa_dir dir,
enum cfa_resource_subtype_idx_tbl subtype,
- uint16_t *id)
+ uint16_t *id, enum cfa_resource_blktype_idx_tbl blktype)
{
int rc = 0;
@@ -430,7 +503,13 @@ tfc_msg_idx_tbl_alloc(struct tfc *tfcp, uint16_t fid, uint16_t sid,
if (rc)
return rc;
req.sid = rte_le_to_cpu_16(sid);
- req.subtype = rte_le_to_cpu_16(subtype);
+ req.subtype = (uint8_t)subtype;
+ req.blktype = cfa_res_to_hwrm_blkt_lkup(blktype, IDX_TBL_ALLOC);
+ if (req.blktype == HWRM_BLKTYPE_ERR) {
+ PMD_DRV_LOG_LINE(ERR, "%s: Invalid blocktype [%u]",
+ __func__, blktype);
+ return -EINVAL;
+ }
rc = bnxt_hwrm_tf_message_direct(bp, false, HWRM_TFC_IDX_TBL_ALLOC,
&req, sizeof(req), &resp, sizeof(resp));
@@ -446,7 +525,7 @@ tfc_msg_idx_tbl_alloc_set(struct tfc *tfcp, uint16_t fid, uint16_t sid,
enum cfa_track_type tt, enum cfa_dir dir,
enum cfa_resource_subtype_idx_tbl subtype,
const uint32_t *dev_data, uint8_t data_size,
- uint16_t *id)
+ uint16_t *id, enum cfa_resource_blktype_idx_tbl blktype)
{
int rc = 0;
@@ -473,6 +552,13 @@ tfc_msg_idx_tbl_alloc_set(struct tfc *tfcp, uint16_t fid, uint16_t sid,
return rc;
req.sid = rte_le_to_cpu_16(sid);
req.subtype = rte_le_to_cpu_16(subtype);
+ req.blktype = cfa_res_to_hwrm_blkt_lkup(blktype, IDX_TBL_ALLOC_SET);
+ if (req.blktype == HWRM_BLKTYPE_ERR) {
+ PMD_DRV_LOG_LINE(ERR, "%s: Invalid blocktype [%u]",
+ __func__, blktype);
+ return -EINVAL;
+ }
+
req.data_size = rte_le_to_cpu_16(data_size);
if (req.data_size >= sizeof(req.dev_data)) {
@@ -504,7 +590,8 @@ int
tfc_msg_idx_tbl_set(struct tfc *tfcp, uint16_t fid,
uint16_t sid, enum cfa_dir dir,
enum cfa_resource_subtype_idx_tbl subtype, uint16_t id,
- const uint32_t *dev_data, uint8_t data_size)
+ const uint32_t *dev_data, uint8_t data_size,
+ enum cfa_resource_blktype_idx_tbl blktype)
{
int rc = 0;
struct bnxt *bp = tfcp->bp;
@@ -526,6 +613,13 @@ tfc_msg_idx_tbl_set(struct tfc *tfcp, uint16_t fid,
req.sid = rte_le_to_cpu_16(sid);
req.idx_tbl_id = rte_le_to_cpu_16(id);
req.subtype = rte_le_to_cpu_16(subtype);
+ req.blktype = cfa_res_to_hwrm_blkt_lkup(blktype, IDX_TBL_SET);
+ if (req.blktype == HWRM_BLKTYPE_ERR) {
+ PMD_DRV_LOG_LINE(ERR, "%s: Invalid blocktype [%u]",
+ __func__, blktype);
+ return -EINVAL;
+ }
+
req.data_size = rte_le_to_cpu_16(data_size);
rc = tfc_msg_alloc_dma_buf(&buf, data_size);
if (rc)
@@ -555,7 +649,8 @@ int
tfc_msg_idx_tbl_get(struct tfc *tfcp, uint16_t fid,
uint16_t sid, enum cfa_dir dir,
enum cfa_resource_subtype_idx_tbl subtype, uint16_t id,
- uint32_t *dev_data, uint8_t *data_size)
+ uint32_t *dev_data, uint8_t *data_size,
+ enum cfa_resource_blktype_idx_tbl blktype)
{
int rc = 0;
struct bnxt *bp = tfcp->bp;
@@ -576,6 +671,13 @@ tfc_msg_idx_tbl_get(struct tfc *tfcp, uint16_t fid,
req.sid = rte_cpu_to_le_16(sid);
req.idx_tbl_id = rte_cpu_to_le_16(id);
req.subtype = rte_cpu_to_le_16(subtype);
+ req.blktype = cfa_res_to_hwrm_blkt_lkup(blktype, IDX_TBL_GET);
+ if (req.blktype == HWRM_BLKTYPE_ERR) {
+ PMD_DRV_LOG_LINE(ERR, "%s: Invalid blocktype [%u]",
+ __func__, blktype);
+ return -EINVAL;
+ }
+
req.buffer_size = rte_cpu_to_le_16(*data_size);
rc = tfc_msg_alloc_dma_buf(&buf, *data_size);
@@ -600,7 +702,8 @@ tfc_msg_idx_tbl_get(struct tfc *tfcp, uint16_t fid,
int
tfc_msg_idx_tbl_free(struct tfc *tfcp, uint16_t fid,
uint16_t sid, enum cfa_dir dir,
- enum cfa_resource_subtype_idx_tbl subtype, uint16_t id)
+ enum cfa_resource_subtype_idx_tbl subtype, uint16_t id,
+ enum cfa_resource_blktype_idx_tbl blktype)
{
struct bnxt *bp = tfcp->bp;
struct hwrm_tfc_idx_tbl_free_input req = { 0 };
@@ -620,6 +723,12 @@ tfc_msg_idx_tbl_free(struct tfc *tfcp, uint16_t fid,
req.sid = rte_cpu_to_le_16(sid);
req.idx_tbl_id = rte_cpu_to_le_16(id);
req.subtype = rte_cpu_to_le_16(subtype);
+ req.blktype = cfa_res_to_hwrm_blkt_lkup(blktype, IDX_TBL_FREE);
+ if (req.blktype == HWRM_BLKTYPE_ERR) {
+ PMD_DRV_LOG_LINE(ERR, "%s: Invalid blocktype [%u]",
+ __func__, blktype);
+ return -EINVAL;
+ }
return bnxt_hwrm_tf_message_direct(bp, false, HWRM_TFC_IDX_TBL_FREE,
&req, sizeof(req), &resp, sizeof(resp));
diff --git a/drivers/net/bnxt/tf_core/v3/tfc_msg.h b/drivers/net/bnxt/tf_core/v3/tfc_msg.h
index a8dcacc9f0..635c656e8f 100644
--- a/drivers/net/bnxt/tf_core/v3/tfc_msg.h
+++ b/drivers/net/bnxt/tf_core/v3/tfc_msg.h
@@ -46,31 +46,34 @@ int
tfc_msg_idx_tbl_alloc(struct tfc *tfcp, uint16_t fid, uint16_t sid,
enum cfa_track_type tt, enum cfa_dir dir,
enum cfa_resource_subtype_idx_tbl rsubtype,
- uint16_t *id);
+ uint16_t *id, enum cfa_resource_blktype_idx_tbl blktype);
int
tfc_msg_idx_tbl_alloc_set(struct tfc *tfcp, uint16_t fid, uint16_t sid,
enum cfa_track_type tt, enum cfa_dir dir,
enum cfa_resource_subtype_idx_tbl subtype,
const uint32_t *dev_data, uint8_t data_size,
- uint16_t *id);
+ uint16_t *id, enum cfa_resource_blktype_idx_tbl blktype);
int
tfc_msg_idx_tbl_set(struct tfc *tfcp, uint16_t fid,
uint16_t sid, enum cfa_dir dir,
enum cfa_resource_subtype_idx_tbl subtype,
- uint16_t id, const uint32_t *dev_data, uint8_t data_size);
+ uint16_t id, const uint32_t *dev_data,
+ uint8_t data_size, enum cfa_resource_blktype_idx_tbl blktype);
int
tfc_msg_idx_tbl_get(struct tfc *tfcp, uint16_t fid,
uint16_t sid, enum cfa_dir dir,
enum cfa_resource_subtype_idx_tbl subtype,
- uint16_t id, uint32_t *dev_data, uint8_t *data_size);
+ uint16_t id, uint32_t *dev_data,
+ uint8_t *data_size, enum cfa_resource_blktype_idx_tbl blktype);
int
tfc_msg_idx_tbl_free(struct tfc *tfcp, uint16_t fid,
uint16_t sid, enum cfa_dir dir,
- enum cfa_resource_subtype_idx_tbl subtype, uint16_t id);
+ enum cfa_resource_subtype_idx_tbl subtype,
+ uint16_t id, enum cfa_resource_blktype_idx_tbl blktype);
int tfc_msg_global_id_alloc(struct tfc *tfcp, uint16_t fid, uint16_t sid,
enum tfc_domain_id domain_id, uint16_t req_cnt,
diff --git a/drivers/net/bnxt/tf_core/v3/tfc_util.c b/drivers/net/bnxt/tf_core/v3/tfc_util.c
index cd784245e5..d3229bd104 100644
--- a/drivers/net/bnxt/tf_core/v3/tfc_util.c
+++ b/drivers/net/bnxt/tf_core/v3/tfc_util.c
@@ -92,6 +92,8 @@ tfc_idx_tbl_2_str(enum cfa_resource_subtype_idx_tbl tbl_stype)
return "idx_tbl_range_prof";
case CFA_RSUBTYPE_IDX_TBL_RANGE_ENTRY:
return "idx_tbl_range_entry";
+ case CFA_RSUBTYPE_IDX_TBL_DYN_UPAR:
+ return "idx_tbl_dyn_upar";
default:
return "Invalid idx tbl subtype";
}
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c b/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c
index 388ebea7ee..db7aa22c57 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c
@@ -18,6 +18,15 @@
#include "tfc_debug.h"
#endif
+#define BNXT_METER_MAX_NUM 1024
+static struct bnxt_mtr_stats_id_map mtr_stats[BNXT_METER_MAX_NUM];
+
+static uint32_t CFA_RESTYPE_TO_BLKT(uint8_t idx_tbl_restype)
+{
+ return (idx_tbl_restype > CFA_RSUBTYPE_IDX_TBL_MAX) ?
+ CFA_IDX_TBL_BLKTYPE_RXP : CFA_IDX_TBL_BLKTYPE_CFA;
+}
+
/* Internal function to write the tcam entry */
static int32_t
ulp_mapper_tfc_tcam_tbl_entry_write(struct bnxt_ulp_mapper_parms *parms,
@@ -857,6 +866,7 @@ ulp_mapper_tfc_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
index = rte_be_to_cpu_64(regval);
tbl_info.dir = tbl->direction;
tbl_info.rsubtype = tbl->resource_type;
+ tbl_info.blktype = CFA_RESTYPE_TO_BLKT(tbl->resource_type);
tbl_info.id = index;
/* Nothing has been pushed to blob, so push bit_size */
tmplen = ulp_blob_pad_push(&data, bit_size);
@@ -910,6 +920,22 @@ ulp_mapper_tfc_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
if (alloc) {
tbl_info.dir = tbl->direction;
tbl_info.rsubtype = tbl->resource_type;
+ tbl_info.blktype = CFA_RESTYPE_TO_BLKT(tbl->resource_type);
+ /*
+ * Read back the operand and pass it into the
+ * alloc command if its a Dyn UPAR table.
+ */
+ if (tbl_info.blktype == CFA_IDX_TBL_BLKTYPE_RXP) {
+ if (ulp_regfile_read(parms->regfile,
+ tbl->tbl_operand, ®val)) {
+ BNXT_DRV_DBG(ERR,
+ "Failed to get tbl idx from regfile[%d]\n",
+ tbl->tbl_operand);
+ return -EINVAL;
+ }
+ tbl_info.rsubtype = rte_be_to_cpu_64(regval);
+ }
+
rc = tfc_idx_tbl_alloc(tfcp, fw_fid, tt, &tbl_info);
if (unlikely(rc)) {
BNXT_DRV_DBG(ERR, "Alloc table[%s][%s] failed rc=%d\n",
@@ -971,6 +997,7 @@ ulp_mapper_tfc_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
data_p = ulp_blob_data_get(&data, &tmplen);
tbl_info.dir = tbl->direction;
tbl_info.rsubtype = tbl->resource_type;
+ tbl_info.blktype = CFA_RESTYPE_TO_BLKT(tbl->resource_type);
tbl_info.id = index;
wordlen = ULP_BITS_2_BYTE(tmplen);
rc = tfc_idx_tbl_set(tfcp, fw_fid, &tbl_info,
@@ -1021,6 +1048,7 @@ ulp_mapper_tfc_index_tbl_process(struct bnxt_ulp_mapper_parms *parms,
* write to the entry or link the flow
*/
+ tbl_info.blktype = CFA_RESTYPE_TO_BLKT(tbl->resource_type);
if (tfc_idx_tbl_free(tfcp, fw_fid, &tbl_info))
BNXT_DRV_DBG(ERR, "Failed to free index entry on failure\n");
return rc;
@@ -1050,6 +1078,7 @@ ulp_mapper_tfc_index_entry_free(struct bnxt_ulp_context *ulp_ctx,
tbl_info.dir = (enum cfa_dir)res->direction;
tbl_info.rsubtype = res->resource_type;
tbl_info.id = (uint16_t)res->resource_hndl;
+ tbl_info.blktype = CFA_RESTYPE_TO_BLKT(res->resource_type);
/* TBD: check to see if the memory needs to be cleaned as well*/
rc = tfc_idx_tbl_free(tfcp, fw_fid, &tbl_info);
--
2.39.5 (Apple Git-154)
next prev parent reply other threads:[~2025-09-30 7:05 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-30 0:35 [PATCH 00/54] bnxt patchset Manish Kurup
2025-09-30 0:35 ` [PATCH 01/54] net/bnxt/tf_ulp: add bnxt app data for 25.11 Manish Kurup
2025-09-30 0:35 ` [PATCH 02/54] net/bnxt: fix a NULL pointer dereference in bnxt_rep funcs Manish Kurup
2025-09-30 0:35 ` [PATCH 03/54] net/bnxt: enable vector mode processing Manish Kurup
2025-09-30 0:35 ` [PATCH 04/54] net/bnxt/tf_ulp: add meter stats support for Thor2 Manish Kurup
2025-09-30 0:35 ` Manish Kurup [this message]
2025-09-30 0:35 ` [PATCH 06/54] net/bnxt/tf_core: fix the miscalculation of the lkup table pool Manish Kurup
2025-09-30 0:35 ` [PATCH 07/54] net/bnxt/tf_core: thor2 TF table scope sizing adjustments Manish Kurup
2025-09-30 0:35 ` [PATCH 08/54] net/bnxt/tf_ulp: add support for global identifiers Manish Kurup
2025-09-30 0:35 ` [PATCH 09/54] net/bnxt/tf_core: add support for multi instance Manish Kurup
2025-09-30 0:35 ` [PATCH 10/54] net/bnxt/tf_core: fix table scope free Manish Kurup
2025-09-30 0:35 ` [PATCH 11/54] net/bnxt/tf_core: fix vfr clean up and stats lockup Manish Kurup
2025-09-30 0:35 ` [PATCH 12/54] net/bnxt/tf_ulp: add support for special vxlan Manish Kurup
2025-09-30 0:35 ` [PATCH 13/54] net/bnxt/tf_ulp: increase shared pool size to 32 Manish Kurup
2025-09-30 0:35 ` [PATCH 14/54] next/bnxt/tf_ulp: truflow fixes for meter and mac_addr cache Manish Kurup
2025-09-30 0:35 ` [PATCH 15/54] net/bnxt/tf_ulp: add support for tcam priority update Manish Kurup
2025-09-30 0:35 ` [PATCH 16/54] net/bnxt/tf_ulp: hot upgrade support Manish Kurup
2025-09-30 0:35 ` [PATCH 17/54] net/bnxt/tf_core: tcam manager logical id free Manish Kurup
2025-09-30 0:35 ` [PATCH 18/54] net/bnxt/tf_ulp: fix stats counter memory initialization Manish Kurup
2025-09-30 0:35 ` [PATCH 19/54] net/bnxt: fix max VFs count for thor2 Manish Kurup
2025-09-30 0:35 ` [PATCH 20/54] net/bnxt/tf_ulp: ovs-dpdk packet drop observed with thor2 Manish Kurup
2025-09-30 0:35 ` [PATCH 21/54] net/bnxt/tf_ulp: fix seg fault when devargs argument missing Manish Kurup
2025-09-30 0:35 ` [PATCH 22/54] net/bnxt: fix default rss config Manish Kurup
2025-09-30 0:35 ` [PATCH 23/54] net/bnxt/tf_ulp: enable support for global index table Manish Kurup
2025-09-30 0:35 ` [PATCH 24/54] net/bnxt/tf_core: fix build failure with flow scale option Manish Kurup
2025-09-30 0:35 ` [PATCH 25/54] net/bnxt: truflow remove redundant code for mpc init Manish Kurup
2025-09-30 0:35 ` [PATCH 26/54] net/bnxt/tf_ulp: optimize template enums Manish Kurup
2025-09-30 0:35 ` [PATCH 27/54] net/bnxt/tf_core: thor2 hot upgrade ungraceful quit crash Manish Kurup
2025-09-30 0:35 ` [PATCH 28/54] net/bnxt/tf_ulp: support MPLS packets Manish Kurup
2025-09-30 0:35 ` [PATCH 29/54] net/bnxt/tf_core: add backing store debug to dpdk Manish Kurup
2025-09-30 0:35 ` [PATCH 30/54] net/bnxt/tf_core: truflow global table scope Manish Kurup
2025-09-30 0:35 ` [PATCH 31/54] net/bnxt/tf_ulp: ulp parser support to handle gre key Manish Kurup
2025-09-30 0:35 ` [PATCH 32/54] net/bnxt/tf_core: handle out of order MPC completions Manish Kurup
2025-09-30 0:35 ` [PATCH 33/54] net/bnxt/tf_ulp: socket direct enable Manish Kurup
2025-09-30 0:35 ` [PATCH 34/54] net/bnxt: fix adding udp_tunnel_port Manish Kurup
2025-09-30 0:35 ` [PATCH 35/54] net/bnxt/tf_ulp: add non vfr mode capability Manish Kurup
2025-09-30 0:35 ` [PATCH 36/54] net/bnxt: avoid iova range check when external memory is used Manish Kurup
2025-09-30 0:35 ` [PATCH 37/54] net/bnxt: avoid potential segfault in VFR handling Manish Kurup
2025-09-30 0:35 ` [PATCH 38/54] net/bnxt/tf_ulp: change rte_mem_virt2iova to rte_mem_virt2phys Manish Kurup
2025-09-30 0:35 ` [PATCH 39/54] net/bnxt: thor2 truflow memory manager bug Manish Kurup
2025-09-30 0:35 ` [PATCH 40/54] net/bnxt: fix stats collection when rx queue is not set Manish Kurup
2025-09-30 0:35 ` [PATCH 41/54] net/bnxt: fix rss configuration when set to none Manish Kurup
2025-09-30 0:35 ` [PATCH 42/54] net/bnxt: packet drop after port stop and start Manish Kurup
2025-09-30 0:35 ` [PATCH 43/54] net/bnxt/tf_core: fix truflow crash on memory allocation failure Manish Kurup
2025-09-30 0:35 ` [PATCH 44/54] net/bnxt: truflow remove RTE devarg processing for mpc=1 Manish Kurup
2025-09-30 0:35 ` [PATCH 45/54] net/bnxt: add meson build options for TruFlow Manish Kurup
2025-09-30 0:35 ` [PATCH 46/54] net/bnxt: truflow HSI struct fixes Manish Kurup
2025-09-30 0:35 ` [PATCH 47/54] net/bnxt/tf_ulp: truflow add pf action handler Manish Kurup
2025-09-30 0:35 ` [PATCH 48/54] net/bnxt/tf_ulp: add support for unicast only feature Manish Kurup
2025-09-30 0:35 ` [PATCH 49/54] net/bnxt/tf_core: remove excessive debug logging Manish Kurup
2025-09-30 0:36 ` [PATCH 50/54] net/bnxt/tf_core: fix truflow PF init failure on sriov disabled Manish Kurup
2025-09-30 0:36 ` [PATCH 51/54] net/bnxt/tf_ulp: fixes to enable TF functionality Manish Kurup
2025-09-30 0:36 ` [PATCH 52/54] net/bnxt/tf_ulp: add feature bit rx miss handling Manish Kurup
2025-09-30 0:36 ` [PATCH 53/54] net/bnxt: add support for truflow promiscuous mode Manish Kurup
2025-09-30 0:36 ` [PATCH 54/54] net/bnxt/tf_ulp: remove Truflow DEBUG code Manish Kurup
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=20250930003604.87108-6-manish.kurup@broadcom.com \
--to=manish.kurup@broadcom.com \
--cc=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=farah.smith@broadcom.com \
--cc=jay.ding@broadcom.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).