+static int
+autodetect_mode(void)
+{
+ RTE_LOG(NOTICE, L3FWD_POWER, "Operating mode not specified, probing frequency scaling support...\n");
+
+ /*
+ * Empty poll and telemetry modes have to be specifically requested to
+ * be enabled, but we can auto-detect between interrupt mode with or
+ * without frequency scaling. Both ACPI and pstate can be used.
+ */
+ if (rte_power_check_env_supported(PM_ENV_ACPI_CPUFREQ))
+ return APP_MODE_LEGACY;
+ if (rte_power_check_env_supported(PM_ENV_PSTATE_CPUFREQ))
+ return APP_MODE_LEGACY;
+
+ RTE_LOG(NOTICE, L3FWD_POWER, "Frequency scaling not supported, selecting interrupt-only mode\n");
+
+ return APP_MODE_INTERRUPT;
+}
+
+static const char *
+mode_to_str(enum appmode mode)
+{
+ switch (mode) {
+ case APP_MODE_LEGACY:
+ return "legacy";
+ case APP_MODE_EMPTY_POLL:
+ return "empty poll";
+ case APP_MODE_TELEMETRY:
+ return "telemetry";
+ case APP_MODE_INTERRUPT:
+ return "interrupt-only";
+ case APP_MODE_PMD_MGMT:
+ return "pmd mgmt";
+ default:
+ return "invalid";
+ }
+}
+
+static uint32_t
+eth_dev_get_overhead_len(uint32_t max_rx_pktlen, uint16_t max_mtu)
+{
+ uint32_t overhead_len;
+
+ if (max_mtu != UINT16_MAX && max_rx_pktlen > max_mtu)
+ overhead_len = max_rx_pktlen - max_mtu;
+ else
+ overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
+
+ return overhead_len;
+}