Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/103796/?format=api
http://patches.dpdk.org/api/patches/103796/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20211104215846.58672-11-ajit.khaparde@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": "<20211104215846.58672-11-ajit.khaparde@broadcom.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20211104215846.58672-11-ajit.khaparde@broadcom.com", "date": "2021-11-04T21:58:34", "name": "[v5,10/22] net/bnxt: get TruFlow version", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "eef14d6af214bd2a66e75f73bdaaf64327ac3764", "submitter": { "id": 501, "url": "http://patches.dpdk.org/api/people/501/?format=api", "name": "Ajit Khaparde", "email": "ajit.khaparde@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/20211104215846.58672-11-ajit.khaparde@broadcom.com/mbox/", "series": [ { "id": 20322, "url": "http://patches.dpdk.org/api/series/20322/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=20322", "date": "2021-11-04T21:58:24", "name": "fixes and enhancements to Truflow", "version": 5, "mbox": "http://patches.dpdk.org/series/20322/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/103796/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/103796/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 DC3C6A0C5E;\n\tThu, 4 Nov 2021 23:00:08 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 82A40427D3;\n\tThu, 4 Nov 2021 22:59:11 +0100 (CET)", "from mail-pl1-f174.google.com (mail-pl1-f174.google.com\n [209.85.214.174])\n by mails.dpdk.org (Postfix) with ESMTP id D1194427C1\n for <dev@dpdk.org>; Thu, 4 Nov 2021 22:59:07 +0100 (CET)", "by mail-pl1-f174.google.com with SMTP id b13so9599335plg.2\n for <dev@dpdk.org>; Thu, 04 Nov 2021 14:59:07 -0700 (PDT)", "from C02GC2QQMD6T.wifi.broadcom.net ([192.19.223.252])\n by smtp.gmail.com with ESMTPSA id pg5sm8532242pjb.26.2021.11.04.14.59.03\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Thu, 04 Nov 2021 14:59:04 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com;\n s=google;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version; bh=/H0Esj9N/I7sxiBtncMKe8VCKhiVI8Q3k6PHsv5IKC0=;\n b=GP1QHqptb2huX8cW3jkue5mLn4z9JWBDDm1Mylzdi9q6dUSHQA+1jSqnELoLUWi+yq\n JMvTVmCni9nQc+wAC9VwtsEZXMZ6Hx4OV5m1HXckYkaUBICWVDz6PD+5I4kUumYZnbz+\n HOM5NxXTtu1Zw0+FBH/GnNR2CCNWucN9dfdq0=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20210112;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version;\n bh=/H0Esj9N/I7sxiBtncMKe8VCKhiVI8Q3k6PHsv5IKC0=;\n b=xnQ28kUVK3yHzgxOIu5+Vr8Hd2wHq8EmGrg+iK5+OdK2G4zD5HdZfBwGbAo6tC5YRY\n KlHj3jxgWwuKK20LsJ1jilW+TXVakntSeEEw+aAhYC5HjvMfDcXNuXsTZ1+KKEUeZdo+\n 7bLF2lRMTuzyOmHFGEbVXHnII8PH55svOaichtVuIK/Gpdgq4i+jHdSusKnu2cBQGLkK\n k0kLd5FxcuYyTOdYAgs9i539/u5uI6vNOg6EOtodGaE0tnyVKHz5RfbLsuqmawH0g2/b\n uPaGvBzdLhBLNotAzuLJ/X5heta2ILjMYqMBawiLPDxOfgM0xSa4tn1FZlMtr+q3HLl1\n diDA==", "X-Gm-Message-State": "AOAM533Ng4KQHm5K6vdJB4rYyXIcUsIqke9+H6c0gGnvqUFeYTiQ1eyT\n yqhKq6fs1GRNR69mqGZjcJ+QVk3CC9iVb/sZskmnuKhrrs2n4UwxualZ2c/2MgURSOXBI0FwqVt\n b95WZ+2kPMwsUIMEWZxpi3fK3mhUcnIzGAK/u63riBLJ2YaN4mPs8CXAs5nhAGKg=", "X-Google-Smtp-Source": "\n ABdhPJwLdFao8/EO44Qzqo/n2DDLjz43RnqtQ+bhC2w8v/0EXRDtYAH5Ms9KYU6enQSmO/yjab2vdg==", "X-Received": "by 2002:a17:902:b196:b0:141:aa55:6f1 with SMTP id\n s22-20020a170902b19600b00141aa5506f1mr41821947plr.41.1636063146490;\n Thu, 04 Nov 2021 14:59:06 -0700 (PDT)", "From": "Ajit Khaparde <ajit.khaparde@broadcom.com>", "To": "dev@dpdk.org", "Cc": "Jay Ding <jay.ding@broadcom.com>,\n Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>,\n Farah Smith <farah.smith@broadcom.com>,\n Randy Schacher <stuart.schacher@broadcom.com>,\n Peter Spreadborough <peter.spreadborough@broadcom.com>", "Date": "Thu, 4 Nov 2021 14:58:34 -0700", "Message-Id": "<20211104215846.58672-11-ajit.khaparde@broadcom.com>", "X-Mailer": "git-send-email 2.30.1 (Apple Git-130)", "In-Reply-To": "<20211104215846.58672-1-ajit.khaparde@broadcom.com>", "References": "<20211103005251.25524-1-ajit.khaparde@broadcom.com>\n <20211104215846.58672-1-ajit.khaparde@broadcom.com>", "MIME-Version": "1.0", "Content-Type": "multipart/signed; protocol=\"application/pkcs7-signature\";\n micalg=sha-256; boundary=\"000000000000b7b0df05cffda2c9\"", "X-Content-Filtered-By": "Mailman/MimeDel 2.1.29", "Subject": "[dpdk-dev] [PATCH v5 10/22] 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>\nReviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\n---\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 9 files changed, 502 insertions(+), 2 deletions(-)", "diff": "diff --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¶ms->dev_ident_caps,\n+\t\t\t\t\t¶ms->dev_tcam_caps,\n+\t\t\t\t\t¶ms->dev_tbl_caps,\n+\t\t\t\t\t¶ms->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": [ "v5", "10/22" ] }{ "id": 103796, "url": "