get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/103407/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 103407,
    "url": "http://patches.dpdk.org/api/patches/103407/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20211102040556.7840-9-venkatkumar.duvvuru@broadcom.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20211102040556.7840-9-venkatkumar.duvvuru@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20211102040556.7840-9-venkatkumar.duvvuru@broadcom.com",
    "date": "2021-11-02T04:05:44",
    "name": "[v3,08/20] net/bnxt: get TruFlow version",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "13a50a87e5c8f086ae02da96ada5f0951c4dc830",
    "submitter": {
        "id": 1635,
        "url": "http://patches.dpdk.org/api/people/1635/?format=api",
        "name": "Venkat Duvvuru",
        "email": "venkatkumar.duvvuru@broadcom.com"
    },
    "delegate": {
        "id": 1766,
        "url": "http://patches.dpdk.org/api/users/1766/?format=api",
        "username": "ajitkhaparde",
        "first_name": "Ajit",
        "last_name": "Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20211102040556.7840-9-venkatkumar.duvvuru@broadcom.com/mbox/",
    "series": [
        {
            "id": 20191,
            "url": "http://patches.dpdk.org/api/series/20191/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=20191",
            "date": "2021-11-02T04:05:36",
            "name": "fixes and enhancements to Truflow",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/20191/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/103407/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/103407/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 81C1DA0C4D;\n\tTue,  2 Nov 2021 05:07:10 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 76DC841154;\n\tTue,  2 Nov 2021 05:06:19 +0100 (CET)",
            "from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com\n [192.19.166.228])\n by mails.dpdk.org (Postfix) with ESMTP id 0EFA74114D\n for <dev@dpdk.org>; Tue,  2 Nov 2021 05:06:18 +0100 (CET)",
            "from S60.dhcp.broadcom.net (unknown [10.123.66.170])\n (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n (No client certificate requested)\n by relay.smtp-ext.broadcom.com (Postfix) with ESMTPS id 4F49DEA;\n Mon,  1 Nov 2021 21:06:16 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 4F49DEA",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n s=dkimrelay; t=1635825977;\n bh=dtm2NQSXawTmq+7IjEXu+eih19XOisJNw+haqxuz8Ak=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=fYrC3VKBhWGZnnjnF0mBDLdygDCtu0Pj9rAKOGWlVI4unyxoZ1slRFx0VciYvxVDm\n g5Pr+AVavlQP7rbWS+E3OJrDTHKgtR+/gzfk/4ckroUB5ThvawyS85vhH1HxTfphmc\n wCQdN2tRTk8DFXru74TrF8PRQWxgpp3meM5P6Rp4=",
        "From": "Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>",
        "To": "dev@dpdk.org",
        "Cc": "Jay Ding <jay.ding@broadcom.com>,\n Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>",
        "Date": "Tue,  2 Nov 2021 09:35:44 +0530",
        "Message-Id": "<20211102040556.7840-9-venkatkumar.duvvuru@broadcom.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20211102040556.7840-1-venkatkumar.duvvuru@broadcom.com>",
        "References": "<20211001055909.27276-1-venkatkumar.duvvuru@broadcom.com>\n <20211102040556.7840-1-venkatkumar.duvvuru@broadcom.com>",
        "Subject": "[dpdk-dev] [PATCH v3 08/20] net/bnxt: get TruFlow version",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Jay Ding <jay.ding@broadcom.com>\n\nImplement tf_get_version that returns TruFlow version\nnumbers and CFA resources capbilities.\n\nSigned-off-by: Jay Ding <jay.ding@broadcom.com>\nSigned-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>\nReviewed-by: Farah Smith <farah.smith@broadcom.com>\nReviewed-by: Randy Schacher <stuart.schacher@broadcom.com>\nReviewed-by: Peter Spreadborough <peter.spreadborough@broadcom.com>\n---\n drivers/net/bnxt/hsi_struct_def_dpdk.h   | 15 ++--\n drivers/net/bnxt/tf_core/tf_core.c       | 29 ++++++++\n drivers/net/bnxt/tf_core/tf_core.h       | 75 ++++++++++++++++++++\n drivers/net/bnxt/tf_core/tf_device.h     | 50 ++++++++++++++\n drivers/net/bnxt/tf_core/tf_device_p4.c  | 65 +++++++++++++++++-\n drivers/net/bnxt/tf_core/tf_device_p4.h  | 79 +++++++++++++++++++++\n drivers/net/bnxt/tf_core/tf_device_p58.c | 65 +++++++++++++++++-\n drivers/net/bnxt/tf_core/tf_device_p58.h | 87 ++++++++++++++++++++++++\n drivers/net/bnxt/tf_core/tf_msg.c        | 35 ++++++++++\n drivers/net/bnxt/tf_core/tf_msg.h        | 19 ++++++\n 10 files changed, 513 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h\nindex 77981b5cdb..6d04e39e48 100644\n--- a/drivers/net/bnxt/hsi_struct_def_dpdk.h\n+++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h\n@@ -1058,8 +1058,8 @@ struct hwrm_err_output {\n #define HWRM_VERSION_MINOR 10\n #define HWRM_VERSION_UPDATE 2\n /* non-zero means beta version */\n-#define HWRM_VERSION_RSVD 55\n-#define HWRM_VERSION_STR \"1.10.2.55\"\n+#define HWRM_VERSION_RSVD 58\n+#define HWRM_VERSION_STR \"1.10.2.58\"\n \n /****************\n  * hwrm_ver_get *\n@@ -45178,7 +45178,7 @@ struct hwrm_tf_version_get_input {\n \tuint64_t\tresp_addr;\n } __rte_packed;\n \n-/* hwrm_tf_version_get_output (size:128b/16B) */\n+/* hwrm_tf_version_get_output (size:256b/32B) */\n struct hwrm_tf_version_get_output {\n \t/* The specific error status for the command. */\n \tuint16_t\terror_code;\n@@ -45195,7 +45195,14 @@ struct hwrm_tf_version_get_output {\n \t/* Version Update number. */\n \tuint8_t\tupdate;\n \t/* unused. */\n-\tuint8_t\tunused0[4];\n+\tuint8_t\tunused0[5];\n+\t/*\n+\t * This field is used to indicate device's capabilities and\n+\t * configurations.\n+\t */\n+\tuint64_t\tdev_caps_cfg;\n+\t/* unused. */\n+\tuint8_t\tunused1[7];\n \t/*\n \t * This field is used in Output records to indicate that the output\n \t * is completely written to RAM. This field should be read as '1'\ndiff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c\nindex 936102c804..86dfec0eb4 100644\n--- a/drivers/net/bnxt/tf_core/tf_core.c\n+++ b/drivers/net/bnxt/tf_core/tf_core.c\n@@ -1802,3 +1802,32 @@ int tf_get_session_info(struct tf *tfp,\n \n \treturn 0;\n }\n+\n+int tf_get_version(struct tf *tfp,\n+\t\t   struct tf_get_version_parms *parms)\n+{\n+\tint rc;\n+\tstruct tf_dev_info dev;\n+\n+\tTF_CHECK_PARMS2(tfp, parms);\n+\n+\t/* This function can be called before open session, filter\n+\t * out any non-supported device types on the Core side.\n+\t */\n+\tif (parms->device_type != TF_DEVICE_TYPE_WH &&\n+\t    parms->device_type != TF_DEVICE_TYPE_THOR &&\n+\t    parms->device_type != TF_DEVICE_TYPE_SR) {\n+\t\tTFP_DRV_LOG(ERR,\n+\t\t\t    \"Unsupported device type %d\\n\",\n+\t\t\t    parms->device_type);\n+\t\treturn -ENOTSUP;\n+\t}\n+\n+\ttf_dev_bind_ops(parms->device_type, &dev);\n+\n+\trc = tf_msg_get_version(parms->bp, &dev, parms);\n+\tif (rc)\n+\t\treturn rc;\n+\n+\treturn 0;\n+}\ndiff --git a/drivers/net/bnxt/tf_core/tf_core.h b/drivers/net/bnxt/tf_core/tf_core.h\nindex fb02c2b161..ba9881c69d 100644\n--- a/drivers/net/bnxt/tf_core/tf_core.h\n+++ b/drivers/net/bnxt/tf_core/tf_core.h\n@@ -2363,4 +2363,79 @@ struct tf_get_if_tbl_entry_parms {\n int tf_get_if_tbl_entry(struct tf *tfp,\n \t\t\tstruct tf_get_if_tbl_entry_parms *parms);\n \n+/**\n+ * tf_get_version parameters definition.\n+ */\n+struct tf_get_version_parms {\n+\t/**\n+\t * [in] device type\n+\t *\n+\t * Device type for the session.\n+\t */\n+\tenum tf_device_type device_type;\n+\n+\t/**\n+\t * [in] bp\n+\t * The pointer to the parent bp struct. This is only used for HWRM\n+\t * message passing within the portability layer. The type is struct\n+\t * bnxt.\n+\t */\n+\tvoid *bp;\n+\n+\t/* [out] major\n+\t *\n+\t * Version Major number.\n+\t */\n+\tuint8_t\tmajor;\n+\n+\t/* [out] minor\n+\t *\n+\t * Version Minor number.\n+\t */\n+\tuint8_t\tminor;\n+\n+\t/* [out] update\n+\t *\n+\t * Version Update number.\n+\t */\n+\tuint8_t\tupdate;\n+\n+\t/**\n+\t * [out] dev_ident_caps\n+\t *\n+\t * fw available identifier resource list\n+\t */\n+\tuint32_t dev_ident_caps;\n+\n+\t/**\n+\t * [out] dev_tbl_caps\n+\t *\n+\t * fw available table resource list\n+\t */\n+\tuint32_t dev_tbl_caps;\n+\n+\t/**\n+\t * [out] dev_tcam_caps\n+\t *\n+\t * fw available tcam resource list\n+\t */\n+\tuint32_t dev_tcam_caps;\n+\n+\t/**\n+\t * [out] dev_em_caps\n+\t *\n+\t * fw available em resource list\n+\t */\n+\tuint32_t dev_em_caps;\n+};\n+\n+/**\n+ * Get tf fw version\n+ *\n+ * Used to retrieve Truflow fw version information.\n+ *\n+ * Returns success or failure code.\n+ */\n+int tf_get_version(struct tf *tfp,\n+\t\t   struct tf_get_version_parms *parms);\n #endif /* _TF_CORE_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_device.h b/drivers/net/bnxt/tf_core/tf_device.h\nindex 9b0c037db0..88bd4515ff 100644\n--- a/drivers/net/bnxt/tf_core/tf_device.h\n+++ b/drivers/net/bnxt/tf_core/tf_device.h\n@@ -6,6 +6,7 @@\n #ifndef _TF_DEVICE_H_\n #define _TF_DEVICE_H_\n \n+#include \"cfa_resource_types.h\"\n #include \"tf_core.h\"\n #include \"tf_identifier.h\"\n #include \"tf_tbl.h\"\n@@ -36,6 +37,21 @@ struct tf_dev_info {\n \tconst struct tf_dev_ops *ops;\n };\n \n+/**\n+ * This structure can be used to translate the CFA resource type to TF type.\n+ */\n+struct tf_hcapi_resource_map {\n+\t/**\n+\t * Truflow module type associated with this resource type.\n+\t */\n+\tenum tf_module_type module_type;\n+\n+\t/**\n+\t * Bitmap of TF sub-type for the element.\n+\t */\n+\tuint32_t type_caps;\n+};\n+\n /**\n  * @page device Device\n  *\n@@ -1037,6 +1053,34 @@ struct tf_dev_ops {\n \t */\n \tuint64_t (*tf_dev_cfa_key_hash)(uint64_t *key_data,\n \t\t\t\t\t  uint16_t bitlen);\n+\n+\t/**\n+\t * Translate the CFA resource type to Truflow type\n+\t *\n+\t * [in] hcapi_types\n+\t *   CFA resource type bitmap\n+\t *\n+\t * [out] ident_types\n+\t *   Pointer to identifier type bitmap\n+\t *\n+\t * [out] tcam_types\n+\t *   Pointer to tcam type bitmap\n+\t *\n+\t * [out] tbl_types\n+\t *   Pointer to table type bitmap\n+\t *\n+\t * [out] em_types\n+\t *   Pointer to em type bitmap\n+\t *\n+\t * Returns\n+\t *   - (0) if successful.\n+\t *   - (-EINVAL) on failure.\n+\t */\n+\tint (*tf_dev_map_hcapi_caps)(uint64_t hcapi_caps,\n+\t\t\t\t     uint32_t *ident_caps,\n+\t\t\t\t     uint32_t *tcam_caps,\n+\t\t\t\t     uint32_t *tbl_caps,\n+\t\t\t\t     uint32_t *em_caps);\n };\n \n /**\n@@ -1047,4 +1091,10 @@ extern const struct tf_dev_ops tf_dev_ops_p4;\n extern const struct tf_dev_ops tf_dev_ops_p58_init;\n extern const struct tf_dev_ops tf_dev_ops_p58;\n \n+/**\n+ * Supported device resource type mapping structures\n+ */\n+extern const struct tf_hcapi_resource_map tf_hcapi_res_map_p4[CFA_RESOURCE_TYPE_P4_LAST + 1];\n+extern const struct tf_hcapi_resource_map tf_hcapi_res_map_p58[CFA_RESOURCE_TYPE_P58_LAST + 1];\n+\n #endif /* _TF_DEVICE_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_device_p4.c b/drivers/net/bnxt/tf_core/tf_device_p4.c\nindex 826cd0cdbc..8089785b82 100644\n--- a/drivers/net/bnxt/tf_core/tf_device_p4.c\n+++ b/drivers/net/bnxt/tf_core/tf_device_p4.c\n@@ -271,6 +271,67 @@ static bool tf_dev_p4_is_sram_managed(struct tf *tfp __rte_unused,\n {\n \treturn false;\n }\n+\n+/**\n+ * Device specific function that maps the hcapi resource types\n+ * to Truflow type.\n+ *\n+ * [in] hcapi_caps\n+ *   CFA resource type bitmap\n+ *\n+ * [out] ident_caps\n+ *   Pointer to identifier type bitmap\n+ *\n+ * [out] tcam_caps\n+ *   Pointer to tcam type bitmap\n+ *\n+ * [out] tbl_caps\n+ *   Pointer to table type bitmap\n+ *\n+ * [out] em_caps\n+ *   Pointer to em type bitmap\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+static int tf_dev_p4_map_hcapi_caps(uint64_t hcapi_caps,\n+\t\t\t\t    uint32_t *ident_caps,\n+\t\t\t\t    uint32_t *tcam_caps,\n+\t\t\t\t    uint32_t *tbl_caps,\n+\t\t\t\t    uint32_t *em_caps)\n+{\n+\tuint32_t i;\n+\n+\t*ident_caps = 0;\n+\t*tcam_caps = 0;\n+\t*tbl_caps = 0;\n+\t*em_caps = 0;\n+\n+\tfor (i = 0; i <= CFA_RESOURCE_TYPE_P4_LAST; i++) {\n+\t\tif (hcapi_caps & 1ULL << i) {\n+\t\t\tswitch (tf_hcapi_res_map_p4[i].module_type) {\n+\t\t\tcase TF_MODULE_TYPE_IDENTIFIER:\n+\t\t\t\t*ident_caps |= tf_hcapi_res_map_p4[i].type_caps;\n+\t\t\t\tbreak;\n+\t\t\tcase TF_MODULE_TYPE_TABLE:\n+\t\t\t\t*tbl_caps |= tf_hcapi_res_map_p4[i].type_caps;\n+\t\t\t\tbreak;\n+\t\t\tcase TF_MODULE_TYPE_TCAM:\n+\t\t\t\t*tcam_caps |= tf_hcapi_res_map_p4[i].type_caps;\n+\t\t\t\tbreak;\n+\t\t\tcase TF_MODULE_TYPE_EM:\n+\t\t\t\t*em_caps |= tf_hcapi_res_map_p4[i].type_caps;\n+\t\t\t\tbreak;\n+\t\t\tdefault:\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n /**\n  * Truflow P4 device specific functions\n  */\n@@ -321,6 +382,7 @@ const struct tf_dev_ops tf_dev_ops_p4_init = {\n \t.tf_dev_get_global_cfg = NULL,\n \t.tf_dev_get_mailbox = tf_dev_p4_get_mailbox,\n \t.tf_dev_word_align = NULL,\n+\t.tf_dev_map_hcapi_caps = tf_dev_p4_map_hcapi_caps\n };\n \n /**\n@@ -382,5 +444,6 @@ const struct tf_dev_ops tf_dev_ops_p4 = {\n \t.tf_dev_get_global_cfg = tf_global_cfg_get,\n \t.tf_dev_get_mailbox = tf_dev_p4_get_mailbox,\n \t.tf_dev_word_align = tf_dev_p4_word_align,\n-\t.tf_dev_cfa_key_hash = hcapi_cfa_p4_key_hash\n+\t.tf_dev_cfa_key_hash = hcapi_cfa_p4_key_hash,\n+\t.tf_dev_map_hcapi_caps = tf_dev_p4_map_hcapi_caps\n };\ndiff --git a/drivers/net/bnxt/tf_core/tf_device_p4.h b/drivers/net/bnxt/tf_core/tf_device_p4.h\nindex c1357913f1..e84c0f9e83 100644\n--- a/drivers/net/bnxt/tf_core/tf_device_p4.h\n+++ b/drivers/net/bnxt/tf_core/tf_device_p4.h\n@@ -157,4 +157,83 @@ struct tf_global_cfg_cfg tf_global_cfg_p4[TF_GLOBAL_CFG_TYPE_MAX] = {\n \t\tTF_GLOBAL_CFG_CFG_HCAPI, TF_ACTION_BLOCK\n \t},\n };\n+\n+const struct tf_hcapi_resource_map tf_hcapi_res_map_p4[CFA_RESOURCE_TYPE_P4_LAST + 1] = {\n+\t[CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP_HIGH] = {\n+\t\tTF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_L2_CTXT_HIGH\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP_LOW] = {\n+\t\tTF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_L2_CTXT_LOW\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_PROF_FUNC] = {\n+\t\tTF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_PROF_FUNC\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_WC_TCAM_PROF_ID] = {\n+\t\tTF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_WC_PROF\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_EM_PROF_ID] = {\n+\t\tTF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_EM_PROF\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM_HIGH] = {\n+\t\tTF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM_LOW] = {\n+\t\tTF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_PROF_TCAM] = {\n+\t\tTF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_PROF_TCAM\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_WC_TCAM] = {\n+\t\tTF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_WC_TCAM\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_SP_TCAM] = {\n+\t\tTF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_SP_TCAM\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_NAT_IPV4] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_MODIFY_IPV4\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_METER_PROF] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_METER_PROF\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_METER] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_METER_INST\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_MIRROR] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_MIRROR_CONFIG\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_FULL_ACTION] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_FULL_ACT_RECORD\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_MCG] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_MCAST_GROUPS\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_ENCAP_8B] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_ENCAP_8B\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_ENCAP_16B] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_ENCAP_16B\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_ENCAP_64B] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_ENCAP_64B\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_SP_MAC] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_SP_SMAC\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_SP_MAC_IPV4] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_SP_SMAC_IPV4\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_SP_MAC_IPV6] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_SP_SMAC_IPV6\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_COUNTER_64B] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_STATS_64\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_EM_REC] = {\n+\t\tTF_MODULE_TYPE_EM, 1 << TF_EM_TBL_TYPE_EM_RECORD\n+\t},\n+\t[CFA_RESOURCE_TYPE_P4_TBL_SCOPE] = {\n+\t\tTF_MODULE_TYPE_EM, 1 << TF_EM_TBL_TYPE_TBL_SCOPE\n+\t},\n+};\n+\n #endif /* _TF_DEVICE_P4_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_device_p58.c b/drivers/net/bnxt/tf_core/tf_device_p58.c\nindex 47d7836a58..03e72b90f5 100644\n--- a/drivers/net/bnxt/tf_core/tf_device_p58.c\n+++ b/drivers/net/bnxt/tf_core/tf_device_p58.c\n@@ -45,6 +45,7 @@ const char *tf_resource_str_p58[CFA_RESOURCE_TYPE_P58_LAST + 1] = {\n \t[CFA_RESOURCE_TYPE_P58_WC_FKB]             = \"wc_fkb  \",\n \t[CFA_RESOURCE_TYPE_P58_VEB_TCAM]           = \"veb     \",\n \t[CFA_RESOURCE_TYPE_P58_METADATA]           = \"metadata\",\n+\t[CFA_RESOURCE_TYPE_P58_METER_DROP_CNT]     = \"meter_dc\",\n };\n \n /**\n@@ -336,6 +337,66 @@ static int tf_dev_p58_get_sram_tbl_info(struct tf *tfp __rte_unused,\n \treturn 0;\n }\n \n+/**\n+ * Device specific function that maps the hcapi resource types\n+ * to Truflow type.\n+ *\n+ * [in] hcapi_caps\n+ *   CFA resource type bitmap\n+ *\n+ * [out] ident_caps\n+ *   Pointer to identifier type bitmap\n+ *\n+ * [out] tcam_caps\n+ *   Pointer to tcam type bitmap\n+ *\n+ * [out] tbl_caps\n+ *   Pointer to table type bitmap\n+ *\n+ * [out] em_caps\n+ *   Pointer to em type bitmap\n+ *\n+ * Returns\n+ *   - (0) if successful.\n+ *   - (-EINVAL) on failure.\n+ */\n+static int tf_dev_p58_map_hcapi_caps(uint64_t hcapi_caps,\n+\t\t\t\t     uint32_t *ident_caps,\n+\t\t\t\t     uint32_t *tcam_caps,\n+\t\t\t\t     uint32_t *tbl_caps,\n+\t\t\t\t     uint32_t *em_caps)\n+{\n+\tuint32_t i;\n+\n+\t*ident_caps = 0;\n+\t*tcam_caps = 0;\n+\t*tbl_caps = 0;\n+\t*em_caps = 0;\n+\n+\tfor (i = 0; i <= CFA_RESOURCE_TYPE_P58_LAST; i++) {\n+\t\tif (hcapi_caps & 1ULL << i) {\n+\t\t\tswitch (tf_hcapi_res_map_p58[i].module_type) {\n+\t\t\tcase TF_MODULE_TYPE_IDENTIFIER:\n+\t\t\t\t*ident_caps |= tf_hcapi_res_map_p58[i].type_caps;\n+\t\t\t\tbreak;\n+\t\t\tcase TF_MODULE_TYPE_TABLE:\n+\t\t\t\t*tbl_caps |= tf_hcapi_res_map_p58[i].type_caps;\n+\t\t\t\tbreak;\n+\t\t\tcase TF_MODULE_TYPE_TCAM:\n+\t\t\t\t*tcam_caps |= tf_hcapi_res_map_p58[i].type_caps;\n+\t\t\t\tbreak;\n+\t\t\tcase TF_MODULE_TYPE_EM:\n+\t\t\t\t*em_caps |= tf_hcapi_res_map_p58[i].type_caps;\n+\t\t\t\tbreak;\n+\t\t\tdefault:\n+\t\t\t\treturn -EINVAL;\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n /**\n  * Truflow P58 device specific functions\n  */\n@@ -386,6 +447,7 @@ const struct tf_dev_ops tf_dev_ops_p58_init = {\n \t.tf_dev_get_global_cfg = NULL,\n \t.tf_dev_get_mailbox = tf_dev_p58_get_mailbox,\n \t.tf_dev_word_align = NULL,\n+\t.tf_dev_map_hcapi_caps = tf_dev_p58_map_hcapi_caps\n };\n \n /**\n@@ -448,5 +510,6 @@ const struct tf_dev_ops tf_dev_ops_p58 = {\n \t.tf_dev_get_global_cfg = tf_global_cfg_get,\n \t.tf_dev_get_mailbox = tf_dev_p58_get_mailbox,\n \t.tf_dev_word_align = tf_dev_p58_word_align,\n-\t.tf_dev_cfa_key_hash = hcapi_cfa_p58_key_hash\n+\t.tf_dev_cfa_key_hash = hcapi_cfa_p58_key_hash,\n+\t.tf_dev_map_hcapi_caps = tf_dev_p58_map_hcapi_caps\n };\ndiff --git a/drivers/net/bnxt/tf_core/tf_device_p58.h b/drivers/net/bnxt/tf_core/tf_device_p58.h\nindex 3e8759f2df..f6e66936f3 100644\n--- a/drivers/net/bnxt/tf_core/tf_device_p58.h\n+++ b/drivers/net/bnxt/tf_core/tf_device_p58.h\n@@ -209,4 +209,91 @@ struct tf_global_cfg_cfg tf_global_cfg_p58[TF_GLOBAL_CFG_TYPE_MAX] = {\n \t\tTF_GLOBAL_CFG_CFG_HCAPI, TF_METER_INTERVAL_CFG\n \t},\n };\n+\n+const struct tf_hcapi_resource_map tf_hcapi_res_map_p58[CFA_RESOURCE_TYPE_P58_LAST + 1] = {\n+\t[CFA_RESOURCE_TYPE_P58_L2_CTXT_REMAP_HIGH] = {\n+\t\tTF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_L2_CTXT_HIGH\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_L2_CTXT_REMAP_LOW] = {\n+\t\tTF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_L2_CTXT_LOW\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_PROF_FUNC] = {\n+\t\tTF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_PROF_FUNC\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_WC_TCAM_PROF_ID] = {\n+\t\tTF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_WC_PROF\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_EM_PROF_ID] = {\n+\t\tTF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_EM_PROF\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM_HIGH] = {\n+\t\tTF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM_LOW] = {\n+\t\tTF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_PROF_TCAM] = {\n+\t\tTF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_PROF_TCAM\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_WC_TCAM] = {\n+\t\tTF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_WC_TCAM\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_VEB_TCAM] = {\n+\t\tTF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_VEB_TCAM\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_EM_FKB] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_EM_FKB\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_WC_FKB] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_WC_FKB\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_METER_PROF] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_METER_PROF\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_METER] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_METER_INST\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_METER_DROP_CNT] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_METER_DROP_CNT\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_MIRROR] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_MIRROR_CONFIG\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_METADATA] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_METADATA\n+\t},\n+\t/* Resources in bank 1 */\n+\t[CFA_RESOURCE_TYPE_P58_SRAM_BANK_1] = {\n+\t\tTF_MODULE_TYPE_TABLE,\n+\t\t1 << TF_TBL_TYPE_FULL_ACT_RECORD\n+\t\t| 1 << TF_TBL_TYPE_COMPACT_ACT_RECORD\n+\t},\n+\t/* Resources in bank 2 */\n+\t[CFA_RESOURCE_TYPE_P58_SRAM_BANK_2] = {\n+\t\tTF_MODULE_TYPE_TABLE,\n+\t\t1 << TF_TBL_TYPE_ACT_ENCAP_8B |\n+\t\t1 << TF_TBL_TYPE_ACT_ENCAP_16B |\n+\t\t1 << TF_TBL_TYPE_ACT_ENCAP_32B |\n+\t\t1 << TF_TBL_TYPE_ACT_ENCAP_64B |\n+\t\t1 << TF_TBL_TYPE_ACT_MODIFY_8B |\n+\t\t1 << TF_TBL_TYPE_ACT_MODIFY_16B |\n+\t\t1 << TF_TBL_TYPE_ACT_MODIFY_32B |\n+\t\t1 << TF_TBL_TYPE_ACT_MODIFY_64B\n+\n+\t},\n+\t/* Resources in bank 0 */\n+\t[CFA_RESOURCE_TYPE_P58_SRAM_BANK_0] = {\n+\t\tTF_MODULE_TYPE_TABLE,\n+\t\t1 << TF_TBL_TYPE_ACT_SP_SMAC |\n+\t\t1 << TF_TBL_TYPE_ACT_SP_SMAC_IPV4 |\n+\t\t1 << TF_TBL_TYPE_ACT_SP_SMAC_IPV6\n+\t},\n+\t/* Resources in bank 3 */\n+\t[CFA_RESOURCE_TYPE_P58_SRAM_BANK_3] = {\n+\t\tTF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_STATS_64\n+\t},\n+\t[CFA_RESOURCE_TYPE_P58_EM_REC] = {\n+\t\tTF_MODULE_TYPE_EM, 1 << TF_EM_TBL_TYPE_EM_RECORD\n+\t},\n+};\n #endif /* _TF_DEVICE_P58_H_ */\ndiff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c\nindex ea6e2af7ce..25bf026658 100644\n--- a/drivers/net/bnxt/tf_core/tf_msg.c\n+++ b/drivers/net/bnxt/tf_core/tf_msg.c\n@@ -2306,3 +2306,38 @@ tf_msg_set_if_tbl_entry(struct tf *tfp,\n \n \treturn 0;\n }\n+\n+int\n+tf_msg_get_version(struct bnxt *bp,\n+\t\t   struct tf_dev_info *dev,\n+\t\t   struct tf_get_version_parms *params)\n+\n+{\n+\tint rc;\n+\tstruct hwrm_tf_version_get_input req = { 0 };\n+\tstruct hwrm_tf_version_get_output resp = { 0 };\n+\tstruct tfp_send_msg_parms parms = { 0 };\n+\n+\t/* Populate the request */\n+\tparms.tf_type = HWRM_TF_VERSION_GET,\n+\tparms.req_data = (uint32_t *)&req;\n+\tparms.req_size = sizeof(req);\n+\tparms.resp_data = (uint32_t *)&resp;\n+\tparms.resp_size = sizeof(resp);\n+\tparms.mailbox = dev->ops->tf_dev_get_mailbox();\n+\n+\trc = tfp_send_msg_direct(bp,\n+\t\t\t\t &parms);\n+\n+\tparams->major = resp.major;\n+\tparams->minor = resp.minor;\n+\tparams->update = resp.update;\n+\n+\tdev->ops->tf_dev_map_hcapi_caps(resp.dev_caps_cfg,\n+\t\t\t\t\t&params->dev_ident_caps,\n+\t\t\t\t\t&params->dev_tcam_caps,\n+\t\t\t\t\t&params->dev_tbl_caps,\n+\t\t\t\t\t&params->dev_em_caps);\n+\n+\treturn rc;\n+}\ndiff --git a/drivers/net/bnxt/tf_core/tf_msg.h b/drivers/net/bnxt/tf_core/tf_msg.h\nindex 718bc2f3b2..08d20cdd7a 100644\n--- a/drivers/net/bnxt/tf_core/tf_msg.h\n+++ b/drivers/net/bnxt/tf_core/tf_msg.h\n@@ -738,4 +738,23 @@ int tf_msg_set_if_tbl_entry(struct tf *tfp,\n int tf_msg_get_if_tbl_entry(struct tf *tfp,\n \t\t\t    struct tf_if_tbl_get_parms *params);\n \n+/**\n+ * Send get version request to the firmware.\n+ *\n+ * [in] bp\n+ *   Pointer to bnxt handle\n+ *\n+ * [in] dev\n+ *   Pointer to the associated device\n+ *\n+ * [in/out] parms\n+ *   Pointer to the version info parameter\n+ *\n+ * Returns:\n+ *  0 on Success else internal Truflow error\n+ */\n+int\n+tf_msg_get_version(struct bnxt *bp,\n+\t\t   struct tf_dev_info *dev,\n+\t\t   struct tf_get_version_parms *parms);\n #endif  /* _TF_MSG_H_ */\n",
    "prefixes": [
        "v3",
        "08/20"
    ]
}