Commit fefbeadb authored by Krishna Kanth Reddy's avatar Krishna Kanth Reddy Committed by Tomasz Zawadzki
Browse files

module/scheduler: Added get_core_avail_freqs



To get the available frequencies of a specific Core ID.

Change-Id: I9187a1643c22fb0cff76ba069f99eac1a577e2ad
Signed-off-by: default avatarKrishna Kanth Reddy <krish.reddy@samsung.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23638


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 78a2b8a8
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -34,6 +34,19 @@ struct spdk_governor_capabilities {
struct spdk_governor {
	const char *name;

	/**
	 * Get available frequencies of a given core.
	 *
	 * \param lcore_id Core ID.
	 * \param freqs The buffer array to save the frequencies.
	 * \param num Number of frequencies to get.
	 *
	 * \return The number of frequencies returned in freqs. 0 on error.
	 *         0 is returned if it could not get the frequencies or
	 *         if the freqs array is too small to fit the returned frequencies.
	 */
	uint32_t (*get_core_avail_freqs)(uint32_t lcore_id, uint32_t *freqs, uint32_t num);

	/**
	 * Get current frequency of a given core.
	 *
+2 −2
Original line number Diff line number Diff line
@@ -6,8 +6,8 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

SO_VER := 13
SO_MINOR := 1
SO_VER := 14
SO_MINOR := 0

CFLAGS += $(ENV_CFLAGS) -Wno-address-of-packed-member

+16 −0
Original line number Diff line number Diff line
@@ -13,6 +13,21 @@

#include <rte_power.h>

static uint32_t
_get_core_avail_freqs(uint32_t lcore_id, uint32_t *freqs, uint32_t num)
{
	uint32_t rc;

	rc = rte_power_freqs(lcore_id, freqs, num);
	if (!rc) {
		SPDK_ERRLOG("Unable to get current core frequency array for core %d\n.", lcore_id);

		return 0;
	}

	return rc;
}

static uint32_t
_get_core_curr_freq(uint32_t lcore_id)
{
@@ -149,6 +164,7 @@ _deinit(void)

static struct spdk_governor dpdk_governor = {
	.name = "dpdk_governor",
	.get_core_avail_freqs = _get_core_avail_freqs,
	.get_core_curr_freq = _get_core_curr_freq,
	.core_freq_up = _core_freq_up,
	.core_freq_down = _core_freq_down,