From patchwork Fri Aug 30 14:00:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriharsha Basavapatna X-Patchwork-Id: 143481 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 1E4D3458A8; Fri, 30 Aug 2024 15:53:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 075D942E9D; Fri, 30 Aug 2024 15:53:46 +0200 (CEST) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by mails.dpdk.org (Postfix) with ESMTP id 494BC42E68 for ; Fri, 30 Aug 2024 15:53:44 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id d9443c01a7336-20223b5c1c0so17326815ad.2 for ; Fri, 30 Aug 2024 06:53:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1725026023; x=1725630823; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vjOV7nisIV3ci6B2xYq0ynIKG97xOIi8HCEtk0S73eg=; b=RU2Vy/fDd2mKPu6kSQw6XWc5BRdPIeVlAgLUMwPl/yNysZnhi6MFqXY4XDzwvNEgdv RGg1k81Xyu/1q1RZimOydUEJZV8V8M5IifoJ3QgvND9wiiH7rywLqRQOL50ddgp4ibNp zyEu/bMcvbfXithFLxEc6mqYMb1lumoDxh4w8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725026023; x=1725630823; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vjOV7nisIV3ci6B2xYq0ynIKG97xOIi8HCEtk0S73eg=; b=PdLR90p+7FdMU7AjMhTon5P7Mtc3w8FmTwEmLuPZvXdwHd5m7Yere1EHfee8E4u9cB k5LKctXCWgG32tyGaWGjUbvbw+f4ZPeKBFtIEMdoqhZY7LmLjlEkAO/FGaGkQasSq5R2 9davrGmG+q+PGRDBxLQRSRHScOtOHU/J7fikplqF6LSPXx2caQkYfG350tx5ojmDUXmI 5Xa7Aqyml0VhfwOawflGJ+BE7REHrQH2Nw0ub7wbTH/o7Hm4VysBmR1nAJypdSehYCaX aPusj2oohEyBMIm+mWU023KitlXshV5JkAO2JJdux9+XRoxbUgE15d9LH8zMaQRQ7U5Y LuHA== X-Gm-Message-State: AOJu0YyL07ZB1ONqo78YPyY6t0AzHCLFIhA2d4mVaVIdNkj5U2efBpe9 /Jw65dPVatoK6IUcN+EqUnmLdqHMQYN/Uaco95hLeKU3UMW23RlySpW15vm7d5quXu6E6E0x04z 41/De7OW6oqVs4NSTSWseZW30fMyF7Yu+t+Rm2TXANZlTi9W86W2osXN9uCucw1PI0bkYuffN3t ANaOrrZbgt6qRiLif0r88JtdWx/QsLc6eKUjwiO8nlUriFa8w= X-Google-Smtp-Source: AGHT+IEPFgqk0XSErESo3vFkpEuiF2JfwuvAIcJFd7beV1+0LlRL9V6NeZgnayhupl6vMs7lqLYpBg== X-Received: by 2002:a17:902:c40e:b0:1fb:90e1:c8c0 with SMTP id d9443c01a7336-2050c4b73bcmr86935135ad.63.1725026022765; Fri, 30 Aug 2024 06:53:42 -0700 (PDT) Received: from dhcp-10-123-154-23.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-205155658dfsm27067145ad.297.2024.08.30.06.53.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2024 06:53:42 -0700 (PDT) From: Sriharsha Basavapatna To: dev@dpdk.org Cc: Mike Baucom , Farah Smith , Kishore Padmanabha , Sriharsha Basavapatna Subject: [PATCH 23/47] net/bnxt: tf_ulp: VFR updates for Thor 2 Date: Fri, 30 Aug 2024 19:30:25 +0530 Message-Id: <20240830140049.1715230-24-sriharsha.basavapatna@broadcom.com> X-Mailer: git-send-email 2.39.0.189.g4dbebc36b0 In-Reply-To: <20240830140049.1715230-1-sriharsha.basavapatna@broadcom.com> References: <20240830140049.1715230-1-sriharsha.basavapatna@broadcom.com> MIME-Version: 1.0 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 From: Mike Baucom Update to VFR code to: - add the endpoint (efid) to the session - modify the generic tables to write the l2 context id - tfc session code changes to allow the efid to be added to the sid - release both rfid and efid from afm This patch includes a few related changes: Thor2 change the counter get to clear on request Allow the caller to either clear on read or simply read based on their request. Reject duplicate EM flow entry It is not necessary to add an duplicate EM entry to WC. This change will reject it. Signed-off-by: Mike Baucom Reviewed-by: Farah Smith Reviewed-by: Kishore Padmanabha Signed-off-by: Sriharsha Basavapatna --- drivers/net/bnxt/bnxt_ethdev.c | 15 +++ drivers/net/bnxt/bnxt_reps.c | 60 +++++++++--- drivers/net/bnxt/tf_ulp/bnxt_ulp.c | 28 ++++++ drivers/net/bnxt/tf_ulp/bnxt_ulp.h | 12 +++ drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c | 2 + drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c | 114 ++++++++++++++++++----- drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c | 11 ++- drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c | 33 ++++++- 8 files changed, 229 insertions(+), 46 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 2c638193a5..aac487bdb2 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1800,6 +1800,21 @@ int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) /* Initialize bnxt ULP port details */ if (bnxt_enable_ulp(bp)) { + if (BNXT_CHIP_P7(bp)) { + /* Need to release the Fid from AFM control */ + rc = bnxt_hwrm_release_afm_func(bp, bp->fw_fid, + bp->fw_fid, + HWRM_CFA_RELEASE_AFM_FUNC_INPUT_TYPE_RFID, + 0); + if (rc) { + PMD_DRV_LOG(ERR, + "Failed in hwrm release afm func:%u rc=%d\n", + bp->fw_fid, rc); + goto error; + } + PMD_DRV_LOG(DEBUG, "Released RFID:%d\n", bp->fw_fid); + } + rc = bnxt_ulp_port_init(bp); if (rc) goto error; diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c index 701f75f53c..f058f1aac2 100644 --- a/drivers/net/bnxt/bnxt_reps.c +++ b/drivers/net/bnxt/bnxt_reps.c @@ -34,7 +34,7 @@ static const struct eth_dev_ops bnxt_rep_dev_ops = { static bool bnxt_rep_check_parent(struct bnxt_representor *rep) { - if (!rep->parent_dev->data->dev_private) + if (!rep->parent_dev->data || !rep->parent_dev->data->dev_private) return false; return true; @@ -357,28 +357,41 @@ static int bnxt_tf_vfr_alloc(struct rte_eth_dev *vfr_ethdev) rc = bnxt_hwrm_release_afm_func(parent_bp, vfr->fw_fid, parent_bp->fw_fid, - HWRM_CFA_RELEASE_AFM_FUNC_INPUT_TYPE_RFID, + HWRM_CFA_RELEASE_AFM_FUNC_INPUT_TYPE_EFID, 0); - if (rc) + if (rc) { PMD_DRV_LOG(ERR, - "Failed in hwrm release afm func:%u rc=%d\n", - vfr->vf_id, rc); + "Failed to release EFID:%d from RFID:%d rc=%d\n", + vfr->vf_id, parent_bp->fw_fid, rc); + goto error_del_rules; + } + PMD_DRV_LOG(DEBUG, "Released EFID:%d from RFID:%d\n", + vfr->fw_fid, parent_bp->fw_fid); + } else { rc = bnxt_hwrm_cfa_pair_alloc(parent_bp, vfr); - if (rc) + if (rc) { PMD_DRV_LOG(ERR, "Failed in hwrm vfr alloc vfr:%u rc=%d\n", vfr->vf_id, rc); + goto error_del_rules; + } } + /* if supported, it will add the vfr endpoint to the session, otherwise + * it returns success + */ + rc = bnxt_ulp_vfr_session_fid_add(parent_bp->ulp_ctx, vfr->fw_fid); if (rc) - (void)bnxt_ulp_delete_vfr_default_rules(vfr); + goto error_del_rules; else PMD_DRV_LOG(DEBUG, "BNXT Port:%d VFR created and initialized\n", vfr->dpdk_port_id); - + return rc; +error_del_rules: + (void)bnxt_ulp_delete_vfr_default_rules(vfr); return rc; } @@ -489,8 +502,29 @@ int bnxt_rep_dev_start_op(struct rte_eth_dev *eth_dev) static int bnxt_tf_vfr_free(struct bnxt_representor *vfr) { + struct bnxt *parent_bp; + int32_t rc; + PMD_DRV_LOG(DEBUG, "BNXT Port:%d VFR ulp free\n", vfr->dpdk_port_id); - return bnxt_ulp_delete_vfr_default_rules(vfr); + rc = bnxt_ulp_delete_vfr_default_rules(vfr); + if (rc) + PMD_DRV_LOG(ERR, + "Failed to delete dflt rules from Port:%d VFR\n", + vfr->dpdk_port_id); + + /* Need to remove the vfr fid from the session regardless */ + parent_bp = vfr->parent_dev->data->dev_private; + if (!parent_bp) { + PMD_DRV_LOG(DEBUG, "BNXT Port:%d VFR already freed\n", + vfr->dpdk_port_id); + return 0; + } + rc = bnxt_ulp_vfr_session_fid_rem(parent_bp->ulp_ctx, vfr->fw_fid); + if (rc) + PMD_DRV_LOG(ERR, + "Failed to remove BNXT Port:%d VFR from session\n", + vfr->dpdk_port_id); + return rc; } static int bnxt_vfr_free(struct bnxt_representor *vfr) @@ -564,13 +598,15 @@ int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev, struct bnxt_representor *rep_bp = eth_dev->data->dev_private; struct bnxt *parent_bp; unsigned int max_rx_rings; - int rc = 0; /* MAC Specifics */ if (!bnxt_rep_check_parent(rep_bp)) { - /* Need not be an error scenario, if parent is closed first */ PMD_DRV_LOG(INFO, "Rep parent port does not exist.\n"); - return rc; + /* Need be an error scenario, if parent is removed first */ + if (eth_dev->device->driver == NULL) + return -ENODEV; + /* Need not be an error scenario, if parent is closed first */ + return 0; } parent_bp = rep_bp->parent_dev->data->dev_private; PMD_DRV_LOG(DEBUG, "Representor dev_info_get_op\n"); diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c index 037723f20c..a942af4486 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.c @@ -1567,3 +1567,31 @@ bnxt_ulp_feature_bits_get(struct bnxt_ulp_context *ulp_ctx) return ulp_ctx->cfg_data->feature_bits; } +/* Add the VF Rep endpoint to the session */ +int32_t +bnxt_ulp_vfr_session_fid_add(struct bnxt_ulp_context *ulp_ctx, + uint16_t vfr_fid) +{ + int32_t rc = 0; + + if (ulp_ctx == NULL || ulp_ctx->ops == NULL) + return -EINVAL; + if (ulp_ctx->ops->ulp_vfr_session_fid_add) + rc = ulp_ctx->ops->ulp_vfr_session_fid_add(ulp_ctx, vfr_fid); + + return rc; +} + +/* Remove the VF Rep endpoint from the session */ +int32_t +bnxt_ulp_vfr_session_fid_rem(struct bnxt_ulp_context *ulp_ctx, + uint16_t vfr_fid) +{ + int32_t rc = 0; + + if (ulp_ctx == NULL || ulp_ctx->ops == NULL) + return -EINVAL; + if (ulp_ctx->ops->ulp_vfr_session_fid_rem) + rc = ulp_ctx->ops->ulp_vfr_session_fid_rem(ulp_ctx, vfr_fid); + return rc; +} diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h index 3ab142767f..9ea34eab3b 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp.h +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp.h @@ -220,6 +220,12 @@ struct bnxt_ulp_core_ops { void (*ulp_ctx_detach)(struct bnxt *bp, struct bnxt_ulp_session_state *session); + int32_t + (*ulp_vfr_session_fid_add)(struct bnxt_ulp_context *ulp_ctx, + uint16_t rep_fid); + int32_t + (*ulp_vfr_session_fid_rem)(struct bnxt_ulp_context *ulp_ctx, + uint16_t rep_fid); }; extern const struct bnxt_ulp_core_ops bnxt_ulp_tf_core_ops; @@ -581,4 +587,10 @@ int32_t bnxt_ulp_num_key_recipes_get(struct bnxt_ulp_context *ulp_ctx); uint64_t bnxt_ulp_feature_bits_get(struct bnxt_ulp_context *ulp_ctx); +int32_t +bnxt_ulp_vfr_session_fid_add(struct bnxt_ulp_context *ulp_ctx, + uint16_t vfr_fid); +int32_t +bnxt_ulp_vfr_session_fid_rem(struct bnxt_ulp_context *ulp_ctx, + uint16_t vfr_fid); #endif /* _BNXT_ULP_H_ */ diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c index 00a36b2e82..2d46d21a5d 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tf.c @@ -1511,4 +1511,6 @@ const struct bnxt_ulp_core_ops bnxt_ulp_tf_core_ops = { .ulp_ctx_detach = ulp_tf_ctx_detach, .ulp_deinit = ulp_tf_deinit, .ulp_init = ulp_tf_init, + .ulp_vfr_session_fid_add = NULL, + .ulp_vfr_session_fid_rem = NULL }; diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c index 191eb09160..3e934c861a 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c @@ -336,7 +336,7 @@ ulp_tfc_tbl_scope_init(struct bnxt *bp) { struct tfc_tbl_scope_mem_alloc_parms mem_parms; struct tfc_tbl_scope_size_query_parms qparms = { 0 }; - uint8_t max_lkup_sz[CFA_DIR_MAX], max_act_sz[CFA_DIR_MAX]; + uint16_t max_lkup_sz[CFA_DIR_MAX], max_act_sz[CFA_DIR_MAX]; struct tfc_tbl_scope_cpm_alloc_parms cparms; uint16_t fid, max_pools; bool first = true, shared = false; @@ -681,6 +681,70 @@ ulp_tfc_ctx_init(struct bnxt *bp, return rc; } +static int32_t +ulp_tfc_vfr_session_fid_add(struct bnxt_ulp_context *ulp_ctx, uint16_t rep_fid) +{ + uint16_t fid_cnt = 0, sid = 0; + struct tfc *tfcp = NULL; + int rc; + + tfcp = bnxt_ulp_cntxt_tfcp_get(ulp_ctx); + if (!tfcp) { + PMD_DRV_LOG(ERR, "Unable to get tfcp from ulp_ctx\n"); + return -EINVAL; + } + + /* Get the session id */ + rc = bnxt_ulp_cntxt_sid_get(ulp_ctx, &sid); + if (rc) { + PMD_DRV_LOG(ERR, "Unable to get SID for VFR FID=%d\n", rep_fid); + return rc; + } + + rc = tfc_session_fid_add(tfcp, rep_fid, sid, &fid_cnt); + if (!rc) + PMD_DRV_LOG(DEBUG, + "EFID=%d added to SID=%d, %d total.\n", + rep_fid, sid, fid_cnt); + else + PMD_DRV_LOG(ERR, + "Failed to add EFID=%d to SID=%d\n", + rep_fid, sid); + return rc; +} + +static int32_t +ulp_tfc_vfr_session_fid_rem(struct bnxt_ulp_context *ulp_ctx, uint16_t rep_fid) +{ + uint16_t fid_cnt = 0, sid = 0; + struct tfc *tfcp = NULL; + int rc; + + tfcp = bnxt_ulp_cntxt_tfcp_get(ulp_ctx); + if (!tfcp) { + PMD_DRV_LOG(ERR, "Unable tfcp from ulp_ctx\n"); + return -EINVAL; + } + + /* Get the session id */ + rc = bnxt_ulp_cntxt_sid_get(ulp_ctx, &sid); + if (rc) { + PMD_DRV_LOG(ERR, "Unable to get SID for VFR FID=%d\n", rep_fid); + return rc; + } + + rc = tfc_session_fid_rem(tfcp, rep_fid, &fid_cnt); + if (!rc) + PMD_DRV_LOG(DEBUG, + "Removed EFID=%d from SID=%d, %d remain.\n", + rep_fid, sid, fid_cnt); + else + PMD_DRV_LOG(ERR, "Failed to remove EFID=%d from SID=%d\n", + rep_fid, sid); + + return rc; +} + static int32_t ulp_tfc_ctx_attach(struct bnxt *bp, struct bnxt_ulp_session_state *session) @@ -703,6 +767,12 @@ ulp_tfc_ctx_attach(struct bnxt *bp, return rc; } + rc = bnxt_ulp_devid_get(bp, &dev_id); + if (rc) { + BNXT_DRV_DBG(ERR, "Unable to get device id from ulp.\n"); + return rc; + } + /* Increment the ulp context data reference count usage. */ bp->ulp_ctx->cfg_data = session->cfg_data; bp->ulp_ctx->cfg_data->ref_cnt++; @@ -710,12 +780,12 @@ ulp_tfc_ctx_attach(struct bnxt *bp, rc = tfc_session_fid_add(&bp->tfcp, bp->fw_fid, session->session_id, &fid_cnt); if (rc) { - BNXT_DRV_DBG(ERR, "Failed to add FID:%d to SID:%d.\n", + BNXT_DRV_DBG(ERR, "Failed to add RFID:%d to SID:%d.\n", bp->fw_fid, session->session_id); return rc; } - BNXT_DRV_DBG(DEBUG, "SID:%d added FID:%d\n", - session->session_id, bp->fw_fid); + BNXT_DRV_DBG(DEBUG, "RFID:%d added to SID:%d\n", + bp->fw_fid, session->session_id); rc = bnxt_ulp_cntxt_sid_set(bp->ulp_ctx, session->session_id); if (rc) { @@ -739,13 +809,6 @@ ulp_tfc_ctx_attach(struct bnxt *bp, BNXT_DRV_DBG(ERR, "Unable to get the app id from ulp.\n"); return -EINVAL; } - - rc = bnxt_ulp_cntxt_dev_id_get(bp->ulp_ctx, &dev_id); - if (rc) { - BNXT_DRV_DBG(ERR, "Unable do get the dev_id.\n"); - return -EINVAL; - } - flags = bp->ulp_ctx->cfg_data->ulp_flags; if (ULP_APP_DEV_UNSUPPORTED_ENABLED(flags)) { BNXT_DRV_DBG(ERR, "APP ID %d, Device ID: 0x%x not supported.\n", @@ -769,11 +832,11 @@ ulp_tfc_ctx_detach(struct bnxt *bp, rc = tfc_session_fid_rem(&bp->tfcp, bp->fw_fid, &fid_cnt); if (rc) - BNXT_DRV_DBG(ERR, "Failed to remove FID:%d from SID:%d\n", + BNXT_DRV_DBG(ERR, "Failed to remove RFID:%d from SID:%d\n", bp->fw_fid, session->session_id); else - BNXT_DRV_DBG(DEBUG, "SID:%d removed FID:%d CNT:%d\n", - session->session_id, bp->fw_fid, fid_cnt); + BNXT_DRV_DBG(DEBUG, "Removed RFID:%d from SID:%d CNT:%d\n", + bp->fw_fid, session->session_id, fid_cnt); bnxt_ulp_cntxt_sid_reset(bp->ulp_ctx); (void)tfc_close(&bp->tfcp); } @@ -826,11 +889,11 @@ ulp_tfc_deinit(struct bnxt *bp, rc = tfc_session_fid_rem(&bp->tfcp, bp->fw_fid, &fid_cnt); if (rc) - BNXT_DRV_DBG(ERR, "Failed to remove FID:%d from SID:%d\n", + BNXT_DRV_DBG(ERR, "Failed to remove RFID:%d from SID:%d\n", bp->fw_fid, session->session_id); else - BNXT_DRV_DBG(DEBUG, "SID:%d removed FID:%d CNT:%d\n", - session->session_id, bp->fw_fid, fid_cnt); + BNXT_DRV_DBG(DEBUG, "Removed RFID:%d from SID:%d CNT:%d\n", + bp->fw_fid, session->session_id, fid_cnt); bnxt_ulp_cntxt_sid_reset(bp->ulp_ctx); (void)tfc_close(&bp->tfcp); @@ -853,6 +916,12 @@ ulp_tfc_init(struct bnxt *bp, uint16_t sid; int rc; + rc = bnxt_ulp_devid_get(bp, &ulp_dev_id); + if (rc) { + BNXT_DRV_DBG(ERR, "Unable to get device id from ulp.\n"); + return rc; + } + bp->tfcp.bp = bp; rc = tfc_open(&bp->tfcp); if (rc) { @@ -872,7 +941,7 @@ ulp_tfc_init(struct bnxt *bp, BNXT_DRV_DBG(ERR, "Failed to allocate a session id\n"); return rc; } - BNXT_DRV_DBG(DEBUG, "SID:%d allocated with FID:%d\n", sid, bp->fw_fid); + BNXT_DRV_DBG(DEBUG, "SID:%d allocated with RFID:%d\n", sid, bp->fw_fid); session->session_id = sid; rc = bnxt_ulp_cntxt_sid_set(bp->ulp_ctx, sid); if (rc) { @@ -899,13 +968,6 @@ ulp_tfc_init(struct bnxt *bp, goto jump_to_error; } - /* Initialize ulp dparms with values devargs passed */ - rc = bnxt_ulp_cntxt_dev_id_get(bp->ulp_ctx, &ulp_dev_id); - if (rc) { - BNXT_DRV_DBG(ERR, "Unable to get device id from ulp.\n"); - return rc; - } - rc = ulp_tfc_dparms_init(bp, bp->ulp_ctx, ulp_dev_id); if (rc) { BNXT_DRV_DBG(ERR, "Failed to initialize the dparms\n"); @@ -968,4 +1030,6 @@ const struct bnxt_ulp_core_ops bnxt_ulp_tfc_core_ops = { .ulp_ctx_detach = ulp_tfc_ctx_detach, .ulp_deinit = ulp_tfc_deinit, .ulp_init = ulp_tfc_init, + .ulp_vfr_session_fid_add = ulp_tfc_vfr_session_fid_add, + .ulp_vfr_session_fid_rem = ulp_tfc_vfr_session_fid_rem }; diff --git a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c index 2be37b59c2..24299a269b 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c +++ b/drivers/net/bnxt/tf_ulp/ulp_fc_mgr_tfc.c @@ -83,10 +83,13 @@ ulp_fc_tfc_flow_stat_get(struct bnxt_ulp_context *ctxt, cmm_info.rsubtype = CFA_RSUBTYPE_CMM_ACT; cmm_info.act_handle = handle; cmm_info.dir = (enum cfa_dir)direction; - cmm_clr.clr = true; - cmm_clr.offset_in_byte = 0; - cmm_clr.sz_in_byte = sizeof(data64[ULP_FC_TFC_PKT_CNT_OFFS]) + - sizeof(data64[ULP_FC_TFC_BYTE_CNT_OFFS]); + /* Read and Clear the hw stat if requested */ + if (count->reset) { + cmm_clr.clr = true; + cmm_clr.offset_in_byte = 0; + cmm_clr.sz_in_byte = sizeof(data64[ULP_FC_TFC_PKT_CNT_OFFS]) + + sizeof(data64[ULP_FC_TFC_BYTE_CNT_OFFS]); + } rc = tfc_act_get(tfcp, NULL, &cmm_info, &cmm_clr, data, &word_size); if (rc) { BNXT_DRV_DBG(ERR, diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c b/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c index d8539134d2..ed840b111c 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper_tfc.c @@ -608,8 +608,12 @@ ulp_mapper_tfc_em_tbl_process(struct bnxt_ulp_mapper_parms *parms, if (tbl->tbl_opcode == BNXT_ULP_EM_TBL_OPC_WR_REGFILE) { uint64_t val = 0; - /* over max flows or hash collision */ - if (rc == -E2BIG || rc == -ENOMEM) { + /* hash collision */ + if (rc == -E2BIG) + BNXT_DRV_DBG(DEBUG, "Dulicate EM entry\n"); + + /* over max flows */ + if (rc == -ENOMEM) { val = 1; rc = 0; BNXT_DRV_DBG(DEBUG, @@ -618,9 +622,11 @@ ulp_mapper_tfc_em_tbl_process(struct bnxt_ulp_mapper_parms *parms, ulp_regfile_write(parms->regfile, tbl->tbl_operand, rte_cpu_to_be_64(val)); } - if (rc) + + if (rc && rc != -E2BIG) BNXT_DRV_DBG(ERR, "Failed to insert em entry rc=%d.\n", rc); + if (rc && error != NULL && tfc_is_mpc_error(rc)) rte_flow_error_set((struct rte_flow_error *)error, EIO, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, @@ -1021,6 +1027,7 @@ ulp_mapper_tfc_index_entry_free(struct bnxt_ulp_context *ulp_ctx, struct tfc *tfcp = NULL; struct tfc_idx_tbl_info tbl_info = { 0 }; uint16_t fw_fid = 0; + int32_t rc; if (bnxt_ulp_cntxt_fid_get(ulp_ctx, &fw_fid)) { BNXT_DRV_DBG(ERR, "Failed to get func_id\n"); @@ -1039,7 +1046,16 @@ ulp_mapper_tfc_index_entry_free(struct bnxt_ulp_context *ulp_ctx, tbl_info.id = (uint16_t)res->resource_hndl; /* TBD: check to see if the memory needs to be cleaned as well*/ - return tfc_idx_tbl_free(tfcp, fw_fid, &tbl_info); + rc = tfc_idx_tbl_free(tfcp, fw_fid, &tbl_info); +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER + if (!rc) + BNXT_DRV_DBG(DEBUG, "Freed Index [%s]:[%s] = 0x%X\n", + tfc_dir_2_str(tbl_info.dir), + tfc_idx_tbl_2_str(tbl_info.rsubtype), tbl_info.id); +#endif +#endif + return rc; } static int32_t @@ -1568,7 +1584,7 @@ ulp_mapper_tfc_ident_free(struct bnxt_ulp_context *ulp_ctx, } #ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG #ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER - BNXT_DRV_INF("Freed Identifier [%s]:[%s] = 0x%X\n", + BNXT_DRV_DBG(DEBUG, "Freed Identifier [%s]:[%s] = 0x%X\n", tfc_dir_2_str(ident_info.dir), tfc_ident_2_str(ident_info.rsubtype), ident_info.id); #endif @@ -1604,6 +1620,13 @@ ulp_mapper_tfc_tcam_entry_free(struct bnxt_ulp_context *ulp, tcam_info.id); return -EINVAL; } +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG +#ifdef RTE_LIBRTE_BNXT_TRUFLOW_DEBUG_MAPPER + BNXT_DRV_DBG(DEBUG, "Freed TCAM [%s]:[%s] = 0x%X\n", + tfc_dir_2_str(tcam_info.dir), + tfc_tcam_2_str(tcam_info.rsubtype), tcam_info.id); +#endif +#endif return 0; }