From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DC3C6A0C5E; Thu, 4 Nov 2021 23:00:08 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 82A40427D3; Thu, 4 Nov 2021 22:59:11 +0100 (CET) Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by mails.dpdk.org (Postfix) with ESMTP id D1194427C1 for ; Thu, 4 Nov 2021 22:59:07 +0100 (CET) Received: by mail-pl1-f174.google.com with SMTP id b13so9599335plg.2 for ; Thu, 04 Nov 2021 14:59:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version; bh=/H0Esj9N/I7sxiBtncMKe8VCKhiVI8Q3k6PHsv5IKC0=; b=GP1QHqptb2huX8cW3jkue5mLn4z9JWBDDm1Mylzdi9q6dUSHQA+1jSqnELoLUWi+yq JMvTVmCni9nQc+wAC9VwtsEZXMZ6Hx4OV5m1HXckYkaUBICWVDz6PD+5I4kUumYZnbz+ HOM5NxXTtu1Zw0+FBH/GnNR2CCNWucN9dfdq0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version; bh=/H0Esj9N/I7sxiBtncMKe8VCKhiVI8Q3k6PHsv5IKC0=; b=xnQ28kUVK3yHzgxOIu5+Vr8Hd2wHq8EmGrg+iK5+OdK2G4zD5HdZfBwGbAo6tC5YRY KlHj3jxgWwuKK20LsJ1jilW+TXVakntSeEEw+aAhYC5HjvMfDcXNuXsTZ1+KKEUeZdo+ 7bLF2lRMTuzyOmHFGEbVXHnII8PH55svOaichtVuIK/Gpdgq4i+jHdSusKnu2cBQGLkK k0kLd5FxcuYyTOdYAgs9i539/u5uI6vNOg6EOtodGaE0tnyVKHz5RfbLsuqmawH0g2/b uPaGvBzdLhBLNotAzuLJ/X5heta2ILjMYqMBawiLPDxOfgM0xSa4tn1FZlMtr+q3HLl1 diDA== X-Gm-Message-State: AOAM533Ng4KQHm5K6vdJB4rYyXIcUsIqke9+H6c0gGnvqUFeYTiQ1eyT yqhKq6fs1GRNR69mqGZjcJ+QVk3CC9iVb/sZskmnuKhrrs2n4UwxualZ2c/2MgURSOXBI0FwqVt b95WZ+2kPMwsUIMEWZxpi3fK3mhUcnIzGAK/u63riBLJ2YaN4mPs8CXAs5nhAGKg= X-Google-Smtp-Source: ABdhPJwLdFao8/EO44Qzqo/n2DDLjz43RnqtQ+bhC2w8v/0EXRDtYAH5Ms9KYU6enQSmO/yjab2vdg== X-Received: by 2002:a17:902:b196:b0:141:aa55:6f1 with SMTP id s22-20020a170902b19600b00141aa5506f1mr41821947plr.41.1636063146490; Thu, 04 Nov 2021 14:59:06 -0700 (PDT) Received: from C02GC2QQMD6T.wifi.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id pg5sm8532242pjb.26.2021.11.04.14.59.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Nov 2021 14:59:04 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Jay Ding , Venkat Duvvuru , Farah Smith , Randy Schacher , Peter Spreadborough 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> <20211104215846.58672-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" --000000000000b7b0df05cffda2c9 Content-Transfer-Encoding: 8bit From: Jay Ding Implement tf_get_version that returns TruFlow version numbers and CFA resources capbilities. Signed-off-by: Jay Ding Signed-off-by: Venkat Duvvuru Reviewed-by: Farah Smith Reviewed-by: Randy Schacher Reviewed-by: Peter Spreadborough Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/tf_core/tf_core.c | 29 ++++++++ drivers/net/bnxt/tf_core/tf_core.h | 75 ++++++++++++++++++++ drivers/net/bnxt/tf_core/tf_device.h | 50 ++++++++++++++ drivers/net/bnxt/tf_core/tf_device_p4.c | 65 +++++++++++++++++- drivers/net/bnxt/tf_core/tf_device_p4.h | 79 +++++++++++++++++++++ drivers/net/bnxt/tf_core/tf_device_p58.c | 65 +++++++++++++++++- drivers/net/bnxt/tf_core/tf_device_p58.h | 87 ++++++++++++++++++++++++ drivers/net/bnxt/tf_core/tf_msg.c | 35 ++++++++++ drivers/net/bnxt/tf_core/tf_msg.h | 19 ++++++ 9 files changed, 502 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c index 936102c804..86dfec0eb4 100644 --- a/drivers/net/bnxt/tf_core/tf_core.c +++ b/drivers/net/bnxt/tf_core/tf_core.c @@ -1802,3 +1802,32 @@ int tf_get_session_info(struct tf *tfp, return 0; } + +int tf_get_version(struct tf *tfp, + struct tf_get_version_parms *parms) +{ + int rc; + struct tf_dev_info dev; + + TF_CHECK_PARMS2(tfp, parms); + + /* This function can be called before open session, filter + * out any non-supported device types on the Core side. + */ + if (parms->device_type != TF_DEVICE_TYPE_WH && + parms->device_type != TF_DEVICE_TYPE_THOR && + parms->device_type != TF_DEVICE_TYPE_SR) { + TFP_DRV_LOG(ERR, + "Unsupported device type %d\n", + parms->device_type); + return -ENOTSUP; + } + + tf_dev_bind_ops(parms->device_type, &dev); + + rc = tf_msg_get_version(parms->bp, &dev, parms); + if (rc) + return rc; + + return 0; +} diff --git a/drivers/net/bnxt/tf_core/tf_core.h b/drivers/net/bnxt/tf_core/tf_core.h index fb02c2b161..ba9881c69d 100644 --- a/drivers/net/bnxt/tf_core/tf_core.h +++ b/drivers/net/bnxt/tf_core/tf_core.h @@ -2363,4 +2363,79 @@ struct tf_get_if_tbl_entry_parms { int tf_get_if_tbl_entry(struct tf *tfp, struct tf_get_if_tbl_entry_parms *parms); +/** + * tf_get_version parameters definition. + */ +struct tf_get_version_parms { + /** + * [in] device type + * + * Device type for the session. + */ + enum tf_device_type device_type; + + /** + * [in] bp + * The pointer to the parent bp struct. This is only used for HWRM + * message passing within the portability layer. The type is struct + * bnxt. + */ + void *bp; + + /* [out] major + * + * Version Major number. + */ + uint8_t major; + + /* [out] minor + * + * Version Minor number. + */ + uint8_t minor; + + /* [out] update + * + * Version Update number. + */ + uint8_t update; + + /** + * [out] dev_ident_caps + * + * fw available identifier resource list + */ + uint32_t dev_ident_caps; + + /** + * [out] dev_tbl_caps + * + * fw available table resource list + */ + uint32_t dev_tbl_caps; + + /** + * [out] dev_tcam_caps + * + * fw available tcam resource list + */ + uint32_t dev_tcam_caps; + + /** + * [out] dev_em_caps + * + * fw available em resource list + */ + uint32_t dev_em_caps; +}; + +/** + * Get tf fw version + * + * Used to retrieve Truflow fw version information. + * + * Returns success or failure code. + */ +int tf_get_version(struct tf *tfp, + struct tf_get_version_parms *parms); #endif /* _TF_CORE_H_ */ diff --git a/drivers/net/bnxt/tf_core/tf_device.h b/drivers/net/bnxt/tf_core/tf_device.h index 9b0c037db0..88bd4515ff 100644 --- a/drivers/net/bnxt/tf_core/tf_device.h +++ b/drivers/net/bnxt/tf_core/tf_device.h @@ -6,6 +6,7 @@ #ifndef _TF_DEVICE_H_ #define _TF_DEVICE_H_ +#include "cfa_resource_types.h" #include "tf_core.h" #include "tf_identifier.h" #include "tf_tbl.h" @@ -36,6 +37,21 @@ struct tf_dev_info { const struct tf_dev_ops *ops; }; +/** + * This structure can be used to translate the CFA resource type to TF type. + */ +struct tf_hcapi_resource_map { + /** + * Truflow module type associated with this resource type. + */ + enum tf_module_type module_type; + + /** + * Bitmap of TF sub-type for the element. + */ + uint32_t type_caps; +}; + /** * @page device Device * @@ -1037,6 +1053,34 @@ struct tf_dev_ops { */ uint64_t (*tf_dev_cfa_key_hash)(uint64_t *key_data, uint16_t bitlen); + + /** + * Translate the CFA resource type to Truflow type + * + * [in] hcapi_types + * CFA resource type bitmap + * + * [out] ident_types + * Pointer to identifier type bitmap + * + * [out] tcam_types + * Pointer to tcam type bitmap + * + * [out] tbl_types + * Pointer to table type bitmap + * + * [out] em_types + * Pointer to em type bitmap + * + * Returns + * - (0) if successful. + * - (-EINVAL) on failure. + */ + int (*tf_dev_map_hcapi_caps)(uint64_t hcapi_caps, + uint32_t *ident_caps, + uint32_t *tcam_caps, + uint32_t *tbl_caps, + uint32_t *em_caps); }; /** @@ -1047,4 +1091,10 @@ extern const struct tf_dev_ops tf_dev_ops_p4; extern const struct tf_dev_ops tf_dev_ops_p58_init; extern const struct tf_dev_ops tf_dev_ops_p58; +/** + * Supported device resource type mapping structures + */ +extern const struct tf_hcapi_resource_map tf_hcapi_res_map_p4[CFA_RESOURCE_TYPE_P4_LAST + 1]; +extern const struct tf_hcapi_resource_map tf_hcapi_res_map_p58[CFA_RESOURCE_TYPE_P58_LAST + 1]; + #endif /* _TF_DEVICE_H_ */ diff --git a/drivers/net/bnxt/tf_core/tf_device_p4.c b/drivers/net/bnxt/tf_core/tf_device_p4.c index 826cd0cdbc..8089785b82 100644 --- a/drivers/net/bnxt/tf_core/tf_device_p4.c +++ b/drivers/net/bnxt/tf_core/tf_device_p4.c @@ -271,6 +271,67 @@ static bool tf_dev_p4_is_sram_managed(struct tf *tfp __rte_unused, { return false; } + +/** + * Device specific function that maps the hcapi resource types + * to Truflow type. + * + * [in] hcapi_caps + * CFA resource type bitmap + * + * [out] ident_caps + * Pointer to identifier type bitmap + * + * [out] tcam_caps + * Pointer to tcam type bitmap + * + * [out] tbl_caps + * Pointer to table type bitmap + * + * [out] em_caps + * Pointer to em type bitmap + * + * Returns + * - (0) if successful. + * - (-EINVAL) on failure. + */ +static int tf_dev_p4_map_hcapi_caps(uint64_t hcapi_caps, + uint32_t *ident_caps, + uint32_t *tcam_caps, + uint32_t *tbl_caps, + uint32_t *em_caps) +{ + uint32_t i; + + *ident_caps = 0; + *tcam_caps = 0; + *tbl_caps = 0; + *em_caps = 0; + + for (i = 0; i <= CFA_RESOURCE_TYPE_P4_LAST; i++) { + if (hcapi_caps & 1ULL << i) { + switch (tf_hcapi_res_map_p4[i].module_type) { + case TF_MODULE_TYPE_IDENTIFIER: + *ident_caps |= tf_hcapi_res_map_p4[i].type_caps; + break; + case TF_MODULE_TYPE_TABLE: + *tbl_caps |= tf_hcapi_res_map_p4[i].type_caps; + break; + case TF_MODULE_TYPE_TCAM: + *tcam_caps |= tf_hcapi_res_map_p4[i].type_caps; + break; + case TF_MODULE_TYPE_EM: + *em_caps |= tf_hcapi_res_map_p4[i].type_caps; + break; + default: + return -EINVAL; + } + } + } + + return 0; +} + /** * Truflow P4 device specific functions */ @@ -321,6 +382,7 @@ const struct tf_dev_ops tf_dev_ops_p4_init = { .tf_dev_get_global_cfg = NULL, .tf_dev_get_mailbox = tf_dev_p4_get_mailbox, .tf_dev_word_align = NULL, + .tf_dev_map_hcapi_caps = tf_dev_p4_map_hcapi_caps }; /** @@ -382,5 +444,6 @@ const struct tf_dev_ops tf_dev_ops_p4 = { .tf_dev_get_global_cfg = tf_global_cfg_get, .tf_dev_get_mailbox = tf_dev_p4_get_mailbox, .tf_dev_word_align = tf_dev_p4_word_align, - .tf_dev_cfa_key_hash = hcapi_cfa_p4_key_hash + .tf_dev_cfa_key_hash = hcapi_cfa_p4_key_hash, + .tf_dev_map_hcapi_caps = tf_dev_p4_map_hcapi_caps }; diff --git a/drivers/net/bnxt/tf_core/tf_device_p4.h b/drivers/net/bnxt/tf_core/tf_device_p4.h index c1357913f1..e84c0f9e83 100644 --- a/drivers/net/bnxt/tf_core/tf_device_p4.h +++ b/drivers/net/bnxt/tf_core/tf_device_p4.h @@ -157,4 +157,83 @@ struct tf_global_cfg_cfg tf_global_cfg_p4[TF_GLOBAL_CFG_TYPE_MAX] = { TF_GLOBAL_CFG_CFG_HCAPI, TF_ACTION_BLOCK }, }; + +const struct tf_hcapi_resource_map tf_hcapi_res_map_p4[CFA_RESOURCE_TYPE_P4_LAST + 1] = { + [CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP_HIGH] = { + TF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_L2_CTXT_HIGH + }, + [CFA_RESOURCE_TYPE_P4_L2_CTXT_REMAP_LOW] = { + TF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_L2_CTXT_LOW + }, + [CFA_RESOURCE_TYPE_P4_PROF_FUNC] = { + TF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_PROF_FUNC + }, + [CFA_RESOURCE_TYPE_P4_WC_TCAM_PROF_ID] = { + TF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_WC_PROF + }, + [CFA_RESOURCE_TYPE_P4_EM_PROF_ID] = { + TF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_EM_PROF + }, + [CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM_HIGH] = { + TF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH + }, + [CFA_RESOURCE_TYPE_P4_L2_CTXT_TCAM_LOW] = { + TF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW + }, + [CFA_RESOURCE_TYPE_P4_PROF_TCAM] = { + TF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_PROF_TCAM + }, + [CFA_RESOURCE_TYPE_P4_WC_TCAM] = { + TF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_WC_TCAM + }, + [CFA_RESOURCE_TYPE_P4_SP_TCAM] = { + TF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_SP_TCAM + }, + [CFA_RESOURCE_TYPE_P4_NAT_IPV4] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_MODIFY_IPV4 + }, + [CFA_RESOURCE_TYPE_P4_METER_PROF] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_METER_PROF + }, + [CFA_RESOURCE_TYPE_P4_METER] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_METER_INST + }, + [CFA_RESOURCE_TYPE_P4_MIRROR] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_MIRROR_CONFIG + }, + [CFA_RESOURCE_TYPE_P4_FULL_ACTION] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_FULL_ACT_RECORD + }, + [CFA_RESOURCE_TYPE_P4_MCG] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_MCAST_GROUPS + }, + [CFA_RESOURCE_TYPE_P4_ENCAP_8B] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_ENCAP_8B + }, + [CFA_RESOURCE_TYPE_P4_ENCAP_16B] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_ENCAP_16B + }, + [CFA_RESOURCE_TYPE_P4_ENCAP_64B] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_ENCAP_64B + }, + [CFA_RESOURCE_TYPE_P4_SP_MAC] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_SP_SMAC + }, + [CFA_RESOURCE_TYPE_P4_SP_MAC_IPV4] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_SP_SMAC_IPV4 + }, + [CFA_RESOURCE_TYPE_P4_SP_MAC_IPV6] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_SP_SMAC_IPV6 + }, + [CFA_RESOURCE_TYPE_P4_COUNTER_64B] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_STATS_64 + }, + [CFA_RESOURCE_TYPE_P4_EM_REC] = { + TF_MODULE_TYPE_EM, 1 << TF_EM_TBL_TYPE_EM_RECORD + }, + [CFA_RESOURCE_TYPE_P4_TBL_SCOPE] = { + TF_MODULE_TYPE_EM, 1 << TF_EM_TBL_TYPE_TBL_SCOPE + }, +}; + #endif /* _TF_DEVICE_P4_H_ */ diff --git a/drivers/net/bnxt/tf_core/tf_device_p58.c b/drivers/net/bnxt/tf_core/tf_device_p58.c index 47d7836a58..03e72b90f5 100644 --- a/drivers/net/bnxt/tf_core/tf_device_p58.c +++ b/drivers/net/bnxt/tf_core/tf_device_p58.c @@ -45,6 +45,7 @@ const char *tf_resource_str_p58[CFA_RESOURCE_TYPE_P58_LAST + 1] = { [CFA_RESOURCE_TYPE_P58_WC_FKB] = "wc_fkb ", [CFA_RESOURCE_TYPE_P58_VEB_TCAM] = "veb ", [CFA_RESOURCE_TYPE_P58_METADATA] = "metadata", + [CFA_RESOURCE_TYPE_P58_METER_DROP_CNT] = "meter_dc", }; /** @@ -336,6 +337,66 @@ static int tf_dev_p58_get_sram_tbl_info(struct tf *tfp __rte_unused, return 0; } +/** + * Device specific function that maps the hcapi resource types + * to Truflow type. + * + * [in] hcapi_caps + * CFA resource type bitmap + * + * [out] ident_caps + * Pointer to identifier type bitmap + * + * [out] tcam_caps + * Pointer to tcam type bitmap + * + * [out] tbl_caps + * Pointer to table type bitmap + * + * [out] em_caps + * Pointer to em type bitmap + * + * Returns + * - (0) if successful. + * - (-EINVAL) on failure. + */ +static int tf_dev_p58_map_hcapi_caps(uint64_t hcapi_caps, + uint32_t *ident_caps, + uint32_t *tcam_caps, + uint32_t *tbl_caps, + uint32_t *em_caps) +{ + uint32_t i; + + *ident_caps = 0; + *tcam_caps = 0; + *tbl_caps = 0; + *em_caps = 0; + + for (i = 0; i <= CFA_RESOURCE_TYPE_P58_LAST; i++) { + if (hcapi_caps & 1ULL << i) { + switch (tf_hcapi_res_map_p58[i].module_type) { + case TF_MODULE_TYPE_IDENTIFIER: + *ident_caps |= tf_hcapi_res_map_p58[i].type_caps; + break; + case TF_MODULE_TYPE_TABLE: + *tbl_caps |= tf_hcapi_res_map_p58[i].type_caps; + break; + case TF_MODULE_TYPE_TCAM: + *tcam_caps |= tf_hcapi_res_map_p58[i].type_caps; + break; + case TF_MODULE_TYPE_EM: + *em_caps |= tf_hcapi_res_map_p58[i].type_caps; + break; + default: + return -EINVAL; + } + } + } + + return 0; +} + /** * Truflow P58 device specific functions */ @@ -386,6 +447,7 @@ const struct tf_dev_ops tf_dev_ops_p58_init = { .tf_dev_get_global_cfg = NULL, .tf_dev_get_mailbox = tf_dev_p58_get_mailbox, .tf_dev_word_align = NULL, + .tf_dev_map_hcapi_caps = tf_dev_p58_map_hcapi_caps }; /** @@ -448,5 +510,6 @@ const struct tf_dev_ops tf_dev_ops_p58 = { .tf_dev_get_global_cfg = tf_global_cfg_get, .tf_dev_get_mailbox = tf_dev_p58_get_mailbox, .tf_dev_word_align = tf_dev_p58_word_align, - .tf_dev_cfa_key_hash = hcapi_cfa_p58_key_hash + .tf_dev_cfa_key_hash = hcapi_cfa_p58_key_hash, + .tf_dev_map_hcapi_caps = tf_dev_p58_map_hcapi_caps }; diff --git a/drivers/net/bnxt/tf_core/tf_device_p58.h b/drivers/net/bnxt/tf_core/tf_device_p58.h index 3e8759f2df..f6e66936f3 100644 --- a/drivers/net/bnxt/tf_core/tf_device_p58.h +++ b/drivers/net/bnxt/tf_core/tf_device_p58.h @@ -209,4 +209,91 @@ struct tf_global_cfg_cfg tf_global_cfg_p58[TF_GLOBAL_CFG_TYPE_MAX] = { TF_GLOBAL_CFG_CFG_HCAPI, TF_METER_INTERVAL_CFG }, }; + +const struct tf_hcapi_resource_map tf_hcapi_res_map_p58[CFA_RESOURCE_TYPE_P58_LAST + 1] = { + [CFA_RESOURCE_TYPE_P58_L2_CTXT_REMAP_HIGH] = { + TF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_L2_CTXT_HIGH + }, + [CFA_RESOURCE_TYPE_P58_L2_CTXT_REMAP_LOW] = { + TF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_L2_CTXT_LOW + }, + [CFA_RESOURCE_TYPE_P58_PROF_FUNC] = { + TF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_PROF_FUNC + }, + [CFA_RESOURCE_TYPE_P58_WC_TCAM_PROF_ID] = { + TF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_WC_PROF + }, + [CFA_RESOURCE_TYPE_P58_EM_PROF_ID] = { + TF_MODULE_TYPE_IDENTIFIER, 1 << TF_IDENT_TYPE_EM_PROF + }, + [CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM_HIGH] = { + TF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_HIGH + }, + [CFA_RESOURCE_TYPE_P58_L2_CTXT_TCAM_LOW] = { + TF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_L2_CTXT_TCAM_LOW + }, + [CFA_RESOURCE_TYPE_P58_PROF_TCAM] = { + TF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_PROF_TCAM + }, + [CFA_RESOURCE_TYPE_P58_WC_TCAM] = { + TF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_WC_TCAM + }, + [CFA_RESOURCE_TYPE_P58_VEB_TCAM] = { + TF_MODULE_TYPE_TCAM, 1 << TF_TCAM_TBL_TYPE_VEB_TCAM + }, + [CFA_RESOURCE_TYPE_P58_EM_FKB] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_EM_FKB + }, + [CFA_RESOURCE_TYPE_P58_WC_FKB] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_WC_FKB + }, + [CFA_RESOURCE_TYPE_P58_METER_PROF] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_METER_PROF + }, + [CFA_RESOURCE_TYPE_P58_METER] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_METER_INST + }, + [CFA_RESOURCE_TYPE_P58_METER_DROP_CNT] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_METER_DROP_CNT + }, + [CFA_RESOURCE_TYPE_P58_MIRROR] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_MIRROR_CONFIG + }, + [CFA_RESOURCE_TYPE_P58_METADATA] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_METADATA + }, + /* Resources in bank 1 */ + [CFA_RESOURCE_TYPE_P58_SRAM_BANK_1] = { + TF_MODULE_TYPE_TABLE, + 1 << TF_TBL_TYPE_FULL_ACT_RECORD + | 1 << TF_TBL_TYPE_COMPACT_ACT_RECORD + }, + /* Resources in bank 2 */ + [CFA_RESOURCE_TYPE_P58_SRAM_BANK_2] = { + TF_MODULE_TYPE_TABLE, + 1 << TF_TBL_TYPE_ACT_ENCAP_8B | + 1 << TF_TBL_TYPE_ACT_ENCAP_16B | + 1 << TF_TBL_TYPE_ACT_ENCAP_32B | + 1 << TF_TBL_TYPE_ACT_ENCAP_64B | + 1 << TF_TBL_TYPE_ACT_MODIFY_8B | + 1 << TF_TBL_TYPE_ACT_MODIFY_16B | + 1 << TF_TBL_TYPE_ACT_MODIFY_32B | + 1 << TF_TBL_TYPE_ACT_MODIFY_64B + + }, + /* Resources in bank 0 */ + [CFA_RESOURCE_TYPE_P58_SRAM_BANK_0] = { + TF_MODULE_TYPE_TABLE, + 1 << TF_TBL_TYPE_ACT_SP_SMAC | + 1 << TF_TBL_TYPE_ACT_SP_SMAC_IPV4 | + 1 << TF_TBL_TYPE_ACT_SP_SMAC_IPV6 + }, + /* Resources in bank 3 */ + [CFA_RESOURCE_TYPE_P58_SRAM_BANK_3] = { + TF_MODULE_TYPE_TABLE, 1 << TF_TBL_TYPE_ACT_STATS_64 + }, + [CFA_RESOURCE_TYPE_P58_EM_REC] = { + TF_MODULE_TYPE_EM, 1 << TF_EM_TBL_TYPE_EM_RECORD + }, +}; #endif /* _TF_DEVICE_P58_H_ */ diff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c index ea6e2af7ce..25bf026658 100644 --- a/drivers/net/bnxt/tf_core/tf_msg.c +++ b/drivers/net/bnxt/tf_core/tf_msg.c @@ -2306,3 +2306,38 @@ tf_msg_set_if_tbl_entry(struct tf *tfp, return 0; } + +int +tf_msg_get_version(struct bnxt *bp, + struct tf_dev_info *dev, + struct tf_get_version_parms *params) + +{ + int rc; + struct hwrm_tf_version_get_input req = { 0 }; + struct hwrm_tf_version_get_output resp = { 0 }; + struct tfp_send_msg_parms parms = { 0 }; + + /* Populate the request */ + parms.tf_type = HWRM_TF_VERSION_GET, + parms.req_data = (uint32_t *)&req; + parms.req_size = sizeof(req); + parms.resp_data = (uint32_t *)&resp; + parms.resp_size = sizeof(resp); + parms.mailbox = dev->ops->tf_dev_get_mailbox(); + + rc = tfp_send_msg_direct(bp, + &parms); + + params->major = resp.major; + params->minor = resp.minor; + params->update = resp.update; + + dev->ops->tf_dev_map_hcapi_caps(resp.dev_caps_cfg, + ¶ms->dev_ident_caps, + ¶ms->dev_tcam_caps, + ¶ms->dev_tbl_caps, + ¶ms->dev_em_caps); + + return rc; +} diff --git a/drivers/net/bnxt/tf_core/tf_msg.h b/drivers/net/bnxt/tf_core/tf_msg.h index 718bc2f3b2..08d20cdd7a 100644 --- a/drivers/net/bnxt/tf_core/tf_msg.h +++ b/drivers/net/bnxt/tf_core/tf_msg.h @@ -738,4 +738,23 @@ int tf_msg_set_if_tbl_entry(struct tf *tfp, int tf_msg_get_if_tbl_entry(struct tf *tfp, struct tf_if_tbl_get_parms *params); +/** + * Send get version request to the firmware. + * + * [in] bp + * Pointer to bnxt handle + * + * [in] dev + * Pointer to the associated device + * + * [in/out] parms + * Pointer to the version info parameter + * + * Returns: + * 0 on Success else internal Truflow error + */ +int +tf_msg_get_version(struct bnxt *bp, + struct tf_dev_info *dev, + struct tf_get_version_parms *parms); #endif /* _TF_MSG_H_ */ -- 2.30.1 (Apple Git-130) --000000000000b7b0df05cffda2c9--