From patchwork Sun Jun 13 00:06:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 94105 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 9CFADA0C41; Sun, 13 Jun 2021 02:08:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F12EC4115F; Sun, 13 Jun 2021 02:07:15 +0200 (CEST) Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by mails.dpdk.org (Postfix) with ESMTP id 57E8F410ED for ; Sun, 13 Jun 2021 02:07:12 +0200 (CEST) Received: by mail-pg1-f179.google.com with SMTP id y11so5602865pgp.11 for ; Sat, 12 Jun 2021 17:07:12 -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=OPi6XwGVro9NMbBTdIN21CBfGTJrakilW77ed9HoZRQ=; b=HuCxoRC78pFdSbz7DhyoiLeE3rO7EgVMumt0kHad9ws+iwm7Xy2zPRbBEqIUTs0y0L 4Kt3LhhHULbe/5kp5LawO8dIAFcgbCRcZMstNOn3UYt5hN4vAgWEKX0b4mWWcYpkGVQv Gdu/4jpceFXsBX+ghDirwBaokMBvW3MVH54Pg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version; bh=OPi6XwGVro9NMbBTdIN21CBfGTJrakilW77ed9HoZRQ=; b=NsFx7/JtVF4J/Kyg0/0+fpt9y7jx8fjOELtkPzQhYA8T9FA6OXDbERvKto/boG41cM lkd7mAF5kPsO6W3KVJjr0An/R47Fv08mXuWKzCopermXqueNqSWcTHpjogNngCrAGLnj QliX50PN8BA2UtsbIpqB7EDs04WmTYFn0wfxDsNaJ0hv7JUqPMk+n3pyMUOKDMyo2U2o Tg7Pm/daRerQghiUpABSboXslYzZ89LEydAQmh51BcwC2s7QMaqUXvVxCVAl92qIk8nZ 2A2laQ8NrWBJcdZPI5d7ayaueu7yiZ3n5/pC74KJQrVB4QkzUDTuZsHtCcro2dkptka8 fw0g== X-Gm-Message-State: AOAM532SXxNBHrnn/UiMx8wTnKk4wuVhUjKRKSlAgQ4Ga9/eiPjYpXB6 mlKHP6J8aiG/oJVuBXUGS0BVlM5+PKp7hUugF1fWeUeIagFrfx2pavJWnw9cZvhHaKQpwrBpIXW yQ+nVzXZEYbiXwma1O9M2EvZTJTGC5V8aDOT04Gai0e7+MNpO5xgpVzKndTrlLJ8= X-Google-Smtp-Source: ABdhPJyiRCjH2r4DJv8HGqOy69u5TEEso4+XDVnSNKbkYuDmoPLG1q2VKKKVx7N9fk5t2pmsSeM73w== X-Received: by 2002:aa7:828f:0:b029:200:6e27:8c8f with SMTP id s15-20020aa7828f0000b02902006e278c8fmr15082927pfm.44.1623542830851; Sat, 12 Jun 2021 17:07:10 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id gg22sm12774609pjb.17.2021.06.12.17.07.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Jun 2021 17:07:10 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Farah Smith , Randy Schacher , Venkat Duvvuru Date: Sat, 12 Jun 2021 17:06:04 -0700 Message-Id: <20210613000652.28191-11-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20210613000652.28191-1-ajit.khaparde@broadcom.com> References: <20210530085929.29695-1-venkatkumar.duvvuru@broadcom.com> <20210613000652.28191-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [dpdk-dev] [PATCH v2 10/58] net/bnxt: add 64B SRAM record management with RM 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" From: Farah Smith HCAPI RM now manages 64Byte records instead of 8Byte. Truflow core RM will manage the same. The tf_tbl core APIs now return 8B pointer addresses. These can be used directly as SRAM pointers in Action Records. When communicating with the firmware 8 byte addresses will be used. Signed-off-by: Farah Smith Signed-off-by: Randy Schacher Signed-off-by: Venkat Duvvuru Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/tf_core/tf_device.h | 29 ++++- drivers/net/bnxt/tf_core/tf_device_p4.c | 2 + drivers/net/bnxt/tf_core/tf_device_p58.c | 71 ++++++++++ drivers/net/bnxt/tf_core/tf_device_p58.h | 24 ++-- drivers/net/bnxt/tf_core/tf_rm.h | 2 +- drivers/net/bnxt/tf_core/tf_tbl.c | 158 ++++++++++++++++++++++- 6 files changed, 267 insertions(+), 19 deletions(-) diff --git a/drivers/net/bnxt/tf_core/tf_device.h b/drivers/net/bnxt/tf_core/tf_device.h index 2cbb42fe2a..a18d59660b 100644 --- a/drivers/net/bnxt/tf_core/tf_device.h +++ b/drivers/net/bnxt/tf_core/tf_device.h @@ -220,9 +220,36 @@ struct tf_dev_ops { */ int (*tf_dev_search_ident)(struct tf *tfp, struct tf_ident_search_parms *parms); + /** + * Get SRAM table information. + * + * Converts an internal RM allocated element offset to + * a user address and vice versa. + * + * [in] tfp + * Pointer to TF handle + * + * [in] type + * Truflow index table type, e.g. TF_TYPE_FULL_ACT_RECORD + * + * [in/out] base + * Pointer to the base address of the associated table type. + * + * [in/out] shift + * Pointer to any shift required for the associated table type. + * + * Returns + * - (0) if successful. + * - (-EINVAL) on failure. + */ + int (*tf_dev_get_tbl_info)(struct tf *tfp, + void *tbl_db, + enum tf_tbl_type type, + uint16_t *base, + uint16_t *shift); /** - * Allocation of a table type element. + * Allocation of an index table type element. * * This API allocates the specified table type element from a * device specific table type DB. The allocated element is diff --git a/drivers/net/bnxt/tf_core/tf_device_p4.c b/drivers/net/bnxt/tf_core/tf_device_p4.c index e5aaaac9a0..8274978bfe 100644 --- a/drivers/net/bnxt/tf_core/tf_device_p4.c +++ b/drivers/net/bnxt/tf_core/tf_device_p4.c @@ -206,6 +206,7 @@ const struct tf_dev_ops tf_dev_ops_p4_init = { .tf_dev_alloc_ident = NULL, .tf_dev_free_ident = NULL, .tf_dev_search_ident = NULL, + .tf_dev_get_tbl_info = NULL, .tf_dev_alloc_ext_tbl = NULL, .tf_dev_alloc_tbl = NULL, .tf_dev_free_ext_tbl = NULL, @@ -246,6 +247,7 @@ const struct tf_dev_ops tf_dev_ops_p4 = { .tf_dev_alloc_ident = tf_ident_alloc, .tf_dev_free_ident = tf_ident_free, .tf_dev_search_ident = tf_ident_search, + .tf_dev_get_tbl_info = NULL, .tf_dev_alloc_tbl = tf_tbl_alloc, .tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc, .tf_dev_free_tbl = tf_tbl_free, diff --git a/drivers/net/bnxt/tf_core/tf_device_p58.c b/drivers/net/bnxt/tf_core/tf_device_p58.c index 65e283ed11..b61c58e41b 100644 --- a/drivers/net/bnxt/tf_core/tf_device_p58.c +++ b/drivers/net/bnxt/tf_core/tf_device_p58.c @@ -148,6 +148,75 @@ static int tf_dev_p58_word_align(uint16_t size) return ((((size) + 63) >> 6) * 8); } + +#define TF_DEV_P58_BANK_SZ_64B 2048 +/** + * Get SRAM table information. + * + * Converts an internal RM allocated element offset to + * a user address and vice versa. + * + * [in] tfp + * Pointer to TF handle + * + * [in] type + * Truflow index table type, e.g. TF_TYPE_FULL_ACT_RECORD + * + * [in/out] base + * Pointer to the Base address of the associated SRAM bank used for + * the type of record allocated. + * + * [in/out] shift + * Pointer to the factor to be used as a multiplier to translate + * between the RM units to the user address. SRAM manages 64B entries + * Addresses must be shifted to an 8B address. + * + * Returns + * - (0) if successful. + * - (-EINVAL) on failure. + */ +static int tf_dev_p58_get_sram_tbl_info(struct tf *tfp __rte_unused, + void *db, + enum tf_tbl_type type, + uint16_t *base, + uint16_t *shift) +{ + uint16_t hcapi_type; + struct tf_rm_get_hcapi_parms parms; + int rc; + + parms.rm_db = db; + parms.subtype = type; + parms.hcapi_type = &hcapi_type; + + rc = tf_rm_get_hcapi_type(&parms); + if (rc) + return rc; + + switch (hcapi_type) { + case CFA_RESOURCE_TYPE_P58_SRAM_BANK_0: + *base = 0; + *shift = 3; + break; + case CFA_RESOURCE_TYPE_P58_SRAM_BANK_1: + *base = TF_DEV_P58_BANK_SZ_64B; + *shift = 3; + break; + case CFA_RESOURCE_TYPE_P58_SRAM_BANK_2: + *base = TF_DEV_P58_BANK_SZ_64B * 2; + *shift = 3; + break; + case CFA_RESOURCE_TYPE_P58_SRAM_BANK_3: + *base = TF_DEV_P58_BANK_SZ_64B * 3; + *shift = 3; + break; + default: + *base = 0; + *shift = 0; + break; + } + return 0; +} /** * Truflow P58 device specific functions */ @@ -158,6 +227,7 @@ const struct tf_dev_ops tf_dev_ops_p58_init = { .tf_dev_alloc_ident = NULL, .tf_dev_free_ident = NULL, .tf_dev_search_ident = NULL, + .tf_dev_get_tbl_info = NULL, .tf_dev_alloc_ext_tbl = NULL, .tf_dev_alloc_tbl = NULL, .tf_dev_free_ext_tbl = NULL, @@ -198,6 +268,7 @@ const struct tf_dev_ops tf_dev_ops_p58 = { .tf_dev_alloc_ident = tf_ident_alloc, .tf_dev_free_ident = tf_ident_free, .tf_dev_search_ident = tf_ident_search, + .tf_dev_get_tbl_info = tf_dev_p58_get_sram_tbl_info, .tf_dev_alloc_tbl = tf_tbl_alloc, .tf_dev_alloc_ext_tbl = tf_tbl_ext_alloc, .tf_dev_free_tbl = tf_tbl_free, diff --git a/drivers/net/bnxt/tf_core/tf_device_p58.h b/drivers/net/bnxt/tf_core/tf_device_p58.h index 07f022769b..4d7a78e52c 100644 --- a/drivers/net/bnxt/tf_core/tf_device_p58.h +++ b/drivers/net/bnxt/tf_core/tf_device_p58.h @@ -68,35 +68,35 @@ struct tf_rm_element_cfg tf_tbl_p58[TF_TBL_TYPE_MAX] = { [TF_TBL_TYPE_FULL_ACT_RECORD] = { .cfg_type = TF_RM_ELEM_CFG_HCAPI_BA_PARENT, .hcapi_type = CFA_RESOURCE_TYPE_P58_SRAM_BANK_1, - .slices = 4, + .slices = 1, .divider = 8, }, [TF_TBL_TYPE_COMPACT_ACT_RECORD] = { .cfg_type = TF_RM_ELEM_CFG_HCAPI_BA_CHILD, .parent_subtype = TF_TBL_TYPE_FULL_ACT_RECORD, .hcapi_type = CFA_RESOURCE_TYPE_P58_SRAM_BANK_1, - .slices = 8, + .slices = 1, .divider = 8, }, /* Policy - Encaps in bank 2 */ [TF_TBL_TYPE_ACT_ENCAP_8B] = { .cfg_type = TF_RM_ELEM_CFG_HCAPI_BA_PARENT, .hcapi_type = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2, - .slices = 8, + .slices = 1, .divider = 8, }, [TF_TBL_TYPE_ACT_ENCAP_16B] = { .cfg_type = TF_RM_ELEM_CFG_HCAPI_BA_CHILD, .parent_subtype = TF_TBL_TYPE_ACT_ENCAP_8B, .hcapi_type = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2, - .slices = 4, + .slices = 1, .divider = 8, }, [TF_TBL_TYPE_ACT_ENCAP_32B] = { .cfg_type = TF_RM_ELEM_CFG_HCAPI_BA_CHILD, .parent_subtype = TF_TBL_TYPE_ACT_ENCAP_8B, .hcapi_type = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2, - .slices = 2, + .slices = 1, .divider = 8, }, [TF_TBL_TYPE_ACT_ENCAP_64B] = { @@ -111,21 +111,21 @@ struct tf_rm_element_cfg tf_tbl_p58[TF_TBL_TYPE_MAX] = { .cfg_type = TF_RM_ELEM_CFG_HCAPI_BA_CHILD, .parent_subtype = TF_TBL_TYPE_ACT_ENCAP_8B, .hcapi_type = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2, - .slices = 8, + .slices = 1, .divider = 8, }, [TF_TBL_TYPE_ACT_MODIFY_16B] = { .cfg_type = TF_RM_ELEM_CFG_HCAPI_BA_CHILD, .parent_subtype = TF_TBL_TYPE_ACT_ENCAP_8B, .hcapi_type = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2, - .slices = 4, + .slices = 1, .divider = 8, }, [TF_TBL_TYPE_ACT_MODIFY_32B] = { .cfg_type = TF_RM_ELEM_CFG_HCAPI_BA_CHILD, .parent_subtype = TF_TBL_TYPE_ACT_ENCAP_8B, .hcapi_type = CFA_RESOURCE_TYPE_P58_SRAM_BANK_2, - .slices = 2, + .slices = 1, .divider = 8, }, [TF_TBL_TYPE_ACT_MODIFY_64B] = { @@ -139,28 +139,28 @@ struct tf_rm_element_cfg tf_tbl_p58[TF_TBL_TYPE_MAX] = { [TF_TBL_TYPE_ACT_SP_SMAC] = { .cfg_type = TF_RM_ELEM_CFG_HCAPI_BA_PARENT, .hcapi_type = CFA_RESOURCE_TYPE_P58_SRAM_BANK_0, - .slices = 8, + .slices = 1, .divider = 8, }, [TF_TBL_TYPE_ACT_SP_SMAC_IPV4] = { .cfg_type = TF_RM_ELEM_CFG_HCAPI_BA_CHILD, .parent_subtype = TF_TBL_TYPE_ACT_SP_SMAC, .hcapi_type = CFA_RESOURCE_TYPE_P58_SRAM_BANK_0, - .slices = 4, + .slices = 1, .divider = 8, }, [TF_TBL_TYPE_ACT_SP_SMAC_IPV6] = { .cfg_type = TF_RM_ELEM_CFG_HCAPI_BA_CHILD, .parent_subtype = TF_TBL_TYPE_ACT_SP_SMAC, .hcapi_type = CFA_RESOURCE_TYPE_P58_SRAM_BANK_0, - .slices = 2, + .slices = 1, .divider = 8, }, /* Policy - Stats in bank 3 */ [TF_TBL_TYPE_ACT_STATS_64] = { .cfg_type = TF_RM_ELEM_CFG_HCAPI_BA_PARENT, .hcapi_type = CFA_RESOURCE_TYPE_P58_SRAM_BANK_3, - .slices = 8, + .slices = 1, .divider = 8, }, }; diff --git a/drivers/net/bnxt/tf_core/tf_rm.h b/drivers/net/bnxt/tf_core/tf_rm.h index 407c7d5bf9..6eb6865dac 100644 --- a/drivers/net/bnxt/tf_core/tf_rm.h +++ b/drivers/net/bnxt/tf_core/tf_rm.h @@ -138,6 +138,7 @@ struct tf_rm_element_cfg { * resource pool chunk size. */ uint8_t slices; + /** * Pool element divider count * If 0 or 1, there is 1:1 correspondence between the RM @@ -146,7 +147,6 @@ struct tf_rm_element_cfg { * correspondence to the HCAPI RM firmware resource. */ uint8_t divider; - }; /** diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c b/drivers/net/bnxt/tf_core/tf_tbl.c index 7d15c3c5d4..75dbe2066f 100644 --- a/drivers/net/bnxt/tf_core/tf_tbl.c +++ b/drivers/net/bnxt/tf_core/tf_tbl.c @@ -16,6 +16,14 @@ #include "tf_session.h" #include "tf_device.h" +#define TF_TBL_RM_TO_PTR(new_idx, idx, base, shift) { \ + *(new_idx) = (((idx) + (base)) << (shift)); \ +} + +#define TF_TBL_PTR_TO_RM(new_idx, idx, base, shift) { \ + *(new_idx) = (((idx) >> (shift)) - (base)); \ +} + struct tf; /** @@ -118,6 +126,9 @@ tf_tbl_alloc(struct tf *tfp __rte_unused, int rc; uint32_t idx; struct tf_rm_allocate_parms aparms = { 0 }; + struct tf_session *tfs; + struct tf_dev_info *dev; + uint16_t base = 0, shift = 0; TF_CHECK_PARMS2(tfp, parms); @@ -128,6 +139,29 @@ tf_tbl_alloc(struct tf *tfp __rte_unused, return -EINVAL; } + /* Retrieve the session information */ + rc = tf_session_get_session_internal(tfp, &tfs); + if (rc) + return rc; + + /* Retrieve the device information */ + rc = tf_session_get_device(tfs, &dev); + if (rc) + return rc; + + /* Only get table info if required for the device */ + if (dev->ops->tf_dev_get_tbl_info) { + rc = dev->ops->tf_dev_get_tbl_info(tfp, tbl_db[parms->dir], + parms->type, &base, &shift); + if (rc) { + TFP_DRV_LOG(ERR, + "%s: Failed to get table info:%d\n", + tf_dir_2_str(parms->dir), + parms->type); + return rc; + } + } + /* Allocate requested element */ aparms.rm_db = tbl_db[parms->dir]; aparms.subtype = parms->type; @@ -141,6 +175,7 @@ tf_tbl_alloc(struct tf *tfp __rte_unused, return rc; } + TF_TBL_RM_TO_PTR(&idx, idx, base, shift); *parms->idx = idx; return 0; @@ -154,6 +189,9 @@ tf_tbl_free(struct tf *tfp __rte_unused, struct tf_rm_is_allocated_parms aparms = { 0 }; struct tf_rm_free_parms fparms = { 0 }; int allocated = 0; + struct tf_session *tfs; + struct tf_dev_info *dev; + uint16_t base = 0, shift = 0; TF_CHECK_PARMS2(tfp, parms); @@ -163,11 +201,35 @@ tf_tbl_free(struct tf *tfp __rte_unused, tf_dir_2_str(parms->dir)); return -EINVAL; } + /* Retrieve the session information */ + rc = tf_session_get_session_internal(tfp, &tfs); + if (rc) + return rc; + + /* Retrieve the device information */ + rc = tf_session_get_device(tfs, &dev); + if (rc) + return rc; + + /* Only get table info if required for the device */ + if (dev->ops->tf_dev_get_tbl_info) { + rc = dev->ops->tf_dev_get_tbl_info(tfp, tbl_db[parms->dir], + parms->type, &base, &shift); + if (rc) { + TFP_DRV_LOG(ERR, + "%s: Failed to get table info:%d\n", + tf_dir_2_str(parms->dir), + parms->type); + return rc; + } + } /* Check if element is in use */ aparms.rm_db = tbl_db[parms->dir]; aparms.subtype = parms->type; - aparms.index = parms->idx; + + TF_TBL_PTR_TO_RM(&aparms.index, parms->idx, base, shift); + aparms.allocated = &allocated; rc = tf_rm_is_allocated(&aparms); if (rc) @@ -184,7 +246,9 @@ tf_tbl_free(struct tf *tfp __rte_unused, /* Free requested element */ fparms.rm_db = tbl_db[parms->dir]; fparms.subtype = parms->type; - fparms.index = parms->idx; + + TF_TBL_PTR_TO_RM(&fparms.index, parms->idx, base, shift); + rc = tf_rm_free(&fparms); if (rc) { TFP_DRV_LOG(ERR, @@ -223,6 +287,9 @@ tf_tbl_set(struct tf *tfp, uint16_t hcapi_type; struct tf_rm_is_allocated_parms aparms = { 0 }; struct tf_rm_get_hcapi_parms hparms = { 0 }; + struct tf_session *tfs; + struct tf_dev_info *dev; + uint16_t base = 0, shift = 0; TF_CHECK_PARMS3(tfp, parms, parms->data); @@ -233,10 +300,34 @@ tf_tbl_set(struct tf *tfp, return -EINVAL; } + /* Retrieve the session information */ + rc = tf_session_get_session_internal(tfp, &tfs); + if (rc) + return rc; + + /* Retrieve the device information */ + rc = tf_session_get_device(tfs, &dev); + if (rc) + return rc; + + /* Only get table info if required for the device */ + if (dev->ops->tf_dev_get_tbl_info) { + rc = dev->ops->tf_dev_get_tbl_info(tfp, tbl_db[parms->dir], + parms->type, &base, &shift); + if (rc) { + TFP_DRV_LOG(ERR, + "%s: Failed to get table info:%d\n", + tf_dir_2_str(parms->dir), + parms->type); + return rc; + } + } + /* Verify that the entry has been previously allocated */ aparms.rm_db = tbl_db[parms->dir]; aparms.subtype = parms->type; - aparms.index = parms->idx; + TF_TBL_PTR_TO_RM(&aparms.index, parms->idx, base, shift); + aparms.allocated = &allocated; rc = tf_rm_is_allocated(&aparms); if (rc) @@ -292,6 +383,9 @@ tf_tbl_get(struct tf *tfp, int allocated = 0; struct tf_rm_is_allocated_parms aparms = { 0 }; struct tf_rm_get_hcapi_parms hparms = { 0 }; + struct tf_session *tfs; + struct tf_dev_info *dev; + uint16_t base = 0, shift = 0; TF_CHECK_PARMS3(tfp, parms, parms->data); @@ -302,10 +396,35 @@ tf_tbl_get(struct tf *tfp, return -EINVAL; } + + /* Retrieve the session information */ + rc = tf_session_get_session_internal(tfp, &tfs); + if (rc) + return rc; + + /* Retrieve the device information */ + rc = tf_session_get_device(tfs, &dev); + if (rc) + return rc; + + /* Only get table info if required for the device */ + if (dev->ops->tf_dev_get_tbl_info) { + rc = dev->ops->tf_dev_get_tbl_info(tfp, tbl_db[parms->dir], + parms->type, &base, &shift); + if (rc) { + TFP_DRV_LOG(ERR, + "%s: Failed to get table info:%d\n", + tf_dir_2_str(parms->dir), + parms->type); + return rc; + } + } + /* Verify that the entry has been previously allocated */ aparms.rm_db = tbl_db[parms->dir]; aparms.subtype = parms->type; - aparms.index = parms->idx; + TF_TBL_PTR_TO_RM(&aparms.index, parms->idx, base, shift); + aparms.allocated = &allocated; rc = tf_rm_is_allocated(&aparms); if (rc) @@ -361,6 +480,9 @@ tf_tbl_bulk_get(struct tf *tfp, uint16_t hcapi_type; struct tf_rm_get_hcapi_parms hparms = { 0 }; struct tf_rm_check_indexes_in_range_parms cparms = { 0 }; + struct tf_session *tfs; + struct tf_dev_info *dev; + uint16_t base = 0, shift = 0; TF_CHECK_PARMS2(tfp, parms); @@ -372,10 +494,36 @@ tf_tbl_bulk_get(struct tf *tfp, return -EINVAL; } + /* Retrieve the session information */ + rc = tf_session_get_session_internal(tfp, &tfs); + if (rc) + return rc; + + /* Retrieve the device information */ + rc = tf_session_get_device(tfs, &dev); + if (rc) + return rc; + + /* Only get table info if required for the device */ + if (dev->ops->tf_dev_get_tbl_info) { + rc = dev->ops->tf_dev_get_tbl_info(tfp, tbl_db[parms->dir], + parms->type, &base, &shift); + if (rc) { + TFP_DRV_LOG(ERR, + "%s: Failed to get table info:%d\n", + tf_dir_2_str(parms->dir), + parms->type); + return rc; + } + } + /* Verify that the entries are in the range of reserved resources. */ cparms.rm_db = tbl_db[parms->dir]; cparms.subtype = parms->type; - cparms.starting_index = parms->starting_idx; + + TF_TBL_PTR_TO_RM(&cparms.starting_index, parms->starting_idx, + base, shift); + cparms.num_entries = parms->num_entries; rc = tf_rm_check_indexes_in_range(&cparms);