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 CD93745B90; Mon, 21 Oct 2024 10:19:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4615640677; Mon, 21 Oct 2024 10:19:07 +0200 (CEST) Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by mails.dpdk.org (Postfix) with ESMTP id 2CED54066F for ; Mon, 21 Oct 2024 10:19:05 +0200 (CEST) Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-7c3e1081804so2088577a12.3 for ; Mon, 21 Oct 2024 01:19:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1729498744; x=1730103544; 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=lN18kwHk4EF8lshbzsB1TYCvMNBmH6HkZUPoy2z+qJE=; b=O1muy/dDTKJvygDbQgVwo2D7acRWeymuPgFvkFqg3JkMw+nXrFGSvjiRDO6PCwniQN AYavOTAlT1xZbyeKOKO0vwNE1U64iL1T3RXVFLmw1RsZbC1xjLfsKlX7aAirssc9y28C 7AEQ3qo4pwIOwrbuf6+QCf9rn7iKfCl79iuB4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729498744; x=1730103544; 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=lN18kwHk4EF8lshbzsB1TYCvMNBmH6HkZUPoy2z+qJE=; b=C+gA4ZIkKFitbu4lth3enbCHkFbITikUq1PdrddSAoyWUjk3uqzror3gRIRjL2M+PL sEWzk+UtP8sU0F0lw6i29ljVV/Mp+D4weSJ1BsNBaS+scz6hix6i87+DpwxN+zhHuwKM cYTphojI4RU96Wt+bP4OjiWchTO1A9mQEVT90VjeB8eJB52TiHAG+ZzBL74iirPnPZMo mil/5uMMjX+lSzD5Loi6O581jvsi2UoBm6S30Ccd9avMDjlfTz5io8Hw5VWFWyUqCCWM J5OG1b0f+Ii0L5rBIg79hu7/2lUxlWVI8vUq6pzWclnIW39a+tYFhganv+svVUlDHiOE ILdw== X-Gm-Message-State: AOJu0YwT0+pOwkyBrkS2ESWtbAfNm5HuRi/N/rp1/tTsWSg/RVTkC9kg fcLvGccAAEM7V8KbcRa4emT4fAWswGAxDEKseZRfxYRQUaPKnTJ9UiMUEDWx+ADaSqlESelaLJ4 KR7Gn50rUx2ARe8CK4mFKfug1lVOYpXsA4jhvYdvZD8vA/RnP79ehJGd+1vVoh/BLdJAJGKXNnL JQXiOriO5GoJvr5r1OGtMCAsX8o5uviPor/TysvrfW0A== X-Google-Smtp-Source: AGHT+IHhmDmxtOP4n/pguR5QFoletbnP4yYjJi+GmYbL4NhoB12RrOeCVG08k8uijDR0+k/3WA/4pQ== X-Received: by 2002:a05:6a20:e617:b0:1d9:1bde:bf8 with SMTP id adf61e73a8af0-1d92c4df71emr14722843637.14.1729498743501; Mon, 21 Oct 2024 01:19:03 -0700 (PDT) Received: from dhcp-10-123-154-23.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ec1313926sm2291631b3a.4.2024.10.21.01.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2024 01:19:03 -0700 (PDT) From: Sriharsha Basavapatna To: dev@dpdk.org Cc: Shuanglin Wang , Sriharsha Basavapatna , Kishore Padmanabha , Ajit Khaparde Subject: [PATCH v6 35/47] net/bnxt: tf_ulp: TF support flow scale query Date: Mon, 21 Oct 2024 13:55:55 +0530 Message-Id: <20241021082607.232829-36-sriharsha.basavapatna@broadcom.com> X-Mailer: git-send-email 2.39.0.189.g4dbebc36b0 In-Reply-To: <20241021082607.232829-1-sriharsha.basavapatna@broadcom.com> References: <20241021082607.232829-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 TF supports the flow scale query feature for OVS application. The resource usage is tracked when opening a TF session or adding/deleting a flow. The resources includes WC TCAM, EM, Action, Counter, Meter, ACT_ENCAP, ACT_ENCAP, and SP_SMAC. User can query the resource usage using niccli. This feature is disabled by default. Using the build flag -DTF_FLOW_SCALE_QUERY to enable it. Improvement on flow scale query feature Several improvements on flow scale query feature: 1. Some default rules require both RX and TX resources; need to update usage states on both direcitons. 2. Update resoure usage state for regular flows only. 3. Added a buffer dirty state to avoid unnecessary state sync with firmware. Signed-off-by: Shuanglin Wang Signed-off-by: Sriharsha Basavapatna Reviewed-by: Kishore Padmanabha Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/tf_ulp/ulp_flow_db.c | 17 +++++++++++++++++ drivers/net/bnxt/tf_ulp/ulp_mapper.c | 13 +++++++++++++ 2 files changed, 30 insertions(+) diff --git a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c index 79e2931e43..e7ac617d7a 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c @@ -12,6 +12,9 @@ #include "ulp_flow_db.h" #include "ulp_fc_mgr.h" #include "ulp_tun.h" +#ifdef TF_FLOW_SCALE_QUERY +#include "tf_resources.h" +#endif /* TF_FLOW_SCALE_QUERY */ #define ULP_FLOW_DB_RES_DIR_BIT 31 #define ULP_FLOW_DB_RES_DIR_MASK 0x80000000 @@ -956,8 +959,15 @@ ulp_flow_db_flush_flows(struct bnxt_ulp_context *ulp_ctx, return -EINVAL; } +#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); +#endif bnxt_ulp_cntxt_release_fdb_lock(ulp_ctx); @@ -994,6 +1004,9 @@ ulp_flow_db_function_flow_flush(struct bnxt_ulp_context *ulp_ctx, return -EINVAL; } +#ifdef TF_FLOW_SCALE_QUERY + tf_resc_pause_usage_update(); +#endif while (!ulp_flow_db_next_entry_get(flow_db, BNXT_ULP_FDB_TYPE_REGULAR, &flow_id)) { if (flow_db->func_id_tbl[flow_id] == func_id) @@ -1002,6 +1015,10 @@ ulp_flow_db_function_flow_flush(struct bnxt_ulp_context *ulp_ctx, flow_id, NULL); } +#ifdef TF_FLOW_SCALE_QUERY + tf_resc_resume_usage_update(); + tf_resc_usage_update_all(ulp_ctx->bp); +#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 17e5b99562..3bf0307980 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -21,6 +21,9 @@ #include "ulp_port_db.h" #include "ulp_ha_mgr.h" #include "bnxt_tf_pmd_shim.h" +#ifdef TF_FLOW_SCALE_QUERY +#include "tf_resources.h" +#endif /* TF_FLOW_SCALE_QUERY */ static uint8_t mapper_fld_zeros[16] = { 0 }; @@ -4315,6 +4318,12 @@ ulp_mapper_resources_free(struct bnxt_ulp_context *ulp_ctx, if (rc) frc = rc; +#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); +#endif /* TF_FLOW_SCALE_QUERY */ + return frc; } @@ -4464,6 +4473,10 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx, goto flow_error; } +#ifdef TF_FLOW_SCALE_QUERY + tf_resc_usage_update_all(ulp_ctx->bp); +#endif /* TF_FLOW_SCALE_QUERY */ + return rc; batch_error: -- 2.39.3