From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 42999A04DD; Tue, 20 Oct 2020 23:56:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8CE14ACAA; Tue, 20 Oct 2020 23:55:57 +0200 (CEST) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id C42EFAC99 for ; Tue, 20 Oct 2020 23:55:48 +0200 (CEST) Received: by mail-pg1-f196.google.com with SMTP id j7so167872pgk.5 for ; Tue, 20 Oct 2020 14:55:48 -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=O3qQvIEkCkXnINkTbrgh2eywFFlLQDyp3oy/ikr07EU=; b=NCxgHuvBXvKXKPCBccctRskj/VaKoRIyCuNJNKPAwDXlBgo1a+yRutUyAS7lGamSlF SExNPvRVm9RfKGTsv2/t8XOej2gwcgLUUpxUcMD7ccP4BK2QHUxw/XIr1zafurPoeDqW eSkX02Oegz6SW85gn1TSrfA2FtGCgCHjLeSHA= 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=O3qQvIEkCkXnINkTbrgh2eywFFlLQDyp3oy/ikr07EU=; b=Deme3l39ry9dk8h0ytOV20/uHG46EuL171zBxgy5HnPnJO7uid3DZqQaOw3sclnEcp uyD0+9PSSyPleKSGblbGQQj6KiLZhZNPMxPdGlxAmT6Q72GaUGZDYA0XHkqyawaXAYVe ve1unjPPbZkvHfeiLP9LNV7wqWi7PDiXUAUThYzCMtAvIS6dIjZc+xsm0RzzGdM/EnGg D+M9ILFWlSnkHA0yLAAvKYAP6hLX3rI/ckvz4qPiaP552VNNJ7EzX0crFQ8wjC98Ekkg qB8jstaUCgj844U+PxHAtu/hWsplqK1fnYYpjR+MP4GtlpQgKIwXldbQpwkKYXNwoD45 wOYQ== X-Gm-Message-State: AOAM530W20RBdSuZIc64vl5MezxCbVuQnGBa2TsP/ti81hKRc5E0PxuW LbJnnDdft6hnYgGSkLEX8IaFvMaVZijL9ISs5TvFRyHqMQnNTGEjNcEIW3vibWr8NNWVmFJazqB 4wzUHzB1BDtC/gvU00Fq7x+iV8m5lAgtE710THJM+MZPYrw0ehrdX/weE+Wja/Sn4KQ== X-Google-Smtp-Source: ABdhPJyWuhbwsu1uuyyYne7FB2cQeyJDgInh5MgZbkTSI3/hB9bguxTPyRnB4ISjmclMj17dtwEalw== X-Received: by 2002:a63:be43:: with SMTP id g3mr323298pgo.266.1603230946555; Tue, 20 Oct 2020 14:55:46 -0700 (PDT) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id e6sm24113pfn.190.2020.10.20.14.55.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Oct 2020 14:55:46 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Farah Smith , Randy Schacher Date: Tue, 20 Oct 2020 14:55:30 -0700 Message-Id: <20201020215538.59242-4-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20201020215538.59242-1-ajit.khaparde@broadcom.com> References: <1602916089-18576-1-git-send-email-venkatkumar.duvvuru@broadcom.com> <20201020215538.59242-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] [PATCH v2 03/11] net/bnxt: add table scope to PF Mapping X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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 Add table scope to PF Mapping for SR and Wh+ devices. Legacy devices require PF set of base addresses for EEM operation. A table scope id is a logical construct and is mapped to the PF associated with the communications channel used. In the case of a VF, the parent PF is used. Signed-off-by: Farah Smith Reviewed-by: Randy Schacher Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/tf_core/tf_device.h | 10 +++++++--- drivers/net/bnxt/tf_core/tf_device_p4.c | 10 +++++----- drivers/net/bnxt/tf_core/tf_em_common.c | 6 ++++-- drivers/net/bnxt/tf_core/tf_em_host.c | 8 ++++++++ drivers/net/bnxt/tf_core/tf_tbl.h | 3 +++ drivers/net/bnxt/tf_core/tfp.c | 19 +++++++++++++++++++ drivers/net/bnxt/tf_core/tfp.h | 16 ++++++++++++++++ 7 files changed, 62 insertions(+), 10 deletions(-) diff --git a/drivers/net/bnxt/tf_core/tf_device.h b/drivers/net/bnxt/tf_core/tf_device.h index cf7c36e0e..b5fc695ec 100644 --- a/drivers/net/bnxt/tf_core/tf_device.h +++ b/drivers/net/bnxt/tf_core/tf_device.h @@ -579,8 +579,11 @@ struct tf_dev_ops { * [in] tfp * Pointer to TF handle * - * [in] parms - * Pointer to table scope map parameters + * [in] pf + * PF associated with the table scope + * + * [in] parif_bitmask + * Bitmask of PARIFs to enable * * [in/out] pointer to the parif_2_pf data to be updated * @@ -593,7 +596,8 @@ struct tf_dev_ops { * -EINVAL - Error */ int (*tf_dev_map_parif)(struct tf *tfp, - struct tf_map_tbl_scope_parms *parms, + uint16_t parif_bitmask, + uint16_t pf, uint8_t *data, uint8_t *mask, uint16_t sz_in_bytes); diff --git a/drivers/net/bnxt/tf_core/tf_device_p4.c b/drivers/net/bnxt/tf_core/tf_device_p4.c index 07c8d02fa..b35e65a8d 100644 --- a/drivers/net/bnxt/tf_core/tf_device_p4.c +++ b/drivers/net/bnxt/tf_core/tf_device_p4.c @@ -103,7 +103,8 @@ tf_dev_p4_get_tcam_slice_info(struct tf *tfp __rte_unused, static int tf_dev_p4_map_parif(struct tf *tfp __rte_unused, - struct tf_map_tbl_scope_parms *parms, + uint16_t parif_bitmask, + uint16_t pf, uint8_t *data, uint8_t *mask, uint16_t sz_in_bytes) @@ -112,21 +113,20 @@ tf_dev_p4_map_parif(struct tf *tfp __rte_unused, uint32_t parif_pf_mask[2] = { 0 }; uint32_t parif; uint32_t shift; - uint32_t scope_id = (uint32_t)(parms->tbl_scope_id); if (sz_in_bytes != sizeof(uint64_t)) return -ENOTSUP; for (parif = 0; parif < TF_DEV_P4_PARIF_MAX; parif++) { - if (parms->parif_bitmask & (1UL << parif)) { + if (parif_bitmask & (1UL << parif)) { if (parif < 8) { shift = 4 * parif; parif_pf_mask[0] |= TF_DEV_P4_PF_MASK << shift; - parif_pf[0] |= scope_id << shift; + parif_pf[0] |= pf << shift; } else { shift = 4 * (parif - 8); parif_pf_mask[1] |= TF_DEV_P4_PF_MASK << shift; - parif_pf[1] |= scope_id << shift; + parif_pf[1] |= pf << shift; } } } diff --git a/drivers/net/bnxt/tf_core/tf_em_common.c b/drivers/net/bnxt/tf_core/tf_em_common.c index a6ddb4eaf..cbce9389d 100644 --- a/drivers/net/bnxt/tf_core/tf_em_common.c +++ b/drivers/net/bnxt/tf_core/tf_em_common.c @@ -1104,8 +1104,10 @@ int tf_em_ext_map_tbl_scope(struct tf *tfp, } mask = aparms.mem_va; - rc = dev->ops->tf_dev_map_parif(tfp, parms, (uint8_t *)data, - (uint8_t *)mask, sz_in_bytes); + rc = dev->ops->tf_dev_map_parif(tfp, parms->parif_bitmask, + tbl_scope_cb->pf, + (uint8_t *)data, (uint8_t *)mask, + sz_in_bytes); if (rc) { TFP_DRV_LOG(ERR, diff --git a/drivers/net/bnxt/tf_core/tf_em_host.c b/drivers/net/bnxt/tf_core/tf_em_host.c index b5db94f3e..a106bdffd 100644 --- a/drivers/net/bnxt/tf_core/tf_em_host.c +++ b/drivers/net/bnxt/tf_core/tf_em_host.c @@ -392,6 +392,14 @@ tf_em_ext_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms) tbl_scope_cb->index = parms->tbl_scope_id; tbl_scope_cb->tbl_scope_id = parms->tbl_scope_id; + rc = tfp_get_pf(tfp, &tbl_scope_cb->pf); + if (rc) { + TFP_DRV_LOG(ERR, + "EEM: PF query error rc:%s\n", + strerror(-rc)); + goto cleanup; + } + for (dir = 0; dir < TF_DIR_MAX; dir++) { rc = tf_msg_em_qcaps(tfp, dir, diff --git a/drivers/net/bnxt/tf_core/tf_tbl.h b/drivers/net/bnxt/tf_core/tf_tbl.h index 2a5d24c94..230338c81 100644 --- a/drivers/net/bnxt/tf_core/tf_tbl.h +++ b/drivers/net/bnxt/tf_core/tf_tbl.h @@ -38,6 +38,9 @@ struct tf_em_caps { */ struct tf_tbl_scope_cb { uint32_t tbl_scope_id; + /** The pf or parent pf of the vf used for table scope creation + */ + uint16_t pf; int index; struct hcapi_cfa_em_ctx_mem_info em_ctx_info[TF_DIR_MAX]; struct tf_em_caps em_caps[TF_DIR_MAX]; diff --git a/drivers/net/bnxt/tf_core/tfp.c b/drivers/net/bnxt/tf_core/tfp.c index 426a182a9..0f6d63cc0 100644 --- a/drivers/net/bnxt/tf_core/tfp.c +++ b/drivers/net/bnxt/tf_core/tfp.c @@ -178,3 +178,22 @@ tfp_get_fid(struct tf *tfp, uint16_t *fw_fid) return 0; } + +int +tfp_get_pf(struct tf *tfp, uint16_t *pf) +{ + struct bnxt *bp = NULL; + + if (tfp == NULL || pf == NULL) + return -EINVAL; + + bp = container_of(tfp, struct bnxt, tfp); + if (BNXT_VF(bp) && bp->parent) { + *pf = bp->parent->fid - 1; + return 0; + } else if (BNXT_PF(bp)) { + *pf = bp->fw_fid - 1; + return 0; + } + return -EINVAL; +} diff --git a/drivers/net/bnxt/tf_core/tfp.h b/drivers/net/bnxt/tf_core/tfp.h index 421a7d9f7..551b9c569 100644 --- a/drivers/net/bnxt/tf_core/tfp.h +++ b/drivers/net/bnxt/tf_core/tfp.h @@ -268,4 +268,20 @@ int tfp_get_fid(struct tf *tfp, uint16_t *fw_fid); */ int tfp_get_fid(struct tf *tfp, uint16_t *fw_fid); +/** + * Get the PF associated with the fw communications channel. + * + * [in] session + * Pointer to session handle + * + * [out] pf + * Pointer to the pf id + * + * Returns: + * 0 - Success + * -EINVAL - Failure + * + */ +int tfp_get_pf(struct tf *tfp, uint16_t *pf); + #endif /* _TFP_H_ */ -- 2.21.1 (Apple Git-122.3)