From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5AA7643D8C; Sat, 30 Mar 2024 08:44:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D5011402C2; Sat, 30 Mar 2024 08:44:14 +0100 (CET) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mails.dpdk.org (Postfix) with ESMTP id E57EC402B0 for ; Sat, 30 Mar 2024 08:44:12 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4V68NS1KVtz1R8tf; Sat, 30 Mar 2024 15:41:28 +0800 (CST) Received: from dggpeml500011.china.huawei.com (unknown [7.185.36.84]) by mail.maildlp.com (Postfix) with ESMTPS id 968BD1402DE; Sat, 30 Mar 2024 15:44:10 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Sat, 30 Mar 2024 15:44:09 +0800 From: Dengdui Huang To: CC: , , , Subject: [PATCH] app/testpmd: handle IEEE1588 init fail Date: Sat, 30 Mar 2024 15:44:09 +0800 Message-ID: <20240330074409.273916-1-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500011.china.huawei.com (7.185.36.84) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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@dpdk.org Signed-off-by: Dengdui Huang --- 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 -- 2.33.0