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 2E1EAA056C for ; Tue, 28 Jun 2022 15:40:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 22BC6410EE; Tue, 28 Jun 2022 15:40:31 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 77E4640691; Tue, 28 Jun 2022 15:40:28 +0200 (CEST) Received: from kwepemi500017.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LXQcS4F61zTgG7; Tue, 28 Jun 2022 21:36:56 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemi500017.china.huawei.com (7.221.188.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 28 Jun 2022 21:40:25 +0800 From: Dongdong Liu To: , , , CC: Subject: [PATCH 1/3] examples/ptpclient: add the check for PTP capability Date: Tue, 28 Jun 2022 21:39:57 +0800 Message-ID: <20220628133959.21381-2-liudongdong3@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20220628133959.21381-1-liudongdong3@huawei.com> References: <20220628133959.21381-1-liudongdong3@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500017.china.huawei.com (7.221.188.110) X-CFilter-Loop: Reflected X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Huisong Li If a port doesn't support PTP, there is no need to keep running app. So this patch adds the check for PTP capability. Signe-off-by: Huisong Li Signed-off-by: Dongdong Liu --- examples/ptpclient/ptpclient.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index 1f1c9c9c52..9689f42f86 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -195,6 +195,11 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) if (dev_info.rx_offload_capa & RTE_ETH_RX_OFFLOAD_TIMESTAMP) port_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_TIMESTAMP; + else { + printf("port(%u) doesn't support PTP: %s\n", port, + strerror(-retval)); + return -ENOTSUP; + } if (dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) port_conf.txmode.offloads |= -- 2.22.0