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 AF39D458A8; Fri, 30 Aug 2024 15:55:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 07AC242F0D; Fri, 30 Aug 2024 15:54:51 +0200 (CEST) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mails.dpdk.org (Postfix) with ESMTP id 7BF5742EA5 for ; Fri, 30 Aug 2024 15:54:48 +0200 (CEST) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2021537a8e6so15190925ad.2 for ; Fri, 30 Aug 2024 06:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1725026087; x=1725630887; 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=nUXtyI7SFmVhvBuvV+/vS4BR6TuwfAEMpHJ3uE6c/ko=; b=YfM3DfwHyw7CO83gFy2Y3ZobU1SrvUp8LWBrVqUPIecDnbQMFYW1c4C2Rmfd+nB9oa ynzcQtV53Fco1D+qsCZrQp3yNME5TGr8bendpmYF1svOztjBwURCguy8TJfS1sETGbz0 +iQrRDb+vSUGDoElsAes81X1iuXIAJLPzY600= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725026087; x=1725630887; 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=nUXtyI7SFmVhvBuvV+/vS4BR6TuwfAEMpHJ3uE6c/ko=; b=a4xIpRufWEwSDhIk/MkRBfHSK4EEl6gqDWAiUjbZJC569bNWcuqoT+2jiSHD9lC09r /fLzHEcNJ5HTUdyRpJtqnwgjSceBYqduQfuGBIPU1kZXF0CEUxOG0wymvFB64qvyj/Bj ROsBi72Lfhpj78DkfO2PaiaaphM/ULEehgnRaNTEPusFxOlbVqJC74nP6LTlBHbSpWu1 zimFKOau/oQjaZFG6UZKKKjY9Zm33YCHIh03YZYtINfbb7hSK2+EFkKRh6MxAAu+JCRw SVhWEJ7jJy5U9WR1iwOrxXljn+HNCJPhZe0CIfYQdnbYPrkuxhzLBfAhnzZrmV6WptUS Hi/A== X-Gm-Message-State: AOJu0Yw3R9lOKqCZ1n1ZqxwcvKZpL6g3NRmd19VHV5XsD65V/LdCRYMk fpGfC0NNLorOxNsWd57tz8j4y3x101fCU1OJkKx+O2gPeoA5HfE58dGYxaytd4ZxQvkdDl/9dMf nLIjZW1ABLr6xTPye0Y4rnZvNeLlB1FgsnGxrmIdL7YjB5fEjCvTAfwDo1+M72IwabTpOXDJWV+ FVbBemYhtVxI3zBj1DwztehjdNnWS1THBPrdWMNWTKMpNA X-Google-Smtp-Source: AGHT+IH91Jiccj6FW0IKDRrD3pgnVIyGlprCqSM8by/bV4UB2WKWS2/1BM/aXmo3OOr1ncD1/znL1g== X-Received: by 2002:a17:903:32d2:b0:203:a0c6:91e7 with SMTP id d9443c01a7336-2050c354a61mr53792875ad.16.1725026087121; Fri, 30 Aug 2024 06:54:47 -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.54.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2024 06:54:46 -0700 (PDT) From: Sriharsha Basavapatna To: dev@dpdk.org Cc: Shuanglin Wang , Kishore Padmanabha , Sriharsha Basavapatna Subject: [PATCH 35/47] net/bnxt: tf_ulp: TF support flow scale query Date: Fri, 30 Aug 2024 19:30:37 +0530 Message-Id: <20240830140049.1715230-36-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 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 Reviewed-by: Kishore Padmanabha Signed-off-by: Sriharsha Basavapatna --- 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