From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C48ACC433ED for ; Tue, 20 Apr 2021 07:32:47 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id 46221608FE for ; Tue, 20 Apr 2021 07:32:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46221608FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DC08B415FC; Tue, 20 Apr 2021 09:32:20 +0200 (CEST) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mails.dpdk.org (Postfix) with ESMTP id 35F0F415BE for ; Tue, 20 Apr 2021 09:32:13 +0200 (CEST) Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FPb161SCyzrfkX; Tue, 20 Apr 2021 15:29:46 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.498.0; Tue, 20 Apr 2021 15:31:59 +0800 From: Huisong Li To: CC: , , , Date: Tue, 20 Apr 2021 15:32:03 +0800 Message-ID: <1618903926-29099-5-git-send-email-lihuisong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1618903926-29099-1-git-send-email-lihuisong@huawei.com> References: <1614939741-63927-1-git-send-email-oulijun@huawei.com> <1618903926-29099-1-git-send-email-lihuisong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH V2 4/7] app/testpmd: add check for support of reporting DCB info 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 Sender: "dev" Currently, '.get_dcb_info' must be supported for the port doing DCB test, or all information in 'rte_eth_dcb_info' are zero. It should be prevented when user run cmd "port config 0 dcb vt off 4 pfc off". This patch adds the check for support of reporting dcb info. Signed-off-by: Huisong Li Signed-off-by: Lijun Ou --- app/test-pmd/cmdline.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index d282c7c..6f4f642 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -3170,6 +3170,7 @@ cmd_config_dcb_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_config_dcb *res = parsed_result; + struct rte_eth_dcb_info dcb_info; portid_t port_id = res->port_id; struct rte_port *port; uint8_t pfc_en; @@ -3192,6 +3193,14 @@ cmd_config_dcb_parsed(void *parsed_result, printf("nb_cores shouldn't be less than number of TCs.\n"); return; } + + /* Check whether the port supports the report of DCB info. */ + ret = rte_eth_dev_get_dcb_info(port_id, &dcb_info); + if (ret == -ENOTSUP) { + printf("Network port must support rte_eth_dev_get_dcb_info API, or cann't does dcb test.\n"); + return; + } + if (!strncmp(res->pfc_en, "on", 2)) pfc_en = 1; else -- 2.7.4