From patchwork Wed Jul 21 14:26:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Burakov, Anatoly" X-Patchwork-Id: 96155 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 4D7C1A0C51; Wed, 21 Jul 2021 16:26:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1466E4014E; Wed, 21 Jul 2021 16:26:39 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 434844014D for ; Wed, 21 Jul 2021 16:26:37 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10052"; a="272558494" X-IronPort-AV: E=Sophos;i="5.84,258,1620716400"; d="scan'208";a="272558494" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2021 07:26:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,258,1620716400"; d="scan'208";a="511810583" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.222.151]) by fmsmga002.fm.intel.com with ESMTP; 21 Jul 2021 07:26:27 -0700 From: Anatoly Burakov To: dev@dpdk.org, David Hunt , Konstantin Ananyev Cc: reshma.pattan@intel.com Date: Wed, 21 Jul 2021 14:26:25 +0000 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v1 1/1] power: fix multi-queue scale mode for pmd mgmt 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 Sender: "dev" Currently in scale mode, multi-queue initialization will attempt to initialize and de-initialize the per-lcore power library structures multiple times. Fix it to only do this whenever we either enabling first queue or disabling last queue. Fixes: 5dff9a72b0ef ("power: support callbacks for multiple Rx queues") Signed-off-by: Anatoly Burakov Tested-by: David Hunt --- lib/power/rte_power_pmd_mgmt.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c index 2586204b93..0ce40f0875 100644 --- a/lib/power/rte_power_pmd_mgmt.c +++ b/lib/power/rte_power_pmd_mgmt.c @@ -534,11 +534,15 @@ rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id, clb = get_monitor_callback(); break; case RTE_POWER_MGMT_TYPE_SCALE: - /* check if we can add a new queue */ - ret = check_scale(lcore_id); - if (ret < 0) - goto end; clb = clb_scale_freq; + + /* we only have to check this when enabling first queue */ + if (lcore_cfg->pwr_mgmt_state != PMD_MGMT_DISABLED) + break; + /* check if we can add a new queue */ + ret = check_scale(lcore_id); + if (ret < 0) + goto end; break; case RTE_POWER_MGMT_TYPE_PAUSE: /* figure out various time-to-tsc conversions */ @@ -633,9 +637,12 @@ rte_power_ethdev_pmgmt_queue_disable(unsigned int lcore_id, rte_eth_remove_rx_callback(port_id, queue_id, queue_cfg->cb); break; case RTE_POWER_MGMT_TYPE_SCALE: - rte_power_freq_max(lcore_id); rte_eth_remove_rx_callback(port_id, queue_id, queue_cfg->cb); - rte_power_exit(lcore_id); + /* disable power library on this lcore if this was last queue */ + if (lcore_cfg->pwr_mgmt_state == PMD_MGMT_DISABLED) { + rte_power_freq_max(lcore_id); + rte_power_exit(lcore_id); + } break; } /*