[PATCH] app/testpmd: handle IEEE1588 init fail

Singh, Aman Deep aman.deep.singh at intel.com
Fri Apr 5 17:36:14 CEST 2024


On 3/30/2024 1:14 PM, Dengdui Huang wrote:
> When the port's timestamping function failed to initialize
> (for example, the device does not support PTP), the packets
> received by the hardware do not contain the timestamp.
> In this case, IEEE1588 packet forwarding should not start.
> This patch fix it.
>
> Plus, adding a failure message when failed to disable PTP.
>
> Fixes: a78040c990cb ("app/testpmd: update forward engine beginning")
> Cc: stable at dpdk.org
>
> Signed-off-by: Dengdui Huang <huangdengdui at huawei.com>

Acked-by: Aman Singh <aman.deep.singh at intel.com>

> ---
>   app/test-pmd/ieee1588fwd.c | 15 ++++++++++++---
>   1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c
> index 3371771751..afea7735c7 100644
> --- a/app/test-pmd/ieee1588fwd.c
> +++ b/app/test-pmd/ieee1588fwd.c
> @@ -197,14 +197,23 @@ ieee1588_packet_fwd(struct fwd_stream *fs)
>   static int
>   port_ieee1588_fwd_begin(portid_t pi)
>   {
> -	rte_eth_timesync_enable(pi);
> -	return 0;
> +	int ret;
> +
> +	ret = rte_eth_timesync_enable(pi);
> +	if (ret)
> +		printf("Port %u enable PTP failed, ret = %d\n", pi, ret);
> +
> +	return ret;
>   }
>   
>   static void
>   port_ieee1588_fwd_end(portid_t pi)
>   {
> -	rte_eth_timesync_disable(pi);
> +	int ret;
> +
> +	ret = rte_eth_timesync_disable(pi);
> +	if (ret)
> +		printf("Port %u disable PTP failed, ret = %d\n", pi, ret);
>   }
>   
>   static void


More information about the dev mailing list