X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=examples%2Fl3fwd-power%2Fmain.c;h=aa7b8db44ae878c48d50163a05d59190cfb9d89d;hb=23370156431239ac850ba2360277d11c19431d0f;hp=0af8810697625b773fa0196a8c6c5e54f48bd52a;hpb=26fe454ec059a3cb476ae33763a23da7a8e520d4;p=dpdk.git diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 0af8810697..aa7b8db44a 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -207,6 +207,7 @@ enum appmode { enum appmode app_mode; static enum rte_power_pmd_mgmt_type pmgmt_type; +bool baseline_enabled; enum freq_scale_hint_t { @@ -910,7 +911,7 @@ static int event_register(struct lcore_conf *qconf) return 0; } -/* main processing loop */ +/* Main processing loop. 8< */ static int main_intr_loop(__rte_unused void *dummy) { struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; @@ -1073,6 +1074,7 @@ start_rx: return 0; } +/* >8 End of main processing loop. */ /* main processing loop */ static int @@ -1617,7 +1619,7 @@ print_usage(const char *prgname) " empty polls, full polls, and core busyness to telemetry\n" " --interrupt-only: enable interrupt-only mode\n" " --pmd-mgmt MODE: enable PMD power management mode. " - "Currently supported modes: monitor, pause, scale\n", + "Currently supported modes: baseline, monitor, pause, scale\n", prgname); } @@ -1714,6 +1716,7 @@ parse_pmd_mgmt_config(const char *name) #define PMD_MGMT_MONITOR "monitor" #define PMD_MGMT_PAUSE "pause" #define PMD_MGMT_SCALE "scale" +#define PMD_MGMT_BASELINE "baseline" if (strncmp(PMD_MGMT_MONITOR, name, sizeof(PMD_MGMT_MONITOR)) == 0) { pmgmt_type = RTE_POWER_MGMT_TYPE_MONITOR; @@ -1729,6 +1732,10 @@ parse_pmd_mgmt_config(const char *name) pmgmt_type = RTE_POWER_MGMT_TYPE_SCALE; return 0; } + if (strncmp(PMD_MGMT_BASELINE, name, sizeof(PMD_MGMT_BASELINE)) == 0) { + baseline_enabled = true; + return 0; + } /* unknown PMD power management mode */ return -1; } @@ -1748,7 +1755,7 @@ parse_ep_config(const char *q_arg) int hgh_edpi; ep_med_edpi = EMPTY_POLL_MED_THRESHOLD; - ep_hgh_edpi = EMPTY_POLL_MED_THRESHOLD; + ep_hgh_edpi = EMPTY_POLL_HGH_THRESHOLD; strlcpy(s, p, sizeof(s)); @@ -1771,7 +1778,7 @@ parse_ep_config(const char *q_arg) if (med_edpi > 0) ep_med_edpi = med_edpi; - if (med_edpi > 0) + if (hgh_edpi > 0) ep_hgh_edpi = hgh_edpi; } else { @@ -2498,6 +2505,7 @@ mode_to_str(enum appmode mode) } } +/* Power library initialized in the main routine. 8< */ int main(int argc, char **argv) { @@ -2528,6 +2536,9 @@ main(int argc, char **argv) /* init RTE timer library to be used late */ rte_timer_subsystem_init(); + /* if we're running pmd-mgmt mode, don't default to baseline mode */ + baseline_enabled = false; + /* parse application arguments (after the EAL ones) */ ret = parse_args(argc, argv); if (ret < 0) @@ -2723,12 +2734,6 @@ main(int argc, char **argv) printf("\nInitializing rx queues on lcore %u ... ", lcore_id ); fflush(stdout); - /* PMD power management mode can only do 1 queue per core */ - if (app_mode == APP_MODE_PMD_MGMT && qconf->n_rx_queue > 1) { - rte_exit(EXIT_FAILURE, - "In PMD power management mode, only one queue per lcore is allowed\n"); - } - /* init RX queues */ for(queue = 0; queue < qconf->n_rx_queue; ++queue) { struct rte_eth_rxconf rxq_conf; @@ -2767,7 +2772,7 @@ main(int argc, char **argv) "Fail to add ptype cb\n"); } - if (app_mode == APP_MODE_PMD_MGMT) { + if (app_mode == APP_MODE_PMD_MGMT && !baseline_enabled) { ret = rte_power_ethdev_pmgmt_queue_enable( lcore_id, portid, queueid, pmgmt_type); @@ -2778,6 +2783,7 @@ main(int argc, char **argv) } } } + /* >8 End of power library initialization. */ printf("\n");