DPDK patches and discussions
 help / color / mirror / Atom feed
From: Radu Nicolau <radu.nicolau@intel.com>
To: dev@dpdk.org
Cc: david.hunt@intel.com, chris.macnamara@intel.com,
	michael.j.glynn@intel.com, Radu Nicolau <radu.nicolau@intel.com>
Subject: [dpdk-dev] [PATCH v2 2/3] test/power: add unit test for get capabilities API
Date: Mon, 11 Jun 2018 11:03:22 +0100	[thread overview]
Message-ID: <1528711403-29776-2-git-send-email-radu.nicolau@intel.com> (raw)
In-Reply-To: <1528711403-29776-1-git-send-email-radu.nicolau@intel.com>

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 test/test/test_power_acpi_cpufreq.c | 42 +++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/test/test/test_power_acpi_cpufreq.c b/test/test/test_power_acpi_cpufreq.c
index 8da2dcc..67d5ee0 100644
--- a/test/test/test_power_acpi_cpufreq.c
+++ b/test/test/test_power_acpi_cpufreq.c
@@ -18,6 +18,12 @@ test_power_acpi_cpufreq(void)
 	printf("Power management library not supported, skipping test\n");
 	return TEST_SKIPPED;
 }
+static int
+test_power_acpi_caps(void)
+{
+	printf("Power management library not supported, skipping test\n");
+	return TEST_SKIPPED;
+}
 
 #else
 #include <rte_power.h>
@@ -517,6 +523,42 @@ test_power_acpi_cpufreq(void)
 	rte_power_unset_env();
 	return -1;
 }
+
+static int
+test_power_acpi_caps(void)
+{
+	struct rte_power_core_capabilities caps;
+	int ret;
+
+	ret = rte_power_set_env(PM_ENV_ACPI_CPUFREQ);
+	if (ret) {
+		printf("Error setting ACPI environment\n");
+		return -1;
+	}
+
+	ret = rte_power_init(TEST_POWER_LCORE_ID);
+	if (ret < 0) {
+		printf("Cannot initialise power management for lcore %u, this "
+			"may occur if environment is not configured "
+			"correctly(APCI cpufreq) or operating in another valid "
+			"Power management environment\n", TEST_POWER_LCORE_ID);
+		rte_power_unset_env();
+		return -1;
+	}
+
+	ret = rte_power_get_capabilities(TEST_POWER_LCORE_ID, &caps);
+	if (ret) {
+		printf("ACPI: Error getting capabilities\n");
+		return -1;
+	}
+
+	printf("ACPI: Capabilities %lx\n", caps.capabilities);
+
+	rte_power_unset_env();
+	return 0;
+}
+
 #endif
 
 REGISTER_TEST_COMMAND(power_acpi_cpufreq_autotest, test_power_acpi_cpufreq);
+REGISTER_TEST_COMMAND(power_acpi_caps_autotest, test_power_acpi_caps);
-- 
2.7.5

  reply	other threads:[~2018-06-11 10:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06 10:47 [dpdk-dev] [PATCH 1/2] power: add " Radu Nicolau
2018-06-06 10:47 ` [dpdk-dev] [PATCH 2/2] examples/l3fw-power: add high/regular performance cores option Radu Nicolau
2018-06-11 10:03 ` [dpdk-dev] [PATCH v2 1/3] power: add get capabilities API Radu Nicolau
2018-06-11 10:03   ` Radu Nicolau [this message]
2018-06-26  9:43     ` [dpdk-dev] [PATCH v2 2/3] test/power: add unit test for " Hunt, David
2018-06-11 10:03   ` [dpdk-dev] [PATCH v2 3/3] examples/l3fw-power: add high/regular performance cores option Radu Nicolau
2018-06-26  9:43     ` Hunt, David
2018-06-26  9:43   ` [dpdk-dev] [PATCH v2 1/3] power: add get capabilities API Hunt, David
2018-07-12 17:20     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1528711403-29776-2-git-send-email-radu.nicolau@intel.com \
    --to=radu.nicolau@intel.com \
    --cc=chris.macnamara@intel.com \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=michael.j.glynn@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).