[PATCH v2 2/4] lib/power: add get and set API for pause duration

Burakov, Anatoly anatoly.burakov at intel.com
Wed May 18 10:58:23 CEST 2022


On 19-Apr-22 12:24 PM, Kevin Laatz wrote:
> Add new get/set API for configuring 'pause_duration' which used to adjust
> the pause mode callback duration.
> 
> Signed-off-by: Kevin Laatz <kevin.laatz at intel.com>
> ---


> @@ -334,11 +336,11 @@ clb_pause(uint16_t port_id __rte_unused, uint16_t qidx __rte_unused,
>   		if (global_data.intrinsics_support.power_pause) {
>   			const uint64_t cur = rte_rdtsc();
>   			const uint64_t wait_tsc =
> -					cur + global_data.tsc_per_us;
> +					cur + global_data.tsc_per_us * pause_duration;
>   			rte_power_pause(wait_tsc);
>   		} else {
>   			uint64_t i;
> -			for (i = 0; i < global_data.pause_per_us; i++)
> +			for (i = 0; i < global_data.pause_per_us * pause_duration; i++)
>   				rte_pause();
>   		}
>   	}
> @@ -673,6 +675,25 @@ rte_power_pmd_mgmt_get_emptypoll_max(void)
>   	return emptypoll_max;
>   }
>   
> +int
> +rte_power_pmd_mgmt_set_pause_duration(unsigned int duration)
> +{
> +	if (duration == 0) {
> +		printf("Pause duration must be greater than 0, value unchanged\n");

This should perhaps be an RTE_LOG rather than a printf?

With that fix,

Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>

-- 
Thanks,
Anatoly


More information about the dev mailing list