From patchwork Fri Jun 19 10:53:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatoly Burakov X-Patchwork-Id: 71797 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DFCF2A0518; Fri, 19 Jun 2020 12:54:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3E1CC1BEA7; Fri, 19 Jun 2020 12:54:04 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 48D1B1BE83 for ; Fri, 19 Jun 2020 12:53:59 +0200 (CEST) IronPort-SDR: T9x8duxbuomPb5YeDHK+Yb3JH5poSEg1UGV1uVRsTokOptowP18ldCZR2lwxXHu3/JYBjVlSY7 mNKwGAbDW6bw== X-IronPort-AV: E=McAfee;i="6000,8403,9656"; a="131318771" X-IronPort-AV: E=Sophos;i="5.75,255,1589266800"; d="scan'208";a="131318771" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2020 03:53:58 -0700 IronPort-SDR: 7X0JePQ5vaWv6eVhFmbBkjfRvT4+mF65CYo6FZ4KqIdbgFm0rKRhPaokKmnbJVzdwuyU/bfZIG sqHWAPmzh7wA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,255,1589266800"; d="scan'208";a="263346869" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.222.52]) by orsmga007.jf.intel.com with ESMTP; 19 Jun 2020 03:53:56 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: David Hunt , reshma.pattan@intel.com, hkalra@marvell.com, jerinjacobk@gmail.com, yinan.wang@intel.com Date: Fri, 19 Jun 2020 11:53:50 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 2/7] l3fwd-power: only allow supported power library envs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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, l3fwd-power will attempt to run even if the power env is set to KVM, which is not supported. Fix this by preventing the app from initializing unless the env is set to one of the supported modes. Signed-off-by: Anatoly Burakov Tested-by: Yinan Wang --- examples/l3fwd-power/main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 2cc5d7b121..5cee9d5387 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -2043,6 +2043,7 @@ static int check_ptype(uint16_t portid) static int init_power_library(void) { + enum power_management_env env; unsigned int lcore_id; int ret = 0; @@ -2055,6 +2056,14 @@ init_power_library(void) lcore_id); return ret; } + /* we're not supporting the VM channel mode */ + env = rte_power_get_env(); + if (env != PM_ENV_ACPI_CPUFREQ && + env != PM_ENV_PSTATE_CPUFREQ) { + RTE_LOG(ERR, POWER, + "Only ACPI and PSTATE mode are supported\n"); + return -1; + } } return ret; }