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 15C8D45C9F; Thu, 7 Nov 2024 14:47:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 202E242F25; Thu, 7 Nov 2024 14:47:05 +0100 (CET) Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by mails.dpdk.org (Postfix) with ESMTP id E2D5A42FBB for ; Thu, 7 Nov 2024 14:47:03 +0100 (CET) Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-2e2bd0e2c4fso773247a91.3 for ; Thu, 07 Nov 2024 05:47:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1730987222; x=1731592022; 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=FaDjlxxwHvQk2zsDAtB8Ls9R3kbrSUuYBL8xY9J2oag=; b=KU4x6OTUpll/4PKoIVc2iyqMNdhqmy4IJj5b68romSt8Uzwj2R66eQk1TtOSnBpm+c 7fW0Nk3bRCqrcP+hqUp2pN1GcVL2TiIAxFgAOXoOseC68mYgSeIWc1SVlJXHCtrhH/1j UEUp2/oPfgoEDVOfxV134+ZyXjcx811ksGpaM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730987222; x=1731592022; 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=FaDjlxxwHvQk2zsDAtB8Ls9R3kbrSUuYBL8xY9J2oag=; b=JfQ8IhtDlrL7h2NYfZD/SGv39FbTQsZyW8/IRwFt8IPvSk5DOHZ57LpCy7L4oFk9gd K0g3e2MWrWutMlViZHTLGmq+EiwtR1SAFE8NPHeXSeWpRjsp8B5DGFnSCEwrEF8846w0 2YlCUEy2guletrQydYxSy3HqV7v9AwrGGjF2BASCdSK0SJ0sekDxcYIWa0AoO8B9Qeo8 vi7gEwdTFzMqQAXkOse2PdgszArEtcmyas4eprzdh/Rl2nnsnxSRRUpFrmg5ryj+RmAR Z9peaBfxVjJMuLvw8dvWq9EJqeM8Y9KfeCFB59oj3YdHJPkhNCH1MrOzOeVp9tqzxRYr j1JQ== X-Gm-Message-State: AOJu0YzkhSB9TKxuNryFXbteSHj4F8SLiG1UyQT9MtH/fBSmjPFnMb4a 7rh66g5YXdb7ncAHhPt76FE2FeNuP08prSz0FNLhey05Vzxwx9BD+b3IKgSs77dku/5VacYWO4W 3WZ13zLek7ytpPAICb3N7+//a2YXv4v8OjLwp6xoZ3/g5tNIOkWtpYXc+hSMQmxqkk+7jM2pr+y PUE0F3AN9kV2tP51U9H2/EnQ2PcialE/OV5fX5R4RQmQ== X-Google-Smtp-Source: AGHT+IGtLpVGr4ztyoFPNbiLW7K2risN3VHdplaJiPAz5obcJHIWAdLT4YRF17NhuChGO8iZwGeiuA== X-Received: by 2002:a17:90b:4c05:b0:2e2:ddfa:24d5 with SMTP id 98e67ed59e1d1-2e9ab01695amr1272248a91.15.1730987222110; Thu, 07 Nov 2024 05:47:02 -0800 (PST) Received: from dhcp-10-123-154-23.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e9a5f52969sm1409878a91.2.2024.11.07.05.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 05:47:01 -0800 (PST) From: Sriharsha Basavapatna To: dev@dpdk.org Cc: Shuanglin Wang , Sriharsha Basavapatna , Kishore Padmanabha , Ajit Khaparde Subject: [PATCH v8 42/47] net/bnxt: tf_ulp: TFC support flow scale query for Thor2 Date: Thu, 7 Nov 2024 19:22:49 +0530 Message-Id: <20241107135254.1611676-43-sriharsha.basavapatna@broadcom.com> X-Mailer: git-send-email 2.39.0.189.g4dbebc36b0 In-Reply-To: <20241107135254.1611676-1-sriharsha.basavapatna@broadcom.com> References: <20241107135254.1611676-1-sriharsha.basavapatna@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: Shuanglin Wang TFC supports the flow scale query feature for OVS application. The resource usage(WC-TCAM) is tracked inside Thor2 firmware. This patch is to query the wc-tcam usage info when adding/ deleting a flow. It is just for debugging purpose and disabled by default. Using the build flag -DTF_FLOW_SCALE_QUERY to enable it. And users should use niccli to query the resource usage. Signed-off-by: Shuanglin Wang Signed-off-by: Sriharsha Basavapatna Reviewed-by: Kishore Padmanabha Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c | 6 ++++++ drivers/net/bnxt/tf_ulp/ulp_flow_db.c | 9 +++++---- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 26 ++++++++++++++++++++++++-- drivers/net/bnxt/tf_ulp/ulp_mapper.h | 5 +++++ 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c index d30339393e..ebbc5a85a9 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_tfc.c @@ -34,6 +34,7 @@ #include "ulp_ha_mgr.h" #include "bnxt_tf_pmd_shim.h" #include "ulp_template_db_tbl.h" +#include "tfc_resources.h" /* define to enable shared table scope */ #define TFC_SHARED_TBL_SCOPE_ENABLE 0 @@ -1053,6 +1054,11 @@ ulp_tfc_init(struct bnxt *bp, } } +#ifdef TF_FLOW_SCALE_QUERY + /* Query resource statstics from firmware */ + tfc_resc_usage_query_all(bp); +#endif /* TF_FLOW_SCALE_QUERY */ + BNXT_DRV_DBG(DEBUG, "ulp ctx has been initialized\n"); return rc; diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c index 90ee2e8808..d5e8bcfacd 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c @@ -16,6 +16,7 @@ #include "ulp_tun.h" #ifdef TF_FLOW_SCALE_QUERY #include "tf_resources.h" +#include "tfc_resources.h" #endif /* TF_FLOW_SCALE_QUERY */ #define ULP_FLOW_DB_RES_DIR_BIT 31 @@ -964,11 +965,12 @@ ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx, #ifdef TF_FLOW_SCALE_QUERY tf_resc_pause_usage_update(); #endif + while (!ulp_flow_db_next_entry_get(flow_db, flow_type, &fid)) ulp_mapper_resources_free(ulp_ctx, flow_type, fid, NULL); + #ifdef TF_FLOW_SCALE_QUERY - tf_resc_resume_usage_update(); - tf_resc_usage_update_all(ulp_ctx->bp); + ulp_resc_usage_sync(ulp_ctx); #endif bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx); @@ -1018,8 +1020,7 @@ ulp_flow_db_function_flow_flush(struct bnxt_ulp_context *ulp_ctx, NULL); } #ifdef TF_FLOW_SCALE_QUERY - tf_resc_resume_usage_update(); - tf_resc_usage_update_all(ulp_ctx->bp); + ulp_resc_usage_sync(ulp_ctx); #endif bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx); return 0; diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c index 5dfe72df17..c595e7cfc3 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -24,6 +24,7 @@ #include "bnxt_tf_pmd_shim.h" #ifdef TF_FLOW_SCALE_QUERY #include "tf_resources.h" +#include "tfc_resources.h" #endif /* TF_FLOW_SCALE_QUERY */ static uint8_t mapper_fld_zeros[16] = { 0 }; @@ -4322,7 +4323,7 @@ ulp_mapper_resources_free(struct bnxt_ulp_context *ulp_ctx, #ifdef TF_FLOW_SCALE_QUERY /* update for regular flows only */ if (flow_type == BNXT_ULP_FDB_TYPE_REGULAR) - tf_resc_usage_update_all(ulp_ctx->bp); + ulp_resc_usage_sync(ulp_ctx); #endif /* TF_FLOW_SCALE_QUERY */ return frc; @@ -4475,7 +4476,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx, } #ifdef TF_FLOW_SCALE_QUERY - tf_resc_usage_update_all(ulp_ctx->bp); + ulp_resc_usage_sync(ulp_ctx); #endif /* TF_FLOW_SCALE_QUERY */ return rc; @@ -4514,6 +4515,27 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx, return rc; } +#ifdef TF_FLOW_SCALE_QUERY +/* Sync resource usage state with firmware */ +int ulp_resc_usage_sync(struct bnxt_ulp_context *ulp_ctx) +{ + uint32_t dev_id; + if (unlikely(bnxt_ulp_cntxt_dev_id_get(ulp_ctx, &dev_id))) { + BNXT_DRV_DBG(ERR, "Invalid ulp context\n"); + return -EINVAL; + } + + if (dev_id == BNXT_ULP_DEVICE_ID_THOR) { + tf_resc_resume_usage_update(); + tf_resc_usage_update_all(ulp_ctx->bp); + } else if (dev_id == BNXT_ULP_DEVICE_ID_THOR2) { + tfc_resc_usage_query_all(ulp_ctx->bp); + } + + return 0; +} +#endif /* TF_FLOW_SCALE_QUERY */ + int32_t ulp_mapper_init(struct bnxt_ulp_context *ulp_ctx) { diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.h b/drivers/net/bnxt/tf_ulp/ulp_mapper.h index 27e139735f..d1dec6c2bd 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.h +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.h @@ -302,4 +302,9 @@ ulp_mapper_init(struct bnxt_ulp_context *ulp_ctx); void ulp_mapper_deinit(struct bnxt_ulp_context *ulp_ctx); +#ifdef TF_FLOW_SCALE_QUERY +int32_t +ulp_resc_usage_sync(struct bnxt_ulp_context *ulp_ctx); +#endif /* TF_FLOW_SCALE_QUERY */ + #endif /* _ULP_MAPPER_H_ */ -- 2.39.3