Re: [PATCH v26 00/15] Log subsystem improvements
Hi, I'm not sure about the proper way to do a code review here, feel free to educate me if there is a better way to do it. I couldn't find the actual patches text in the mail and patchwork has no interface to write comments on the line itself but I may very well have missed something. https://patches.dpdk.org/project/dpdk/patch/20241016202343.190653-13-step...@networkplumber.org/ Why not provide an option to disable the syslog with --syslog=none? It will allow overriding a previous setting if one was given as well. (the same applies to the --log-journal option) https://patches.dpdk.org/project/dpdk/patch/20241016202343.190653-15-step...@networkplumber.org/ You have both --log-color=never and --log-color=none, you probably need to make up your mind, my vote would be with none for better compatibility with the syslog/journal options I made above. But I don't care that much about it. Would also be good to document about the dark mode option so people don't need to find it only in the code. Baruch On Wed, Oct 16, 2024 at 11:24 PM Stephen Hemminger < step...@networkplumber.org> wrote: > Improvements and unification of logging library. > This version works on all platforms: Linux, Windows and FreeBSD. > > This is update to rework patch set. It adds several new features > to the console log output. > > * Putting a timestamp on console output which is useful for > analyzing performance of startup codes. Timestamp is optional > and must be enabled on command line. > > * Displaying console output with colors. > It uses the standard conventions used by many other Linux commands > for colorized display. The default is to enable color if the > console output is going to a terminal. But it can be always > on or disabled by command line flag. This default was chosen > based on what dmesg(1) command does. > > Color is used by many tools (vi, iproute2, git) because it is helpful; > DPDK drivers and libraries print lots of not very useful messages. > And having error messages highlighted in bold face helps. > This might also get users to pay more attention to error messages. > Many bug reports have earlier messages that are lost because > there are so many info messages. > > * Add support for automatic detection of systemd journal > protocol. If running as systemd service will get enhanced > logging. > > * Use of syslog is optional and the meaning of the > --syslog flag has changed. The default is *not* to use > syslog if output is going to a terminal. > > Add myself as maintainer for log because by now have added > more than previous authors. > > v26 - rebase and change release note > - by default, do not disable color > - support dark mode with colors > - when using color format message to string then print > to avoid getting multiple threads intermixing on output. > > Stephen Hemminger (15): > maintainers: add for log library > windows: make getopt functions have const properties > windows: add os shim for localtime_r > eal: make eal_log_level_parse common > eal: do not duplicate rte_init_alert() messages > eal: change rte_exit() output to match rte_log() > log: move handling of syslog facility out of eal > eal: initialize log before everything else > log: drop syslog support, and make code common > log: add hook for printing log messages > log: add timestamp option > log: add optional support of syslog > log: add support for systemd journal > log: colorize log output > doc: add release note about log library > > MAINTAINERS | 1 + > app/test/test_eal_flags.c | 64 - > doc/guides/linux_gsg/linux_eal_parameters.rst | 27 -- > doc/guides/prog_guide/log_lib.rst | 76 +- > doc/guides/rel_notes/release_24_11.rst| 26 ++ > lib/eal/common/eal_common_debug.c | 6 +- > lib/eal/common/eal_common_options.c | 135 ++ > lib/eal/common/eal_internal_cfg.h | 1 - > lib/eal/common/eal_options.h | 7 + > lib/eal/freebsd/eal.c | 64 + > lib/eal/linux/eal.c | 68 + > lib/eal/windows/eal.c | 49 +--- > lib/eal/windows/getopt.c | 23 +- > lib/eal/windows/include/getopt.h | 8 +- > lib/eal/windows/include/rte_os_shim.h | 10 + > lib/log/log.c | 71 -- > lib/log/log_color.c | 216 > lib/log/log_freebsd.c | 12 - > lib/log/log_internal.h| 28 +- > lib/log/log_journal.c | 200 +++ > lib/log/log_linux.c | 61 - > lib/log/log_private.h | 61 + > lib/log/log_syslog.c | 88 +++ > lib/lo
[PATCH v7 0/5] power: refactor power management library
This patchset refactors the power management library, addressing both core and uncore power management. The primary changes involve the creation of dedicated directories for each driver within 'drivers/power/core/*' and 'drivers/power/uncore/*'. This refactor significantly improves code organization, enhances clarity, and boosts maintainability. It lays the foundation for more focused development on individual drivers and facilitates seamless integration of future enhancements, particularly the AMD uncore driver. Furthermore, this effort aims to streamline code maintenance by consolidating common functions for cpufreq and cppc across various core drivers, thus reducing code duplication. Sivaprasad Tummala (5): power: refactor core power management library power: refactor uncore power management library test/power: removed function pointer validations drivers/power: uncore support for AMD EPYC processors maintainers: update for drivers/power MAINTAINERS | 1 + app/test/test_power.c | 95 - app/test/test_power_cpufreq.c | 52 --- app/test/test_power_kvm_vm.c | 36 -- drivers/meson.build | 1 + .../power/acpi/acpi_cpufreq.c | 22 +- .../power/acpi/acpi_cpufreq.h | 6 +- drivers/power/acpi/meson.build| 10 + .../power/amd_pstate/amd_pstate_cpufreq.c | 24 +- .../power/amd_pstate/amd_pstate_cpufreq.h | 10 +- drivers/power/amd_pstate/meson.build | 10 + drivers/power/amd_uncore/amd_uncore.c | 329 drivers/power/amd_uncore/amd_uncore.h | 226 +++ drivers/power/amd_uncore/meson.build | 20 + .../power/cppc/cppc_cpufreq.c | 22 +- .../power/cppc/cppc_cpufreq.h | 8 +- drivers/power/cppc/meson.build| 10 + .../power/intel_uncore/intel_uncore.c | 18 +- .../power/intel_uncore/intel_uncore.h | 8 +- drivers/power/intel_uncore/meson.build| 6 + .../power/kvm_vm}/guest_channel.c | 0 .../power/kvm_vm}/guest_channel.h | 0 .../power/kvm_vm/kvm_vm.c | 22 +- .../power/kvm_vm/kvm_vm.h | 6 +- drivers/power/kvm_vm/meson.build | 14 + drivers/power/meson.build | 14 + drivers/power/pstate/meson.build | 10 + .../power/pstate/pstate_cpufreq.c | 22 +- .../power/pstate/pstate_cpufreq.h | 6 +- examples/l3fwd-power/main.c | 12 +- lib/power/meson.build | 9 +- lib/power/power_common.c | 2 +- lib/power/power_common.h | 18 +- lib/power/rte_power.c | 355 -- lib/power/rte_power.h | 116 +++--- lib/power/rte_power_cpufreq_api.h | 206 ++ lib/power/rte_power_uncore.c | 256 +++-- lib/power/rte_power_uncore.h | 61 ++- lib/power/rte_power_uncore_ops.h | 230 lib/power/version.map | 16 + 40 files changed, 1666 insertions(+), 623 deletions(-) rename lib/power/power_acpi_cpufreq.c => drivers/power/acpi/acpi_cpufreq.c (95%) rename lib/power/power_acpi_cpufreq.h => drivers/power/acpi/acpi_cpufreq.h (98%) create mode 100644 drivers/power/acpi/meson.build rename lib/power/power_amd_pstate_cpufreq.c => drivers/power/amd_pstate/amd_pstate_cpufreq.c (95%) rename lib/power/power_amd_pstate_cpufreq.h => drivers/power/amd_pstate/amd_pstate_cpufreq.h (96%) create mode 100644 drivers/power/amd_pstate/meson.build create mode 100644 drivers/power/amd_uncore/amd_uncore.c create mode 100644 drivers/power/amd_uncore/amd_uncore.h create mode 100644 drivers/power/amd_uncore/meson.build rename lib/power/power_cppc_cpufreq.c => drivers/power/cppc/cppc_cpufreq.c (95%) rename lib/power/power_cppc_cpufreq.h => drivers/power/cppc/cppc_cpufreq.h (97%) create mode 100644 drivers/power/cppc/meson.build rename lib/power/power_intel_uncore.c => drivers/power/intel_uncore/intel_uncore.c (95%) rename lib/power/power_intel_uncore.h => drivers/power/intel_uncore/intel_uncore.h (97%) create mode 100644 drivers/power/intel_uncore/meson.build rename {lib/power => drivers/power/kvm_vm}/guest_channel.c (100%) rename {lib/power => drivers/power/kvm_vm}/guest_channel.h (100%) rename lib/power/power_kvm_vm.c => drivers/power/kvm_vm/kvm_vm.c (82%) rename lib/power/power_kvm_vm.h => drivers/power/kvm_vm/kvm_vm.h (98%) create mode 100644 drivers/power/kvm_vm/meson.build create mode 100644 drivers/power/meson.build create mode 100644 drivers/power/pstate/meson.build rename lib/power/power_pstate_cpufreq.c => drivers/power/pstate/pstate_cpufreq.c (96%) rename lib/power/power_pstate_cpufreq.h => dri
[PATCH v7 1/5] power: refactor core power management library
This patch introduces a comprehensive refactor to the core power management library. The primary focus is on improving modularity and organization by relocating specific driver implementations from the 'lib/power' directory to dedicated directories within 'drivers/power/core/*'. The adjustment of meson.build files enables the selective activation of individual drivers. These changes contribute to a significant enhancement in code organization, providing a clearer structure for driver implementations. The refactor aims to improve overall code clarity and boost maintainability. Additionally, it establishes a foundation for future development, allowing for more focused work on individual drivers and seamless integration of forthcoming enhancements. v6: - fixed compilation error with symbol export in API - exported power_get_lcore_mapped_cpu_id as internal API to be used in drivers/power/* v5: - fixed code style warning v4: - fixed build error with RTE_ASSERT v3: - renamed rte_power_core_ops.h as rte_power_cpufreq_api.h - re-worked on auto detection logic v2: - added NULL check for global_core_ops in rte_power_get_core_ops Signed-off-by: Sivaprasad Tummala --- drivers/meson.build | 1 + .../power/acpi/acpi_cpufreq.c | 22 +- .../power/acpi/acpi_cpufreq.h | 6 +- drivers/power/acpi/meson.build| 10 + .../power/amd_pstate/amd_pstate_cpufreq.c | 24 +- .../power/amd_pstate/amd_pstate_cpufreq.h | 10 +- drivers/power/amd_pstate/meson.build | 10 + .../power/cppc/cppc_cpufreq.c | 22 +- .../power/cppc/cppc_cpufreq.h | 8 +- drivers/power/cppc/meson.build| 10 + .../power/kvm_vm}/guest_channel.c | 0 .../power/kvm_vm}/guest_channel.h | 0 .../power/kvm_vm/kvm_vm.c | 22 +- .../power/kvm_vm/kvm_vm.h | 6 +- drivers/power/kvm_vm/meson.build | 14 + drivers/power/meson.build | 12 + drivers/power/pstate/meson.build | 10 + .../power/pstate/pstate_cpufreq.c | 22 +- .../power/pstate/pstate_cpufreq.h | 6 +- lib/power/meson.build | 7 +- lib/power/power_common.c | 2 +- lib/power/power_common.h | 18 +- lib/power/rte_power.c | 355 -- lib/power/rte_power.h | 116 +++--- lib/power/rte_power_cpufreq_api.h | 206 ++ lib/power/version.map | 15 + 26 files changed, 665 insertions(+), 269 deletions(-) rename lib/power/power_acpi_cpufreq.c => drivers/power/acpi/acpi_cpufreq.c (95%) rename lib/power/power_acpi_cpufreq.h => drivers/power/acpi/acpi_cpufreq.h (98%) create mode 100644 drivers/power/acpi/meson.build rename lib/power/power_amd_pstate_cpufreq.c => drivers/power/amd_pstate/amd_pstate_cpufreq.c (95%) rename lib/power/power_amd_pstate_cpufreq.h => drivers/power/amd_pstate/amd_pstate_cpufreq.h (96%) create mode 100644 drivers/power/amd_pstate/meson.build rename lib/power/power_cppc_cpufreq.c => drivers/power/cppc/cppc_cpufreq.c (95%) rename lib/power/power_cppc_cpufreq.h => drivers/power/cppc/cppc_cpufreq.h (97%) create mode 100644 drivers/power/cppc/meson.build rename {lib/power => drivers/power/kvm_vm}/guest_channel.c (100%) rename {lib/power => drivers/power/kvm_vm}/guest_channel.h (100%) rename lib/power/power_kvm_vm.c => drivers/power/kvm_vm/kvm_vm.c (82%) rename lib/power/power_kvm_vm.h => drivers/power/kvm_vm/kvm_vm.h (98%) create mode 100644 drivers/power/kvm_vm/meson.build create mode 100644 drivers/power/meson.build create mode 100644 drivers/power/pstate/meson.build rename lib/power/power_pstate_cpufreq.c => drivers/power/pstate/pstate_cpufreq.c (96%) rename lib/power/power_pstate_cpufreq.h => drivers/power/pstate/pstate_cpufreq.h (98%) create mode 100644 lib/power/rte_power_cpufreq_api.h diff --git a/drivers/meson.build b/drivers/meson.build index 2733306698..7ef4f581a0 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -29,6 +29,7 @@ subdirs = [ 'event', # depends on common, bus, mempool and net. 'baseband', # depends on common and bus. 'gpu',# depends on common and bus. +'power', # depends on common (in future). ] if meson.is_cross_build() diff --git a/lib/power/power_acpi_cpufreq.c b/drivers/power/acpi/acpi_cpufreq.c similarity index 95% rename from lib/power/power_acpi_cpufreq.c rename to drivers/power/acpi/acpi_cpufreq.c index ae809fbb60..974fbb7ba8 100644 --- a/lib/power/power_acpi_cpufreq.c +++ b/drivers/power/acpi/acpi_cpufreq.c @@ -10,7 +10,7 @@ #include #include -#include "power_acpi_cpufreq.h" +#include "acpi_cpufreq.h" #include "power_common.h" #define STR_SIZE 1024 @@ -587,3 +587,23 @
[PATCH v7 5/5] maintainers: update for drivers/power
Update maintainers for drivers/power/*. Signed-off-by: Sivaprasad Tummala --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 6ea7850093..7e29931be9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1744,6 +1744,7 @@ M: Anatoly Burakov M: David Hunt M: Sivaprasad Tummala F: lib/power/ +F: drivers/power/* F: doc/guides/prog_guide/power_man.rst F: app/test/test_power* F: examples/l3fwd-power/ -- 2.34.1
[PATCH v7 2/5] power: refactor uncore power management library
iThis patch refactors the power management library, addressing uncore power management. The primary changes involve the creation of dedicated directories for each driver within 'drivers/power/uncore/*'. The adjustment of meson.build files enables the selective activation of individual drivers. This refactor significantly improves code organization, enhances clarity and boosts maintainability. It lays the foundation for more focused development on individual drivers and facilitates seamless integration of future enhancements, particularly the AMD uncore driver. v7: - fixed build error with aarch32 gcc cross compilation v6: - fixed compilation error with symbol export in API v5: - fixed build errors for risc-v/ppc targets v4: - fixed build error with RTE_ASSERT v3: - fixed typo in header file inclusion Signed-off-by: Sivaprasad Tummala --- .../power/intel_uncore/intel_uncore.c | 18 +- .../power/intel_uncore/intel_uncore.h | 8 +- drivers/power/intel_uncore/meson.build| 6 + drivers/power/meson.build | 3 +- lib/power/meson.build | 2 +- lib/power/rte_power_uncore.c | 256 +- lib/power/rte_power_uncore.h | 61 ++--- lib/power/rte_power_uncore_ops.h | 230 lib/power/version.map | 1 + 9 files changed, 421 insertions(+), 164 deletions(-) rename lib/power/power_intel_uncore.c => drivers/power/intel_uncore/intel_uncore.c (95%) rename lib/power/power_intel_uncore.h => drivers/power/intel_uncore/intel_uncore.h (97%) create mode 100644 drivers/power/intel_uncore/meson.build create mode 100644 lib/power/rte_power_uncore_ops.h diff --git a/lib/power/power_intel_uncore.c b/drivers/power/intel_uncore/intel_uncore.c similarity index 95% rename from lib/power/power_intel_uncore.c rename to drivers/power/intel_uncore/intel_uncore.c index 4eb9c5900a..804ad5d755 100644 --- a/lib/power/power_intel_uncore.c +++ b/drivers/power/intel_uncore/intel_uncore.c @@ -8,7 +8,7 @@ #include -#include "power_intel_uncore.h" +#include "intel_uncore.h" #include "power_common.h" #define MAX_NUMA_DIE 8 @@ -475,3 +475,19 @@ power_intel_uncore_get_num_dies(unsigned int pkg) return count; } + +static struct rte_power_uncore_ops intel_uncore_ops = { + .name = "intel-uncore", + .init = power_intel_uncore_init, + .exit = power_intel_uncore_exit, + .get_avail_freqs = power_intel_uncore_freqs, + .get_num_pkgs = power_intel_uncore_get_num_pkgs, + .get_num_dies = power_intel_uncore_get_num_dies, + .get_num_freqs = power_intel_uncore_get_num_freqs, + .get_freq = power_get_intel_uncore_freq, + .set_freq = power_set_intel_uncore_freq, + .freq_max = power_intel_uncore_freq_max, + .freq_min = power_intel_uncore_freq_min, +}; + +RTE_POWER_REGISTER_UNCORE_OPS(intel_uncore_ops); diff --git a/lib/power/power_intel_uncore.h b/drivers/power/intel_uncore/intel_uncore.h similarity index 97% rename from lib/power/power_intel_uncore.h rename to drivers/power/intel_uncore/intel_uncore.h index 20a3ba8ebe..ffee28f9b3 100644 --- a/lib/power/power_intel_uncore.h +++ b/drivers/power/intel_uncore/intel_uncore.h @@ -2,8 +2,8 @@ * Copyright(c) 2022 Intel Corporation */ -#ifndef POWER_INTEL_UNCORE_H -#define POWER_INTEL_UNCORE_H +#ifndef _INTEL_UNCORE_H +#define _INTEL_UNCORE_H /** * @file @@ -11,7 +11,7 @@ */ #include "rte_power.h" -#include "rte_power_uncore.h" +#include "rte_power_uncore_ops.h" #ifdef __cplusplus extern "C" { @@ -223,4 +223,4 @@ power_intel_uncore_get_num_dies(unsigned int pkg); } #endif -#endif /* POWER_INTEL_UNCORE_H */ +#endif /* _INTEL_UNCORE_H */ diff --git a/drivers/power/intel_uncore/meson.build b/drivers/power/intel_uncore/meson.build new file mode 100644 index 00..876df8ad14 --- /dev/null +++ b/drivers/power/intel_uncore/meson.build @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2017 Intel Corporation +# Copyright(c) 2024 Advanced Micro Devices, Inc. + +sources = files('intel_uncore.c') +deps += ['power'] diff --git a/drivers/power/meson.build b/drivers/power/meson.build index 8c7215c639..c83047af94 100644 --- a/drivers/power/meson.build +++ b/drivers/power/meson.build @@ -6,7 +6,8 @@ drivers = [ 'amd_pstate', 'cppc', 'kvm_vm', -'pstate' +'pstate', +'intel_uncore' ] std_deps = ['power'] diff --git a/lib/power/meson.build b/lib/power/meson.build index 9a4a592caf..d435197cef 100644 --- a/lib/power/meson.build +++ b/lib/power/meson.build @@ -13,7 +13,6 @@ if not is_linux endif sources = files( 'power_common.c', -'power_intel_uncore.c', 'rte_power.c', 'rte_power_uncore.c', 'rte_power_pmd_mgmt.c', @@ -24,6 +23,7 @@ headers = files( 'rte_power_guest_channel.h', 'rte_power_pmd_mgmt.h',
[PATCH v7 4/5] drivers/power: uncore support for AMD EPYC processors
This patch introduces driver support for power management of uncore components in AMD EPYC processors. v2: - fixed typo in comments section. - added fabric frequency get support for legacy platforms. Signed-off-by: Sivaprasad Tummala --- drivers/power/amd_uncore/amd_uncore.c | 329 ++ drivers/power/amd_uncore/amd_uncore.h | 226 ++ drivers/power/amd_uncore/meson.build | 20 ++ drivers/power/meson.build | 1 + 4 files changed, 576 insertions(+) create mode 100644 drivers/power/amd_uncore/amd_uncore.c create mode 100644 drivers/power/amd_uncore/amd_uncore.h create mode 100644 drivers/power/amd_uncore/meson.build diff --git a/drivers/power/amd_uncore/amd_uncore.c b/drivers/power/amd_uncore/amd_uncore.c new file mode 100644 index 00..c3e95cdc08 --- /dev/null +++ b/drivers/power/amd_uncore/amd_uncore.c @@ -0,0 +1,329 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Advanced Micro Devices, Inc. + */ + +#include +#include +#include + +#include + +#include "amd_uncore.h" +#include "power_common.h" +#include "e_smi/e_smi.h" + +#define MAX_NUMA_DIE 8 + +struct __rte_cache_aligned uncore_power_info { + unsigned int die; /* Core die id */ + unsigned int pkg; /* Package id */ + uint32_t freqs[RTE_MAX_UNCORE_FREQS]; /* Frequency array */ + uint32_t nb_freqs; /* Number of available freqs */ + uint32_t curr_idx; /* Freq index in freqs array */ + uint32_t max_freq;/* System max uncore freq */ + uint32_t min_freq;/* System min uncore freq */ +}; + +static struct uncore_power_info uncore_info[RTE_MAX_NUMA_NODES][MAX_NUMA_DIE]; +static int esmi_initialized; +static unsigned int hsmp_proto_ver; + +static int +set_uncore_freq_internal(struct uncore_power_info *ui, uint32_t idx) +{ + int ret; + + if (idx >= RTE_MAX_UNCORE_FREQS || idx >= ui->nb_freqs) { + POWER_LOG(DEBUG, "Invalid uncore frequency index %u, which " + "should be less than %u", idx, ui->nb_freqs); + return -1; + } + + ret = esmi_apb_disable(ui->pkg, idx); + if (ret != ESMI_SUCCESS) { + POWER_LOG(ERR, "DF P-state '%u' set failed for pkg %02u", + idx, ui->pkg); + return -1; + } + + POWER_DEBUG_LOG("DF P-state '%u' to be set for pkg %02u die %02u", + idx, ui->pkg, ui->die); + + /* write the minimum value first if the target freq is less than current max */ + ui->curr_idx = idx; + + return 0; +} + +static int +power_init_for_setting_uncore_freq(struct uncore_power_info *ui) +{ + switch (hsmp_proto_ver) { + case HSMP_PROTO_VER5: + ui->max_freq = 180; /* Hz */ + ui->min_freq = 120; /* Hz */ + break; + case HSMP_PROTO_VER2: + default: + ui->max_freq = 160; /* Hz */ + ui->min_freq = 120; /* Hz */ + } + + return 0; +} + +/* + * Get the available uncore frequencies of the specific die. + */ +static int +power_get_available_uncore_freqs(struct uncore_power_info *ui) +{ + ui->nb_freqs = 3; + if (ui->nb_freqs >= RTE_MAX_UNCORE_FREQS) { + POWER_LOG(ERR, "Too many available uncore frequencies: %d", + ui->nb_freqs); + return -1; + } + + /* Generate the uncore freq bucket array. */ + switch (hsmp_proto_ver) { + case HSMP_PROTO_VER5: + ui->freqs[0] = 180; + ui->freqs[1] = 144; + ui->freqs[2] = 120; + break; + case HSMP_PROTO_VER2: + default: + ui->freqs[0] = 160; + ui->freqs[1] = 1333000; + ui->freqs[2] = 120; + } + + POWER_DEBUG_LOG("%d frequency(s) of pkg %02u die %02u are available", + ui->num_uncore_freqs, ui->pkg, ui->die); + + return 0; +} + +static int +check_pkg_die_values(unsigned int pkg, unsigned int die) +{ + unsigned int max_pkgs, max_dies; + max_pkgs = power_amd_uncore_get_num_pkgs(); + if (max_pkgs == 0) + return -1; + if (pkg >= max_pkgs) { + POWER_LOG(DEBUG, "Package number %02u can not exceed %u", + pkg, max_pkgs); + return -1; + } + + max_dies = power_amd_uncore_get_num_dies(pkg); + if (max_dies == 0) + return -1; + if (die >= max_dies) { + POWER_LOG(DEBUG, "Die number %02u can not exceed %u", + die, max_dies); + return -1; + } + + return 0; +} + +static void +power_amd_uncore_esmi_init(void) +{ + if (esmi_init() == ESMI_SUCCESS) { + i
[PATCH v7 0/5] power: refactor power management library
This patchset refactors the power management library, addressing both core and uncore power management. The primary changes involve the creation of dedicated directories for each driver within 'drivers/power/core/*' and 'drivers/power/uncore/*'. This refactor significantly improves code organization, enhances clarity, and boosts maintainability. It lays the foundation for more focused development on individual drivers and facilitates seamless integration of future enhancements, particularly the AMD uncore driver. Furthermore, this effort aims to streamline code maintenance by consolidating common functions for cpufreq and cppc across various core drivers, thus reducing code duplication. Sivaprasad Tummala (5): power: refactor core power management library power: refactor uncore power management library test/power: removed function pointer validations drivers/power: uncore support for AMD EPYC processors maintainers: update for drivers/power MAINTAINERS | 1 + app/test/test_power.c | 95 - app/test/test_power_cpufreq.c | 52 --- app/test/test_power_kvm_vm.c | 36 -- drivers/meson.build | 1 + .../power/acpi/acpi_cpufreq.c | 22 +- .../power/acpi/acpi_cpufreq.h | 6 +- drivers/power/acpi/meson.build| 10 + .../power/amd_pstate/amd_pstate_cpufreq.c | 24 +- .../power/amd_pstate/amd_pstate_cpufreq.h | 10 +- drivers/power/amd_pstate/meson.build | 10 + drivers/power/amd_uncore/amd_uncore.c | 329 drivers/power/amd_uncore/amd_uncore.h | 226 +++ drivers/power/amd_uncore/meson.build | 20 + .../power/cppc/cppc_cpufreq.c | 22 +- .../power/cppc/cppc_cpufreq.h | 8 +- drivers/power/cppc/meson.build| 10 + .../power/intel_uncore/intel_uncore.c | 18 +- .../power/intel_uncore/intel_uncore.h | 8 +- drivers/power/intel_uncore/meson.build| 6 + .../power/kvm_vm}/guest_channel.c | 0 .../power/kvm_vm}/guest_channel.h | 0 .../power/kvm_vm/kvm_vm.c | 22 +- .../power/kvm_vm/kvm_vm.h | 6 +- drivers/power/kvm_vm/meson.build | 14 + drivers/power/meson.build | 14 + drivers/power/pstate/meson.build | 10 + .../power/pstate/pstate_cpufreq.c | 22 +- .../power/pstate/pstate_cpufreq.h | 6 +- examples/l3fwd-power/main.c | 12 +- lib/power/meson.build | 9 +- lib/power/power_common.c | 2 +- lib/power/power_common.h | 18 +- lib/power/rte_power.c | 355 -- lib/power/rte_power.h | 116 +++--- lib/power/rte_power_cpufreq_api.h | 206 ++ lib/power/rte_power_uncore.c | 256 +++-- lib/power/rte_power_uncore.h | 61 ++- lib/power/rte_power_uncore_ops.h | 230 lib/power/version.map | 16 + 40 files changed, 1666 insertions(+), 623 deletions(-) rename lib/power/power_acpi_cpufreq.c => drivers/power/acpi/acpi_cpufreq.c (95%) rename lib/power/power_acpi_cpufreq.h => drivers/power/acpi/acpi_cpufreq.h (98%) create mode 100644 drivers/power/acpi/meson.build rename lib/power/power_amd_pstate_cpufreq.c => drivers/power/amd_pstate/amd_pstate_cpufreq.c (95%) rename lib/power/power_amd_pstate_cpufreq.h => drivers/power/amd_pstate/amd_pstate_cpufreq.h (96%) create mode 100644 drivers/power/amd_pstate/meson.build create mode 100644 drivers/power/amd_uncore/amd_uncore.c create mode 100644 drivers/power/amd_uncore/amd_uncore.h create mode 100644 drivers/power/amd_uncore/meson.build rename lib/power/power_cppc_cpufreq.c => drivers/power/cppc/cppc_cpufreq.c (95%) rename lib/power/power_cppc_cpufreq.h => drivers/power/cppc/cppc_cpufreq.h (97%) create mode 100644 drivers/power/cppc/meson.build rename lib/power/power_intel_uncore.c => drivers/power/intel_uncore/intel_uncore.c (95%) rename lib/power/power_intel_uncore.h => drivers/power/intel_uncore/intel_uncore.h (97%) create mode 100644 drivers/power/intel_uncore/meson.build rename {lib/power => drivers/power/kvm_vm}/guest_channel.c (100%) rename {lib/power => drivers/power/kvm_vm}/guest_channel.h (100%) rename lib/power/power_kvm_vm.c => drivers/power/kvm_vm/kvm_vm.c (82%) rename lib/power/power_kvm_vm.h => drivers/power/kvm_vm/kvm_vm.h (98%) create mode 100644 drivers/power/kvm_vm/meson.build create mode 100644 drivers/power/meson.build create mode 100644 drivers/power/pstate/meson.build rename lib/power/power_pstate_cpufreq.c => drivers/power/pstate/pstate_cpufreq.c (96%) rename lib/power/power_pstate_cpufreq.h => dri
[PATCH v7 3/5] test/power: removed function pointer validations
After refactoring the power library, power management operations are now consistently supported regardless of the operating environment, making function pointer checks unnecessary and thus removed from applications. v2: - removed function pointer validation in l3fwd-power app. Signed-off-by: Sivaprasad Tummala --- app/test/test_power.c | 95 --- app/test/test_power_cpufreq.c | 52 --- app/test/test_power_kvm_vm.c | 36 - examples/l3fwd-power/main.c | 12 ++--- 4 files changed, 4 insertions(+), 191 deletions(-) diff --git a/app/test/test_power.c b/app/test/test_power.c index 403adc22d6..5df5848c70 100644 --- a/app/test/test_power.c +++ b/app/test/test_power.c @@ -24,86 +24,6 @@ test_power(void) #include -static int -check_function_ptrs(void) -{ - enum power_management_env env = rte_power_get_env(); - - const bool not_null_expected = !(env == PM_ENV_NOT_SET); - - const char *inject_not_string1 = not_null_expected ? " not" : ""; - const char *inject_not_string2 = not_null_expected ? "" : " not"; - - if ((rte_power_freqs == NULL) == not_null_expected) { - printf("rte_power_freqs should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_get_freq == NULL) == not_null_expected) { - printf("rte_power_get_freq should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_set_freq == NULL) == not_null_expected) { - printf("rte_power_set_freq should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_up == NULL) == not_null_expected) { - printf("rte_power_freq_up should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_down == NULL) == not_null_expected) { - printf("rte_power_freq_down should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_max == NULL) == not_null_expected) { - printf("rte_power_freq_max should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_min == NULL) == not_null_expected) { - printf("rte_power_freq_min should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_turbo_status == NULL) == not_null_expected) { - printf("rte_power_turbo_status should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_enable_turbo == NULL) == not_null_expected) { - printf("rte_power_freq_enable_turbo should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_disable_turbo == NULL) == not_null_expected) { - printf("rte_power_freq_disable_turbo should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_get_capabilities == NULL) == not_null_expected) { - printf("rte_power_get_capabilities should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - - return 0; -} - static int test_power(void) { @@ -124,10 +44,6 @@ test_power(void) return -1; } - /* Verify that function pointers are NULL */ - if (check_function_ptrs() < 0) - goto fail_all; - rte_power_unset_env(); /* Perform tests for valid environments.*/ @@ -154,22 +70,11 @@ test_power(void)
RE: [PATCH v2] net/bonding: add user callback for bond xmit policy
> From: Vignesh PS > > Add support to bonding PMD to allow user callback function registration for > TX transmit policy. > > Signed-off-by: Vignesh PS > --- > .mailmap| 1 + > drivers/net/bonding/eth_bond_private.h | 6 ++ > drivers/net/bonding/rte_eth_bond.h | 17 + > drivers/net/bonding/rte_eth_bond_api.c | 15 +++ > drivers/net/bonding/rte_eth_bond_args.c | 2 ++ > drivers/net/bonding/rte_eth_bond_pmd.c | 2 +- > drivers/net/bonding/version.map | 1 + > 7 files changed, 39 insertions(+), 5 deletions(-) > > diff --git a/.mailmap b/.mailmap > index f51b1dda5d..16ebc28a5a 100644 > --- a/.mailmap > +++ b/.mailmap > @@ -1556,6 +1556,7 @@ Viacheslav Ovsiienko > Victor Kaplansky Victor > Raj Vidya Sagar Velumuri > +Vignesh PS > + > Vignesh Sridhar Vijayakumar Muthuvel > Manickam Vijaya Mohan Guvva > diff --git a/drivers/net/bonding/eth_bond_private.h > b/drivers/net/bonding/eth_bond_private.h > index 378bbba4e6..9d4483a972 100644 > --- a/drivers/net/bonding/eth_bond_private.h > +++ b/drivers/net/bonding/eth_bond_private.h > @@ -32,6 +32,7 @@ > #define PMD_BOND_XMIT_POLICY_LAYER2_KVARG("l2") > #define PMD_BOND_XMIT_POLICY_LAYER23_KVARG ("l23") > #define PMD_BOND_XMIT_POLICY_LAYER34_KVARG ("l34") > +#define PMD_BOND_XMIT_POLICY_USER_KVARG ("user") > > extern int bond_logtype; > #define RTE_LOGTYPE_BOND bond_logtype > @@ -101,9 +102,6 @@ struct rte_flow { > uint8_t rule_data[]; > }; > > -typedef void (*burst_xmit_hash_t)(struct rte_mbuf **buf, uint16_t nb_pkts, > - uint16_t member_count, uint16_t *members); > - > /** Link Bonding PMD device private configuration Structure */ struct > bond_dev_private { > uint16_t port_id; /**< Port Id of Bonding Port > */ > @@ -118,7 +116,7 @@ struct bond_dev_private { > /**< Flag for whether primary port is user defined or not */ > > uint8_t balance_xmit_policy; > - /**< Transmit policy - l2 / l23 / l34 for operation in balance mode */ > + /**< Transmit policy - l2 / l23 / l34 / user for operation in balance > +mode */ > burst_xmit_hash_t burst_xmit_hash; > /**< Transmit policy hash function */ > > diff --git a/drivers/net/bonding/rte_eth_bond.h > b/drivers/net/bonding/rte_eth_bond.h > index e59ff8793e..2244b39bb9 100644 > --- a/drivers/net/bonding/rte_eth_bond.h > +++ b/drivers/net/bonding/rte_eth_bond.h > @@ -91,6 +91,11 @@ extern "C" { > /**< Layer 2+3 (Ethernet MAC + IP Addresses) transmit load balancing */ > #define BALANCE_XMIT_POLICY_LAYER34 (2) > /**< Layer 3+4 (IP Addresses + UDP Ports) transmit load balancing */ > +#define BALANCE_XMIT_POLICY_USER (3) > +/**< User callback function to transmit load balancing */ > + > +typedef void (*burst_xmit_hash_t)(struct rte_mbuf **buf, uint16_t nb_pkts, > + uint16_t member_count, uint16_t *members); > > /** > * Create a bonding rte_eth_dev device > @@ -351,6 +356,18 @@ rte_eth_bond_link_up_prop_delay_set(uint16_t > bonding_port_id, int rte_eth_bond_link_up_prop_delay_get(uint16_t > bonding_port_id); > > +/** > + * Register transmit callback function for bonded device to use when it > +is operating in > + * balance mode. The callback is ignored in other modes of operation. > + * > + * @param cb_fn User defined callback function to determine the > xmit > members > + * > + * @return > + * 0 on success, negative value otherwise. > + */ > +__rte_experimental > +int > +rte_eth_bond_xmit_policy_cb_register(burst_xmit_hash_t cb_fn); > > #ifdef __cplusplus > } > diff --git a/drivers/net/bonding/rte_eth_bond_api.c > b/drivers/net/bonding/rte_eth_bond_api.c > index ffc1322047..351f2c99dc 100644 > --- a/drivers/net/bonding/rte_eth_bond_api.c > +++ b/drivers/net/bonding/rte_eth_bond_api.c > @@ -15,6 +15,8 @@ > #include "eth_bond_private.h" > #include "eth_bond_8023ad_private.h" > > +static burst_xmit_hash_t burst_xmit_user_hash; > + > int > check_for_bonding_ethdev(const struct rte_eth_dev *eth_dev) { @@ -972,6 > +974,13 @@ rte_eth_bond_mac_address_reset(uint16_t bonding_port_id) > return 0; > } > > +int > +rte_eth_bond_xmit_policy_cb_register(burst_xmit_hash_t cb_fn) { > + burst_xmit_user_hash = cb_fn; > + return 0; > +} If there are 3 bonding ports, and I want to assign 'user_define_xmit_1()' to ponding port 0, and to assign 'user_define_xmit_2()' to ponding port 2, seems will have problem? Maybe we can use an array for the function pointer and add a 'bonding_port_id' parameter to this register API? > + > int > rte_eth_bond_xmit_policy_set(uint16_t bonding_port_id, uint8_t policy) > { @@ -995,6 +1004,12 @@ rte_eth_bond_xmit_policy_set(uint16_t > bonding_port_id, uint8_t policy) > internals->balance_xmit_policy = policy; > internals->burst_xmit_hash = burst_xmit_l34_hash; > break; > + case BALANCE_XMIT_POLICY_USE
[PATCH 1/9] net/nfp: extract the function to allocate the PHY
From: Peng Zhang Extract the helper function to allocate the PHY representor port. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- .../net/nfp/flower/nfp_flower_representor.c | 86 --- 1 file changed, 53 insertions(+), 33 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index f6557525c0..af5f7fa4af 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -798,26 +798,71 @@ nfp_flower_repr_priv_init(struct nfp_app_fw_flower *app_fw_flower, } } +static int +nfp_flower_phy_repr_alloc(struct nfp_net_hw_priv *hw_priv, + struct nfp_flower_representor *flower_repr, + const char *pci_name) +{ + int i; + int ret; + uint8_t id; + struct nfp_pf_dev *pf_dev; + struct nfp_repr_init repr_init; + struct nfp_eth_table_port *eth_port; + struct nfp_app_fw_flower *app_fw_flower; + + pf_dev = hw_priv->pf_dev; + repr_init.hw_priv = hw_priv; + app_fw_flower = flower_repr->app_fw_flower; + for (i = 0; i < app_fw_flower->num_phyport_reprs; i++) { + id = nfp_function_id_get(pf_dev, i); + eth_port = &pf_dev->nfp_eth_table->ports[id]; + flower_repr->repr_type = NFP_REPR_TYPE_PHYS_PORT; + flower_repr->port_id = nfp_flower_get_phys_port_id(eth_port->index); + flower_repr->nfp_idx = eth_port->index; + flower_repr->vf_id = i + 1; + + /* Copy the real mac of the interface to the representor struct */ + rte_ether_addr_copy(ð_port->mac_addr, &flower_repr->mac_addr); + snprintf(flower_repr->name, sizeof(flower_repr->name), + "%s_repr_p%d", pci_name, id); + + /* +* Create a eth_dev for this representor. +* This will also allocate private memory for the device. +*/ + repr_init.flower_repr = flower_repr; + ret = rte_eth_dev_create(&pf_dev->pci_dev->device, flower_repr->name, + sizeof(struct nfp_flower_representor), + NULL, NULL, nfp_flower_repr_init, &repr_init); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Could not create eth_dev for repr."); + break; + } + } + + if (i < app_fw_flower->num_phyport_reprs) + return -EIO; + + return 0; +} + static int nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, struct nfp_net_hw_priv *hw_priv) { int i; int ret; - uint8_t id; const char *pci_name; struct nfp_pf_dev *pf_dev; struct rte_pci_device *pci_dev; struct nfp_repr_init repr_init; - struct nfp_eth_table *nfp_eth_table; - struct nfp_eth_table_port *eth_port; struct nfp_flower_representor flower_repr = { .switch_domain_id = app_fw_flower->switch_domain_id, .app_fw_flower= app_fw_flower, }; pf_dev = hw_priv->pf_dev; - nfp_eth_table = pf_dev->nfp_eth_table; repr_init.hw_priv = hw_priv; /* Send a NFP_FLOWER_CMSG_TYPE_MAC_REPR cmsg to hardware */ @@ -855,36 +900,11 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, } /* Create a rte_eth_dev for every phyport representor */ - for (i = 0; i < app_fw_flower->num_phyport_reprs; i++) { - id = nfp_function_id_get(pf_dev, i); - eth_port = &nfp_eth_table->ports[id]; - flower_repr.repr_type = NFP_REPR_TYPE_PHYS_PORT; - flower_repr.port_id = nfp_flower_get_phys_port_id(eth_port->index); - flower_repr.nfp_idx = eth_port->index; - flower_repr.vf_id = i + 1; - flower_repr.idx = id; - - /* Copy the real mac of the interface to the representor struct */ - rte_ether_addr_copy(ð_port->mac_addr, &flower_repr.mac_addr); - snprintf(flower_repr.name, sizeof(flower_repr.name), - "%s_repr_p%d", pci_name, id); - - /* -* Create a eth_dev for this representor. -* This will also allocate private memory for the device. -*/ - repr_init.flower_repr = &flower_repr; - ret = rte_eth_dev_create(&pci_dev->device, flower_repr.name, - sizeof(struct nfp_flower_representor), - NULL, NULL, nfp_flower_repr_init, &repr_init); - if (ret != 0) { - PMD_INIT_LOG(ERR, "Could not create eth_dev for repr."); - break; - } - } - - if (i < app_fw_f
[PATCH 0/9] support multiple PF flower firmware
This patch series add support of the multiple PF flower firmware. Peng Zhang (9): net/nfp: extract the function to allocate the PHY net/nfp: extract the function to initialize the PF net/nfp: extract the function to allocate PF net/nfp: extract the function to allocate the VF net/nfp: revise the number of PF representor port net/nfp: initialize the representor port of the multiple PF net/nfp: ignore useless message for multiple PF net/nfp: add the new operations for multiple PF net/nfp: update the Tx and Rx function for multiple PF drivers/net/nfp/flower/nfp_flower.c | 91 drivers/net/nfp/flower/nfp_flower.h | 7 + drivers/net/nfp/flower/nfp_flower_cmsg.h | 7 + drivers/net/nfp/flower/nfp_flower_ctrl.c | 10 +- .../net/nfp/flower/nfp_flower_representor.c | 413 +- drivers/net/nfp/nfp_ethdev.c | 6 + drivers/net/nfp/nfp_ethdev_vf.c | 6 + drivers/net/nfp/nfp_net_common.c | 50 ++- drivers/net/nfp/nfp_net_common.h | 4 + drivers/net/nfp/nfp_rxtx.c| 14 +- 10 files changed, 479 insertions(+), 129 deletions(-) -- 2.39.1
[PATCH 4/9] net/nfp: extract the function to allocate the VF
From: Peng Zhang Extract the helper function to allocate the VF representor ports. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- .../net/nfp/flower/nfp_flower_representor.c | 85 +++ 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 2045076b4b..d49f02fc75 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -873,6 +873,49 @@ nfp_flower_phy_repr_alloc(struct nfp_net_hw_priv *hw_priv, return 0; } +static int +nfp_flower_vf_repr_alloc(struct nfp_net_hw_priv *hw_priv, + struct nfp_flower_representor *flower_repr, + const char *pci_name) +{ + int i; + int ret; + struct nfp_pf_dev *pf_dev; + struct nfp_repr_init repr_init; + struct nfp_app_fw_flower *app_fw_flower; + + pf_dev = hw_priv->pf_dev; + repr_init.hw_priv = hw_priv; + app_fw_flower = flower_repr->app_fw_flower; + for (i = 0; i < app_fw_flower->num_vf_reprs; i++) { + flower_repr->repr_type = NFP_REPR_TYPE_VF; + flower_repr->port_id = nfp_get_pcie_port_id(pf_dev->cpp, + NFP_FLOWER_CMSG_PORT_VNIC_TYPE_VF, i + pf_dev->vf_base_id, 0); + flower_repr->nfp_idx = 0; + flower_repr->vf_id = i; + + /* VF reprs get a random MAC address */ + rte_eth_random_addr(flower_repr->mac_addr.addr_bytes); + snprintf(flower_repr->name, sizeof(flower_repr->name), + "%s_repr_vf%d", pci_name, i); + + repr_init.flower_repr = flower_repr; + /* This will also allocate private memory for the device */ + ret = rte_eth_dev_create(&pf_dev->pci_dev->device, flower_repr->name, + sizeof(struct nfp_flower_representor), + NULL, NULL, nfp_flower_repr_init, &repr_init); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Could not create eth_dev for repr."); + break; + } + } + + if (i < app_fw_flower->num_vf_reprs) + return -EIO; + + return 0; +} + static int nfp_flower_pf_repr_alloc(struct nfp_net_hw_priv *hw_priv, struct nfp_flower_representor *flower_repr, @@ -912,30 +955,21 @@ static int nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, struct nfp_net_hw_priv *hw_priv) { - int i; int ret; const char *pci_name; - struct nfp_pf_dev *pf_dev; - struct rte_pci_device *pci_dev; - struct nfp_repr_init repr_init; struct nfp_flower_representor flower_repr = { .switch_domain_id = app_fw_flower->switch_domain_id, .app_fw_flower= app_fw_flower, }; - pf_dev = hw_priv->pf_dev; - repr_init.hw_priv = hw_priv; - /* Send a NFP_FLOWER_CMSG_TYPE_MAC_REPR cmsg to hardware */ - ret = nfp_flower_cmsg_mac_repr(app_fw_flower, pf_dev); + ret = nfp_flower_cmsg_mac_repr(app_fw_flower, hw_priv->pf_dev); if (ret != 0) { PMD_INIT_LOG(ERR, "Could not send mac repr cmsgs."); return ret; } - pci_dev = pf_dev->pci_dev; - - pci_name = strchr(pci_dev->name, ':') + 1; + pci_name = strchr(hw_priv->pf_dev->pci_dev->name, ':') + 1; ret = nfp_flower_pf_repr_alloc(hw_priv, &flower_repr, pci_name); if (ret != 0) { @@ -954,32 +988,11 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, * Now allocate eth_dev's for VF representors. * Also send reify messages. */ - for (i = 0; i < app_fw_flower->num_vf_reprs; i++) { - flower_repr.repr_type = NFP_REPR_TYPE_VF; - flower_repr.port_id = nfp_get_pcie_port_id(pf_dev->cpp, - NFP_FLOWER_CMSG_PORT_VNIC_TYPE_VF, i + pf_dev->vf_base_id, 0); - flower_repr.nfp_idx = 0; - flower_repr.vf_id = i; - flower_repr.idx = 0; - - /* VF reprs get a random MAC address */ - rte_eth_random_addr(flower_repr.mac_addr.addr_bytes); - snprintf(flower_repr.name, sizeof(flower_repr.name), - "%s_repr_vf%d", pci_name, i); - - repr_init.flower_repr = &flower_repr; - /* This will also allocate private memory for the device */ - ret = rte_eth_dev_create(&pci_dev->device, flower_repr.name, - sizeof(struct nfp_flower_representor), - NULL, NULL, nfp_flower_repr_init, &repr_init); - if (ret != 0) { - PMD_INIT_LOG(ERR, "Could not create eth_dev for re
[PATCH 2/9] net/nfp: extract the function to initialize the PF
From: Peng Zhang Extract the helper function to initialize the basic information of the PF representor port. The logic of check VF is updated because of changing the order of some logics in the initialization function. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- .../net/nfp/flower/nfp_flower_representor.c | 114 +++--- drivers/net/nfp/nfp_net_common.c | 2 +- 2 files changed, 71 insertions(+), 45 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index af5f7fa4af..f76e780840 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -389,6 +389,12 @@ nfp_flower_repr_close_queue(struct rte_eth_dev *eth_dev, } } +static void +nfp_flower_repr_base_uninit(struct nfp_flower_representor *repr) +{ + rte_free(repr->repr_xstats_base); +} + static int nfp_flower_repr_uninit(struct rte_eth_dev *eth_dev) { @@ -396,7 +402,7 @@ nfp_flower_repr_uninit(struct rte_eth_dev *eth_dev) struct nfp_flower_representor *repr; repr = eth_dev->data->dev_private; - rte_free(repr->repr_xstats_base); + nfp_flower_repr_base_uninit(repr); rte_free(repr->ring); if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) { @@ -616,6 +622,63 @@ nfp_flower_pf_repr_init(struct rte_eth_dev *eth_dev, return 0; } +static int +nfp_flower_repr_base_init(struct rte_eth_dev *eth_dev, + struct nfp_flower_representor *repr, + struct nfp_repr_init *repr_init) +{ + int ret; + struct nfp_flower_representor *init_repr_data; + + /* Cast the input representor data to the correct struct here */ + init_repr_data = repr_init->flower_repr; + + /* Copy data here from the input representor template */ + repr->vf_id= init_repr_data->vf_id; + repr->switch_domain_id = init_repr_data->switch_domain_id; + repr->port_id = init_repr_data->port_id; + repr->nfp_idx = init_repr_data->nfp_idx; + repr->repr_type= init_repr_data->repr_type; + repr->app_fw_flower= init_repr_data->app_fw_flower; + + snprintf(repr->name, sizeof(repr->name), "%s", init_repr_data->name); + + /* This backer port is that of the eth_device created for the PF vNIC */ + eth_dev->data->backer_port_id = 0; + + /* Allocating memory for mac addr */ + eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", RTE_ETHER_ADDR_LEN, 0); + if (eth_dev->data->mac_addrs == NULL) { + PMD_INIT_LOG(ERR, "Failed to allocate memory for repr MAC."); + return -ENOMEM; + } + + rte_ether_addr_copy(&init_repr_data->mac_addr, &repr->mac_addr); + rte_ether_addr_copy(&init_repr_data->mac_addr, eth_dev->data->mac_addrs); + + /* Send reify message to hardware to inform it about the new repr */ + ret = nfp_flower_cmsg_repr_reify(init_repr_data->app_fw_flower, repr); + if (ret != 0) { + PMD_INIT_LOG(WARNING, "Failed to send repr reify message."); + goto mac_cleanup; + } + + /* Allocate memory for extended statistics counters */ + repr->repr_xstats_base = rte_zmalloc("rte_eth_xstat", + sizeof(struct rte_eth_xstat) * nfp_net_xstats_size(eth_dev), 0); + if (repr->repr_xstats_base == NULL) { + PMD_INIT_LOG(ERR, "No memory for xstats base on device %s!", repr->name); + ret = -ENOMEM; + goto mac_cleanup; + } + + return 0; + +mac_cleanup: + rte_free(eth_dev->data->mac_addrs); + return ret; +} + static int nfp_flower_repr_init(struct rte_eth_dev *eth_dev, void *init_params) @@ -654,50 +717,24 @@ nfp_flower_repr_init(struct rte_eth_dev *eth_dev, return -ENOMEM; } - /* Copy data here from the input representor template */ - repr->idx = init_repr_data->idx; - repr->vf_id= init_repr_data->vf_id; - repr->switch_domain_id = init_repr_data->switch_domain_id; - repr->port_id = init_repr_data->port_id; - repr->nfp_idx = init_repr_data->nfp_idx; - repr->repr_type= init_repr_data->repr_type; - repr->app_fw_flower= init_repr_data->app_fw_flower; - - strlcpy(repr->name, init_repr_data->name, sizeof(repr->name)); - eth_dev->dev_ops = &nfp_flower_repr_dev_ops; eth_dev->rx_pkt_burst = nfp_flower_repr_rx_burst; eth_dev->tx_pkt_burst = nfp_flower_repr_tx_burst; eth_dev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR | RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; + ret = nfp_flower_repr_base_init(eth_dev, repr, repr_init); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Flower repr base init failed."); +
[PATCH 7/9] net/nfp: ignore useless message for multiple PF
From: Peng Zhang When using the multiple PF firmware, there is no PF representor port, so we also need not care about the corresponding control messages anymore. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- drivers/net/nfp/flower/nfp_flower_ctrl.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c index 3bf8b1f399..92887ce1be 100644 --- a/drivers/net/nfp/flower/nfp_flower_ctrl.c +++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c @@ -436,10 +436,14 @@ nfp_flower_cmsg_port_mod_rx(struct nfp_net_hw_priv *hw_priv, break; case NFP_FLOWER_CMSG_PORT_TYPE_PCIE_PORT: index = NFP_FLOWER_CMSG_PORT_VNIC_OFFSET(port, hw_priv->pf_dev->vf_base_id); - if (NFP_FLOWER_CMSG_PORT_VNIC_TYPE(port) == NFP_FLOWER_CMSG_PORT_VNIC_TYPE_VF) - repr = app_fw_flower->vf_reprs[index]; - else + if (NFP_FLOWER_CMSG_PORT_VNIC_TYPE(port) == NFP_FLOWER_CMSG_PORT_VNIC_TYPE_VF) { + repr = app_fw_flower->vf_reprs[index]; + } else { + if (hw_priv->pf_dev->multi_pf.enabled) + return 0; + repr = app_fw_flower->pf_repr; + } break; default: PMD_DRV_LOG(ERR, "Ctrl msg for unknown port %#x.", port); -- 2.39.1
[PATCH 3/9] net/nfp: extract the function to allocate PF
From: Peng Zhang Extract the helper function to allocate the PF representor port. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- .../net/nfp/flower/nfp_flower_representor.c | 58 --- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index f76e780840..2045076b4b 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -873,6 +873,41 @@ nfp_flower_phy_repr_alloc(struct nfp_net_hw_priv *hw_priv, return 0; } +static int +nfp_flower_pf_repr_alloc(struct nfp_net_hw_priv *hw_priv, + struct nfp_flower_representor *flower_repr, + const char *pci_name) +{ + int ret; + struct nfp_pf_dev *pf_dev; + + pf_dev = hw_priv->pf_dev; + + /* Create a rte_eth_dev for PF vNIC representor */ + flower_repr->repr_type = NFP_REPR_TYPE_PF; + + /* PF vNIC reprs get a random MAC address */ + rte_eth_random_addr(flower_repr->mac_addr.addr_bytes); + + if (pf_dev->multi_pf.enabled) + snprintf(flower_repr->name, sizeof(flower_repr->name), + "%s_repr_pf%d", pci_name, pf_dev->multi_pf.function_id); + else + snprintf(flower_repr->name, sizeof(flower_repr->name), + "%s_repr_pf", pci_name); + + /* Create a eth_dev for this representor */ + ret = rte_eth_dev_create(&pf_dev->pci_dev->device, flower_repr->name, + sizeof(struct nfp_flower_representor), + NULL, NULL, nfp_flower_pf_repr_init, flower_repr); + if (ret != 0) { + PMD_INIT_LOG(ERR, "Failed to init the pf repr."); + return -EINVAL; + } + + return 0; +} + static int nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, struct nfp_net_hw_priv *hw_priv) @@ -898,31 +933,14 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower, return ret; } - /* Create a rte_eth_dev for PF vNIC representor */ - flower_repr.repr_type = NFP_REPR_TYPE_PF; - flower_repr.idx = 0; - - /* PF vNIC reprs get a random MAC address */ - rte_eth_random_addr(flower_repr.mac_addr.addr_bytes); - pci_dev = pf_dev->pci_dev; pci_name = strchr(pci_dev->name, ':') + 1; - if (pf_dev->multi_pf.enabled) - snprintf(flower_repr.name, sizeof(flower_repr.name), - "%s_repr_pf%d", pci_name, pf_dev->multi_pf.function_id); - else - snprintf(flower_repr.name, sizeof(flower_repr.name), - "%s_repr_pf", pci_name); - - /* Create a eth_dev for this representor */ - ret = rte_eth_dev_create(&pci_dev->device, flower_repr.name, - sizeof(struct nfp_flower_representor), - NULL, NULL, nfp_flower_pf_repr_init, &flower_repr); + ret = nfp_flower_pf_repr_alloc(hw_priv, &flower_repr, pci_name); if (ret != 0) { - PMD_INIT_LOG(ERR, "Failed to init the pf repr."); - return -EINVAL; + PMD_INIT_LOG(ERR, "Could not alloc pf repr."); + return ret; } /* Create a rte_eth_dev for every phyport representor */ -- 2.39.1
[PATCH 5/9] net/nfp: revise the number of PF representor port
From: Peng Zhang When using the multiple PF firmware, there is no need to create the PF representor port anymore. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- drivers/net/nfp/flower/nfp_flower_representor.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index d49f02fc75..f769123174 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -1009,6 +1009,7 @@ nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower, struct nfp_net_hw_priv *hw_priv) { int ret; + uint8_t num_pf_reprs; struct nfp_pf_dev *pf_dev; struct rte_pci_device *pci_dev; struct rte_eth_devargs eth_da = { @@ -1037,8 +1038,13 @@ nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower, return 0; } - /* There always exist phy repr */ - if (eth_da.nb_representor_ports < pf_dev->total_phyports + 1) { + /* Calculate the number of pf repr */ + if (pf_dev->multi_pf.enabled) + num_pf_reprs = 0; + else + num_pf_reprs = 1; + + if (eth_da.nb_representor_ports < pf_dev->total_phyports + num_pf_reprs) { PMD_INIT_LOG(ERR, "Should also create repr port for phy port and PF vNIC."); return -ERANGE; } @@ -1052,7 +1058,7 @@ nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower, /* Fill in flower app with repr counts */ app_fw_flower->num_phyport_reprs = pf_dev->total_phyports; app_fw_flower->num_vf_reprs = eth_da.nb_representor_ports - - pf_dev->total_phyports - 1; + pf_dev->total_phyports - num_pf_reprs; if (pf_dev->max_vfs != 0 && pf_dev->sriov_vf < app_fw_flower->num_vf_reprs) { PMD_INIT_LOG(ERR, "The VF repr nums %d is bigger than VF nums %d.", app_fw_flower->num_vf_reprs, pf_dev->sriov_vf); -- 2.39.1
[PATCH 6/9] net/nfp: initialize the representor port of the multiple PF
From: Peng Zhang When using multiple PF firmware, add the process of initialize the representor port and revise the corresponding logic in the close function. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- .../net/nfp/flower/nfp_flower_representor.c | 80 --- 1 file changed, 69 insertions(+), 11 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index f769123174..c096862a0f 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -373,9 +373,15 @@ static void nfp_flower_repr_close_queue(struct rte_eth_dev *eth_dev, enum nfp_repr_type repr_type) { + struct nfp_net_hw_priv *hw_priv; + switch (repr_type) { case NFP_REPR_TYPE_PHYS_PORT: - nfp_flower_repr_free_queue(eth_dev); + hw_priv = eth_dev->process_private; + if (hw_priv->pf_dev->multi_pf.enabled) + nfp_flower_pf_repr_close_queue(eth_dev); + else + nfp_flower_repr_free_queue(eth_dev); break; case NFP_REPR_TYPE_PF: nfp_flower_pf_repr_close_queue(eth_dev); @@ -757,6 +763,51 @@ nfp_flower_repr_init(struct rte_eth_dev *eth_dev, return ret; } +static int +nfp_flower_multiple_pf_repr_init(struct rte_eth_dev *eth_dev, + void *init_params) +{ + int ret; + uint16_t index; + struct nfp_repr_init *repr_init; + struct nfp_net_hw_priv *hw_priv; + struct nfp_flower_representor *repr; + struct nfp_app_fw_flower *app_fw_flower; + + /* Cast the input representor data to the correct struct here */ + repr_init = init_params; + app_fw_flower = repr_init->flower_repr->app_fw_flower; + + /* Memory has been allocated in the eth_dev_create() function */ + repr = eth_dev->data->dev_private; + hw_priv = repr_init->hw_priv; + + eth_dev->dev_ops = &nfp_flower_pf_repr_dev_ops; + eth_dev->rx_pkt_burst = nfp_net_recv_pkts; + eth_dev->tx_pkt_burst = nfp_flower_pf_xmit_pkts; + eth_dev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR | + RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; + + ret = nfp_flower_repr_base_init(eth_dev, repr, repr_init); + if (ret < 0) { + PMD_DRV_LOG(ERR, "Flower multiple PF repr base init failed."); + return -ENOMEM; + } + + eth_dev->data->representor_id = repr->vf_id; + + /* Add repr to correct array */ + index = NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM(repr->port_id); + app_fw_flower->phy_reprs[index] = repr; + + repr->mac_stats = hw_priv->pf_dev->mac_stats_bar + + (repr->nfp_idx * NFP_MAC_STATS_SIZE); + + app_fw_flower->pf_ethdev = eth_dev; + + return 0; +} + static void nfp_flower_repr_free_all(struct nfp_app_fw_flower *app_fw_flower) { @@ -833,6 +884,7 @@ nfp_flower_phy_repr_alloc(struct nfp_net_hw_priv *hw_priv, int ret; uint8_t id; struct nfp_pf_dev *pf_dev; + ethdev_init_t ethdev_init; struct nfp_repr_init repr_init; struct nfp_eth_table_port *eth_port; struct nfp_app_fw_flower *app_fw_flower; @@ -846,21 +898,29 @@ nfp_flower_phy_repr_alloc(struct nfp_net_hw_priv *hw_priv, flower_repr->repr_type = NFP_REPR_TYPE_PHYS_PORT; flower_repr->port_id = nfp_flower_get_phys_port_id(eth_port->index); flower_repr->nfp_idx = eth_port->index; - flower_repr->vf_id = i + 1; /* Copy the real mac of the interface to the representor struct */ rte_ether_addr_copy(ð_port->mac_addr, &flower_repr->mac_addr); - snprintf(flower_repr->name, sizeof(flower_repr->name), - "%s_repr_p%d", pci_name, id); /* * Create a eth_dev for this representor. * This will also allocate private memory for the device. */ repr_init.flower_repr = flower_repr; + if (pf_dev->multi_pf.enabled) { + repr_init.flower_repr->vf_id = i; + snprintf(flower_repr->name, sizeof(flower_repr->name), + "%s_repr_p", pci_name); + ethdev_init = nfp_flower_multiple_pf_repr_init; + } else { + repr_init.flower_repr->vf_id = i + 1; + snprintf(flower_repr->name, sizeof(flower_repr->name), + "%s_repr_p%d", pci_name, id); + ethdev_init = nfp_flower_repr_init; + } ret = rte_eth_dev_create(&pf_dev->pci_dev->device, flower_repr->name, sizeof(struct nfp_flower_representor
[PATCH 9/9] net/nfp: update the Tx and Rx function for multiple PF
From: Peng Zhang Update the Tx function and Rx function for multiple PF and simplify the Rx function to enhance the performance. In the RX function, the packets are processed according the firmware type. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- drivers/net/nfp/flower/nfp_flower.c | 70 +++ drivers/net/nfp/flower/nfp_flower.h | 6 ++ drivers/net/nfp/flower/nfp_flower_cmsg.h | 7 ++ .../net/nfp/flower/nfp_flower_representor.c | 4 +- drivers/net/nfp/nfp_ethdev.c | 6 ++ drivers/net/nfp/nfp_ethdev_vf.c | 6 ++ drivers/net/nfp/nfp_net_common.c | 48 + drivers/net/nfp/nfp_net_common.h | 4 ++ drivers/net/nfp/nfp_rxtx.c| 14 ++-- 9 files changed, 158 insertions(+), 7 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index df7a150a99..f087d0dfdc 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -215,6 +215,76 @@ nfp_flower_pf_xmit_pkts(void *tx_queue, return app_fw_flower->nfd_func.pf_xmit_t(tx_queue, tx_pkts, nb_pkts); } +uint16_t +nfp_flower_multiple_pf_recv_pkts(void *rx_queue, + struct rte_mbuf **rx_pkts, + uint16_t nb_pkts) +{ + int i; + uint16_t recv; + uint32_t data_len; + struct nfp_net_rxq *rxq; + struct rte_eth_dev *repr_dev; + struct nfp_flower_representor *repr; + + recv = nfp_net_recv_pkts(rx_queue, rx_pkts, nb_pkts); + if (recv != 0) { + /* Grab a handle to the representor struct */ + rxq = rx_queue; + repr_dev = &rte_eth_devices[rxq->port_id]; + repr = repr_dev->data->dev_private; + + data_len = 0; + for (i = 0; i < recv; i++) + data_len += rx_pkts[i]->data_len; + + repr->repr_stats.ipackets += recv; + repr->repr_stats.q_ipackets[rxq->qidx] += recv; + repr->repr_stats.q_ibytes[rxq->qidx] += data_len; + } + + return recv; +} + +uint16_t +nfp_flower_multiple_pf_xmit_pkts(void *tx_queue, + struct rte_mbuf **tx_pkts, + uint16_t nb_pkts) +{ + int i; + uint16_t sent; + uint32_t data_len; + struct nfp_net_txq *txq; + struct rte_eth_dev *repr_dev; + struct nfp_flower_representor *repr; + + txq = tx_queue; + if (unlikely(txq == NULL)) { + PMD_TX_LOG(ERR, "TX Bad queue."); + return 0; + } + + /* Grab a handle to the representor struct */ + repr_dev = &rte_eth_devices[txq->port_id]; + repr = repr_dev->data->dev_private; + for (i = 0; i < nb_pkts; i++) + nfp_flower_pkt_add_metadata(repr->app_fw_flower, + tx_pkts[i], repr->port_id); + + sent = nfp_flower_pf_xmit_pkts(tx_queue, tx_pkts, nb_pkts); + if (sent != 0) { + data_len = 0; + for (i = 0; i < sent; i++) + data_len += tx_pkts[i]->data_len; + + repr->repr_stats.opackets += sent; + repr->repr_stats.q_opackets[txq->qidx] += sent; + repr->repr_stats.q_obytes[txq->qidx] += data_len; + } + + return sent; +} + static int nfp_flower_init_vnic_common(struct nfp_net_hw_priv *hw_priv, struct nfp_net_hw *hw, diff --git a/drivers/net/nfp/flower/nfp_flower.h b/drivers/net/nfp/flower/nfp_flower.h index a257366656..7b919a939b 100644 --- a/drivers/net/nfp/flower/nfp_flower.h +++ b/drivers/net/nfp/flower/nfp_flower.h @@ -115,6 +115,12 @@ bool nfp_flower_pf_dispatch_pkts(struct nfp_net_rxq *rxq, uint32_t port_id); uint16_t nfp_flower_pf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); +uint16_t nfp_flower_multiple_pf_xmit_pkts(void *tx_queue, + struct rte_mbuf **tx_pkts, + uint16_t nb_pkts); +uint16_t nfp_flower_multiple_pf_recv_pkts(void *rx_queue, + struct rte_mbuf **tx_pkts, + uint16_t nb_pkts); int nfp_flower_pf_start(struct rte_eth_dev *dev); int nfp_flower_pf_stop(struct rte_eth_dev *dev); uint32_t nfp_flower_pkt_add_metadata(struct nfp_app_fw_flower *app_fw_flower, diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index eda047a404..a7866e8382 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -1045,4 +1045,11 @@ int nfp_flower_cmsg_qos_delete(struct nfp_app_fw_flower *app_fw_flower, int nfp_flower_cmsg_qos_stats(struct nfp_app_fw_flower *app_fw_flower, struct nfp_cfg_head *head); +static inline bool +nfp_flower_port_is_phy_port(uint32_t port_id) +{ + return (NFP_FLOWER_CMSG_PORT_TYPE(port_id) == +
[PATCH 8/9] net/nfp: add the new operations for multiple PF
From: Peng Zhang When using the multiple PF firmware, add the new operations and update the port start and stop function. Signed-off-by: Peng Zhang Reviewed-by: Chaoyong He Reviewed-by: Long Wu --- drivers/net/nfp/flower/nfp_flower.c | 21 drivers/net/nfp/flower/nfp_flower.h | 1 + .../net/nfp/flower/nfp_flower_representor.c | 34 ++- 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index fd0a454432..df7a150a99 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -23,6 +23,20 @@ #define CTRL_VNIC_NB_DESC 512 +int +nfp_flower_pf_stop(struct rte_eth_dev *dev) +{ + struct nfp_net_hw_priv *hw_priv; + struct nfp_flower_representor *repr; + + repr = dev->data->dev_private; + hw_priv = dev->process_private; + nfp_flower_cmsg_port_mod(repr->app_fw_flower, repr->port_id, false); + (void)nfp_eth_set_configured(hw_priv->pf_dev->cpp, repr->nfp_idx, 0); + + return nfp_net_stop(dev); +} + int nfp_flower_pf_start(struct rte_eth_dev *dev) { @@ -34,6 +48,7 @@ nfp_flower_pf_start(struct rte_eth_dev *dev) struct nfp_net_hw *net_hw; struct rte_eth_conf *dev_conf; struct rte_eth_rxmode *rxmode; + struct nfp_net_hw_priv *hw_priv; struct nfp_flower_representor *repr; repr = dev->data->dev_private; @@ -84,6 +99,12 @@ nfp_flower_pf_start(struct rte_eth_dev *dev) return -EIO; } + hw_priv = dev->process_private; + if (hw_priv->pf_dev->multi_pf.enabled) { + (void)nfp_eth_set_configured(hw_priv->pf_dev->cpp, repr->nfp_idx, 1); + nfp_flower_cmsg_port_mod(repr->app_fw_flower, repr->port_id, true); + } + for (i = 0; i < dev->data->nb_rx_queues; i++) dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED; for (i = 0; i < dev->data->nb_tx_queues; i++) diff --git a/drivers/net/nfp/flower/nfp_flower.h b/drivers/net/nfp/flower/nfp_flower.h index 1dc868fb68..a257366656 100644 --- a/drivers/net/nfp/flower/nfp_flower.h +++ b/drivers/net/nfp/flower/nfp_flower.h @@ -116,6 +116,7 @@ bool nfp_flower_pf_dispatch_pkts(struct nfp_net_rxq *rxq, uint16_t nfp_flower_pf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); int nfp_flower_pf_start(struct rte_eth_dev *dev); +int nfp_flower_pf_stop(struct rte_eth_dev *dev); uint32_t nfp_flower_pkt_add_metadata(struct nfp_app_fw_flower *app_fw_flower, struct rte_mbuf *mbuf, uint32_t port_id); diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index c096862a0f..6e957b125f 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -523,6 +523,38 @@ static const struct eth_dev_ops nfp_flower_pf_repr_dev_ops = { .fw_version_get = nfp_net_firmware_version_get, }; +static const struct eth_dev_ops nfp_flower_multiple_pf_repr_dev_ops = { + .dev_infos_get= nfp_flower_repr_dev_infos_get, + + .dev_start= nfp_flower_pf_start, + .dev_configure= nfp_net_configure, + .dev_stop = nfp_flower_pf_stop, + .dev_close= nfp_flower_repr_dev_close, + + .rx_queue_setup = nfp_net_rx_queue_setup, + .tx_queue_setup = nfp_net_tx_queue_setup, + + .link_update = nfp_flower_repr_link_update, + + .stats_get= nfp_flower_repr_stats_get, + .stats_reset = nfp_flower_repr_stats_reset, + + .promiscuous_enable = nfp_net_promisc_enable, + .promiscuous_disable = nfp_net_promisc_disable, + + .mac_addr_set = nfp_flower_repr_mac_addr_set, + .fw_version_get = nfp_net_firmware_version_get, + + .flow_ops_get = nfp_flow_ops_get, + .mtr_ops_get = nfp_net_mtr_ops_get, + + .xstats_get = nfp_net_xstats_get, + .xstats_reset = nfp_net_xstats_reset, + .xstats_get_names = nfp_net_xstats_get_names, + .xstats_get_by_id = nfp_net_xstats_get_by_id, + .xstats_get_names_by_id = nfp_net_xstats_get_names_by_id, +}; + static const struct eth_dev_ops nfp_flower_repr_dev_ops = { .dev_infos_get= nfp_flower_repr_dev_infos_get, @@ -782,7 +814,7 @@ nfp_flower_multiple_pf_repr_init(struct rte_eth_dev *eth_dev, repr = eth_dev->data->dev_private; hw_priv = repr_init->hw_priv; - eth_dev->dev_ops = &nfp_flower_pf_repr_dev_ops; + eth_dev->dev_ops = &nfp_flower_multiple_pf_repr_dev_ops; eth_dev->rx_pkt_burst = nfp_net_recv_pkts; eth_dev->tx_pkt_burst = nfp_flower_pf_xmit_pkts; eth_dev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR | -- 2.39.1
[PATCH] net/hns3: fix variable type
The patch fixes variable type in case of data trunction. Fixes: dd4b8bba785f ("net/hns3: support reporting names of registers") Cc: sta...@dpdk.org Signed-off-by: Jie Hai --- drivers/net/hns3/hns3_regs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c index e8bc7fbc66e1..be6929738942 100644 --- a/drivers/net/hns3/hns3_regs.c +++ b/drivers/net/hns3/hns3_regs.c @@ -1178,9 +1178,9 @@ hns3_direct_access_tqp_regs_help(struct hns3_hw *hw, struct rte_dev_reg_info *re uint32_t modules, enum hns3_reg_modules idx) { const struct hns3_dirt_reg_entry *reg_list; - uint16_t tqp_num, reg_offset; + uint32_t reg_num, i, j, reg_offset; uint32_t *data = regs->data; - uint32_t reg_num, i, j; + uint16_t tqp_num; if ((modules & HNS3_MODULE_MASK(idx)) == 0) return; -- 2.22.0
RE: DPDK - PCIe Steering Tags Meeting on 10/23/24
Here is the updated RFC https://inbox.dpdk.org/dev/20241021015246.304431-1-wathsala.vithan...@arm.com/#t Thanks --wathsal > > Subject: DPDK - PCIe Steering Tags Meeting on 10/23/24 > > Hi all, > > This is an invitation to discuss adding PCIe steering tags support to DPDK. > We have had brief conversations over the idea at the DPDK summit. > Steering tags allows stashing of descriptors and packet data closer to the > CPUs, possibly allowing for lower latency and higher throughput. > This feature requires contributions from CPU vendors and NIC vendors. > The goal of the meeting is to present the next version of the API and seek > support for implementation from other participants in the community. > > I will be sending out the RFC some time this week, so there will be a plenty > of > time before the meeting to go over it. > > Agenda: > - Brief introduction to the feature > - Introduce the APIs from RFC v2 (this will be submitted to the community > before the call) > - Dependencies on kernel support - API for reading steering tags > - Addressing ABI in advance as patches will not be ready by 24.11 > > Please join the call if you are interested in the topic. > LXF meeting registration ink: https://zoom- > lfx.platform.linuxfoundation.org/meeting/94917063595?password=77f3662 > 5-ad41-4b9c-b067-d33e68c3a29e&invite=true > > Thanks. > > --wathsala
RE: [PATCH v2] examples/l3fwd: support setting the data size of mbuf
> On Fri, 18 Oct 2024 05:50:20 + > Chaoyong He wrote: > > > > On Fri, 18 Oct 2024 03:21:28 + > > > Chaoyong He wrote: > > > > > > > > RTE_PKTMBUF_HEADROOM); } > > > > > > + > > > > > > > > > > Not sure why this is needed? What is the problem with the original > code? > > > > > Are you trying to force packets to be segmented? > > > > > > > > Actually, we are trying to force packets *not* segmented by making > > > > the > > > mbuf size large enough to hold the packets. > > > > > > > > In our user case, we start l3fwd app with parameter '--max-pkt-len > > > > 4000', > > > and obviously the original logic with RTE_MBUF_DEFAULT_DATAROOM > mbuf > > > size will cause the packets to be segmented. > > > > Which is not what we want, so we add this new '--mbuf-size=4096' > > > parameter, the mbuf size will large enough to hold even the largest > > > packet. > > > > > > > > Do you think this make sense? > > > > > > Maybe query the driver, and use the max_rx_pkt_len as input to > > > deciding the right mbuf size. > > > > Sorry, I am not quite understanding here. > > I can't find 'max_rx_pkt_len' in l3fwd app, instead it's exist testpmd app. > > Could you please explain a little more about the advice? > > In rte_eth_dev_info, I meant the field max_rx_bufsize and there is also > max_rx_pktlen. > > > > > > If max-pkt-len was 4000 and driver can only take 2K buffers, then > > > use 2K mbuf size. > > > If max-pkt-len was 1500 then use mtu + headroom and round up Oh, I understand what you mean now, thanks for the clarification. But the solution you suppose is not flexible enough, thus can't satisfy our needs. Follow your example and consider this situation: If max-pkt-len was 4000 and driver can only take 2K buffers, then use 2K mbuf size. But we want to measure the performance when the mbuf size is 1024 and 512. Then there is no way to do this in your solution, I suppose? But with our '--mbuf-size' parameter, we can easily do that. Thanks for your hint, we realized our solution also has a little problem, which not consider the 'max_rx_bufsize' of rte_eth_dev_info, and we will fix that in the next version patch.
Re: [PATCH] net/sxe: add build and doc infrastructure
On Sat, 19 Oct 2024 19:42:03 -0700 Jie Liu wrote: > Adding a minimum maintainable directory structure for the > network driver and request maintenance of the sxe driver. > > Signed-off-by: Jie Liu Even the minimum version patch has to compile cleanly, this one doesn't. Please fix and resubmit as V2.
Re: [PATCH v6 2/5] power: refactor uncore power management library
On Sun, 20 Oct 2024 09:22:29 + Sivaprasad Tummala wrote: > diff --git a/lib/power/rte_power_uncore.c b/lib/power/rte_power_uncore.c > index 48c75a5da0..f11238cc34 100644 > --- a/lib/power/rte_power_uncore.c > +++ b/lib/power/rte_power_uncore.c > @@ -10,100 +10,53 @@ > > #include "power_common.h" > #include "rte_power_uncore.h" > -#include "power_intel_uncore.h" > > -enum rte_uncore_power_mgmt_env default_uncore_env = > RTE_UNCORE_PM_ENV_NOT_SET; > +static enum rte_uncore_power_mgmt_env global_uncore_env = > RTE_UNCORE_PM_ENV_NOT_SET; > +static struct rte_power_uncore_ops *global_uncore_ops; > > static rte_spinlock_t global_env_cfg_lock = RTE_SPINLOCK_INITIALIZER; > +static RTE_TAILQ_HEAD(, rte_power_uncore_ops) uncore_ops_list = > + TAILQ_HEAD_INITIALIZER(uncore_ops_list); > Need to include rte_debug.h now? _github build: failed_ Build URL: https://github.com/ovsrobot/dpdk/actions/runs/11425299483 Build Logs: ---Summary of failed steps--- "ubuntu-22.04-gcc-ppc64le" failed at step Build and test "ubuntu-22.04-gcc-riscv64" failed at step Build and test --End summary of failed steps ---BEGIN LOGS [Begin job log] "ubuntu-22.04-gcc-ppc64le" at step Build and test [325/3576] Generating symbol file lib/librte_latencystats.so.25.0.p/librte_latencystats.so.25.0.symbols [326/3576] Generating symbol file lib/librte_jobstats.so.25.0.p/librte_jobstats.so.25.0.symbols [327/3576] Compiling C object lib/librte_member.a.p/member_rte_member_ht.c.o [328/3576] Generating symbol file lib/librte_ip_frag.so.25.0.p/librte_ip_frag.so.25.0.symbols [329/3576] Compiling C object drivers/libtmp_rte_bus_platform.a.p/bus_platform_platform_params.c.o [330/3576] Compiling C object lib/librte_member.a.p/member_rte_member_vbf.c.o [331/3576] Compiling C object lib/librte_power.a.p/power_power_common.c.o [332/3576] Compiling C object lib/librte_power.a.p/power_rte_power.c.o [333/3576] Compiling C object lib/librte_power.a.p/power_rte_power_uncore.c.o FAILED: lib/librte_power.a.p/power_rte_power_uncore.c.o ccache powerpc64le-linux-gnu-gcc -Ilib/librte_power.a.p -Ilib -I../lib -Ilib/power -I../lib/power -I. -I.. -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include -I../lib/eal/linux/include -Ilib/eal/ppc/include -I../lib/eal/ppc/include -Ilib/eal/common -I../lib/eal/common -Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs -Ilib/log -I../lib/log -Ilib/metrics -I../lib/metrics -Ilib/telemetry -I../lib/telemetry -Ilib/timer -I../lib/timer -Ilib/ethdev -I../lib/ethdev -Ilib/net -I../lib/net -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/meter -I../lib/meter -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -O2 -g -include rte_config.h -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-address-of-packed-member -Wno-packed-not-aligned -Wno-missing-field-initializers -Wno-psabi -D_GNU_SOURCE -fPIC -mcpu=power8 -mtune=power8 -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation -DRTE_LOG_DEFAULT_LOGTYPE=lib.power -MD -MQ lib/librte_power.a.p/power_rte_power_uncore.c.o -MF lib/librte_power.a.p/power_rte_power_uncore.c.o.d -o lib/librte_power.a.p/power_rte_power_uncore.c.o -c ../lib/power/rte_power_uncore.c ../lib/power/rte_power_uncore.c: In function ‘rte_power_get_uncore_freq’: ../lib/power/rte_power_uncore.c:149:9: error: implicit declaration of function ‘RTE_ASSERT’; did you mean ‘RTE_STR’? [-Werror=implicit-function-declaration] 149 | RTE_ASSERT(global_uncore_ops != NULL); | ^~ | RTE_STR ../lib/power/rte_power_uncore.c:149:9: error: nested extern declaration of ‘RTE_ASSERT’ [-Werror=nested-externs] cc1: all warnings being treated as errors [334/3576] Compiling C object lib/librte_member.a.p/member_rte_member_sketch.c.o [335/3576] Generating lpm.sym_chk with a custom command (wrapped by meson to capture output) [336/3576] Compiling C object lib/librte_pcapng.a.p/pcapng_rte_pcapng.c.o [337/3576] Compiling C object lib/librte_power.a.p/power_rte_power_pmd_mgmt.c.o [338/3576] Generating eventdev.sym_chk with a custom command (wrapped by meson to capture output) ninja: build stopped: subcommand failed. ##[error]Process completed with exit code 1. [End job log] "ubuntu-22.04-gcc-ppc64le" at step Build and test ##
Re: [PATCH v6 2/5] power: refactor uncore power management library
On Sun, 20 Oct 2024 09:22:29 + Sivaprasad Tummala wrote: > +uint32_t > +rte_power_get_uncore_freq(unsigned int pkg, unsigned int die) > +{ > + RTE_ASSERT(global_uncore_ops != NULL); All these RTE_ASSERT calls seem like a good idea, they really don't help. If RTE_ASSERT fails it prints a message and calls abort. If you skip the RTE_ASSERT, the next line will cause a NULL dereference illegal pointer reference and crash. So in either case it crashes, and the RTE_ASSERT() doesn't add much help. Also RTE_ENABLE_ASSERT() is usually disabled.
Re: [PATCH 4/4] net/hns3: support outer VLAN flow match
On 2024/10/19 0:41, Stephen Hemminger wrote: > On Fri, 18 Oct 2024 14:19:41 +0800 > Jie Hai wrote: > >> @@ -306,11 +324,16 @@ hns3_parse_devargs(struct rte_eth_dev *dev) >> &hns3_parse_dev_caps_mask, &dev_caps_mask); >> (void)rte_kvargs_process(kvlist, HNS3_DEVARG_MBX_TIME_LIMIT_MS, >> &hns3_parse_mbx_time_limit, &mbx_time_limit_ms); >> -if (!hns->is_vf) >> +if (!hns->is_vf) { >> (void)rte_kvargs_process(kvlist, >> HNS3_DEVARG_FDIR_VALN_MATCH_MODE, >> &hns3_parse_vlan_match_mode, >> &hns->pf.fdir.vlan_match_mode); >> +(void)rte_kvargs_process(kvlist, >> + HNS3_DEVARG_FDIR_TUPLE_CONFIG, >> + &hns3_parse_fdir_tuple_config, >> + &hns->pf.fdir.tuple_cfg); >> +} >> > > Side question, why the casts to void here? > Is there some tool that is complaining (like old lint), or is there > some error handling missing. Yes, it will output a code check warning if don't add (void). In our design, there will be a warning trace if user input an invalid option (and nothing changed), so it is OK for don't process the function's return value.
[RFC v3 1/2] pci: introduce the PCIe TLP Processing Hints API
Extend the PCI driver and the library to extract the Steering Tag (ST) for a given Processor/Processor Container and Cache ID pair and validate a Processing Hint from a TPH _DSM associated with a root port device. The rte_pci_device structure passed into the rte_pci_extract_tph_st() function could be a device or a root port. If it's a device, the function should trace it back to the root port and use its TPH _DSM to extract STs. The implementation of rte_pci_extract_tph_st() is dependent on the operating system. rte_pci_extract_tph_st() should also be supplied with a rte_tph_acpi__dsm_args, and a rte_tph_acpi__dsm_return structures. These two structures are defined in the PCI library and comply with the TPH _DSM argument and return encoding specified in the PCI firmware ECN titled "Revised _DSM for Cache Locality TPH Features.". Use of rte_init_tph_acpi__dsm_args() is recommended for initializing the rte_tph_acpi__dsm_args struct which is capable of converting lcore ID, the cache level into values understood by the ACPI _DSM function. rte_tph_acpi__dsm_return struct will be initialized with the values returned by the TPH _DSM; it is up to the caller to use these values per the device's capabilities. Signed-off-by: Wathsala Vithanage Reviewed-by: Honnappa Nagarahalli Reviewed-by: Dhruv Tripathi --- drivers/bus/pci/bsd/pci.c | 12 drivers/bus/pci/linux/pci.c | 12 drivers/bus/pci/rte_bus_pci.h | 22 +++ drivers/bus/pci/version.map | 3 + drivers/bus/pci/windows/pci.c | 14 + lib/pci/meson.build | 2 + lib/pci/rte_pci.h | 2 + lib/pci/rte_pci_tph.c | 21 +++ lib/pci/rte_pci_tph.h | 111 ++ 9 files changed, 199 insertions(+) create mode 100644 lib/pci/rte_pci_tph.c create mode 100644 lib/pci/rte_pci_tph.h diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c index 2f88252418..a143cecf45 100644 --- a/drivers/bus/pci/bsd/pci.c +++ b/drivers/bus/pci/bsd/pci.c @@ -639,3 +639,15 @@ rte_pci_ioport_unmap(struct rte_pci_ioport *p) return ret; } + +int +rte_pci_extract_tph_st(const struct rte_pci_device *dev, + const struct rte_tph_acpi__dsm_args *args, + struct rte_tph_acpi__dsm_return *ret) +{ + RTE_SET_USED(dev); + RTE_SET_USED(args); + RTE_SET_USED(ret); + /* BSD doesn't support this feature yet! */ + return -1; +} diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 9056035b33..dffb945462 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -803,3 +803,15 @@ rte_pci_ioport_unmap(struct rte_pci_ioport *p) return ret; } + +int +rte_pci_extract_tph_st(const struct rte_pci_device *dev, + const struct rte_tph_acpi__dsm_args *args, + struct rte_tph_acpi__dsm_return *ret) +{ + RTE_SET_USED(dev); + RTE_SET_USED(args); + RTE_SET_USED(ret); + /* Linux doesn't support this feature yet! */ + return -1; +} diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h index 19a7b15b99..a8167e9b4b 100644 --- a/drivers/bus/pci/rte_bus_pci.h +++ b/drivers/bus/pci/rte_bus_pci.h @@ -312,6 +312,28 @@ void rte_pci_ioport_read(struct rte_pci_ioport *p, void rte_pci_ioport_write(struct rte_pci_ioport *p, const void *data, size_t len, off_t offset); +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Extract steering tag from the ACPI TPH _DSM of the root port + * of the device is connected to. + * + * @param device + * A pointer to a rte_pci_device structure describing the device + * to use. + * @param args + * An initialized args object for the _DSM. + * @param ret + * A pointer to a _DSM return object to store the extracted steering tag. + * @return + * 0 on success, -1 on error extracting the steeting tag. + */ +__rte_experimental +int rte_pci_extract_tph_st(const struct rte_pci_device *device, + const struct rte_tph_acpi__dsm_args *args, + struct rte_tph_acpi__dsm_return *ret); + #ifdef __cplusplus } #endif diff --git a/drivers/bus/pci/version.map b/drivers/bus/pci/version.map index cd653de5ac..5c89f80c8e 100644 --- a/drivers/bus/pci/version.map +++ b/drivers/bus/pci/version.map @@ -31,6 +31,9 @@ EXPERIMENTAL { rte_pci_find_capability; rte_pci_find_next_capability; rte_pci_has_capability_list; + + # added in 24.11 + rte_pci_extract_tph_st; }; INTERNAL { diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c index 36e6f89093..761f714a18 100644 --- a/drivers/bus/pci/windows/pci.c +++ b/drivers/bus/pci/windows/pci.c @@ -500,3 +500,17 @@ rte_pci_scan(void) return ret; } + + +int +rte_pci_extract_tph_st(const struct rte_pci_device *dev, + const struct rte_tph_acpi__dsm_args *
[RFC v3 2/2] ethdev: introduce the cache stashing hints API
Extend the ethdev library to enable the stashing of different data objects, such as the ones listed below, into CPU caches directly from the NIC. - Rx/Tx queue descriptors - Rx packets - Packet headers - packet payloads - Data of a packet at an offset from the start of the packet The APIs are designed in a hardware/vendor agnostic manner such that supporting PMDs could use any capabilities available in the underlying hardware for fine-grained stashing of data objects into a CPU cache (e.g., Steering Tags int PCIe TLP Processing Hints). The API provides an interface to query the availability of stashing capabilities, i.e., platform/NIC support, stashable object types, etc, via the rte_eth_dev_stashing_capabilities_get interface. The function pair rte_eth_dev_stashing_rx_config_set and rte_eth_dev_stashing_tx_config_set sets the stashing hint (the CPU, cache level, and data object types) on the Rx and Tx queues. PMDs that support stashing must register their implementations with the following eth_dev_ops callbacks, which are invoked by the ethdev functions listed above. - stashing_capabilities_get - stashing_rx_hints_set - stashing_tx_hints_set Signed-off-by: Wathsala Vithanage Reviewed-by: Honnappa Nagarahalli Reviewed-by: Dhruv Tripathi --- lib/ethdev/ethdev_driver.h | 66 +++ lib/ethdev/rte_ethdev.c| 120 +++ lib/ethdev/rte_ethdev.h| 161 + lib/ethdev/version.map | 4 + 4 files changed, 351 insertions(+) diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h index 1fd4562b40..7caaea54a8 100644 --- a/lib/ethdev/ethdev_driver.h +++ b/lib/ethdev/ethdev_driver.h @@ -1367,6 +1367,68 @@ enum rte_eth_dev_operation { typedef uint64_t (*eth_get_restore_flags_t)(struct rte_eth_dev *dev, enum rte_eth_dev_operation op); +/** + * @internal + * Set cache stashing hints in Rx queue. + * + * @param dev + * Port (ethdev) handle. + * @param queue_id + * Rx queue. + * @param config + * Stashing hints configuration for the queue. + * + * @return + * -ENOTSUP if the device or the platform does not support cache stashing. + * -ENOSYS if the underlying PMD hasn't implemented cache stashing feature. + * -EINVAL on invalid arguments. + * 0 on success. + */ +typedef int (*eth_stashing_rx_hints_set_t)(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_stashing_config *config); + +/** + * @internal + * Set cache stashing hints in Tx queue. + * + * @param dev + * Port (ethdev) handle. + * @param queue_id + * Tx queue. + * @param config + * Stashing hints configuration for the queue. + * + * @return + * -ENOTSUP if the device or the platform does not support cache stashing. + * -ENOSYS if the underlying PMD hasn't implemented cache stashing feature. + * -EINVAL on invalid arguments. + * 0 on success. + */ +typedef int (*eth_stashing_tx_hints_set_t)(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_stashing_config *config); + +/** + * @internal + * Get cache stashing object types supported in the ethernet device. + * The return value indicates availability of stashing hints support + * in the hardware and the PMD. + * + * @param dev + * Port (ethdev) handle. + * @param objects + * PMD sets supported bits on return. + * + * @return + * -ENOTSUP if the device or the platform does not support cache stashing. + * -ENOSYS if the underlying PMD hasn't implemented cache stashing feature. + * -EINVAL on NULL values for types or hints parameters. + * On return, types and hints parameters will have bits set for supported + * object types and hints. + * 0 on success. + */ +typedef int (*eth_stashing_capabilities_get_t)(struct rte_eth_dev *dev, +uint16_t *objects); + /** * @internal A structure containing the functions exported by an Ethernet driver. */ @@ -1393,6 +1455,10 @@ struct eth_dev_ops { eth_mac_addr_remove_t mac_addr_remove; /**< Remove MAC address */ eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address */ eth_mac_addr_set_t mac_addr_set; /**< Set a MAC address */ + eth_stashing_rx_hints_set_t stashing_rx_hints_set; /**< Set Rx cache stashing*/ + eth_stashing_tx_hints_set_t stashing_tx_hints_set; /**< Set Tx cache stashing*/ + /** Get supported stashing hints*/ + eth_stashing_capabilities_get_t stashing_capabilities_get; /** Set list of multicast addresses */ eth_set_mc_addr_list_t set_mc_addr_list; mtu_set_t mtu_set; /**< Set MTU */ diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 6413c54e3b..d9bcc6c13d 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -153,6 +153,7 @@ static const struct { {RTE_ETH
[RFC v3 0/2] An API for Stashing Packets into CPU caches
DPDK applications benefit from Direct Cache Access (DCA) features like Intel DDIO and Arm's write-allocate-to-SLC. However, those features do not allow fine-grained control of direct cache access, such as stashing packets into upper-level caches (L2 caches) of a processor or the shared cache of a chiplet. PCIe TLP Processing Hints (TPH) addresses this need in a vendor-agnostic manner. TPH capability has existed since PCI Express Base Specification revision 3.0; today, numerous Network Interface Cards and interconnects from different vendors support TPH capability. TPH comprises a steering tag (ST) and a processing hint (PH). ST specifies the cache level of a CPU at which the data should be written to (or DCAed into), while PH is a hint provided by the PCIe requester to the completer on an upcoming traffic pattern. Some NIC vendors bundle TPH capability with fine-grained control over the type of objects that can be stashed into CPU caches, such as - Rx/Tx queue descriptors - Packet-headers - Packet-payloads - Data from a given offset from the start of a packet Note that stashable object types are outside the scope of PCIe standard; therefore, vendors could support any combination of the above items as they see fit. To enable TPH and fine-grained packet stashing, this API extends the ethdev library, PCI library, and the PCI driver. In this design, the application via the ethdev stashing API provides hints to the PMD to indicate the underlying hardware at which processor and cache level it prefers a packet to end up. Once the PMD receives a CPU and a cache-level combination, it must extract the matching ST from the TPH ACPI _DSM of the PCIe root port to which the NIC is connected. To facilitate the extraction of STs, the PCI library and the PCI driver APIs are extended. PMD's implementation of eth_dev_ops stashing_rx_hints_set and stashing_tx_hints_set function pointers are responsible for extracting the ST. The PCI bus driver provides the generic TPH ST extraction API that can be used by any PMD that drives a PCIe device. The extraction process begins by calling rte_pci_extract_tph_st() function in drivers/bus/pci/rte_bus_pci.h, which takes an initialized input object rte_tph_acpi__dsm_args and a pointer to rte_tph_acpi__dsm_return to store the ST returned by the TPH _DSM. rte_tph_acpi__dsm_arg and rte_tph_acpi__dsm_return objects are defined in lib/pci/rte_pci_tph.h as defined by the PCIe firmware specification and the associated ECN titled "Revised _DSM for Cache Locality TPH Features". The helper function rte_init_tph_acpi__dsm_args is used by the rte_pci_extract_tph_st() to convert lcore_id and cache_level provided by the PMD into well-formatted rte_tph_acpi__dsm_args. The processor or, in some cases, a container ID (which is synonymous with a core complex of a chiplet die) and the cache level in the rte_tph_acpi__dsm_args structure are not the same as the lcore_id and the cache_level provided by the application to the ethdev library, which PMD passes down to the rte_pci_extract_st() function. The rte_init_tph_acpi__dsm_args helper converts lcore_id to an APIC processor-id or a PPTT processor-container-id if the container of the lcore_id was requested as the target by the application. Similarly, it must convert cache_level to a PPTT cache-reference-id. These conversions are possible with the hwloc library or some other library DPDK may eventually provide. However, DPDK cannot execute the TPH _DSM directly, as it can only be done with kernel privileges. Therefore, appropriate mechanisms must be established in supported Operating Systems(Linux, FreeBSD, and Windows) to expose the _DSM return for a given argument. For instance, on Linux, this mechanism could be sysfs. Therefore, the implementation of rte_pci_extract_tph_st() is done in OS-specific files drivers/bus/pci/{bsd, linux, windows}/pci.c. Once the ST is acquired from the OS-specific method described earlier, the stashing_rx_hints_set/stashing_tx_hints_set PMD implementations are ready to set the ST. As per PCIe specification, hints can be put on the MSI-X tables or using a device-specific method. Considering this, many NICs that support TPH allow setting steering tags and processing hints on the device's MSI-X table and queue contexts. For PMDs, setting the ST on queue contexts is the only viable method of using TPH. Therefore, the DPDK can only support setting ST in queue contexts. An application uses the cache stashing ethdev API by first calling the rte_eth_dev_stashing_capabilities_get() function to find out what object types can be stashed into a processor cache by the NIC out of the object types in the bulleted list above. This function takes a port_id and a pointer to a uint16_t to report back the object type flags. PMD implements the stashing_capabilities_get function pointer in eth_dev_ops. If the underlying platform or the NIC does not support TPH, this function returns -ENOTSUP and the application should consider any values stored i
[dpdk-dev] [PATCH 1/2] common/cnxk: support NPC flow on cn20k
From: Satheesh Paul ROC changes to support NPC flow on cn20k. Signed-off-by: Satheesh Paul Reviewed-by: Kiran Kumar K --- drivers/common/cnxk/roc_mbox.h | 144 +- drivers/common/cnxk/roc_nix.h | 18 +- drivers/common/cnxk/roc_nix_mcast.c | 40 +- drivers/common/cnxk/roc_nix_vlan.c | 66 ++- drivers/common/cnxk/roc_npc.c | 58 ++- drivers/common/cnxk/roc_npc.h | 59 ++- drivers/common/cnxk/roc_npc_mcam.c | 602 +++- drivers/common/cnxk/roc_npc_mcam_dump.c | 279 +-- drivers/common/cnxk/roc_npc_priv.h | 86 +++- drivers/common/cnxk/roc_npc_utils.c | 340 ++--- drivers/common/cnxk/version.map | 1 + 11 files changed, 1321 insertions(+), 372 deletions(-) diff --git a/drivers/common/cnxk/roc_mbox.h b/drivers/common/cnxk/roc_mbox.h index dd65946e9e..451589e7e5 100644 --- a/drivers/common/cnxk/roc_mbox.h +++ b/drivers/common/cnxk/roc_mbox.h @@ -234,6 +234,22 @@ struct mbox_msghdr { npc_get_field_hash_info_req, npc_get_field_hash_info_rsp)\ M(NPC_MCAM_GET_HIT_STATUS, 0x6015, npc_mcam_get_hit_status,\ npc_mcam_get_hit_status_req, npc_mcam_get_hit_status_rsp)\ + M(NPC_MCAM_DEFRAG, 0x6016, npc_defrag, msg_req, msg_rsp) \ + M(NPC_CN20K_GET_KEX_CFG, 0x6017, npc_cn20k_get_kex_cfg, msg_req, \ + npc_cn20k_get_kex_cfg_rsp) \ + M(NPC_CN20K_MCAM_GET_FREE_COUNT, 0x6018, npc_cn20k_get_free_count, \ + msg_req, npc_cn20k_get_free_count_rsp) \ + M(NPC_CN20K_MCAM_WRITE_ENTRY, 0x6019, npc_cn20k_mcam_write_entry,\ + npc_cn20k_mcam_write_entry_req, msg_rsp) \ + M(NPC_CN20K_MCAM_ALLOC_AND_WRITE_ENTRY, 0x601a,\ + npc_cn20k_mcam_alloc_and_write_entry,\ + npc_cn20k_mcam_alloc_and_write_entry_req,\ + npc_mcam_alloc_and_write_entry_rsp) \ + M(NPC_CN20K_MCAM_READ_ENTRY,0x601b, npc_cn20k_mcam_read_entry, \ + npc_mcam_read_entry_req, npc_cn20k_mcam_read_entry_rsp) \ + M(NPC_CN20K_MCAM_READ_BASE_RULE, 0x601c, \ + npc_cn20k_read_base_steer_rule, msg_req, \ + npc_cn20k_mcam_read_base_rule_rsp) \ /* NIX mbox IDs (range 0x8000 - 0x) */ \ M(NIX_LF_ALLOC, 0x8000, nix_lf_alloc, nix_lf_alloc_req,\ nix_lf_alloc_rsp)\ @@ -637,7 +653,7 @@ struct cgx_mac_addr_add_req { */ struct cgx_mac_addr_add_rsp { struct mbox_msghdr hdr; - uint8_t __io index; + uint32_t __io index; }; /* Structure for requesting the operation to @@ -645,7 +661,7 @@ struct cgx_mac_addr_add_rsp { */ struct cgx_mac_addr_del_req { struct mbox_msghdr hdr; - uint8_t __io index; + uint32_t __io index; }; /* Structure for response against the operation to @@ -653,7 +669,7 @@ struct cgx_mac_addr_del_req { */ struct cgx_max_dmac_entries_get_rsp { struct mbox_msghdr hdr; - uint8_t __io max_dmac_filters; + uint32_t __io max_dmac_filters; }; struct cgx_link_user_info { @@ -2433,6 +2449,14 @@ enum npc_af_status { NPC_MCAM_ALLOC_FAILED = -703, NPC_MCAM_PERM_DENIED = -704, NPC_AF_ERR_HIGIG_CONFIG_FAIL = -705, + NPC_AF_ERR_HIGIG_NOT_SUPPORTED = -706, + NPC_FLOW_INTF_INVALID = -707, + NPC_FLOW_CHAN_INVALID = -708, + NPC_FLOW_NO_NIXLF = -709, + NPC_FLOW_NOT_SUPPORTED = -710, + NPC_FLOW_VF_PERM_DENIED = -711, + NPC_FLOW_VF_NOT_INIT = -712, + NPC_FLOW_VF_OVERLAP = -713, }; struct npc_mcam_alloc_entry_req { @@ -2442,9 +2466,12 @@ struct npc_mcam_alloc_entry_req { #define NPC_MCAM_ANY_PRIO0 #define NPC_MCAM_LOWER_PRIO 1 #define NPC_MCAM_HIGHER_PRIO 2 - uint8_t __io priority; /* Lower or higher w.r.t ref_entry */ + uint8_t __io ref_priority; /* Lower or higher w.r.t ref_entry */ uint16_t __io ref_entry; uint16_t __io count; /* Number of entries requested */ + uint8_t __io kw_type; /* Key type */ + uint8_t __io virt;/* Request virtual index */ + uint16_t __io rsvd[16]; /* Reserved */ }; struct npc_mcam_alloc_entry_rsp { @@ -2456,6 +2483,7 @@ struct npc_mcam_alloc_entry_rsp { uint16_t __io count; /* Number of entries allocated */ uint16_t __io free_count; /* Number of entries available */ uint16_t __io entry_list[NPC_MAX_NONCONTIG_ENTRIES]; + uint16_t __io rsvd[16]; /* Reserved */ }; struct npc_mcam_free_entry_req { @@ -2482,6 +2510,26 @@ struct npc_mcam_write_entry_req { uin
[dpdk-dev] [PATCH 2/2] net/cnxk: support rte flow on cn20k
From: Satheesh Paul Support for rte flow in cn20k. Signed-off-by: Satheesh Paul Reviewed-by: Kiran Kumar K --- drivers/net/cnxk/cn10k_ethdev.c| 8 +- drivers/net/cnxk/cn10k_flow.h | 21 -- drivers/net/cnxk/cn20k_ethdev.c| 4 + drivers/net/cnxk/cnxk_ethdev_devargs.c | 10 +- drivers/net/cnxk/cnxk_flow.c | 10 +- drivers/net/cnxk/cnxk_flow_wrapper.c | 303 + drivers/net/cnxk/cnxk_flow_wrapper.h | 21 ++ drivers/net/cnxk/meson.build | 10 +- 8 files changed, 355 insertions(+), 32 deletions(-) delete mode 100644 drivers/net/cnxk/cn10k_flow.h create mode 100644 drivers/net/cnxk/cnxk_flow_wrapper.c create mode 100644 drivers/net/cnxk/cnxk_flow_wrapper.h diff --git a/drivers/net/cnxk/cn10k_ethdev.c b/drivers/net/cnxk/cn10k_ethdev.c index fbb9b09062..a4b3d56c61 100644 --- a/drivers/net/cnxk/cn10k_ethdev.c +++ b/drivers/net/cnxk/cn10k_ethdev.c @@ -2,9 +2,9 @@ * Copyright(C) 2021 Marvell. */ #include "cn10k_ethdev.h" -#include "cn10k_flow.h" #include "cn10k_rx.h" #include "cn10k_tx.h" +#include "cnxk_flow_wrapper.h" static uint16_t nix_rx_offload_flags(struct rte_eth_dev *eth_dev) @@ -913,9 +913,9 @@ npc_flow_ops_override(void) init_once = 1; /* Update platform specific ops */ - cnxk_flow_ops.create = cn10k_flow_create; - cnxk_flow_ops.destroy = cn10k_flow_destroy; - cnxk_flow_ops.info_get = cn10k_flow_info_get; + cnxk_flow_ops.create = cnxk_flow_create_wrapper; + cnxk_flow_ops.destroy = cnxk_flow_destroy_wrapper; + cnxk_flow_ops.info_get = cnxk_flow_info_get_wrapper; } static int diff --git a/drivers/net/cnxk/cn10k_flow.h b/drivers/net/cnxk/cn10k_flow.h deleted file mode 100644 index 316b74e6a6..00 --- a/drivers/net/cnxk/cn10k_flow.h +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(C) 2020 Marvell. - */ -#ifndef __CN10K_RTE_FLOW_H__ -#define __CN10K_RTE_FLOW_H__ - -#include - -struct rte_flow *cn10k_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, - const struct rte_flow_item pattern[], - const struct rte_flow_action actions[], - struct rte_flow_error *error); -int cn10k_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, - struct rte_flow_error *error); - -int cn10k_flow_info_get(struct rte_eth_dev *dev, struct rte_flow_port_info *port_info, - struct rte_flow_queue_info *queue_info, struct rte_flow_error *err); - -#define CN10K_NPC_COUNTERS_MAX 512 - -#endif /* __CN10K_RTE_FLOW_H__ */ diff --git a/drivers/net/cnxk/cn20k_ethdev.c b/drivers/net/cnxk/cn20k_ethdev.c index 37c372d80f..e74dd88172 100644 --- a/drivers/net/cnxk/cn20k_ethdev.c +++ b/drivers/net/cnxk/cn20k_ethdev.c @@ -4,6 +4,7 @@ #include "cn20k_ethdev.h" #include "cn20k_rx.h" #include "cn20k_tx.h" +#include "cnxk_flow_wrapper.h" static uint16_t nix_rx_offload_flags(struct rte_eth_dev *eth_dev) @@ -867,6 +868,9 @@ npc_flow_ops_override(void) init_once = 1; /* Update platform specific ops */ + cnxk_flow_ops.create = cnxk_flow_create_wrapper; + cnxk_flow_ops.destroy = cnxk_flow_destroy_wrapper; + cnxk_flow_ops.info_get = cnxk_flow_info_get_wrapper; } static int diff --git a/drivers/net/cnxk/cnxk_ethdev_devargs.c b/drivers/net/cnxk/cnxk_ethdev_devargs.c index 5bd50bb9a1..bdf5d88b92 100644 --- a/drivers/net/cnxk/cnxk_ethdev_devargs.c +++ b/drivers/net/cnxk/cnxk_ethdev_devargs.c @@ -88,8 +88,7 @@ parse_flow_max_priority(const char *key, const char *value, void *extra_args) val = atoi(value); - /* Limit the max priority to 32 */ - if (val < 1 || val > 32) + if (val < 1 || val > ROC_NPC_MAX_MCAM_PRIORITY) return -EINVAL; *(uint16_t *)extra_args = val; @@ -390,7 +389,12 @@ cnxk_ethdev_parse_devargs(struct rte_devargs *devargs, struct cnxk_eth_dev *dev) dev->nix.meta_buf_sz = meta_buf_sz; dev->npc.flow_prealloc_size = flow_prealloc_size; - dev->npc.flow_max_priority = flow_max_priority; + + if (roc_model_is_cn20k()) + dev->npc.flow_max_priority = ROC_NPC_MAX_MCAM_PRIORITY; + else + dev->npc.flow_max_priority = flow_max_priority; + dev->npc.switch_header_type = switch_header_type; dev->npc.sdp_channel = sdp_chan.channel; dev->npc.sdp_channel_mask = sdp_chan.mask; diff --git a/drivers/net/cnxk/cnxk_flow.c b/drivers/net/cnxk/cnxk_flow.c index d3c20e8315..887dd8f911 100644 --- a/drivers/net/cnxk/cnxk_flow.c +++ b/drivers/net/cnxk/cnxk_flow.c @@ -990,10 +990,14 @@ cnxk_flow_query_common(struct rte_eth_dev *eth_dev, struct rte_flow *flow, npc = &rep_dev->parent_dev->npc; } - if (in_flow->use_pre_alloc) + if (in_flow->use_pre_alloc) { rc = roc
[PATCH v6 4/5] drivers/power: uncore support for AMD EPYC processors
This patch introduces driver support for power management of uncore components in AMD EPYC processors. v2: - fixed typo in comments section. - added fabric frequency get support for legacy platforms. Signed-off-by: Sivaprasad Tummala --- drivers/power/amd_uncore/amd_uncore.c | 329 ++ drivers/power/amd_uncore/amd_uncore.h | 226 ++ drivers/power/amd_uncore/meson.build | 20 ++ drivers/power/meson.build | 1 + 4 files changed, 576 insertions(+) create mode 100644 drivers/power/amd_uncore/amd_uncore.c create mode 100644 drivers/power/amd_uncore/amd_uncore.h create mode 100644 drivers/power/amd_uncore/meson.build diff --git a/drivers/power/amd_uncore/amd_uncore.c b/drivers/power/amd_uncore/amd_uncore.c new file mode 100644 index 00..c3e95cdc08 --- /dev/null +++ b/drivers/power/amd_uncore/amd_uncore.c @@ -0,0 +1,329 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Advanced Micro Devices, Inc. + */ + +#include +#include +#include + +#include + +#include "amd_uncore.h" +#include "power_common.h" +#include "e_smi/e_smi.h" + +#define MAX_NUMA_DIE 8 + +struct __rte_cache_aligned uncore_power_info { + unsigned int die; /* Core die id */ + unsigned int pkg; /* Package id */ + uint32_t freqs[RTE_MAX_UNCORE_FREQS]; /* Frequency array */ + uint32_t nb_freqs; /* Number of available freqs */ + uint32_t curr_idx; /* Freq index in freqs array */ + uint32_t max_freq;/* System max uncore freq */ + uint32_t min_freq;/* System min uncore freq */ +}; + +static struct uncore_power_info uncore_info[RTE_MAX_NUMA_NODES][MAX_NUMA_DIE]; +static int esmi_initialized; +static unsigned int hsmp_proto_ver; + +static int +set_uncore_freq_internal(struct uncore_power_info *ui, uint32_t idx) +{ + int ret; + + if (idx >= RTE_MAX_UNCORE_FREQS || idx >= ui->nb_freqs) { + POWER_LOG(DEBUG, "Invalid uncore frequency index %u, which " + "should be less than %u", idx, ui->nb_freqs); + return -1; + } + + ret = esmi_apb_disable(ui->pkg, idx); + if (ret != ESMI_SUCCESS) { + POWER_LOG(ERR, "DF P-state '%u' set failed for pkg %02u", + idx, ui->pkg); + return -1; + } + + POWER_DEBUG_LOG("DF P-state '%u' to be set for pkg %02u die %02u", + idx, ui->pkg, ui->die); + + /* write the minimum value first if the target freq is less than current max */ + ui->curr_idx = idx; + + return 0; +} + +static int +power_init_for_setting_uncore_freq(struct uncore_power_info *ui) +{ + switch (hsmp_proto_ver) { + case HSMP_PROTO_VER5: + ui->max_freq = 180; /* Hz */ + ui->min_freq = 120; /* Hz */ + break; + case HSMP_PROTO_VER2: + default: + ui->max_freq = 160; /* Hz */ + ui->min_freq = 120; /* Hz */ + } + + return 0; +} + +/* + * Get the available uncore frequencies of the specific die. + */ +static int +power_get_available_uncore_freqs(struct uncore_power_info *ui) +{ + ui->nb_freqs = 3; + if (ui->nb_freqs >= RTE_MAX_UNCORE_FREQS) { + POWER_LOG(ERR, "Too many available uncore frequencies: %d", + ui->nb_freqs); + return -1; + } + + /* Generate the uncore freq bucket array. */ + switch (hsmp_proto_ver) { + case HSMP_PROTO_VER5: + ui->freqs[0] = 180; + ui->freqs[1] = 144; + ui->freqs[2] = 120; + break; + case HSMP_PROTO_VER2: + default: + ui->freqs[0] = 160; + ui->freqs[1] = 1333000; + ui->freqs[2] = 120; + } + + POWER_DEBUG_LOG("%d frequency(s) of pkg %02u die %02u are available", + ui->num_uncore_freqs, ui->pkg, ui->die); + + return 0; +} + +static int +check_pkg_die_values(unsigned int pkg, unsigned int die) +{ + unsigned int max_pkgs, max_dies; + max_pkgs = power_amd_uncore_get_num_pkgs(); + if (max_pkgs == 0) + return -1; + if (pkg >= max_pkgs) { + POWER_LOG(DEBUG, "Package number %02u can not exceed %u", + pkg, max_pkgs); + return -1; + } + + max_dies = power_amd_uncore_get_num_dies(pkg); + if (max_dies == 0) + return -1; + if (die >= max_dies) { + POWER_LOG(DEBUG, "Die number %02u can not exceed %u", + die, max_dies); + return -1; + } + + return 0; +} + +static void +power_amd_uncore_esmi_init(void) +{ + if (esmi_init() == ESMI_SUCCESS) { + i
[PATCH v6 1/5] power: refactor core power management library
This patch introduces a comprehensive refactor to the core power management library. The primary focus is on improving modularity and organization by relocating specific driver implementations from the 'lib/power' directory to dedicated directories within 'drivers/power/core/*'. The adjustment of meson.build files enables the selective activation of individual drivers. These changes contribute to a significant enhancement in code organization, providing a clearer structure for driver implementations. The refactor aims to improve overall code clarity and boost maintainability. Additionally, it establishes a foundation for future development, allowing for more focused work on individual drivers and seamless integration of forthcoming enhancements. v6: - fixed compilation error with symbol export in API - exported power_get_lcore_mapped_cpu_id as internal API to be used in drivers/power/* v5: - fixed code style warning v4: - fixed build error with RTE_ASSERT v3: - renamed rte_power_core_ops.h as rte_power_cpufreq_api.h - re-worked on auto detection logic v2: - added NULL check for global_core_ops in rte_power_get_core_ops Signed-off-by: Sivaprasad Tummala --- drivers/meson.build | 1 + .../power/acpi/acpi_cpufreq.c | 22 +- .../power/acpi/acpi_cpufreq.h | 6 +- drivers/power/acpi/meson.build| 10 + .../power/amd_pstate/amd_pstate_cpufreq.c | 24 +- .../power/amd_pstate/amd_pstate_cpufreq.h | 10 +- drivers/power/amd_pstate/meson.build | 10 + .../power/cppc/cppc_cpufreq.c | 22 +- .../power/cppc/cppc_cpufreq.h | 8 +- drivers/power/cppc/meson.build| 10 + .../power/kvm_vm}/guest_channel.c | 0 .../power/kvm_vm}/guest_channel.h | 0 .../power/kvm_vm/kvm_vm.c | 22 +- .../power/kvm_vm/kvm_vm.h | 6 +- drivers/power/kvm_vm/meson.build | 14 + drivers/power/meson.build | 12 + drivers/power/pstate/meson.build | 10 + .../power/pstate/pstate_cpufreq.c | 22 +- .../power/pstate/pstate_cpufreq.h | 6 +- lib/power/meson.build | 7 +- lib/power/power_common.c | 2 +- lib/power/power_common.h | 18 +- lib/power/rte_power.c | 355 -- lib/power/rte_power.h | 116 +++--- lib/power/rte_power_cpufreq_api.h | 206 ++ lib/power/version.map | 15 + 26 files changed, 665 insertions(+), 269 deletions(-) rename lib/power/power_acpi_cpufreq.c => drivers/power/acpi/acpi_cpufreq.c (95%) rename lib/power/power_acpi_cpufreq.h => drivers/power/acpi/acpi_cpufreq.h (98%) create mode 100644 drivers/power/acpi/meson.build rename lib/power/power_amd_pstate_cpufreq.c => drivers/power/amd_pstate/amd_pstate_cpufreq.c (95%) rename lib/power/power_amd_pstate_cpufreq.h => drivers/power/amd_pstate/amd_pstate_cpufreq.h (96%) create mode 100644 drivers/power/amd_pstate/meson.build rename lib/power/power_cppc_cpufreq.c => drivers/power/cppc/cppc_cpufreq.c (95%) rename lib/power/power_cppc_cpufreq.h => drivers/power/cppc/cppc_cpufreq.h (97%) create mode 100644 drivers/power/cppc/meson.build rename {lib/power => drivers/power/kvm_vm}/guest_channel.c (100%) rename {lib/power => drivers/power/kvm_vm}/guest_channel.h (100%) rename lib/power/power_kvm_vm.c => drivers/power/kvm_vm/kvm_vm.c (82%) rename lib/power/power_kvm_vm.h => drivers/power/kvm_vm/kvm_vm.h (98%) create mode 100644 drivers/power/kvm_vm/meson.build create mode 100644 drivers/power/meson.build create mode 100644 drivers/power/pstate/meson.build rename lib/power/power_pstate_cpufreq.c => drivers/power/pstate/pstate_cpufreq.c (96%) rename lib/power/power_pstate_cpufreq.h => drivers/power/pstate/pstate_cpufreq.h (98%) create mode 100644 lib/power/rte_power_cpufreq_api.h diff --git a/drivers/meson.build b/drivers/meson.build index 2733306698..7ef4f581a0 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -29,6 +29,7 @@ subdirs = [ 'event', # depends on common, bus, mempool and net. 'baseband', # depends on common and bus. 'gpu',# depends on common and bus. +'power', # depends on common (in future). ] if meson.is_cross_build() diff --git a/lib/power/power_acpi_cpufreq.c b/drivers/power/acpi/acpi_cpufreq.c similarity index 95% rename from lib/power/power_acpi_cpufreq.c rename to drivers/power/acpi/acpi_cpufreq.c index ae809fbb60..974fbb7ba8 100644 --- a/lib/power/power_acpi_cpufreq.c +++ b/drivers/power/acpi/acpi_cpufreq.c @@ -10,7 +10,7 @@ #include #include -#include "power_acpi_cpufreq.h" +#include "acpi_cpufreq.h" #include "power_common.h" #define STR_SIZE 1024 @@ -587,3 +587,23 @
[PATCH v6 0/5] power: refactor power management library
This patchset refactors the power management library, addressing both core and uncore power management. The primary changes involve the creation of dedicated directories for each driver within 'drivers/power/core/*' and 'drivers/power/uncore/*'. This refactor significantly improves code organization, enhances clarity, and boosts maintainability. It lays the foundation for more focused development on individual drivers and facilitates seamless integration of future enhancements, particularly the AMD uncore driver. Furthermore, this effort aims to streamline code maintenance by consolidating common functions for cpufreq and cppc across various core drivers, thus reducing code duplication. Sivaprasad Tummala (5): power: refactor core power management library power: refactor uncore power management library test/power: removed function pointer validations drivers/power: uncore support for AMD EPYC processors maintainers: update for drivers/power MAINTAINERS | 1 + app/test/test_power.c | 95 - app/test/test_power_cpufreq.c | 52 --- app/test/test_power_kvm_vm.c | 36 -- drivers/meson.build | 1 + .../power/acpi/acpi_cpufreq.c | 22 +- .../power/acpi/acpi_cpufreq.h | 6 +- drivers/power/acpi/meson.build| 10 + .../power/amd_pstate/amd_pstate_cpufreq.c | 24 +- .../power/amd_pstate/amd_pstate_cpufreq.h | 10 +- drivers/power/amd_pstate/meson.build | 10 + drivers/power/amd_uncore/amd_uncore.c | 329 drivers/power/amd_uncore/amd_uncore.h | 226 +++ drivers/power/amd_uncore/meson.build | 20 + .../power/cppc/cppc_cpufreq.c | 22 +- .../power/cppc/cppc_cpufreq.h | 8 +- drivers/power/cppc/meson.build| 10 + .../power/intel_uncore/intel_uncore.c | 18 +- .../power/intel_uncore/intel_uncore.h | 8 +- drivers/power/intel_uncore/meson.build| 6 + .../power/kvm_vm}/guest_channel.c | 0 .../power/kvm_vm}/guest_channel.h | 0 .../power/kvm_vm/kvm_vm.c | 22 +- .../power/kvm_vm/kvm_vm.h | 6 +- drivers/power/kvm_vm/meson.build | 14 + drivers/power/meson.build | 14 + drivers/power/pstate/meson.build | 10 + .../power/pstate/pstate_cpufreq.c | 22 +- .../power/pstate/pstate_cpufreq.h | 6 +- examples/l3fwd-power/main.c | 12 +- lib/power/meson.build | 9 +- lib/power/power_common.c | 2 +- lib/power/power_common.h | 18 +- lib/power/rte_power.c | 355 -- lib/power/rte_power.h | 116 +++--- lib/power/rte_power_cpufreq_api.h | 206 ++ lib/power/rte_power_uncore.c | 253 +++-- lib/power/rte_power_uncore.h | 61 ++- lib/power/rte_power_uncore_ops.h | 230 lib/power/version.map | 16 + 40 files changed, 1664 insertions(+), 622 deletions(-) rename lib/power/power_acpi_cpufreq.c => drivers/power/acpi/acpi_cpufreq.c (95%) rename lib/power/power_acpi_cpufreq.h => drivers/power/acpi/acpi_cpufreq.h (98%) create mode 100644 drivers/power/acpi/meson.build rename lib/power/power_amd_pstate_cpufreq.c => drivers/power/amd_pstate/amd_pstate_cpufreq.c (95%) rename lib/power/power_amd_pstate_cpufreq.h => drivers/power/amd_pstate/amd_pstate_cpufreq.h (96%) create mode 100644 drivers/power/amd_pstate/meson.build create mode 100644 drivers/power/amd_uncore/amd_uncore.c create mode 100644 drivers/power/amd_uncore/amd_uncore.h create mode 100644 drivers/power/amd_uncore/meson.build rename lib/power/power_cppc_cpufreq.c => drivers/power/cppc/cppc_cpufreq.c (95%) rename lib/power/power_cppc_cpufreq.h => drivers/power/cppc/cppc_cpufreq.h (97%) create mode 100644 drivers/power/cppc/meson.build rename lib/power/power_intel_uncore.c => drivers/power/intel_uncore/intel_uncore.c (95%) rename lib/power/power_intel_uncore.h => drivers/power/intel_uncore/intel_uncore.h (97%) create mode 100644 drivers/power/intel_uncore/meson.build rename {lib/power => drivers/power/kvm_vm}/guest_channel.c (100%) rename {lib/power => drivers/power/kvm_vm}/guest_channel.h (100%) rename lib/power/power_kvm_vm.c => drivers/power/kvm_vm/kvm_vm.c (82%) rename lib/power/power_kvm_vm.h => drivers/power/kvm_vm/kvm_vm.h (98%) create mode 100644 drivers/power/kvm_vm/meson.build create mode 100644 drivers/power/meson.build create mode 100644 drivers/power/pstate/meson.build rename lib/power/power_pstate_cpufreq.c => drivers/power/pstate/pstate_cpufreq.c (96%) rename lib/power/power_pstate_cpufreq.h => dri
[PATCH v6 2/5] power: refactor uncore power management library
iThis patch refactors the power management library, addressing uncore power management. The primary changes involve the creation of dedicated directories for each driver within 'drivers/power/uncore/*'. The adjustment of meson.build files enables the selective activation of individual drivers. This refactor significantly improves code organization, enhances clarity and boosts maintainability. It lays the foundation for more focused development on individual drivers and facilitates seamless integration of future enhancements, particularly the AMD uncore driver. v6: - fixed compilation error with symbol export in API v5: - fixed build errors for risc-v/ppc targets v4: - fixed build error with RTE_ASSERT v3: - fixed typo in header file inclusion Signed-off-by: Sivaprasad Tummala --- .../power/intel_uncore/intel_uncore.c | 18 +- .../power/intel_uncore/intel_uncore.h | 8 +- drivers/power/intel_uncore/meson.build| 6 + drivers/power/meson.build | 3 +- lib/power/meson.build | 2 +- lib/power/rte_power_uncore.c | 253 +- lib/power/rte_power_uncore.h | 61 ++--- lib/power/rte_power_uncore_ops.h | 230 lib/power/version.map | 1 + 9 files changed, 419 insertions(+), 163 deletions(-) rename lib/power/power_intel_uncore.c => drivers/power/intel_uncore/intel_uncore.c (95%) rename lib/power/power_intel_uncore.h => drivers/power/intel_uncore/intel_uncore.h (97%) create mode 100644 drivers/power/intel_uncore/meson.build create mode 100644 lib/power/rte_power_uncore_ops.h diff --git a/lib/power/power_intel_uncore.c b/drivers/power/intel_uncore/intel_uncore.c similarity index 95% rename from lib/power/power_intel_uncore.c rename to drivers/power/intel_uncore/intel_uncore.c index 4eb9c5900a..804ad5d755 100644 --- a/lib/power/power_intel_uncore.c +++ b/drivers/power/intel_uncore/intel_uncore.c @@ -8,7 +8,7 @@ #include -#include "power_intel_uncore.h" +#include "intel_uncore.h" #include "power_common.h" #define MAX_NUMA_DIE 8 @@ -475,3 +475,19 @@ power_intel_uncore_get_num_dies(unsigned int pkg) return count; } + +static struct rte_power_uncore_ops intel_uncore_ops = { + .name = "intel-uncore", + .init = power_intel_uncore_init, + .exit = power_intel_uncore_exit, + .get_avail_freqs = power_intel_uncore_freqs, + .get_num_pkgs = power_intel_uncore_get_num_pkgs, + .get_num_dies = power_intel_uncore_get_num_dies, + .get_num_freqs = power_intel_uncore_get_num_freqs, + .get_freq = power_get_intel_uncore_freq, + .set_freq = power_set_intel_uncore_freq, + .freq_max = power_intel_uncore_freq_max, + .freq_min = power_intel_uncore_freq_min, +}; + +RTE_POWER_REGISTER_UNCORE_OPS(intel_uncore_ops); diff --git a/lib/power/power_intel_uncore.h b/drivers/power/intel_uncore/intel_uncore.h similarity index 97% rename from lib/power/power_intel_uncore.h rename to drivers/power/intel_uncore/intel_uncore.h index 20a3ba8ebe..ffee28f9b3 100644 --- a/lib/power/power_intel_uncore.h +++ b/drivers/power/intel_uncore/intel_uncore.h @@ -2,8 +2,8 @@ * Copyright(c) 2022 Intel Corporation */ -#ifndef POWER_INTEL_UNCORE_H -#define POWER_INTEL_UNCORE_H +#ifndef _INTEL_UNCORE_H +#define _INTEL_UNCORE_H /** * @file @@ -11,7 +11,7 @@ */ #include "rte_power.h" -#include "rte_power_uncore.h" +#include "rte_power_uncore_ops.h" #ifdef __cplusplus extern "C" { @@ -223,4 +223,4 @@ power_intel_uncore_get_num_dies(unsigned int pkg); } #endif -#endif /* POWER_INTEL_UNCORE_H */ +#endif /* _INTEL_UNCORE_H */ diff --git a/drivers/power/intel_uncore/meson.build b/drivers/power/intel_uncore/meson.build new file mode 100644 index 00..876df8ad14 --- /dev/null +++ b/drivers/power/intel_uncore/meson.build @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2017 Intel Corporation +# Copyright(c) 2024 Advanced Micro Devices, Inc. + +sources = files('intel_uncore.c') +deps += ['power'] diff --git a/drivers/power/meson.build b/drivers/power/meson.build index 8c7215c639..c83047af94 100644 --- a/drivers/power/meson.build +++ b/drivers/power/meson.build @@ -6,7 +6,8 @@ drivers = [ 'amd_pstate', 'cppc', 'kvm_vm', -'pstate' +'pstate', +'intel_uncore' ] std_deps = ['power'] diff --git a/lib/power/meson.build b/lib/power/meson.build index 9a4a592caf..d435197cef 100644 --- a/lib/power/meson.build +++ b/lib/power/meson.build @@ -13,7 +13,6 @@ if not is_linux endif sources = files( 'power_common.c', -'power_intel_uncore.c', 'rte_power.c', 'rte_power_uncore.c', 'rte_power_pmd_mgmt.c', @@ -24,6 +23,7 @@ headers = files( 'rte_power_guest_channel.h', 'rte_power_pmd_mgmt.h', 'rte_power_uncore.h', +'rte_power_uncore_ops.h',
[PATCH v6 0/5] power: refactor power management library
This patchset refactors the power management library, addressing both core and uncore power management. The primary changes involve the creation of dedicated directories for each driver within 'drivers/power/core/*' and 'drivers/power/uncore/*'. This refactor significantly improves code organization, enhances clarity, and boosts maintainability. It lays the foundation for more focused development on individual drivers and facilitates seamless integration of future enhancements, particularly the AMD uncore driver. Furthermore, this effort aims to streamline code maintenance by consolidating common functions for cpufreq and cppc across various core drivers, thus reducing code duplication. Sivaprasad Tummala (5): power: refactor core power management library power: refactor uncore power management library test/power: removed function pointer validations drivers/power: uncore support for AMD EPYC processors maintainers: update for drivers/power MAINTAINERS | 1 + app/test/test_power.c | 95 - app/test/test_power_cpufreq.c | 52 --- app/test/test_power_kvm_vm.c | 36 -- drivers/meson.build | 1 + .../power/acpi/acpi_cpufreq.c | 22 +- .../power/acpi/acpi_cpufreq.h | 6 +- drivers/power/acpi/meson.build| 10 + .../power/amd_pstate/amd_pstate_cpufreq.c | 24 +- .../power/amd_pstate/amd_pstate_cpufreq.h | 10 +- drivers/power/amd_pstate/meson.build | 10 + drivers/power/amd_uncore/amd_uncore.c | 329 drivers/power/amd_uncore/amd_uncore.h | 226 +++ drivers/power/amd_uncore/meson.build | 20 + .../power/cppc/cppc_cpufreq.c | 22 +- .../power/cppc/cppc_cpufreq.h | 8 +- drivers/power/cppc/meson.build| 10 + .../power/intel_uncore/intel_uncore.c | 18 +- .../power/intel_uncore/intel_uncore.h | 8 +- drivers/power/intel_uncore/meson.build| 6 + .../power/kvm_vm}/guest_channel.c | 0 .../power/kvm_vm}/guest_channel.h | 0 .../power/kvm_vm/kvm_vm.c | 22 +- .../power/kvm_vm/kvm_vm.h | 6 +- drivers/power/kvm_vm/meson.build | 14 + drivers/power/meson.build | 14 + drivers/power/pstate/meson.build | 10 + .../power/pstate/pstate_cpufreq.c | 22 +- .../power/pstate/pstate_cpufreq.h | 6 +- examples/l3fwd-power/main.c | 12 +- lib/power/meson.build | 9 +- lib/power/power_common.c | 2 +- lib/power/power_common.h | 18 +- lib/power/rte_power.c | 355 -- lib/power/rte_power.h | 116 +++--- lib/power/rte_power_cpufreq_api.h | 206 ++ lib/power/rte_power_uncore.c | 253 +++-- lib/power/rte_power_uncore.h | 61 ++- lib/power/rte_power_uncore_ops.h | 230 lib/power/version.map | 16 + 40 files changed, 1664 insertions(+), 622 deletions(-) rename lib/power/power_acpi_cpufreq.c => drivers/power/acpi/acpi_cpufreq.c (95%) rename lib/power/power_acpi_cpufreq.h => drivers/power/acpi/acpi_cpufreq.h (98%) create mode 100644 drivers/power/acpi/meson.build rename lib/power/power_amd_pstate_cpufreq.c => drivers/power/amd_pstate/amd_pstate_cpufreq.c (95%) rename lib/power/power_amd_pstate_cpufreq.h => drivers/power/amd_pstate/amd_pstate_cpufreq.h (96%) create mode 100644 drivers/power/amd_pstate/meson.build create mode 100644 drivers/power/amd_uncore/amd_uncore.c create mode 100644 drivers/power/amd_uncore/amd_uncore.h create mode 100644 drivers/power/amd_uncore/meson.build rename lib/power/power_cppc_cpufreq.c => drivers/power/cppc/cppc_cpufreq.c (95%) rename lib/power/power_cppc_cpufreq.h => drivers/power/cppc/cppc_cpufreq.h (97%) create mode 100644 drivers/power/cppc/meson.build rename lib/power/power_intel_uncore.c => drivers/power/intel_uncore/intel_uncore.c (95%) rename lib/power/power_intel_uncore.h => drivers/power/intel_uncore/intel_uncore.h (97%) create mode 100644 drivers/power/intel_uncore/meson.build rename {lib/power => drivers/power/kvm_vm}/guest_channel.c (100%) rename {lib/power => drivers/power/kvm_vm}/guest_channel.h (100%) rename lib/power/power_kvm_vm.c => drivers/power/kvm_vm/kvm_vm.c (82%) rename lib/power/power_kvm_vm.h => drivers/power/kvm_vm/kvm_vm.h (98%) create mode 100644 drivers/power/kvm_vm/meson.build create mode 100644 drivers/power/meson.build create mode 100644 drivers/power/pstate/meson.build rename lib/power/power_pstate_cpufreq.c => drivers/power/pstate/pstate_cpufreq.c (96%) rename lib/power/power_pstate_cpufreq.h => dri
[PATCH v6 5/5] maintainers: update for drivers/power
Update maintainers for drivers/power/*. Signed-off-by: Sivaprasad Tummala --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 6ea7850093..7e29931be9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1744,6 +1744,7 @@ M: Anatoly Burakov M: David Hunt M: Sivaprasad Tummala F: lib/power/ +F: drivers/power/* F: doc/guides/prog_guide/power_man.rst F: app/test/test_power* F: examples/l3fwd-power/ -- 2.34.1
[PATCH v6 3/5] test/power: removed function pointer validations
After refactoring the power library, power management operations are now consistently supported regardless of the operating environment, making function pointer checks unnecessary and thus removed from applications. v2: - removed function pointer validation in l3fwd-power app. Signed-off-by: Sivaprasad Tummala --- app/test/test_power.c | 95 --- app/test/test_power_cpufreq.c | 52 --- app/test/test_power_kvm_vm.c | 36 - examples/l3fwd-power/main.c | 12 ++--- 4 files changed, 4 insertions(+), 191 deletions(-) diff --git a/app/test/test_power.c b/app/test/test_power.c index 403adc22d6..5df5848c70 100644 --- a/app/test/test_power.c +++ b/app/test/test_power.c @@ -24,86 +24,6 @@ test_power(void) #include -static int -check_function_ptrs(void) -{ - enum power_management_env env = rte_power_get_env(); - - const bool not_null_expected = !(env == PM_ENV_NOT_SET); - - const char *inject_not_string1 = not_null_expected ? " not" : ""; - const char *inject_not_string2 = not_null_expected ? "" : " not"; - - if ((rte_power_freqs == NULL) == not_null_expected) { - printf("rte_power_freqs should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_get_freq == NULL) == not_null_expected) { - printf("rte_power_get_freq should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_set_freq == NULL) == not_null_expected) { - printf("rte_power_set_freq should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_up == NULL) == not_null_expected) { - printf("rte_power_freq_up should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_down == NULL) == not_null_expected) { - printf("rte_power_freq_down should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_max == NULL) == not_null_expected) { - printf("rte_power_freq_max should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_min == NULL) == not_null_expected) { - printf("rte_power_freq_min should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_turbo_status == NULL) == not_null_expected) { - printf("rte_power_turbo_status should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_enable_turbo == NULL) == not_null_expected) { - printf("rte_power_freq_enable_turbo should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_freq_disable_turbo == NULL) == not_null_expected) { - printf("rte_power_freq_disable_turbo should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - if ((rte_power_get_capabilities == NULL) == not_null_expected) { - printf("rte_power_get_capabilities should%s be NULL, environment has%s been " - "initialised\n", inject_not_string1, - inject_not_string2); - return -1; - } - - return 0; -} - static int test_power(void) { @@ -124,10 +44,6 @@ test_power(void) return -1; } - /* Verify that function pointers are NULL */ - if (check_function_ptrs() < 0) - goto fail_all; - rte_power_unset_env(); /* Perform tests for valid environments.*/ @@ -154,22 +70,11 @@ test_power(void)
[PATCH] maintainers: update for hns3
This email address is bouncing, remove it from MAINTAINERS. Signed-off-by: Jie Hai --- MAINTAINERS | 1 - 1 file changed, 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 6ea785009341..cd78bc7db172 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -750,7 +750,6 @@ F: doc/guides/nics/features/gve.ini Hisilicon hns3 M: Jie Hai -M: Yisen Zhuang F: drivers/net/hns3/ F: doc/guides/nics/hns3.rst F: doc/guides/nics/features/hns3.ini -- 2.22.0