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 90F7C45C9F; Thu, 7 Nov 2024 14:46:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 55A2E42FDF; Thu, 7 Nov 2024 14:46:26 +0100 (CET) Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by mails.dpdk.org (Postfix) with ESMTP id D2F4442FB1 for ; Thu, 7 Nov 2024 14:46:24 +0100 (CET) Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-2e2bb1efe78so760087a91.1 for ; Thu, 07 Nov 2024 05:46:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1730987183; x=1731591983; 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=Kf8JTiptL+lMqFPyFJxSSBtWJsiNgGWXhkAYQpNOduE=; b=VapO+nAmA6i8umA5CTfaC0Iq+o7jhSe0MQ4UjoyqHVOWIc5Z7Ydfk/SFM7Tnk1rlI5 q1seVjmPgVY2GDPhVTO7gsC0jQkE2lARblhQOSic8R8pC8c8bDmB1Sk6RpYSdtVc9Kan OlfwpwEO6BBZUQLo+zFepWhFLOYFi9y2cOKaU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730987183; x=1731591983; 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=Kf8JTiptL+lMqFPyFJxSSBtWJsiNgGWXhkAYQpNOduE=; b=jVWvl+2u+t+cFHqT/NMg4v9REtfq3Z23XjxucTpYPnUbPBXENWSit19Uo8H/qa1M8y ULJXQAxmQQTpMfsmIDqE9zgHL2I0Mdj7tGxUv99u65mBfQjY2MO8I6gI0a+4rhtAE5IQ EWQII1aY6DLQKBbdzvTTfsg2L7B7aJC8WrIfJpHDYfwDowtdnNnWB/KbbfWIsAz+p95p hOlNq3bzu6DhhfbUrAs9F6lOfhefERdqoi7H0YuXXqbNPIYzCfjkB6hjGMmhwxIdQFY0 x6I/z9in5K7dG2unzvVJQUBTbWLxJxwQES/0eAEFY3K2G1iL9Wda9kmGAPtv3lrp8rOt KMLg== X-Gm-Message-State: AOJu0Yx/tkAegBG34cHhGBWru6rqAcwCyzVu0QAY4Un1tnxE06g5fzZ6 BcFDh4JoEh52RmpPaiIqATHeWMd53JxQKc7gXu9+8MtdtEjapNX33ST6078pdOu60wlIYy8rnuY TKLXz4oQlwBpa7MV7HWTJ332FyIen2uEhM0SmU9TguziSNAR92UQUD7bnMyINd5DsVJYSJMQHiM rvz0ZZwwMSMhOpk7xBpY1ahKw5a01egjcQscp00fdL6A== X-Google-Smtp-Source: AGHT+IGYnF52W/GTphvaKTWsFZAhIkN3Gn6LUIHMRcvF9CJgjGCUZuZ6yVWXIhceXretZD+ndYTh+Q== X-Received: by 2002:a17:90a:e7c5:b0:2e3:bc3e:feef with SMTP id 98e67ed59e1d1-2e9afaf43b4mr53294a91.3.1730987183279; Thu, 07 Nov 2024 05:46:23 -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.46.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 05:46:22 -0800 (PST) From: Sriharsha Basavapatna To: dev@dpdk.org Cc: Shuanglin Wang , Sriharsha Basavapatna , Kishore Padmanabha , Ajit Khaparde Subject: [PATCH v8 35/47] net/bnxt: tf_ulp: TF support flow scale query Date: Thu, 7 Nov 2024 19:22:42 +0530 Message-Id: <20241107135254.1611676-36-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 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 directions. 2. Update resource 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 23382fecb3..02a1da24bb 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_flow_db.c +++ b/drivers/net/bnxt/tf_ulp/ulp_flow_db.c @@ -14,6 +14,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 @@ -958,8 +961,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); @@ -996,6 +1006,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) @@ -1004,6 +1017,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